/* ===== Design tokens ===== */
:root {
    --gold: #D4AF37;
    --gold-light: #f5e9c8;
    --gold-dark: #a8842a;
    --black: #14141a;
    --white: #ffffff;
    --grey-50: #fafafa;
    --grey-100: #f4f4f5;
    --grey-200: #e4e4e7;
    --grey-400: #a1a1aa;
    --grey-600: #52525b;
    --grey-800: #27272a;
    --danger: #b91c1c;
    --danger-bg: #fee2e2;
    --success: #15803d;
    --success-bg: #dcfce7;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(20,20,26,0.08), 0 1px 2px rgba(20,20,26,0.04);
    --shadow-lg: 0 8px 24px rgba(20,20,26,0.10);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--grey-50);
    margin: 0;
    color: var(--black);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--gold-dark); }
h1, h2, h3, h4 { margin: 0 0 4px 0; letter-spacing: -0.01em; }

/* ===== Top navigation ===== */
.topnav {
    background: var(--black);
    color: var(--white);
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}
.topnav .brand {
    color: var(--white);
    font-weight: 700;
    font-size: 17px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}
.topnav .brand::before {
    content: '';
    display: inline-block;
    width: 9px;
    height: 9px;
    background: var(--gold);
    border-radius: 50%;
}
.nav-left { display: flex; align-items: center; gap: 20px; }
.nav-right { display: flex; align-items: center; gap: 16px; }
.topnav a { color: var(--grey-200); text-decoration: none; font-size: 14px; }
.topnav a:hover { color: var(--gold); }
.nav-links { display: flex; align-items: center; gap: 16px; }
.nav-user-chip { display: flex; align-items: center; gap: 8px; }
.nav-avatar {
    width: 28px; height: 28px; border-radius: 50%; object-fit: cover;
    border: 1.5px solid var(--gold);
}
.nav-avatar-fallback {
    width: 28px; height: 28px; border-radius: 50%;
    background: var(--gold); color: var(--black);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700;
}
.hamburger {
    display: none;
    background: none; border: none; color: var(--white);
    font-size: 22px; cursor: pointer; padding: 4px 8px;
}
.mobile-menu {
    display: none;
    flex-direction: column;
    background: var(--black);
    padding: 12px 20px 16px;
    gap: 12px;
    border-top: 1px solid #2a2a33;
}
.mobile-menu.open { display: flex; }
.mobile-menu a { color: var(--grey-200); text-decoration: none; font-size: 15px; padding: 6px 0; }

@media (max-width: 780px) {
    .nav-links, .nav-user-chip-desktop { display: none; }
    .hamburger { display: block; }
}

/* ===== Layout ===== */
.container { max-width: 1100px; margin: 0 auto; padding: 20px 16px 60px; }
.page-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
h1 { font-size: 22px; }

@media (max-width: 600px) {
    .container { padding: 14px 12px 50px; }
    h1 { font-size: 19px; }
}

/* ===== Buttons ===== */
.btn, button {
    background: var(--black); color: var(--white); border: none; padding: 11px 18px;
    border-radius: 9px; cursor: pointer; text-decoration: none; font-size: 14px; font-weight: 600;
    display: inline-flex; align-items: center; gap: 6px; transition: background 0.15s, transform 0.1s;
}
.btn:hover, button:hover { background: #000; }
.btn:active, button:active { transform: scale(0.98); }
.btn-gold { background: var(--gold); color: var(--black); }
.btn-gold:hover { background: var(--gold-dark); color: var(--white); }
.btn-outline { background: var(--white); color: var(--black); border: 1.5px solid var(--grey-200); }
.btn-outline:hover { background: var(--grey-100); border-color: var(--grey-400); }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 7px; }
button:disabled { opacity: 0.6; cursor: not-allowed; }

/* ===== Cards ===== */
.card {
    background: var(--white); border-radius: var(--radius); padding: 20px;
    box-shadow: var(--shadow); border: 1px solid var(--grey-100);
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }

/* ===== KPI stat cards ===== */
.stat-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px; margin-bottom: 20px;
}
.stat-card {
    background: var(--white); border-radius: var(--radius); padding: 18px;
    box-shadow: var(--shadow); border: 1px solid var(--grey-100);
    border-top: 3px solid var(--gold);
}
.stat-card .stat-label {
    font-size: 12px; color: var(--grey-600); text-transform: uppercase;
    letter-spacing: 0.04em; font-weight: 600; margin-bottom: 6px;
}
.stat-card .stat-value { font-size: 24px; font-weight: 700; color: var(--black); }
.stat-card .stat-sub { font-size: 12px; color: var(--grey-400); margin-top: 4px; }
.stat-card.accent-black { border-top-color: var(--black); }

/* ===== Tables ===== */
.table-wrap { overflow-x: auto; border-radius: var(--radius); box-shadow: var(--shadow); }
.data-table { width: 100%; border-collapse: collapse; background: var(--white); min-width: 560px; }
.data-table th, .data-table td { padding: 12px 14px; border-bottom: 1px solid var(--grey-100); text-align: left; font-size: 13.5px; }
.data-table th { background: var(--grey-50); font-weight: 700; color: var(--grey-800); font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; }
.data-table tr:hover td { background: var(--grey-50); }
.data-table td a { font-weight: 600; }

/* ===== Badges ===== */
.badge { color: var(--white); padding: 4px 11px; border-radius: 20px; font-size: 11.5px; font-weight: 600; display: inline-block; }
.badge-pending { background: #9a7b1f; }
.badge-active { background: var(--black); }
.badge-completed { background: var(--gold-dark); color: var(--black); }
.badge-open { background: var(--danger); }
.badge-resolved { background: var(--success); }

/* ===== Forms ===== */
.form-box { background: var(--white); padding: 24px; border-radius: var(--radius); max-width: 520px; box-shadow: var(--shadow); border: 1px solid var(--grey-100); }
.form-box label, .field-label { display: block; margin-top: 14px; margin-bottom: 5px; font-size: 13px; font-weight: 600; color: var(--grey-800); }
.form-box input, .form-box select, .form-box textarea,
input[type=text], input[type=password], input[type=number], input[type=date], input[type=file], select, textarea {
    width: 100%; padding: 10px 12px; border: 1.5px solid var(--grey-200); border-radius: 8px; font-size: 14.5px;
    font-family: inherit; background: var(--white); color: var(--black);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-light); }
.form-box button { margin-top: 20px; width: 100%; justify-content: center; }
.inline-form { display: flex; gap: 10px; align-items: end; margin-bottom: 16px; flex-wrap: wrap; }
.inline-form label { font-size: 12.5px; font-weight: 600; }
.inline-form input, .inline-form select { padding: 9px 10px; }
.field-row { display: flex; gap: 12px; flex-wrap: wrap; }
.field-row > div { flex: 1; min-width: 160px; }

.password-field { position: relative; }
.password-field input { padding-right: 42px; }
.password-toggle {
    position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
    background: none; border: none; cursor: pointer; padding: 6px 8px; color: var(--grey-600); font-size: 13px;
}
.password-toggle:hover { background: none; color: var(--black); }

/* ===== Filters ===== */
.filter-bar {
    display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
    background: var(--white); padding: 14px; border-radius: var(--radius);
    box-shadow: var(--shadow); margin-bottom: 16px; border: 1px solid var(--grey-100);
}
.filter-bar input, .filter-bar select { width: auto; min-width: 140px; padding: 9px 12px; }
.filter-bar input[type=text] { flex: 1; min-width: 180px; }

/* ===== Auth pages ===== */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--black); padding: 20px; }
.auth-box {
    width: 100%; max-width: 380px; background: var(--white); padding: 32px 28px;
    border-radius: 16px; box-shadow: var(--shadow-lg);
}
.auth-box .auth-logo { text-align: center; margin-bottom: 6px; }
.auth-box .auth-logo .dot { width: 10px; height: 10px; background: var(--gold); border-radius: 50%; display: inline-block; margin-right: 6px; }
.auth-box h2 { text-align: center; margin-bottom: 22px; }
.auth-box button { width: 100%; margin-top: 20px; padding: 12px; }
.lang-switch-standalone { text-align: center; margin-top: 16px; font-size: 13px; }
.lang-switch-standalone a { color: var(--grey-400); text-decoration: none; }
.lang-switch-standalone a.lang-active { color: var(--white); font-weight: 700; }

/* ===== Alerts ===== */
.error { color: var(--danger); background: var(--danger-bg); padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 14px; }
.notice { color: #8a6416; background: var(--gold-light); padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 14px; }
.success-msg { color: var(--success); background: var(--success-bg); padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 14px; }

/* ===== Avatars ===== */
.avatar-lg { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; border: 3px solid var(--gold); }
.avatar-lg-fallback {
    width: 84px; height: 84px; border-radius: 50%; background: var(--black); color: var(--gold);
    display: flex; align-items: center; justify-content: center; font-size: 30px; font-weight: 700;
    border: 3px solid var(--gold);
}
.avatar-sm { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; vertical-align: middle; margin-right: 8px; border: 1.5px solid var(--grey-200); }
.avatar-sm-fallback {
    width: 32px; height: 32px; border-radius: 50%; background: var(--grey-800); color: var(--gold);
    display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700;
    vertical-align: middle; margin-right: 8px;
}

/* ===== Tabs ===== */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--grey-100); margin-bottom: 18px; }
.tab-btn {
    background: none; border: none; padding: 10px 16px; font-size: 14px; font-weight: 600;
    color: var(--grey-600); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px;
}
.tab-btn.active { color: var(--black); border-bottom-color: var(--gold); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ===== Misc ===== */
.staff-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.staff-actions a { color: var(--gold-dark); text-decoration: none; font-size: 13px; font-weight: 600; }
.link-danger { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 13px; padding: 0; font-weight: 600; }
.link-danger:hover { background: none; color: #7f1d1d; }
.section-title { font-size: 15px; font-weight: 700; margin: 24px 0 12px; color: var(--grey-800); }
.chip { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 600; background: var(--grey-100); color: var(--grey-800); }
hr { border: none; border-top: 1px solid var(--grey-100); margin: 16px 0; }
.bar-chart { display: flex; align-items: flex-end; gap: 10px; height: 140px; padding-top: 10px; }
.bar-chart .bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.bar-chart .bar { width: 100%; max-width: 34px; background: var(--gold); border-radius: 4px 4px 0 0; transition: height 0.3s; }
.bar-chart .bar-label { font-size: 10.5px; color: var(--grey-600); margin-top: 6px; text-align: center; }
.bar-chart .bar-value { font-size: 10px; color: var(--grey-800); font-weight: 700; margin-bottom: 3px; }
