* { box-sizing: border-box; font-family: "Segoe UI", Arial, Helvetica, sans-serif; }
:root {
    --bg: #f9f4e8;
    --surface: #ffffff;
    --surface-soft: #faf6ec;
    --text: #3d3323;
    --text-muted: #8a7a5f;
    --border: #e9dcc0;
    --gold: #c89b3c;
    --gold-dark: #a97d27;
    --shadow: 0 10px 28px rgba(123, 93, 31, 0.1);
}
body { margin: 0; background: var(--surface-soft); color: var(--text); }
a { color: inherit; }
.container { max-width: 1280px; margin: 72px 18px 18px 294px; padding: 18px 8px; }
img { max-width: 100%; height: auto; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap table { min-width: 760px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.page-head h1 { margin: 0 0 6px; }
.page-head p { margin: 0; color: var(--text-muted); }
.panel { border-left: 4px solid var(--gold); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.chip.accepted { background: #d8f5e4; color: #126637; }
.chip.rejected { background: #fbe3e1; color: #8a1911; }
.chip.hold { background: #fdf1cc; color: #8a6005; }
.muted { color: var(--text-muted); font-size: 13px; }
.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 270px;
    background: #ffffff;
    color: var(--text);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 18px 16px;
}
.brand-block { display: flex; gap: 12px; align-items: center; margin-bottom: 24px; }
.brand-pill {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: linear-gradient(140deg, #e0b85f 0%, #c9972f 100%);
    color: #fff;
    font-weight: 800;
}
.brand-pill.has-logo {
    width: 52px;
    height: 52px;
    background: #fff;
    border: 1px solid #e5d1a8;
    padding: 5px;
    box-shadow: inset 0 0 0 1px #f8efd9;
}
.brand-logo-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    border-radius: 6px;
    display: block;
}
.brand-block p { margin: 4px 0 0; color: var(--text-muted); font-size: 12px; }
.sidebar-nav { display: grid; gap: 8px; }
.sidebar-nav a {
    text-decoration: none;
    padding: 10px 12px;
    border-radius: 10px;
    color: #5f4a21;
    border: 1px solid transparent;
    transition: 0.18s ease;
}
.sidebar-nav a:hover { border-color: #dcc79d; background: #fbf4e5; }
.sidebar-nav a.active { background: linear-gradient(90deg, #f7ebcf 0%, #fff8ea 100%); border-color: #dfc487; color: #6e531e; }
.sidebar-footer { margin-top: auto; border-top: 1px solid var(--border); padding-top: 14px; }
.user-badge { background: #fdf8ed; border: 1px solid #ecd9b3; border-radius: 10px; padding: 10px; margin-bottom: 10px; }
.user-badge span { display: block; font-weight: 700; }
.user-badge small { color: #a67c2e; letter-spacing: 0.6px; }
.logout-link { display: block; text-align: center; text-decoration: none; padding: 10px; border-radius: 8px; background: #fcf3de; color: #7b5d1d; border: 1px solid #e7d0a1; }
.app-topbar {
    position: fixed;
    top: 0;
    left: 270px;
    right: 0;
    height: 66px;
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    z-index: 10;
    backdrop-filter: blur(6px);
    box-shadow: 0 3px 10px rgba(78, 52, 120, 0.06);
}
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-mark {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, #e0b85f 0%, #c9972f 100%);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    border: 1px solid #c99634;
    flex-shrink: 0;
}
.topbar-mark.has-logo {
    background: #fff;
    border-color: #e5d1a8;
    padding: 4px;
    box-shadow: inset 0 0 0 1px #f8efd9;
}
.topbar-logo-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    border-radius: 6px;
    display: block;
}
.topbar-brand { min-width: 0; }
.topbar-brand strong { display: block; font-size: 15px; line-height: 1.15; letter-spacing: 0.1px; }
.topbar-brand span { font-size: 11px; color: var(--text-muted); display: block; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 360px; margin-top: 2px; }
.topbar-right { display: flex; gap: 8px; align-items: center; }
.topbar-user { font-weight: 700; font-size: 13px; color: #4d3b1b; }
.topbar-role { font-size: 11px; background: #f6ebd2; color: #7a5b1d; border-radius: 999px; padding: 4px 10px; border: 1px solid #e2c88f; }
.mobile-menu-btn {
    display: none;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid #e1c89a;
    background: #fbf2de;
    color: #7a5b1d;
    font-size: 18px;
    line-height: 1;
    margin-right: 8px;
}
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(20, 12, 35, 0.36);
    z-index: 30;
}
.sidebar-backdrop.show { display: block; }
.card { background: var(--surface); border: 1px solid var(--border); padding: 16px; margin-bottom: 14px; border-radius: 12px; box-shadow: var(--shadow); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.metric { font-size: 2rem; font-weight: 800; margin: 2px 0 0; }
.stat-card .label { font-size: 13px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.6px; }
.stat-card { color: #fff; border: none; position: relative; overflow: hidden; }
.stat-card::after {
    content: "";
    position: absolute;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    right: -28px;
    bottom: -52px;
    background: rgba(255, 255, 255, 0.16);
}
.stat-card .label { color: rgba(255, 255, 255, 0.82); }
.stat-card.gold { background: linear-gradient(120deg, #f3a48c 0%, #ec6fb0 100%); }
.stat-card.accepted { background: linear-gradient(120deg, #5da7ec 0%, #2c74d4 100%); }
.stat-card.rejected { background: linear-gradient(120deg, #64c8d2 0%, #52b6aa 100%); }
.stat-card.hold { background: linear-gradient(120deg, #aa7af5 0%, #7f5ad6 100%); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { border: 1px solid var(--border); padding: 9px; text-align: left; vertical-align: top; }
th { background: #f6edd9; color: #5b4924; }
label { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; font-weight: 600; }
input, select, textarea, button { padding: 9px; border: 1px solid #babdc5; border-radius: 8px; background: #fff; }
textarea { min-height: 80px; }
button, .btn { background: linear-gradient(120deg, #d4a647 0%, #b9892f 100%); color: #fff; border: none; text-decoration: none; display: inline-block; padding: 9px 14px; border-radius: 8px; cursor: pointer; }
button:hover, .btn:hover { background: var(--gold-dark); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.form-inline { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; align-items: end; }
.alert { padding: 10px; margin-bottom: 10px; border-radius: 8px; border: 1px solid transparent; }
.danger { background: #fee2e2; color: #991b1b; border-color: #f3b7b7; }
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at 20% 20%, #252525 0%, #0f0f10 50%); }
.auth-card { width: 100%; max-width: 440px; border-top: 5px solid var(--gold); }
.auth-card h1 { margin-top: 6px; }
.auth-card .logo-title { font-size: 14px; color: var(--text-muted); margin-bottom: 14px; }
.dashboard-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.dashboard-head p { color: var(--text-muted); margin: 6px 0 0; }
.dashboard-hero {
    background: linear-gradient(120deg, #ffffff 0%, #fdf7ea 100%);
    border: 1px solid #ecdab3;
    border-radius: 14px;
    padding: 16px;
    box-shadow: var(--shadow);
}
.active-filter-pill {
    display: inline-block;
    margin-top: 8px !important;
    font-size: 12px;
    font-weight: 700;
    color: #7a5b1d !important;
    background: #f8ecd1;
    border: 1px solid #e3c98f;
    border-radius: 999px;
    padding: 4px 10px;
}
.dashboard-filter-card {
    border-left-color: #c99634;
    background: linear-gradient(180deg, #ffffff 0%, #fdf8ee 100%);
}
.dashboard-kpi-grid .stat-card { min-height: 124px; }
.dashboard-actions-card .actions .btn { min-width: 160px; }
.dashboard-insight-grid .card { min-height: 205px; }
.progress-item { margin: 10px 0 12px; }
.progress-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.progress-head strong { font-size: 12px; color: #5b4924; }
.dash-progress-track { height: 8px; background: #f0e3c7; border-radius: 99px; overflow: hidden; }
.dash-progress-fill { height: 100%; border-radius: 99px; }
.accepted-fill { background: #56c6be; }
.rejected-fill { background: #f08ba8; }
.hold-fill { background: #d0a748; }
.dashboard-table-card h2 { margin-bottom: 12px; }
.card > table { display: block; overflow-x: auto; white-space: nowrap; }
.card > table th, .card > table td { white-space: normal; }
@media print {
    .app-sidebar, .app-topbar, .btn { display:none !important; }
    body { background:#fff; }
    .container { margin: 0; max-width: 100%; padding: 0; }
}
@media (max-width: 1200px) {
    .container { margin: 72px 14px 16px 286px; padding: 14px 4px; }
    .grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
}
@media (max-width: 1100px) {
    .app-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 270px;
        height: 100vh;
        transform: translateX(-110%);
        transition: transform 0.22s ease;
        z-index: 40;
        border-right: 1px solid var(--border);
        border-bottom: none;
    }
    .app-sidebar.mobile-open { transform: translateX(0); }
    .brand-block { margin-bottom: 14px; }
    .sidebar-nav {
        display: grid;
        grid-auto-flow: row;
        grid-auto-columns: initial;
        overflow-x: visible;
        padding-bottom: 0;
    }
    .sidebar-footer { display: block; border-top: 1px solid var(--border); padding-top: 10px; }
    .user-badge { margin-bottom: 8px; }
    .logout-link { width: 100%; }
    .app-topbar { position: static; height: auto; padding: 10px 14px; left: 0; }
    .container { margin: 0; padding: 14px; }
    .mobile-menu-btn { display: inline-block; }
    .dashboard-head { flex-direction: column; align-items: flex-start; }
    .dashboard-head .btn { width: 100%; text-align: center; }
    .page-head { flex-direction: column; }
    .page-head .actions { width: 100%; }
    .page-head .actions .btn { width: 100%; text-align: center; }
    .dashboard-actions-card .actions .btn { min-width: 0; }
    .form-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
}
@media (min-width: 1101px) {
    .mobile-menu-btn { display: none !important; }
    .sidebar-backdrop { display: none !important; }
    .app-sidebar { transform: none !important; }
}
@media (max-width: 720px) {
    .container { padding: 10px; }
    .card { padding: 12px; border-radius: 10px; }
    h1 { font-size: 1.35rem; margin: 8px 0 10px; }
    h2 { font-size: 1.05rem; margin: 6px 0 10px; }
    .metric { font-size: 1.65rem; }
    .form-grid { grid-template-columns: 1fr; }
    .filters { grid-template-columns: 1fr; }
    .form-inline { flex-direction: column; align-items: stretch; }
    button, .btn { width: 100%; text-align: center; }
    .auth-page { background: radial-gradient(circle at 20% 20%, #e9d4a6 0%, #f6f0e2 70%); }
    .auth-card { max-width: 100%; margin: 10px; }
    .sidebar-footer { flex-direction: column; align-items: stretch; }
    .logout-link { width: 100%; }
    .sidebar-nav a { white-space: nowrap; }
    th, td { font-size: 13px; padding: 8px; }
    .app-topbar {
        position: sticky;
        top: 0;
        z-index: 20;
        border-radius: 0 0 12px 12px;
        box-shadow: 0 6px 18px rgba(78, 52, 120, 0.12);
    }
    .topbar-left { flex: 1; min-width: 0; }
    .topbar-mark { width: 28px; height: 28px; border-radius: 8px; font-size: 10px; }
    .topbar-brand strong { font-size: 13px; }
    .topbar-brand span { max-width: 170px; font-size: 11px; }
    .topbar-right { gap: 6px; }
    .topbar-user { font-size: 12px; line-height: 1.15; max-width: 86px; white-space: normal; }
    .topbar-role { font-size: 10px; padding: 2px 7px; }
}
@media (max-width: 480px) {
    .brand-pill { width: 36px; height: 36px; border-radius: 9px; font-size: 12px; }
    .brand-block strong { font-size: 14px; }
    input, select, textarea, button { padding: 8px; font-size: 14px; }
    .topbar-brand strong { font-size: 12px; }
    .topbar-brand span { font-size: 10px; max-width: 140px; }
    .topbar-role { font-size: 10px; padding: 2px 8px; }
}
