/* ============================================================================
   Geekys Staff Backend — Design System
   Brand palette: green, black & gold.
   ============================================================================ */

:root {
  --gk-primary: #1B6E43;        /* Geekys green — buttons, active nav, links */
  --gk-primary-dark: #124D2E;
  --gk-primary-light: #E3F1E9;
  --gk-gold: #B8872F;           /* Gold accent — highlights, secondary emphasis */
  --gk-gold-dark: #96701F;
  --gk-gold-bg: #F6EDD8;
  --gk-ink: #12130F;            /* Near-black, warm */
  --gk-ink-soft: #55574D;
  --gk-border: #E3E1D6;
  --gk-bg: #F5F4EE;             /* Warm off-white ground */
  --gk-surface: #ffffff;

  --gk-success: #1B6E43;
  --gk-success-bg: #E3F1E9;
  --gk-warning: #B8872F;
  --gk-warning-bg: #F6EDD8;
  --gk-danger: #A83232;
  --gk-danger-bg: #F6E4E1;
  --gk-info: #12130F;
  --gk-info-bg: #ECEBE4;

  --gk-radius: 12px;
  --gk-radius-sm: 8px;
  --gk-shadow: 0 1px 2px rgba(18, 19, 15, 0.05), 0 4px 16px rgba(18, 19, 15, 0.07);
  --gk-sidebar-w: 250px;
  color-scheme: light;
}

html[data-theme="dark"] {
  --gk-primary: #45A96B;
  --gk-primary-dark: #8AD9A5;
  --gk-primary-light: #183726;
  --gk-gold: #D5A74B;
  --gk-gold-dark: #F0C96F;
  --gk-gold-bg: #352C17;
  --gk-ink: #F3F5F1;
  --gk-ink-soft: #B7BDB5;
  --gk-border: #333A34;
  --gk-bg: #0D110E;
  --gk-surface: #181D19;
  --gk-success: #72D596;
  --gk-success-bg: #183726;
  --gk-warning: #E1B85F;
  --gk-warning-bg: #352C17;
  --gk-danger: #FF8D8D;
  --gk-danger-bg: #3A2020;
  --gk-info: #F3F5F1;
  --gk-info-bg: #282E29;
  --gk-shadow: 0 1px 2px rgba(0,0,0,.35), 0 5px 20px rgba(0,0,0,.28);
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--gk-bg);
  color: var(--gk-ink);
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { color: var(--gk-ink); }

a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0 0 4px; font-weight: 700; }
p { margin: 0 0 8px; color: var(--gk-ink-soft); }

/* ---- App shell -------------------------------------------------------- */

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

.gk-sidebar {
  width: var(--gk-sidebar-w);
  flex-shrink: 0;
  background: var(--gk-surface);
  border-right: 1px solid var(--gk-border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.gk-brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 22px; }
.gk-brand-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--gk-primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 16px;
}
.gk-brand-name { font-weight: 800; font-size: 16px; }
.gk-brand-name small { display: block; font-weight: 500; font-size: 11px; color: var(--gk-ink-soft); letter-spacing: 0.04em; text-transform: uppercase; }

.gk-sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }

.gk-nav-section {
  margin-top: 16px;
  padding: 0 10px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #9aa0b4;
}

.gk-nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border-radius: var(--gk-radius-sm);
  color: var(--gk-ink-soft);
  font-weight: 600;
  font-size: 14px;
}
.gk-nav-link:hover { background: var(--gk-bg); color: var(--gk-ink); }
.gk-nav-link.is-active { background: var(--gk-primary-light); color: var(--gk-primary-dark); }
.gk-nav-icon { width: 18px; height: 18px; display: inline-block; }
.gk-logout { margin-top: 10px; border-top: 1px solid var(--gk-border); padding-top: 14px; }

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

.gk-topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 28px;
  background: var(--gk-surface);
  border-bottom: 1px solid var(--gk-border);
  position: sticky; top: 0; z-index: 5;
}
.gk-page-title { font-size: 19px; flex: 1; }
.gk-topbar-right { display:flex; align-items:center; gap:12px; }
.gk-topbar-user { font-size: 13px; font-weight: 600; color: var(--gk-ink-soft); }
.gk-nav-toggle { display: none; background: none; border: none; font-size: 20px; cursor: pointer; }
.gk-theme-toggle {
  width:36px; height:36px; flex:0 0 36px; display:inline-grid; place-items:center;
  border:1px solid var(--gk-border); border-radius:999px; background:var(--gk-bg);
  color:var(--gk-ink); font-size:20px; line-height:1; cursor:pointer;
}
.gk-theme-toggle:hover { border-color:var(--gk-primary); background:var(--gk-primary-light); }

.gk-content { padding: 28px; max-width: 1320px; width: 100%; margin: 0 auto; }

/* ---- Cards / layout primitives ---------------------------------------- */

.gk-card {
  background: var(--gk-surface);
  border: 1px solid var(--gk-border);
  border-radius: var(--gk-radius);
  box-shadow: var(--gk-shadow);
  padding: 20px;
}

.gk-grid { display: grid; gap: 18px; }
.gk-grid-3 { grid-template-columns: repeat(3, 1fr); }
.gk-grid-4 { grid-template-columns: repeat(4, 1fr); }
.gk-grid-2 { grid-template-columns: 2fr 1fr; }

/* ---- Service tiles ------------------------------------------------------ */

.gk-service-card {
  padding: 26px;
  border-radius: var(--gk-radius);
  border: 1px solid var(--gk-border);
  background: var(--gk-surface);
  box-shadow: var(--gk-shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.gk-service-icon {
  width: 46px; height: 46px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; margin-bottom: 4px;
}
.gk-service-card.buyins .gk-service-icon { background: var(--gk-info-bg); color: var(--gk-info); }
.gk-service-card.repairs .gk-service-icon { background: var(--gk-warning-bg); color: var(--gk-warning); }
.gk-service-card.buyback .gk-service-icon { background: var(--gk-success-bg); color: var(--gk-success); }

.gk-service-card h3 { font-size: 18px; }
.gk-service-card p { font-size: 13.5px; }

/* ---- Buttons ------------------------------------------------------------ */

.gk-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 18px;
  border-radius: var(--gk-radius-sm);
  font-weight: 700; font-size: 14px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.05s ease, filter 0.15s ease;
}
.gk-btn:active { transform: translateY(1px); }
.gk-btn-primary { background: var(--gk-primary); color: #fff; }
.gk-btn-primary:hover { filter: brightness(1.08); }
.gk-btn-secondary { background: var(--gk-surface); color: var(--gk-ink); border-color: var(--gk-border); }
.gk-btn-secondary:hover { background: var(--gk-bg); }
.gk-btn-danger { background: var(--gk-danger); color: #fff; }
.gk-btn-block { width: 100%; }
.gk-btn:disabled { opacity: 0.55; cursor: not-allowed; }

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

.gk-field { margin-bottom: 16px; }
.gk-field label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.gk-field input, .gk-field select, .gk-field textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--gk-border);
  border-radius: var(--gk-radius-sm);
  font-size: 14px;
  font-family: inherit;
  background: var(--gk-surface);
}
.gk-field input:focus, .gk-field select:focus, .gk-field textarea:focus {
  outline: none; border-color: var(--gk-primary); box-shadow: 0 0 0 3px var(--gk-primary-light);
}

/* ---- Badges / status ------------------------------------------------------ */

.gk-badge { display: inline-flex; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.gk-badge-success { background: var(--gk-success-bg); color: var(--gk-success); }
.gk-badge-warning { background: var(--gk-warning-bg); color: var(--gk-warning); }
.gk-badge-danger { background: var(--gk-danger-bg); color: var(--gk-danger); }
.gk-badge-neutral { background: var(--gk-bg); color: var(--gk-ink-soft); }

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

.gk-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.gk-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: #9aa0b4; padding: 10px 12px; border-bottom: 1px solid var(--gk-border); }
.gk-table td { padding: 12px; border-bottom: 1px solid var(--gk-border); }
.gk-table tr:last-child td { border-bottom: none; }

/* ---- Stat tiles ------------------------------------------------------------ */

.gk-stat { padding: 16px 18px; }
.gk-stat .value { font-size: 26px; font-weight: 800; }
.gk-stat .label { font-size: 12.5px; color: var(--gk-ink-soft); font-weight: 600; }

/* ---- Empty / placeholder states -------------------------------------------- */

.gk-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--gk-ink-soft);
}
.gk-empty .gk-empty-icon { font-size: 32px; margin-bottom: 10px; }

/* ---- Auth pages ------------------------------------------------------------- */

.gk-auth-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--gk-primary) 0%, var(--gk-primary-dark) 100%);
  padding: 20px;
}
.gk-auth-card {
  width: 100%; max-width: 380px;
  background: var(--gk-surface);
  border-radius: 16px;
  padding: 34px 30px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.gk-auth-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.gk-auth-error {
  background: var(--gk-danger-bg); color: var(--gk-danger);
  padding: 10px 12px; border-radius: var(--gk-radius-sm);
  font-size: 13px; font-weight: 600; margin-bottom: 14px; display: none;
}
.gk-auth-error.is-visible { display: block; }
.gk-auth-links { display: flex; justify-content: space-between; margin-top: 14px; font-size: 13px; }
.gk-auth-links a { color: var(--gk-primary); font-weight: 600; }

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

@media (max-width: 1100px) {
  .gk-grid-3 { grid-template-columns: repeat(2, 1fr); }
  .gk-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .gk-grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .gk-nav-toggle { display: block; }
  .gk-sidebar {
    position: fixed; left: -270px; top: 0; z-index: 20;
    transition: left 0.2s ease; box-shadow: 0 0 40px rgba(0,0,0,0.15);
  }
  .gk-sidebar.is-open { left: 0; }
  .gk-content { padding: 18px; }
}

@media (max-width: 620px) {
  .gk-grid-3, .gk-grid-4 { grid-template-columns: 1fr; }
  .gk-topbar { padding:14px 18px; }
  .gk-topbar-right { gap:8px; }
  .gk-topbar-user { max-width:112px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
}

/* ---- Print ------------------------------------------------------------------ */
/* Shared by every report page's "Print" button: hide the app shell (sidebar,
   topbar) and anything explicitly marked .gk-print-hide (date pickers, the
   Run report / Print / Back controls), then let the report content itself
   fill the page. `.gk-print-only` is the inverse — content (e.g. a printed
   report's date range) that only appears in the printed output. */
@media print {
  html[data-theme="dark"] {
    --gk-ink:#12130F; --gk-ink-soft:#55574D; --gk-border:#E3E1D6;
    --gk-bg:#F5F4EE; --gk-surface:#ffffff; color-scheme:light;
  }
  .gk-sidebar, .gk-topbar, .gk-print-hide { display: none !important; }
  .gk-shell { display: block !important; }
  .gk-main { margin: 0 !important; }
  .gk-content { max-width: none !important; margin: 0 !important; padding: 0 !important; }
  body { background: #fff !important; }
  .gk-card { box-shadow: none !important; border: 1px solid #ccc !important; break-inside: avoid; }
  .gk-print-only { display: block !important; }
}
.gk-print-only { display: none; }
