/*
 * The admin panel's stylesheet.
 *
 * Hand-written and served from the binary rather than pulled from a CDN or
 * built by a bundler: the panel is a dozen screens of tables and forms, and a
 * front-end toolchain to produce that is a build step, a lockfile and a supply
 * chain for no gain. The palette is the GoPearl brand system: deep emerald
 * carries the structure — sidebar, headers, primary actions — and gold
 * carries the accent layer — active states, queue badges, approvals — in
 * roughly equal measure, the same balance the website and app hold.
 */

:root {
    --primary-900: #03251d;
    --primary-800: #06382c;
    --primary-700: #0b4a3a;
    --primary-600: #116149;
    --primary-500: #17795b;
    --primary-100: #d6ecdf;
    --primary-50: #eef7f1;

    --gold-700: #a37a12;
    --gold-600: #c2941a;
    --gold-500: #d4a018;
    --gold-400: #e3b23c;
    --gold-300: #eec96f;
    --gold-100: #f8ecca;
    --gold-50: #fcf7e8;

    --ink: #111827;
    --ink-soft: #374151;
    --muted: #6b7280;
    --line: #e5e7eb;
    --surface: #ffffff;
    --canvas: #f6f7f9;

    --green: #047857;
    --green-bg: #d1fae5;
    --amber: #b45309;
    --amber-bg: #fef3c7;
    --red: #b91c1c;
    --red-bg: #fee2e2;
    --grey-bg: #f3f4f6;

    --radius: 10px;
    --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.1);
}

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--canvas);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary-600); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { margin: 0; font-weight: 600; }

/* ---------------------------------------------------------------- Shell */

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

.sidebar {
    width: 250px;
    flex-shrink: 0;
    background: var(--primary-900);
    color: var(--primary-100);
    padding: 20px 14px 40px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 20px; }
.brand-mark {
    width: 34px; height: 34px; border-radius: 9px;
    background: var(--gold-400); color: var(--primary-900);
    display: grid; place-items: center; font-weight: 700; letter-spacing: .5px;
}
.brand-name { color: #fff; font-weight: 600; font-size: 16px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-heading {
    margin: 18px 0 6px; padding: 0 10px;
    font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
    color: rgba(238, 201, 111, .6);
}
.nav-link {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px; padding: 9px 12px; border-radius: 8px;
    color: var(--primary-100); text-decoration: none;
    border-left: 3px solid transparent;
}
.nav-link:hover { background: var(--primary-800); color: #fff; text-decoration: none; }
.nav-link.active {
    background: var(--primary-800); color: var(--gold-300);
    border-left-color: var(--gold-400); font-weight: 600;
}
.nav-badge {
    background: var(--gold-400); color: var(--primary-900);
    border-radius: 999px; padding: 1px 8px; font-size: 11px; font-weight: 700;
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 14px;
    padding: 12px 22px; background: var(--surface);
    border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 17px; }
.icon-button {
    display: none; border: 0; background: transparent; font-size: 20px;
    cursor: pointer; color: var(--ink-soft);
}

.account { margin-left: auto; position: relative; }
.account summary {
    display: flex; align-items: center; gap: 8px;
    cursor: pointer; list-style: none; padding: 4px 6px; border-radius: 8px;
}
.account summary::-webkit-details-marker { display: none; }
.account summary:hover { background: var(--canvas); }
.account-name { font-weight: 500; color: var(--ink-soft); }

.avatar { width: 30px; height: 30px; border-radius: 999px; object-fit: cover; border: 1px solid var(--line); }
.avatar-initial {
    display: grid; place-items: center;
    background: var(--gold-100); color: var(--gold-700); font-weight: 700;
}

.menu {
    position: absolute; right: 0; top: calc(100% + 8px); width: 210px;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px; z-index: 30;
}
.menu-header { margin: 0; padding: 8px 10px; color: var(--muted); font-size: 12px; border-bottom: 1px solid var(--line); }
.menu a, .menu button {
    display: block; width: 100%; text-align: left;
    padding: 9px 10px; border: 0; background: transparent;
    border-radius: 7px; font: inherit; color: var(--ink-soft); cursor: pointer;
}
.menu a:hover, .menu button:hover { background: var(--primary-50); color: var(--primary-700); text-decoration: none; }
.menu .danger { color: var(--red); }
.menu .danger:hover { background: var(--red-bg); }

.content { padding: 22px; flex: 1; }

/* ---------------------------------------------------------------- Cards */

.card {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px;
}
.card-header {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.card-header h2 { font-size: 15px; }
.card-header .spacer { margin-left: auto; }
.card-body { padding: 18px; }

.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.stat {
    display: flex; flex-direction: column; gap: 4px;
    padding: 18px 20px; margin-bottom: 0;
}
.stat-label {
    color: var(--muted); font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: .07em;
}
.stat-value { font-size: 32px; font-weight: 700; line-height: 1.15; color: var(--primary-800); }
.stat-trend { font-size: 12px; font-weight: 600; color: var(--muted); }
.trend-up { color: var(--green); }
.trend-down { color: var(--red); }
.stat-accent { border-left: 4px solid var(--gold-400); background: var(--gold-50); }
.stat-accent .stat-value { color: var(--gold-700); }
a.stat { text-decoration: none; transition: transform .12s ease, box-shadow .12s ease; }
a.stat:hover {
    text-decoration: none; transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(16, 24, 40, .12);
}

/* The dashboard greeting. */
.greeting { margin: 2px 0 18px; }
.greeting h2 { font-size: 19px; color: var(--primary-900); }
.greeting p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }

/* The all-clear panel shown when both approval queues are empty. */
.all-clear {
    display: flex; align-items: center; gap: 14px;
    padding: 18px 20px; border-left: 4px solid var(--primary-500);
}
.all-clear-mark {
    width: 40px; height: 40px; border-radius: 999px; flex-shrink: 0;
    background: var(--primary-100); color: var(--primary-700);
    display: grid; place-items: center; font-size: 18px; font-weight: 700;
}
.all-clear p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.all-clear h3 { font-size: 15px; }
.all-clear .quick-links { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* --------------------------------------------------------------- Tables */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 16px; text-align: left; vertical-align: middle; }
thead th {
    background: #fafbfc; color: var(--ink-soft); font-size: 12px;
    text-transform: uppercase; letter-spacing: .04em;
    border-bottom: 1px solid var(--line); white-space: nowrap;
}
tbody tr { border-bottom: 1px solid #f1f2f4; }
tbody tr:hover { background: #fafbfc; }
td .sub { display: block; color: var(--muted); font-size: 12px; }

.empty { padding: 40px 18px; text-align: center; color: var(--muted); }

.badge {
    display: inline-block; padding: 2px 9px; border-radius: 999px;
    font-size: 12px; font-weight: 600; text-transform: capitalize;
}
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-amber { background: var(--gold-100); color: var(--gold-700); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-grey { background: var(--grey-bg); color: var(--ink-soft); }

/* ---------------------------------------------------------------- Forms */

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 180px; }
.field.wide { flex: 1; min-width: 240px; }
label { font-size: 12px; font-weight: 600; color: var(--ink-soft); }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=search], input[type=file], select, textarea {
    width: 100%; padding: 9px 11px; font: inherit; color: var(--ink);
    background: #fff; border: 1px solid var(--line); border-radius: 8px;
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(23, 121, 91, .18);
}
textarea { min-height: 120px; resize: vertical; }
.hint { color: var(--muted); font-size: 12px; }

.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 15px; border-radius: 8px; border: 1px solid transparent;
    font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary-600); color: #fff; }
.btn-primary:hover { background: var(--primary-700); }
.btn-secondary { background: #fff; color: var(--ink-soft); border-color: var(--line); }
.btn-secondary:hover { background: var(--canvas); }
.btn-gold { background: var(--gold-400); color: var(--primary-900); }
.btn-gold:hover { background: var(--gold-500); }
.btn-danger { background: var(--red-bg); color: var(--red); }
.btn-danger:hover { background: #fecaca; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.row-actions { display: flex; gap: 6px; align-items: center; }
.row-actions form { display: inline; }
.inline-form { display: inline; }

.checkbox-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.checkbox { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.checkbox input { width: auto; }

/* --------------------------------------------------------------- Flash */

.flash {
    padding: 12px 16px; border-radius: var(--radius);
    margin-bottom: 16px; border-left: 4px solid;
}
.flash ul { margin: 6px 0 0; padding-left: 18px; }
.flash-success { background: var(--green-bg); border-color: var(--green); color: #064e3b; }
.flash-error { background: var(--red-bg); border-color: var(--red); color: #7f1d1d; }

/* ----------------------------------------------------------- Pagination */

.pagination { display: flex; gap: 6px; align-items: center; padding: 14px 18px; flex-wrap: wrap; }
.pagination a, .pagination span {
    padding: 6px 11px; border: 1px solid var(--line); border-radius: 7px;
    color: var(--ink-soft); background: #fff;
}
.pagination .current { background: var(--primary-600); border-color: var(--primary-600); color: #fff; font-weight: 600; }
.pagination .disabled { color: #c3c7cd; }
.pagination-summary { margin-right: auto; color: var(--muted); }

/* -------------------------------------------------------------- Charts */

.chart { width: 100%; height: 220px; }
.chart-bar { fill: var(--primary-500); }
.chart-bar:hover { fill: var(--gold-400); }
.chart-bar-pending { fill: var(--gold-400); }
.chart-bar-rejected { fill: var(--red); }
.chart-bar-zero { fill: var(--line); }
.chart-bar-zero:hover { fill: var(--line); }
.chart-value { font-size: 11px; font-weight: 700; fill: var(--ink-soft); }
.chart-axis { stroke: var(--line); }
.chart-label { font-size: 11px; fill: var(--muted); }

.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-soft); }
.legend-swatch { width: 10px; height: 10px; border-radius: 3px; }

/* ---------------------------------------------------------------- Chat */

.chat { display: grid; grid-template-columns: 280px 1fr; min-height: 520px; }
.chat-list { border-right: 1px solid var(--line); overflow-y: auto; max-height: 640px; }
.chat-contact {
    display: flex; gap: 10px; align-items: center;
    padding: 12px 14px; border-bottom: 1px solid #f1f2f4; color: var(--ink);
}
.chat-contact:hover { background: var(--canvas); text-decoration: none; }
.chat-contact.active { background: var(--primary-50); }
.chat-thread { display: flex; flex-direction: column; }
.chat-messages { flex: 1; padding: 18px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; max-height: 520px; }
.bubble { max-width: 70%; padding: 10px 13px; border-radius: 12px; background: var(--grey-bg); }
.bubble.mine { align-self: flex-end; background: var(--gold-100); }
.bubble time { display: block; margin-top: 4px; font-size: 11px; color: var(--muted); }
.chat-compose { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }

/* ------------------------------------------------------------- Gallery */

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.gallery figure { margin: 0; position: relative; }
.gallery img { width: 100%; height: 110px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }

.thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; border: 1px solid var(--line); }

/* --------------------------------------------------------------- Login */

.login {
    min-height: 100vh; display: grid; place-items: center;
    background:
        radial-gradient(80% 120% at 100% 0%, rgba(212, 160, 24, .25), transparent 55%),
        linear-gradient(160deg, var(--primary-900), var(--primary-700));
    padding: 20px;
}
.login-card {
    width: 100%; max-width: 380px; background: #fff;
    border-radius: 14px; padding: 30px; box-shadow: 0 20px 40px rgba(0, 0, 0, .25);
}
.login-card h1 { font-size: 20px; margin-bottom: 4px; }
.login-card p.sub { margin: 0 0 22px; color: var(--muted); }
.login-card .field { margin-bottom: 14px; min-width: 0; }
.login-card .btn { width: 100%; justify-content: center; }

/* ------------------------------------------------------------ Responsive */

@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .chat { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
    .icon-button { display: block; }
    .sidebar {
        position: fixed; inset: 0 auto 0 0; z-index: 40;
        transform: translateX(-100%); transition: transform .2s ease;
    }
    .sidebar.open { transform: translateX(0); }
    .grid-4, .grid-2 { grid-template-columns: 1fr; }
    .account-name { display: none; }
    .checkbox-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
