:root {
    --page: #f5f7fa;
    --panel: #ffffff;
    --panel-raised: #eef2f7;
    --border: #e2e8f0;
    --text: #1a202c;
    --muted: #718096;
    --gold: #d5ad67;
    --blue: #144e8c;
    --red: #d32027;
    --green: #22a06b;
    --orange: #d97706;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .06), 0 1px 2px rgba(0, 0, 0, .04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, .08), 0 2px 4px rgba(0, 0, 0, .04);
}

* { box-sizing: border-box; }
body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background: var(--page);
    font-family: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: inherit; }
.shell { min-height: 100vh; display: grid; grid-template-columns: 252px minmax(0, 1fr); }
.sidebar {
    position: sticky;
    top: 0;
    display: flex;
    height: 100vh;
    flex-direction: column;
    gap: 7px;
    padding: 22px 16px;
    border-right: 1px solid rgba(255, 255, 255, .1);
    background: #0a2647;
}
.brand {
    display: flex;
    min-height: 60px;
    align-items: center;
    gap: 10px;
    margin: 0 0 25px;
    color: #fff;
    font-family: "Old Standard TT", "Times New Roman", serif;
    font-size: 17px;
    text-decoration: none;
}
.brand img { width: 48px; height: 48px; object-fit: contain; }
.sidebar a:not(.brand) {
    display: block;
    padding: 12px 14px;
    border: 1px solid transparent;
    border-radius: 7px;
    color: rgba(255, 255, 255, .72);
    text-decoration: none;
    transition: color .2s ease, background .2s ease, border-color .2s ease;
}
.sidebar a:not(.brand):hover,
.sidebar a:not(.brand).active {
    border-color: rgba(255, 255, 255, .16);
    color: #fff;
    background: rgba(255, 255, 255, .09);
}
.sidebar a:last-child { margin-top: auto; }
.main { min-width: 0; padding: 30px clamp(20px, 4vw, 56px); }
.topbar {
    display: flex;
    justify-content: flex-end;
    gap: 20px;
    margin-bottom: 30px;
    color: var(--muted);
    font-size: 13px;
}
.topbar a { color: var(--blue); text-decoration: none; }
.topbar a:hover { text-decoration: underline; }
h1, h2, h3 { color: var(--text); }
h1, .login-card h1 {
    font-family: "Old Standard TT", "Times New Roman", serif;
    font-weight: 400;
}
.main > h1 { margin: 0 0 28px; font-size: clamp(36px, 5vw, 54px); }
.card {
    min-width: 0;
    margin-bottom: 20px;
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--panel);
    box-shadow: var(--shadow-sm);
}
.card h2 { margin-top: 0; font-family: "Old Standard TT", "Times New Roman", serif; font-weight: 400; font-size: 28px; }
.admin-section-card { overflow-x: auto; }

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 27px;
}
.dashboard-header h1 { margin: 0 0 5px; font-size: clamp(32px, 4vw, 42px); }
.dashboard-header p { margin: 0; color: var(--muted); font-size: 14px; }
.dashboard-header .button { margin-top: 4px; }
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}
.stat-card {
    position: relative;
    min-height: 154px;
    overflow: hidden;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--panel);
    box-shadow: var(--shadow-sm);
    transition: transform .2s ease, box-shadow .2s ease;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-card::before {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 4px;
    background: var(--blue);
    content: "";
}
.stat-card.accent-orange::before { background: var(--orange); }
.stat-card.accent-green::before { background: var(--green); }
.stat-card.accent-red::before { background: var(--red); }
.stat-card.accent-blue::before { background: #3b82f6; }
.stat-card-icon {
    display: grid;
    width: 38px;
    height: 38px;
    margin-bottom: 12px;
    place-items: center;
    border-radius: 10px;
    color: var(--blue);
    background: #edf3fa;
    font-size: 12px;
    font-weight: 700;
}
.accent-orange .stat-card-icon { color: var(--orange); background: #fff7ed; }
.accent-green .stat-card-icon { color: var(--green); background: #ecfdf5; }
.accent-red .stat-card-icon { color: var(--red); background: #fef2f2; }
.accent-blue .stat-card-icon { color: #3b82f6; background: #eff6ff; }
.stat-card-value { margin-bottom: 4px; color: #0a2647; font-size: 30px; font-weight: 800; line-height: 1; }
.stat-card-label { color: var(--muted); font-size: 12px; }

.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}
.module-card {
    display: block;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--panel);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.module-card:hover { transform: translateY(-3px); border-color: #9db5d0; box-shadow: var(--shadow-md); }
.module-icon {
    display: grid;
    width: 44px;
    height: 44px;
    margin-bottom: 15px;
    place-items: center;
    border-radius: 10px;
    color: #fff;
    background: linear-gradient(135deg, #0a2647, #2563a8);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .04em;
}
.module-icon.red { background: linear-gradient(135deg, #d32027, #b01a20); }
.module-icon.green { background: linear-gradient(135deg, #22c55e, #16a34a); }
.module-title { margin-bottom: 5px; color: #0a2647; font-size: 15px; font-weight: 700; }
.module-desc { color: var(--muted); font-size: 12px; line-height: 1.55; }
.admin-section {
    margin-bottom: 22px;
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--panel);
    box-shadow: var(--shadow-sm);
}
.admin-table-wrap { overflow-x:auto; }
.admin-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}
.admin-section-title { margin: 0; color: #0a2647; font-size: 17px; font-weight: 700; }
.btn-view-all { color: var(--red); font-size: 13px; font-weight: 600; text-decoration: none; }
.btn-view-all:hover { color: #b01a20; }
.action-code {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 5px;
    color: var(--blue);
    background: #edf3fa;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 11px;
    font-weight: 600;
}
.no-data { padding: 28px 16px; color: var(--muted); text-align: center; }

.stats { display:grid; grid-template-columns: repeat(3, minmax(140px,1fr)); gap:16px; }
.stats .card { position:relative; padding:24px; }
.stats .card::before {
    position:absolute;
    top:0;
    bottom:0;
    left:0;
    width:3px;
    border-radius:10px 0 0 10px;
    background:var(--gold);
    content:"";
}
.stat-value { color:#0a2647; font-family:"Old Standard TT",serif; font-size:38px; }
.stat-label { color:var(--muted); font-size:13px; }
table { width:100%; border-collapse:collapse; background:transparent; }
th, td { padding:12px 10px; border-bottom:1px solid var(--border); text-align:left; }
th { color:var(--muted); font-size:12px; font-weight:600; }
td { color:var(--text); font-size:13px; }
tr:last-child td { border-bottom:0; }
form p { margin: 0 0 16px; }
.form-grid { display:grid; grid-template-columns:repeat(2,minmax(180px,1fr)); gap:12px; }
label { display:block; margin-bottom:7px; color:var(--muted); font-size:13px; }
input, select, textarea {
    width:100%;
    min-height:42px;
    padding:10px 12px;
    border:1px solid var(--border);
    border-radius:6px;
    color:var(--text);
    background:#fff;
    font:inherit;
}
input[type="file"] { padding:7px; }
input:focus, select:focus, textarea:focus { outline:2px solid rgba(20,78,140,.18); border-color:var(--blue); }
select option { color:var(--text); background:var(--panel); }
.button {
    display:inline-flex;
    min-height:40px;
    align-items:center;
    justify-content:center;
    padding:9px 16px;
    border:1px solid transparent;
    border-radius:6px;
    color:#fff;
    background:var(--blue);
    font:inherit;
    font-size:13px;
    font-weight:700;
    text-decoration:none;
    cursor:pointer;
    transition:filter .2s ease, transform .2s ease;
}
.button:hover { filter:brightness(1.08); transform:translateY(-1px); }
.button-danger { color:#fff; background:var(--red); }
.error, .success { padding:12px 14px; border-radius:6px; }
.error { border:1px solid rgba(211,32,39,.2); color:#a51920; background:#fff1f1; }
.success { border:1px solid rgba(34,160,107,.2); color:#18794e; background:#effaf4; }
.login-page { min-height:100vh; display:grid; place-items:center; padding:28px 16px; color:#ece3d0; background:#101426; }
.login-card {
    position:relative;
    width:min(440px, 100%);
    padding:38px;
    border:1px solid rgba(236, 227, 208, .12);
    border-radius:12px;
    background:linear-gradient(145deg, rgba(26,34,56,.95), rgba(16,20,38,.98));
    box-shadow:0 24px 70px rgba(0,0,0,.28);
}
.login-card::before {
    position:absolute;
    top:0;
    right:24px;
    left:24px;
    height:2px;
    background:linear-gradient(90deg, transparent, var(--gold), transparent);
    content:"";
}
.login-logo { display:block; width:86px; height:86px; margin:0 auto 12px; object-fit:contain; }
.login-card h1 { margin:10px 0; color:#ece3d0; text-align:center; font-size:36px; }
.login-description { margin:0 0 26px; color:#a7adbd; text-align:center; font-size:14px; }
.login-card label { color:#a7adbd; }
.login-card input { border-color:rgba(236, 227, 208, .12); color:#ece3d0; background:#0f1527; }
.login-card input:focus { border-color:var(--gold); outline-color:rgba(213,173,103,.35); }
.login-card .button { width:100%; margin-top:6px; color:#171b29; background:var(--gold); }
.password-field { position:relative; display:block; }
.password-field input { padding-right:84px; }
.password-toggle {
    position:absolute;
    top:50%;
    right:8px;
    padding:6px 8px;
    border:0;
    border-radius:5px;
    color:#d5ad67;
    background:transparent;
    font:inherit;
    font-size:12px;
    cursor:pointer;
    transform:translateY(-50%);
}
.password-toggle:hover, .password-toggle:focus-visible { color:#fff; background:rgba(236,227,208,.08); }
.media-row {
    display: grid;
    grid-template-columns: 130px 1fr auto;
    gap: 16px;
    align-items: center;
    margin: 12px 0;
    padding: 10px 0;
    border-bottom:1px solid var(--border);
}
.media-row img { width:130px; height:82px; object-fit:cover; border-radius:6px; }

@media (max-width:800px) {
    .shell { grid-template-columns:1fr; }
    .sidebar { position:static; height:auto; flex-direction:row; align-items:center; overflow-x:auto; padding:10px 14px; }
    .brand { min-height:42px; margin:0 8px 0 0; white-space:nowrap; font-size:14px; }
    .brand img { width:34px; height:34px; }
    .sidebar a:not(.brand) { flex:0 0 auto; padding:9px 11px; white-space:nowrap; font-size:13px; }
    .sidebar a:last-child { margin-top:0; }
    .main { padding:22px 16px; }
    .topbar { justify-content:space-between; }
    .stats { grid-template-columns:1fr; }
    .form-grid { grid-template-columns:1fr; }
    .media-row { grid-template-columns:80px 1fr; gap:10px; }
    .media-row form { grid-column:2; }
    .media-row img { width:80px; height:62px; }
}
@media (max-width:600px) {
    .stats-grid { grid-template-columns:repeat(2, minmax(0, 1fr)); gap:10px; }
    .stat-card { min-height:140px; padding:15px; }
    .modules-grid { grid-template-columns:1fr; }
    .admin-section { padding:16px; }
    .admin-section-header { align-items:flex-start; flex-direction:column; }
    .dashboard-header { flex-direction:column; align-items:flex-start; }
    .login-card { padding:30px 22px; }
    .login-card h1 { font-size:31px; }
}
