/* ============ Toledo CMS Admin ============ */
:root {
    --blue: #0038A8;
    --blue-dark: #002766;
    --red: #CE1126;
    --gold: #FCD116;
    --ink: #1a2230;
    --muted: #6b7488;
    --line: #e7eaf1;
    --bg: #f4f6fb;
    --sidebar: #0c1426;
    --sidebar-2: #131d33;
    --radius: 14px;
    --shadow: 0 10px 30px rgba(16, 32, 70, .08);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Inter", system-ui, sans-serif; background: var(--bg); color: var(--ink); font-size: 15px; }
h1, h2, h3, h4 { font-family: "Plus Jakarta Sans", sans-serif; }
a { text-decoration: none; }

.admin-shell { display: flex; min-height: 100vh; }

/* ---- Sidebar ---- */
.sidebar { width: 264px; background: var(--sidebar); color: #aeb6c8; display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; z-index: 1040; transition: transform .25s ease; }
.sidebar-brand { display: flex; align-items: center; gap: .7rem; padding: 1.3rem 1.4rem; border-bottom: 1px solid rgba(255, 255, 255, .07); }
.sidebar-brand img { width: 42px; height: 42px; object-fit: contain; }
.sidebar-brand strong { display: block; color: #fff; font-family: "Plus Jakarta Sans"; font-size: 1.05rem; }
.sidebar-brand span { font-size: .74rem; color: #7b86a0; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: .8rem .8rem 1.5rem; }
.nav-group { font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; color: #61708f; margin: 1.1rem .8rem .4rem; font-weight: 700; }
.nav-item { display: flex; align-items: center; gap: .8rem; padding: .68rem .85rem; border-radius: 10px; color: #aeb6c8; font-weight: 500; font-size: .92rem; margin-bottom: 2px; transition: all .18s; position: relative; }
.nav-item i { width: 20px; text-align: center; font-size: .98rem; }
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item.active { background: linear-gradient(120deg, var(--blue), var(--blue-dark)); color: #fff; box-shadow: 0 6px 16px rgba(0, 56, 168, .35); }
.nav-badge { margin-left: auto; background: var(--red); color: #fff; font-size: .7rem; font-weight: 700; padding: .1rem .45rem; border-radius: 999px; }
.sidebar-foot { padding: 1rem 1.4rem; border-top: 1px solid rgba(255, 255, 255, .07); }
.sidebar-foot a { color: #9aa3ba; font-size: .86rem; }
.sidebar-foot a:hover { color: var(--gold); }

/* ---- Main ---- */
.admin-main { flex: 1; margin-left: 264px; display: flex; flex-direction: column; min-width: 0; }
.admin-topbar { background: #fff; border-bottom: 1px solid var(--line); padding: 0 1.6rem; height: 68px; display: flex; align-items: center; gap: 1rem; position: sticky; top: 0; z-index: 1020; }
.admin-topbar h1 { font-size: 1.25rem; margin: 0; flex: 1; }
.sb-toggle { display: none; background: none; border: 0; font-size: 1.3rem; color: var(--ink); cursor: pointer; }
.topbar-right { display: flex; align-items: center; gap: 1rem; }
.tb-icon { position: relative; color: var(--muted); font-size: 1.1rem; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; }
.tb-icon:hover { background: var(--bg); color: var(--blue); }
.tb-icon .dot { position: absolute; top: 9px; right: 10px; width: 8px; height: 8px; background: var(--red); border-radius: 50%; border: 2px solid #fff; }
.user-chip { display: flex; align-items: center; gap: .6rem; }
.user-chip .avatar { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(120deg, var(--blue), var(--blue-dark)); color: #fff; display: grid; place-items: center; font-weight: 700; }
.user-meta strong { display: block; font-size: .88rem; line-height: 1.1; }
.user-meta span { font-size: .76rem; color: var(--muted); }
.logout-form { margin: 0; }
.admin-content { padding: 1.8rem; flex: 1; }

/* ---- Cards / Dashboard ---- */
.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.1rem; margin-bottom: 1.6rem; }
.stat-box { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem; display: flex; align-items: center; gap: 1rem; transition: .2s; box-shadow: var(--shadow); }
.stat-box:hover { transform: translateY(-3px); }
.stat-box .sb-icon { width: 54px; height: 54px; border-radius: 12px; display: grid; place-items: center; font-size: 1.4rem; background: #eef3fb; color: var(--blue); flex: 0 0 auto; }
.stat-box .sb-num { font-size: 1.8rem; font-weight: 800; font-family: "Plus Jakarta Sans"; line-height: 1; }
.stat-box .sb-label { font-size: .85rem; color: var(--muted); }

.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-head { padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.panel-head h2, .panel-head h3 { margin: 0; font-size: 1.08rem; }
.panel-body { padding: 1.4rem; }

/* ---- Toolbar ---- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.3rem; flex-wrap: wrap; }
.toolbar .title-wrap h1 { font-size: 1.5rem; margin: 0; }
.toolbar .title-wrap p { color: var(--muted); margin: .2rem 0 0; font-size: .9rem; }

/* ---- Table ---- */
.table-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.adm-table { width: 100%; border-collapse: collapse; }
.adm-table th { background: #f8fafd; text-align: left; padding: .9rem 1.1rem; font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; border-bottom: 1px solid var(--line); white-space: nowrap; }
.adm-table td { padding: .85rem 1.1rem; border-bottom: 1px solid var(--line); font-size: .9rem; vertical-align: middle; }
.adm-table tbody tr:last-child td { border-bottom: 0; }
.adm-table tbody tr:hover { background: #f8fafd; }
.adm-table .thumb { width: 46px; height: 46px; border-radius: 8px; object-fit: cover; background: #eef3fb; }
.row-title { font-weight: 600; color: var(--ink); }
.muted-sm { color: var(--muted); font-size: .82rem; }

.badge-soft { font-size: .74rem; font-weight: 600; padding: .25rem .6rem; border-radius: 999px; background: #eef3fb; color: var(--blue); }
.badge-on { background: #e3f6ec; color: #137a43; }
.badge-off { background: #fdecec; color: var(--red); }
.badge-yes { background: #fff4d6; color: #9a7400; }

.row-actions { display: flex; gap: .4rem; justify-content: flex-end; }
.icon-btn { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--muted); display: grid; place-items: center; cursor: pointer; transition: .15s; font-size: .85rem; }
.icon-btn:hover { color: var(--blue); border-color: var(--blue); }
.icon-btn.danger:hover { color: var(--red); border-color: var(--red); }
.icon-btn form { margin: 0; }

/* ---- Forms ---- */
.form-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.8rem; max-width: 960px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem 1.4rem; }
.fld { display: flex; flex-direction: column; }
.fld.full { grid-column: 1 / -1; }
.fld label { font-weight: 600; font-size: .88rem; margin-bottom: .4rem; }
.fld label .req { color: var(--red); }
.fld input[type=text], .fld input[type=email], .fld input[type=url], .fld input[type=number], .fld input[type=date], .fld textarea, .fld select {
    width: 100%; padding: .7rem .85rem; border: 1px solid var(--line); border-radius: 9px; font: inherit; color: var(--ink); background: #fff; transition: .15s;
}
.fld textarea { resize: vertical; min-height: 90px; }
.fld input:focus, .fld textarea:focus, .fld select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0, 56, 168, .12); }
.fld .hint { font-size: .78rem; color: var(--muted); margin-top: .3rem; }
.switch-row { display: flex; align-items: center; gap: .6rem; padding: .6rem 0; }
.switch { position: relative; width: 46px; height: 26px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track { position: absolute; inset: 0; background: #cdd4e2; border-radius: 999px; transition: .2s; cursor: pointer; }
.switch .track::before { content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .track { background: var(--blue); }
.switch input:checked + .track::before { transform: translateX(20px); }

.img-field { display: flex; gap: 1rem; align-items: center; }
.img-preview { width: 92px; height: 92px; border-radius: 10px; object-fit: cover; border: 1px solid var(--line); background: #eef3fb; }
.img-preview-empty { width: 92px; height: 92px; border-radius: 10px; border: 1px dashed var(--line); display: grid; place-items: center; color: var(--muted); background: #f8fafd; }

.editor-host { background: #fff; }
.fld .ql-toolbar.ql-snow { border: 1px solid var(--line); border-bottom: 0; border-top-left-radius: 9px; border-top-right-radius: 9px; }
.editor-host.ql-container.ql-snow { border: 1px solid var(--line); border-bottom-left-radius: 9px; border-bottom-right-radius: 9px; }
.editor-host .ql-editor { min-height: 200px; font-family: inherit; font-size: 1rem; }

.form-actions { display: flex; gap: .7rem; margin-top: 1.6rem; padding-top: 1.4rem; border-top: 1px solid var(--line); }

.empty { text-align: center; padding: 3.5rem 1rem; color: var(--muted); }
.empty i { font-size: 2.6rem; color: var(--line); margin-bottom: .8rem; display: block; }

/* dashboard panels grid */
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; }
.list-row { display: flex; align-items: center; gap: .8rem; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-row .lr-icon { width: 38px; height: 38px; border-radius: 9px; background: #eef3fb; color: var(--blue); display: grid; place-items: center; flex: 0 0 auto; }
.list-row .lr-body { flex: 1; min-width: 0; }
.list-row .lr-body strong { display: block; font-size: .9rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .lr-body span { font-size: .8rem; color: var(--muted); }

/* ---- Login ---- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login-aside { background: linear-gradient(150deg, var(--blue-dark), var(--blue)); color: #fff; padding: 3.5rem; display: flex; flex-direction: column; justify-content: center; position: relative; overflow: hidden; }
.login-aside::after { content: ""; position: absolute; right: -80px; bottom: -80px; width: 360px; height: 360px; background: radial-gradient(circle, rgba(252, 209, 22, .25), transparent 70%); }
.login-aside img { width: 84px; margin-bottom: 1.6rem; }
.login-aside h1 { color: #fff; font-size: 2rem; line-height: 1.2; }
.login-aside p { color: rgba(255, 255, 255, .82); max-width: 380px; }
.login-aside .badge-pills { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1.6rem; position: relative; z-index: 1; }
.login-aside .bp { background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .25); padding: .4rem .9rem; border-radius: 999px; font-size: .82rem; }
.login-main { display: grid; place-items: center; padding: 2rem; }
.login-box { width: 100%; max-width: 400px; }
.login-box h2 { font-size: 1.6rem; margin-bottom: .3rem; }
.login-box .sub { color: var(--muted); margin-bottom: 1.8rem; }
.login-box .fld { margin-bottom: 1.1rem; }
.login-box label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .4rem; }
.login-box input[type=email], .login-box input[type=password] { width: 100%; padding: .85rem 1rem; border: 1px solid var(--line); border-radius: 10px; font: inherit; }
.login-box input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0, 56, 168, .12); }
.btn-block { width: 100%; justify-content: center; padding: .9rem; font-weight: 700; border-radius: 10px; border: 0; background: linear-gradient(120deg, var(--blue), var(--blue-dark)); color: #fff; cursor: pointer; font-size: 1rem; }
.btn-block:hover { opacity: .95; }
.cred-hint { background: #eef3fb; border: 1px dashed #b9cdf0; border-radius: 10px; padding: .8rem 1rem; font-size: .82rem; color: var(--blue-dark); margin-top: 1.4rem; }

/* message detail */
.msg-head { display: flex; gap: 1rem; align-items: center; margin-bottom: 1.2rem; }
.msg-avatar { width: 54px; height: 54px; border-radius: 50%; background: linear-gradient(120deg, var(--blue), var(--blue-dark)); color: #fff; display: grid; place-items: center; font-size: 1.3rem; font-weight: 700; }
.msg-body { background: #f8fafd; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem; line-height: 1.7; white-space: pre-wrap; }

/* ---- Buttons ---- */
.btn-pri { display: inline-flex; align-items: center; gap: .5rem; padding: .62rem 1.1rem; border-radius: 9px; border: 0; background: linear-gradient(120deg, var(--blue), var(--blue-dark)); color: #fff; font-weight: 600; font-size: .9rem; cursor: pointer; transition: .18s; }
.btn-pri:hover { color: #fff; opacity: .95; transform: translateY(-1px); box-shadow: 0 8px 18px rgba(0, 56, 168, .25); }
.btn-ghost { display: inline-flex; align-items: center; gap: .5rem; padding: .62rem 1.1rem; border-radius: 9px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-weight: 600; font-size: .9rem; cursor: pointer; transition: .18s; }
.btn-ghost:hover { border-color: var(--blue); color: var(--blue); }
.btn-danger { display: inline-flex; align-items: center; gap: .5rem; padding: .62rem 1.1rem; border-radius: 9px; border: 1px solid #f3c9c9; background: #fdecec; color: var(--red); font-weight: 600; font-size: .9rem; cursor: pointer; transition: .18s; }
.btn-danger:hover { background: var(--red); color: #fff; border-color: var(--red); }
.file-input { font-size: .85rem; color: var(--muted); }
.file-input::file-selector-button { padding: .5rem .9rem; margin-right: .8rem; border: 1px solid var(--line); border-radius: 8px; background: #f8fafd; color: var(--ink); font: inherit; font-size: .85rem; cursor: pointer; }
.file-input::file-selector-button:hover { border-color: var(--blue); color: var(--blue); }
.field-error { color: var(--red); font-size: .8rem; margin-top: .3rem; }
.alert-err { background: #fdecec; border: 1px solid #f3c9c9; color: #a11020; padding: .8rem 1rem; border-radius: 10px; font-size: .88rem; margin-bottom: 1.1rem; }
.color-row { display: flex; align-items: center; gap: .7rem; }
.color-row input[type=color] { width: 52px; height: 42px; padding: 0; border: 1px solid var(--line); border-radius: 9px; background: #fff; cursor: pointer; }
.color-row input[type=text] { max-width: 140px; }

@media (max-width: 1100px) { .stat-cards { grid-template-columns: repeat(2, 1fr); } .dash-grid { grid-template-columns: 1fr; } }
@media (max-width: 992px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .admin-main { margin-left: 0; }
    .sb-toggle { display: block; }
    .sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1030; }
    .sidebar-backdrop.show { display: block; }
    .login-wrap { grid-template-columns: 1fr; }
    .login-aside { display: none; }
}
@media (max-width: 640px) {
    .form-grid { grid-template-columns: 1fr; }
    .stat-cards { grid-template-columns: 1fr; }
    .user-meta { display: none; }
}
