:root {
    --admin-primary: #6e0e0f;
    --admin-primary-dark: #3f0607;
    --admin-gold: #d5a33c;
    --admin-bg: #f5f3ef;
    --admin-card: #ffffff;
    --admin-text: #292222;
    --admin-muted: #786e6e;
    --admin-border: #e7e0d8;
    --admin-success: #16805c;
    --admin-danger: #c53c42;
    --admin-warning: #a66b08;
    --admin-info: #2163a8;
    --sidebar-width: 270px;
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
    margin: 0;
    min-height: 100%;
    color: var(--admin-text);
    background: var(--admin-bg);
    font-family: Inter, Arial, "Noto Sans Devanagari", sans-serif;
    font-size: 14px;
}

button, input, select, textarea { font: inherit; }

a { color: var(--admin-primary); }

.admin-layout { min-height: 100vh; }

.admin-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 60;
    display: flex;
    flex-direction: column;
    width: var(--sidebar-width);
    color: #fff;
    background: linear-gradient(180deg, #57090a 0%, #290304 100%);
    box-shadow: 10px 0 30px rgba(55, 6, 7, .16);
}

.admin-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 84px;
    padding: 13px 17px;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.12);
    text-decoration: none;
}

.admin-brand img {
    width: 52px;
    height: 52px;
    padding: 3px;
    object-fit: contain;
    border-radius: 12px;
    background: #fff;
}

.admin-brand span { min-width: 0; }
.admin-brand strong, .admin-brand small { display: block; }
.admin-brand strong { font-family: Georgia, serif; font-size: 14px; line-height: 1.25; }
.admin-brand small { margin-top: 4px; color: #e7c98a; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }

.admin-nav {
    flex: 1;
    overflow-y: auto;
    padding: 16px 11px;
    scrollbar-width: thin;
}

.admin-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    margin: 3px 0;
    padding: 8px 12px;
    color: #f8eded;
    border-radius: 10px;
    font-weight: 600;
    text-decoration: none;
    transition: background .2s, transform .2s;
}

.admin-nav a:hover { background: rgba(255,255,255,.1); transform: translateX(2px); }
.admin-nav a.active { color: #2c1600; background: linear-gradient(135deg, #efcd82, var(--admin-gold)); box-shadow: 0 8px 18px rgba(0,0,0,.15); }
.nav-icon { display: inline-grid; place-items: center; width: 23px; font-size: 20px; line-height: 1; }
.nav-section { margin: 20px 12px 7px; color: #c7a96c; font-size: 9px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-top: 1px solid rgba(255,255,255,.12);
    background: rgba(0,0,0,.12);
}

.user-avatar {
    display: grid;
    place-items: center;
    width: 37px;
    height: 37px;
    flex: 0 0 37px;
    color: #301a00;
    border-radius: 50%;
    background: var(--admin-gold);
    font-weight: 900;
}

.sidebar-user div:last-child { min-width: 0; }
.sidebar-user strong, .sidebar-user small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user strong { font-size: 12px; }
.sidebar-user small { margin-top: 3px; color: #d7bbbb; font-size: 9px; }

.admin-content-shell { min-height: 100vh; margin-left: var(--sidebar-width); }

.admin-topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    min-height: 72px;
    padding: 10px 28px;
    border-bottom: 1px solid var(--admin-border);
    background: rgba(255,255,255,.96);
    box-shadow: 0 4px 18px rgba(64,39,33,.05);
    backdrop-filter: blur(10px);
}

.menu-toggle { display: none; width: 40px; height: 40px; margin-right: 10px; border: 1px solid var(--admin-border); border-radius: 10px; color: var(--admin-primary); background: #fff; cursor: pointer; }
.topbar-title { display: flex; flex-direction: column; }
.topbar-title small { color: var(--admin-muted); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.topbar-title strong { margin-top: 3px; color: var(--admin-primary-dark); font-family: Georgia, serif; font-size: 21px; }
.topbar-actions { display: flex; align-items: center; gap: 9px; margin-left: auto; }
.topbar-actions form { margin: 0; }
.topbar-view, .logout-button { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; padding: 8px 13px; border-radius: 9px; font-size: 12px; font-weight: 750; text-decoration: none; cursor: pointer; }
.topbar-view { color: var(--admin-primary); border: 1px solid #dec9c9; background: #fff; }
.logout-button { color: #fff; border: 1px solid var(--admin-primary); background: var(--admin-primary); }

.admin-main { width: min(1440px, 100%); min-height: calc(100vh - 125px); padding: 28px; }
.admin-footer { display: flex; justify-content: space-between; gap: 10px; padding: 17px 28px; color: var(--admin-muted); border-top: 1px solid var(--admin-border); background: #fff; font-size: 11px; }

.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 23px; }
.page-heading h1 { margin: 0; color: var(--admin-primary-dark); font-family: Georgia, serif; font-size: clamp(26px,3vw,34px); }
.page-heading p { max-width: 720px; margin: 7px 0 0; color: var(--admin-muted); line-height: 1.6; }
.heading-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 40px;
    padding: 8px 15px;
    border: 1px solid transparent;
    border-radius: 9px;
    font-weight: 750;
    text-decoration: none;
    cursor: pointer;
}

.button-primary { color: #fff; background: var(--admin-primary); }
.button-primary:hover { background: var(--admin-primary-dark); }
.button-secondary { color: var(--admin-primary); border-color: #dbcaca; background: #fff; }
.button-danger { color: #fff; background: var(--admin-danger); }
.button-success { color: #fff; background: var(--admin-success); }
.button-small { min-height: 32px; padding: 5px 9px; border-radius: 7px; font-size: 11px; }
.button:disabled { opacity: .55; cursor: not-allowed; }

.stats-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 17px; margin-bottom: 24px; }
.stat-card { position: relative; overflow: hidden; min-height: 135px; padding: 21px; border: 1px solid var(--admin-border); border-radius: 16px; background: var(--admin-card); box-shadow: 0 9px 26px rgba(77,48,39,.06); }
.stat-card::after { content: ""; position: absolute; width: 82px; height: 82px; right: -24px; top: -26px; border-radius: 50%; background: var(--card-tint,#f2e8e0); }
.stat-card small { color: var(--admin-muted); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.stat-card strong { display: block; margin-top: 13px; color: var(--admin-primary-dark); font-family: Georgia,serif; font-size: 34px; }
.stat-card span { display: block; margin-top: 5px; color: var(--admin-muted); font-size: 11px; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0,1.45fr) minmax(280px,.75fr); gap: 20px; }
.panel { overflow: hidden; border: 1px solid var(--admin-border); border-radius: 16px; background: var(--admin-card); box-shadow: 0 9px 26px rgba(77,48,39,.05); }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 15px; min-height: 62px; padding: 14px 19px; border-bottom: 1px solid var(--admin-border); }
.panel-header h2 { margin: 0; color: var(--admin-primary-dark); font-family: Georgia,serif; font-size: 19px; }
.panel-header p { margin: 3px 0 0; color: var(--admin-muted); font-size: 11px; }
.panel-body { padding: 19px; }

.quick-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.quick-link { display: flex; align-items: center; gap: 11px; min-height: 61px; padding: 12px; color: var(--admin-text); border: 1px solid var(--admin-border); border-radius: 11px; text-decoration: none; transition: border .2s, transform .2s, box-shadow .2s; }
.quick-link:hover { border-color: #d5b474; transform: translateY(-2px); box-shadow: 0 8px 18px rgba(70,41,31,.08); }
.quick-icon { display: grid; place-items: center; width: 36px; height: 36px; flex: 0 0 36px; color: #fff; border-radius: 9px; background: var(--admin-primary); font-size: 19px; }
.quick-link strong { display: block; font-size: 12px; }
.quick-link small { display: block; margin-top: 3px; color: var(--admin-muted); font-size: 9px; }

.activity-list { display: grid; gap: 0; }
.activity-item { display: grid; grid-template-columns: 9px minmax(0,1fr) auto; gap: 11px; align-items: start; padding: 12px 0; border-bottom: 1px dashed var(--admin-border); }
.activity-item:last-child { border-bottom: 0; }
.activity-dot { width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; background: var(--admin-gold); box-shadow: 0 0 0 3px #f7ead0; }
.activity-item strong { display: block; font-size: 11px; }
.activity-item p { margin: 3px 0 0; color: var(--admin-muted); font-size: 10px; line-height: 1.45; }
.activity-item time { color: var(--admin-muted); font-size: 9px; white-space: nowrap; }

.alert { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 17px; padding: 13px 15px; border: 1px solid; border-radius: 10px; line-height: 1.5; }
.alert button { padding: 0; color: inherit; border: 0; background: transparent; font-size: 20px; cursor: pointer; }
.alert-success { color: #0f694b; border-color: #a6dbc9; background: #eaf8f3; }
.alert-error { color: #9d2930; border-color: #efb8bb; background: #fff0f1; }
.alert-warning { color: #7e5208; border-color: #ecd296; background: #fff8e5; }
.alert-info { color: #1c568e; border-color: #b9d5ee; background: #eff7ff; }

.filter-bar { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; padding: 14px; border-bottom: 1px solid var(--admin-border); background: #fbfaf8; }
.filter-field { display: grid; gap: 4px; }
.filter-field.grow { flex: 1; min-width: 210px; }
.filter-field label { color: var(--admin-muted); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.filter-field input, .filter-field select { min-height: 38px; padding: 8px 10px; border: 1px solid #dbd3ca; border-radius: 8px; color: var(--admin-text); background: #fff; outline: none; }
.filter-field input:focus, .filter-field select:focus { border-color: var(--admin-gold); box-shadow: 0 0 0 3px rgba(213,163,60,.13); }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 13px 15px; border-bottom: 1px solid var(--admin-border); text-align: left; vertical-align: middle; }
.data-table th { color: var(--admin-muted); background: #fbfaf8; font-size: 9px; font-weight: 850; letter-spacing: .07em; text-transform: uppercase; white-space: nowrap; }
.data-table td { font-size: 12px; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #fffdf9; }
.table-title { min-width: 230px; }
.table-title strong { display: block; max-width: 520px; color: var(--admin-text); line-height: 1.45; }
.table-title small { display: block; margin-top: 4px; color: var(--admin-muted); }
.table-actions { display: flex; flex-wrap: wrap; gap: 5px; min-width: 165px; }
.inline-form { display: inline; margin: 0; }

.badge { display: inline-flex; align-items: center; min-height: 23px; padding: 3px 7px; border-radius: 99px; font-size: 9px; font-weight: 850; letter-spacing: .03em; text-transform: uppercase; white-space: nowrap; }
.badge-success { color: #0f6c4d; background: #ddf4ec; }
.badge-danger { color: #a22d34; background: #fde6e7; }
.badge-warning { color: #855908; background: #fff0c9; }
.badge-info { color: #245d94; background: #e6f2ff; }
.badge-neutral { color: #665f5f; background: #ece9e6; }
.badge-admin { color: #6b4500; background: #f8e4b9; }

.empty-state { padding: 50px 20px; text-align: center; }
.empty-state strong { display: block; color: var(--admin-primary-dark); font-family: Georgia,serif; font-size: 20px; }
.empty-state p { margin: 7px 0 17px; color: var(--admin-muted); }

.form-card { max-width: 960px; overflow: hidden; border: 1px solid var(--admin-border); border-radius: 16px; background: #fff; box-shadow: 0 9px 28px rgba(77,48,39,.06); }
.form-card.wide { max-width: 1100px; }
.form-section { padding: 22px; border-bottom: 1px solid var(--admin-border); }
.form-section:last-child { border-bottom: 0; }
.form-section h2 { margin: 0 0 4px; color: var(--admin-primary-dark); font-family: Georgia,serif; font-size: 19px; }
.form-section > p { margin: 0 0 18px; color: var(--admin-muted); font-size: 11px; line-height: 1.55; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 17px; }
.form-group { display: grid; align-content: start; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { color: #554949; font-size: 11px; font-weight: 800; }
.required { color: var(--admin-danger); }
.form-control { width: 100%; min-height: 44px; padding: 10px 12px; color: var(--admin-text); border: 1px solid #dcd3cb; border-radius: 9px; background: #fff; outline: none; }
textarea.form-control { min-height: 110px; resize: vertical; }
.form-control:focus { border-color: var(--admin-gold); box-shadow: 0 0 0 3px rgba(213,163,60,.14); }
.field-help { color: var(--admin-muted); font-size: 9px; line-height: 1.5; }
.field-error { color: var(--admin-danger); font-size: 10px; }
.password-wrap { position: relative; }
.password-wrap .form-control { padding-right: 58px; }
.password-toggle { position: absolute; right: 7px; top: 7px; min-height: 30px; padding: 4px 7px; color: var(--admin-primary); border: 0; border-radius: 6px; background: #f4ecec; font-size: 9px; font-weight: 800; cursor: pointer; }
.checkbox-row { display: flex; align-items: center; gap: 9px; min-height: 44px; padding: 9px 11px; border: 1px solid #e2d9d1; border-radius: 9px; background: #fbfaf8; }
.checkbox-row input { width: 17px; height: 17px; accent-color: var(--admin-primary); }
.checkbox-row label { font-weight: 650; cursor: pointer; }
.color-control { display: grid; grid-template-columns: 54px minmax(0,1fr); gap: 8px; }
.color-control input[type="color"] { width: 54px; height: 44px; padding: 3px; border: 1px solid #dcd3cb; border-radius: 9px; background: #fff; cursor: pointer; }
.range-row { display: flex; align-items: center; gap: 13px; min-height: 44px; }
.range-row input { flex: 1; accent-color: var(--admin-primary); }
.range-output { min-width: 72px; color: var(--admin-primary); font-size: 11px; font-weight: 800; }
.form-actions { display: flex; flex-wrap: wrap; gap: 9px; padding: 18px 22px; background: #fbfaf8; }

.pagination { display: flex; justify-content: center; flex-wrap: wrap; gap: 5px; padding: 17px; border-top: 1px solid var(--admin-border); }
.pagination a, .pagination span { display: grid; place-items: center; min-width: 34px; height: 34px; padding: 0 8px; border: 1px solid var(--admin-border); border-radius: 8px; color: var(--admin-primary); background: #fff; font-size: 11px; text-decoration: none; }
.pagination .active { color: #fff; border-color: var(--admin-primary); background: var(--admin-primary); }

.auth-body { display: grid; min-height: 100vh; place-items: center; padding: 25px 14px; background: radial-gradient(circle at top left,#f6e8cc,transparent 34%),linear-gradient(145deg,#f8f5ef,#e9ded4); }
.auth-shell { width: min(100%, 440px); }
.auth-card { overflow: hidden; border: 1px solid rgba(110,14,15,.15); border-radius: 21px; background: #fff; box-shadow: 0 25px 70px rgba(61,23,21,.17); }
.auth-brand { padding: 26px 25px 20px; text-align: center; background: linear-gradient(145deg,#6e0e0f,#350405); }
.auth-brand img { width: 78px; height: 78px; padding: 4px; object-fit: contain; border-radius: 17px; background: #fff; box-shadow: 0 8px 23px rgba(0,0,0,.2); }
.auth-brand h1 { margin: 11px 0 3px; color: #fff; font-family: Georgia,serif; font-size: 24px; }
.auth-brand p { margin: 0; color: #e6c982; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.auth-content { padding: 25px; }
.auth-content h2 { margin: 0; color: var(--admin-primary-dark); font-family: Georgia,serif; font-size: 23px; }
.auth-content > p { margin: 7px 0 20px; color: var(--admin-muted); font-size: 11px; line-height: 1.55; }
.auth-form { display: grid; gap: 15px; }
.auth-form .button { width: 100%; min-height: 46px; }
.auth-footer { margin-top: 17px; text-align: center; color: var(--admin-muted); font-size: 10px; }
.auth-back { display: inline-block; margin-top: 12px; font-weight: 700; text-decoration: none; }
.requirement-list { margin: 0 0 18px; padding: 12px 14px 12px 30px; color: var(--admin-muted); border-radius: 9px; background: #f8f5f0; font-size: 10px; line-height: 1.7; }

.log-description { max-width: 460px; line-height: 1.45; }
.code-text { font-family: Consolas,monospace; font-size: 10px; }
.sidebar-backdrop, .admin-sidebar-backdrop { display: none; }

@media (max-width: 1180px) {
    .stats-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
    .admin-sidebar { transform: translateX(-105%); transition: transform .24s ease; }
    .admin-layout.sidebar-open .admin-sidebar { transform: translateX(0); }
    .admin-sidebar-backdrop { position: fixed; inset: 0; z-index: 50; display: block; visibility: hidden; opacity: 0; background: rgba(32,11,11,.52); transition: opacity .24s,visibility .24s; }
    .admin-layout.sidebar-open .admin-sidebar-backdrop { visibility: visible; opacity: 1; }
    .admin-content-shell { margin-left: 0; }
    .menu-toggle { display: inline-grid; place-items: center; }
}

@media (max-width: 700px) {
    .admin-topbar { min-height: 64px; padding: 8px 12px; }
    .topbar-title small { display: none; }
    .topbar-title strong { font-size: 17px; }
    .topbar-view { display: none; }
    .logout-button { min-height: 35px; padding: 7px 10px; }
    .admin-main { padding: 18px 12px; }
    .page-heading { align-items: stretch; flex-direction: column; margin-bottom: 17px; }
    .page-heading h1 { font-size: 27px; }
    .heading-actions .button { flex: 1; }
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
    .stat-card { min-height: 115px; padding: 15px; }
    .stat-card strong { margin-top: 10px; font-size: 28px; }
    .quick-grid { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .form-group.full { grid-column: auto; }
    .form-section { padding: 17px; }
    .form-actions { padding: 15px 17px; }
    .admin-footer { flex-direction: column; padding: 14px; text-align: center; }
    .activity-item { grid-template-columns: 8px minmax(0,1fr); }
    .activity-item time { grid-column: 2; }
}

@media (max-width: 430px) {
    .stats-grid { grid-template-columns: 1fr; }
    .auth-content, .auth-brand { padding-left: 19px; padding-right: 19px; }
}
