/* HomeTurf Admin — unified stylesheet */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,600;0,9..144,700;1,9..144,600&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  --bg:      #0F0D0C;
  --surface: #1A1714;
  --raised:  #232019;
  --overlay: #2C2821;
  --b1:      #342F27;
  --b2:      #2A2420;
  --t1:      #F2EDE8;
  --t2:      #A89C90;
  --t3:      #7A6E64;
  --t4:      #5C5148;
  --orange:  #FF5600;
  --clay:    #C4633A;
  --olive:   #3E7B55;
  --rust:    #B84040;
  --amber:   #D4862A;
  --r-sm:    5px;
  --r-md:    7px;
  --r-lg:    10px;
  --font-d:  'Fraunces', Georgia, serif;
  --font-b:  'Plus Jakarta Sans', system-ui, sans-serif;
}

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

body {
  font-family: var(--font-b);
  background:  var(--bg);
  color:       var(--t1);
  font-size:   13px;
  line-height: 1.5;
  display:     flex;
  min-height:  100vh;
}

/* ── SIDEBAR ── */
.sidebar {
  width: 200px; flex-shrink: 0;
  background: var(--surface); border-right: 1px solid var(--b2);
  display: flex; flex-direction: column; height: 100vh; position: sticky; top: 0;
  overflow-y: auto;
}
.sb-brand {
  padding: 16px 14px; border-bottom: 1px solid var(--b2);
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}
.sb-logo {
  width: 28px; height: 28px; border-radius: 7px;
  background: var(--orange); display: flex; align-items: center;
  justify-content: center; font-family: var(--font-d);
  font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.sb-name { font-family: var(--font-d); font-size: 14px; font-weight: 700; color: var(--t1); }
.sb-role { font-size: 9px; color: var(--t4); text-transform: uppercase; letter-spacing: .06em; margin-top: 1px; }
.sb-section {
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .1em; color: var(--t4); padding: 12px 14px 4px;
}
.sb-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 14px; font-size: 12px; font-weight: 500; color: var(--t3);
  cursor: pointer; transition: all .1s; position: relative;
  border-left: 2px solid transparent; border: none; background: none; width: 100%; text-align: left;
}
.sb-item:hover  { color: var(--t1); background: rgba(255,255,255,.03); }
.sb-item.active { color: var(--orange); background: rgba(255,86,0,.06); border-left-color: var(--orange); }
.sb-item i { font-size: 16px; flex-shrink: 0; }
.sb-badge {
  margin-left: auto; border-radius: 10px; padding: 1px 6px;
  font-size: 10px; font-weight: 700; flex-shrink: 0; color: #fff; background: var(--rust);
}
.sb-badge.amber  { background: var(--amber); }
.sb-badge.olive  { background: var(--olive); }
.sb-footer {
  margin-top: auto; padding: 12px 14px; border-top: 1px solid var(--b2); flex-shrink: 0;
}
.sb-user { display: flex; align-items: center; gap: 8px; }
.sb-av {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, #C4633A, #8C3A2A);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.sb-uname  { font-size: 11px; font-weight: 600; color: var(--t1); }
.sb-uemail { font-size: 9px; color: var(--t4); }

/* ── MAIN ── */
.main { flex: 1; overflow-x: hidden; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  background: var(--surface); border-bottom: 1px solid var(--b2);
  padding: 12px 24px; display: flex; align-items: center; gap: 12px; flex-shrink: 0;
}
.tb-title { font-size: 15px; font-weight: 700; color: var(--t1); flex: 1; }
.tb-search {
  flex: 1; max-width: 260px; background: var(--raised);
  border: 1px solid var(--b1); border-radius: var(--r-sm);
  padding: 7px 10px; color: var(--t1); font-size: 12px;
  font-family: var(--font-b); outline: none; display: flex; align-items: center; gap: 6px;
}
.tb-search input {
  background: transparent; border: none; outline: none;
  color: var(--t1); font-size: 12px; font-family: var(--font-b); width: 100%;
}
.tb-search input::placeholder { color: var(--t4); }
.tb-search i { color: var(--t4); font-size: 14px; flex-shrink: 0; }
.tb-btn {
  width: 32px; height: 32px; border-radius: var(--r-sm);
  background: var(--raised); border: 1px solid var(--b1);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; position: relative; color: var(--t3);
}
.tb-btn:hover { background: var(--overlay); }
.tb-btn i { font-size: 16px; }
.content { padding: 20px 24px; flex: 1; overflow-y: auto; }

/* ── METRIC CARDS ── */
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 20px; }
.mc {
  background: var(--surface); border: 1px solid var(--b2);
  border-radius: var(--r-lg); padding: 14px 16px; transition: border-color .15s;
}
.mc:hover { border-color: var(--b1); }
.mc-label {
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--t4); margin-bottom: 8px;
  display: flex; align-items: center; gap: 5px;
}
.mc-label i { font-size: 12px; }
.mc-num {
  font-family: var(--font-d); font-size: 26px; font-weight: 700;
  color: var(--t1); letter-spacing: -.5px; line-height: 1;
  margin-bottom: 3px; font-variant-numeric: tabular-nums;
}
.mc-change { font-size: 10px; font-weight: 600; display: flex; align-items: center; gap: 3px; }
.mc-change.up      { color: var(--olive); }
.mc-change.down    { color: var(--rust); }
.mc-change.neutral { color: var(--t4); }

/* ── PANELS ── */
.panel {
  background: var(--surface); border: 1px solid var(--b2);
  border-radius: var(--r-lg); overflow: hidden; margin-bottom: 12px;
}
.panel-hdr {
  padding: 12px 16px; border-bottom: 1px solid var(--b2);
  display: flex; align-items: center; gap: 8px;
}
.panel-title { font-size: 12px; font-weight: 700; color: var(--t1); flex: 1; }
.panel-action { font-size: 11px; color: var(--orange); cursor: pointer; font-weight: 600; background: none; border: none; }
.panel-action:hover { text-decoration: underline; }
.panel-body { padding: 0; }

/* ── TABLES ── */
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table th {
  text-align: left; padding: 8px 12px; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em; color: var(--t4);
  border-bottom: 1px solid var(--b2); background: var(--raised);
}
.data-table td {
  padding: 9px 12px; border-bottom: 1px solid var(--b2); color: var(--t2);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255,255,255,.015); }
.data-table a { color: var(--orange); text-decoration: none; }
.data-table a:hover { text-decoration: underline; }

/* ── CHIPS ── */
.chip {
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; padding: 2px 7px; border-radius: 3px; display: inline-block;
}
.chip-rust   { background: rgba(184,64,64,.12);   color: var(--rust); }
.chip-amber  { background: rgba(212,134,42,.12);  color: var(--amber); }
.chip-olive  { background: rgba(62,123,85,.12);   color: var(--olive); }
.chip-orange { background: rgba(255,86,0,.12);    color: var(--orange); }
.chip-grey   { background: rgba(122,110,100,.12); color: var(--t3); }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--r-sm); font-size: 12px; font-weight: 600;
  cursor: pointer; border: 1px solid transparent; font-family: var(--font-b); transition: all .1s;
}
.btn-primary  { background: var(--orange); color: #fff; border-color: var(--orange); }
.btn-primary:hover { background: #e04d00; }
.btn-ghost   { background: transparent; color: var(--t2); border-color: var(--b1); }
.btn-ghost:hover { background: var(--raised); color: var(--t1); }
.btn-danger  { background: transparent; color: var(--rust); border-color: var(--rust); }
.btn-danger:hover { background: rgba(184,64,64,.1); }
.btn-sm { padding: 4px 10px; font-size: 11px; }
.btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── FORMS ── */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 11px; font-weight: 600; color: var(--t2); margin-bottom: 5px; }
.form-input {
  width: 100%; background: var(--raised); border: 1px solid var(--b1);
  border-radius: var(--r-sm); padding: 8px 11px; color: var(--t1);
  font-size: 12px; font-family: var(--font-b); outline: none;
  transition: border-color .15s;
}
.form-input:focus { border-color: var(--orange); }
.form-input::placeholder { color: var(--t4); }
textarea.form-input { min-height: 80px; resize: vertical; }
select.form-input { cursor: pointer; }

/* ── MODALS ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--surface); border: 1px solid var(--b1);
  border-radius: var(--r-lg); width: 100%; max-width: 480px;
  max-height: 90vh; overflow-y: auto;
}
.modal-hdr {
  padding: 16px 20px; border-bottom: 1px solid var(--b2);
  display: flex; align-items: center; gap: 10px;
}
.modal-title { font-size: 14px; font-weight: 700; color: var(--t1); flex: 1; }
.modal-close { background: none; border: none; color: var(--t3); cursor: pointer; font-size: 18px; line-height: 1; }
.modal-body   { padding: 20px; }
.modal-footer { padding: 12px 20px; border-top: 1px solid var(--b2); display: flex; gap: 8px; justify-content: flex-end; }

/* ── TOAST ── */
.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px; z-index: 2000;
}
.toast {
  background: var(--overlay); border: 1px solid var(--b1);
  border-radius: var(--r-md); padding: 10px 16px;
  font-size: 12px; color: var(--t1); display: flex; align-items: center;
  gap: 8px; min-width: 220px; animation: slideIn .2s ease;
}
.toast.success { border-left: 3px solid var(--olive); }
.toast.error   { border-left: 3px solid var(--rust); }
.toast.warning { border-left: 3px solid var(--amber); }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── APPROVAL QUEUE ROWS ── */
.aq-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-bottom: 1px solid var(--b2);
  cursor: pointer; transition: background .1s;
}
.aq-row:last-child { border-bottom: none; }
.aq-row:hover { background: var(--raised); }
.aq-icon {
  width: 32px; height: 32px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0;
}
.aq-info { flex: 1; }
.aq-title { font-size: 12px; font-weight: 600; color: var(--t1); margin-bottom: 1px; }
.aq-sub   { font-size: 10px; color: var(--t3); }
.aq-time  { font-size: 10px; color: var(--t4); flex-shrink: 0; }

/* ── ERROR LOG ── */
.err-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 16px; border-bottom: 1px solid var(--b2);
  cursor: pointer; transition: background .1s; font-size: 11px;
}
.err-row:hover { background: var(--raised); }
.err-row:last-child { border-bottom: none; }
.err-level {
  flex-shrink: 0; width: 44px; font-size: 9px; font-weight: 700;
  text-transform: uppercase; padding: 2px 0; text-align: center; border-radius: 3px;
}
.el-error { background: rgba(212,134,42,.2); color: var(--amber); }
.el-fatal  { background: rgba(184,64,64,.2); color: var(--rust); }
.err-msg   { flex: 1; color: var(--t2); word-break: break-word; }
.err-count { color: var(--t4); flex-shrink: 0; text-align: right; min-width: 60px; }

/* ── GRID HELPERS ── */
.two-col   { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.three-col { display: grid; grid-template-columns: 1.6fr 1fr; gap: 12px; margin-bottom: 12px; }

/* ── PAGINATION ── */
.pagination { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--b2); }
.pagination-info { flex: 1; font-size: 11px; color: var(--t4); }

/* ── DETAIL DRAWER ── */
.drawer-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  z-index: 900; display: none;
}
.drawer-overlay.open { display: block; }
.drawer {
  position: fixed; right: 0; top: 0; bottom: 0;
  width: 440px; background: var(--surface); border-left: 1px solid var(--b1);
  z-index: 901; overflow-y: auto; transform: translateX(100%); transition: transform .2s ease;
}
.drawer.open { transform: none; }
.drawer-hdr {
  padding: 16px 20px; border-bottom: 1px solid var(--b2);
  display: flex; align-items: center; gap: 10px; position: sticky; top: 0;
  background: var(--surface); z-index: 1;
}
.drawer-title  { flex: 1; font-size: 14px; font-weight: 700; color: var(--t1); }
.drawer-close  { background: none; border: none; color: var(--t3); cursor: pointer; font-size: 20px; }
.drawer-body   { padding: 20px; }
.drawer-section { margin-bottom: 20px; }
.drawer-section-title {
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .1em; color: var(--t4); margin-bottom: 10px;
}
.kv-row { display: flex; gap: 10px; margin-bottom: 7px; font-size: 12px; }
.kv-key { color: var(--t3); flex-shrink: 0; width: 140px; }
.kv-val { color: var(--t1); word-break: break-word; }
.drawer-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }

/* ── EMPTY + LOADING STATES ── */
.state-empty {
  padding: 40px 20px; text-align: center; color: var(--t4); font-size: 12px;
}
.state-empty i { font-size: 32px; display: block; margin-bottom: 8px; color: var(--t4); }
.loading { display: flex; align-items: center; gap: 8px; padding: 20px; color: var(--t4); font-size: 12px; }

/* ── LOGIN PAGE ── */
.login-page {
  min-height: 100vh; display: flex; align-items: center;
  justify-content: center; background: var(--bg);
}
.login-card {
  background: var(--surface); border: 1px solid var(--b1);
  border-radius: var(--r-lg); padding: 36px 32px; width: 100%; max-width: 360px;
}
.login-logo {
  width: 40px; height: 40px; border-radius: 10px; background: var(--orange);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-d); font-size: 18px; font-weight: 700; color: #fff; margin-bottom: 20px;
}
.login-title { font-family: var(--font-d); font-size: 22px; font-weight: 700; color: var(--t1); margin-bottom: 4px; }
.login-sub   { font-size: 12px; color: var(--t3); margin-bottom: 24px; }
.login-error { background: rgba(184,64,64,.1); border: 1px solid rgba(184,64,64,.3); border-radius: var(--r-sm); padding: 10px 14px; font-size: 12px; color: var(--rust); margin-bottom: 14px; }

/* ── TICKET THREAD ── */
.msg-bubble {
  margin-bottom: 12px; display: flex; flex-direction: column;
}
.msg-bubble.admin { align-items: flex-end; }
.msg-bubble.user  { align-items: flex-start; }
.msg-content {
  max-width: 80%; padding: 10px 14px; border-radius: var(--r-md);
  font-size: 12px; line-height: 1.6; word-break: break-word;
}
.msg-bubble.admin .msg-content { background: rgba(255,86,0,.1); color: var(--t1); border-radius: var(--r-md) var(--r-md) 0 var(--r-md); }
.msg-bubble.user  .msg-content { background: var(--raised); color: var(--t2); border-radius: var(--r-md) var(--r-md) var(--r-md) 0; }
.msg-meta { font-size: 10px; color: var(--t4); margin-top: 3px; }

/* ── AUDIT LOG ── */
.audit-row {
  padding: 10px 16px; border-bottom: 1px solid var(--b2);
  font-size: 12px; display: flex; gap: 12px; align-items: flex-start;
}
.audit-row:last-child { border-bottom: none; }
.audit-time   { color: var(--t4); font-size: 10px; flex-shrink: 0; width: 100px; margin-top: 2px; }
.audit-actor  { color: var(--orange); font-weight: 600; flex-shrink: 0; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audit-action { color: var(--t3); flex-shrink: 0; max-width: 180px; font-family: monospace; font-size: 11px; }
.audit-summary { color: var(--t2); flex: 1; }

/* ── MISC ── */
.minor-flag { color: var(--rust); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.divider { border: none; border-top: 1px solid var(--b2); margin: 16px 0; }
.text-muted { color: var(--t4); }
.text-orange { color: var(--orange); }
.mb-12 { margin-bottom: 12px; }
.mb-20 { margin-bottom: 20px; }
.flex-center { display: flex; align-items: center; gap: 8px; }
