/* =============================================================
   Afrobora Admin Panel — Styles
   Requires tokens.css to be loaded first.
   ============================================================= */

/* ---- override body font-size for dense admin UI ---- */
body { font-size: 15px; }

/* =============================================================
   LOGIN SCREEN
   ============================================================= */
#login-screen {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: var(--ink);
  background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,.04) 1px, transparent 0);
  background-size: 22px 22px;
}
.login-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 48px 44px;
  width: 100%; max-width: 400px;
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; gap: 28px;
}
.login-brand { display: flex; align-items: center; gap: 12px; }
.login-brand .bmark {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--ink);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.login-brand .bmark svg { width: 20px; height: 20px; color: #fff; }
.login-brand-text strong { font-size: 16px; font-weight: 700; display: block; }
.login-brand-text small {
  font-family: var(--mono); font-size: 11px;
  color: var(--muted); letter-spacing: .08em; text-transform: uppercase;
}
.login-card h2 { font-size: 22px; font-weight: 700; }
.login-card p.sub { color: var(--muted); font-size: 14px; margin-top: 4px; }

.login-field { display: flex; flex-direction: column; gap: 6px; }
.login-field label {
  font-size: 13px; font-weight: 500; color: var(--muted);
  font-family: var(--mono); letter-spacing: .04em;
}
.login-field input {
  width: 100%; padding: 11px 14px;
  border: 1.5px solid var(--line-2); border-radius: var(--radius-sm);
  font: inherit; font-size: 15px; color: var(--ink);
  background: var(--surface-2); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.login-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}
.login-error {
  font-size: 13px; color: var(--danger);
  background: var(--danger-tint);
  border-radius: var(--radius-sm);
  padding: 9px 13px; display: none;
  font-family: var(--mono);
}
.login-error.show { display: block; }
.btn-login {
  width: 100%; padding: 13px;
  background: var(--ink); color: #fff;
  border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 600;
  letter-spacing: -0.01em;
  transition: opacity .15s; border: none; cursor: pointer;
}
.btn-login:hover { opacity: .88; }
.btn-login:disabled { opacity: .5; cursor: not-allowed; }
.login-hint {
  font-family: var(--mono); font-size: 11px;
  color: var(--muted-2); text-align: center; letter-spacing: .04em;
}

/* =============================================================
   APP SHELL
   ============================================================= */
#app { display: none; height: 100vh; }
#app.visible { display: flex; }

/* ---- Sidebar ---- */
.sidebar {
  width: 240px; flex-shrink: 0;
  background: var(--ink);
  display: flex; flex-direction: column;
  padding: 24px 0;
  height: 100vh; position: sticky; top: 0; overflow-y: auto;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 0 20px 24px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: 16px;
}
.sidebar-brand .bmark {
  width: 32px; height: 32px; border-radius: 8px;
  background: rgba(255,255,255,.1);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.sidebar-brand .bmark svg { width: 16px; height: 16px; color: #fff; }
.sidebar-brand-text strong { font-size: 14px; font-weight: 700; color: #fff; display: block; line-height: 1.2; }
.sidebar-brand-text small {
  font-family: var(--mono); font-size: 10px;
  color: rgba(255,255,255,.4); letter-spacing: .08em; text-transform: uppercase;
}
.sidebar-section { padding: 4px 12px; margin-bottom: 4px; }
.sidebar-section-label {
  font-family: var(--mono); font-size: 10px;
  color: rgba(255,255,255,.3); letter-spacing: .12em; text-transform: uppercase;
  padding: 4px 8px 8px; display: block;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500;
  color: rgba(255,255,255,.55);
  transition: background .12s, color .12s;
  cursor: pointer; user-select: none;
}
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .8; }
.nav-item:hover { background: rgba(255,255,255,.07); color: rgba(255,255,255,.9); }
.nav-item.active { background: rgba(255,255,255,.12); color: #fff; }
.nav-item .badge {
  margin-left: auto; background: var(--accent); color: #fff;
  font-family: var(--mono); font-size: 10px;
  padding: 2px 7px; border-radius: 999px; font-weight: 600;
}
.sidebar-footer {
  margin-top: auto; padding: 16px 0 0;
  border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 20px 8px;
}
.sidebar-user .avatar {
  width: 30px; height: 30px; border-radius: 999px;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.sidebar-user-info strong { display: block; font-size: 13px; color: #fff; line-height: 1.2; }
.sidebar-user-info small { font-family: var(--mono); font-size: 10px; color: rgba(255,255,255,.4); letter-spacing: .04em; }

/* ---- Main content area ---- */
.main { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }
.topbar-admin {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 0 28px; height: 58px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow-sm);
}
.topbar-admin h1 { font-size: 17px; font-weight: 700; letter-spacing: -.02em; }
.topbar-admin-right { display: flex; align-items: center; gap: 12px; }

/* ---- Admin button variants ---- */
.btn-sm {
  padding: 7px 14px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px;
  transition: opacity .15s, background .12s;
  cursor: pointer; border: none;
}
.btn-sm:hover { opacity: .85; }
.btn-primary-sm { background: var(--ink); color: #fff; }
.btn-ghost-sm {
  background: transparent; color: var(--muted);
  border: 1.5px solid var(--line-2);
}
.btn-ghost-sm:hover { background: var(--bg); color: var(--ink); opacity: 1; }
.btn-danger-sm { background: var(--danger-tint); color: var(--danger); }

.content-area { padding: 28px; flex: 1; }

/* =============================================================
   PANELS (tab content)
   ============================================================= */
.panel { display: none; }
.panel.active { display: block; }

/* ---- Stat cards ---- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px; margin-bottom: 28px;
}
.stat-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px;
  display: flex; flex-direction: column; gap: 8px;
  box-shadow: var(--shadow-sm);
}
.stat-card .label {
  font-family: var(--mono); font-size: 10px; color: var(--muted-2);
  letter-spacing: .12em; text-transform: uppercase;
}
.stat-card .value { font-size: 30px; font-weight: 700; letter-spacing: -.04em; line-height: 1; }
.stat-card .meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat-card.accent-card { background: var(--ink); border-color: transparent; }
.stat-card.accent-card .label { color: rgba(255,255,255,.4); }
.stat-card.accent-card .value { color: #fff; }
.stat-card.accent-card .meta  { color: rgba(255,255,255,.5); }

/* ---- Section card ---- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  overflow: hidden; margin-bottom: 20px;
}
.card-head {
  padding: 16px 20px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-head h3 { font-size: 15px; font-weight: 600; }
.card-head p  { font-size: 13px; color: var(--muted); margin-top: 2px; }
.card-body { padding: 20px; }

/* ---- Data table ---- */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  text-align: left; padding: 10px 14px;
  font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); background: var(--surface-2);
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--line); transition: background .1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-tint); }
tbody td { padding: 12px 14px; vertical-align: top; }
tbody td .name    { font-weight: 600; font-size: 14px; }
tbody td .company { font-size: 12px; color: var(--muted); margin-top: 2px; }
tbody td .msg-preview {
  font-size: 12px; color: var(--muted);
  max-width: 240px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---- Status badges ---- */
.badge-status {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--mono); font-size: 10px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px;
}
.badge-new  { background: var(--accent-tint); color: var(--accent-ink); }
.badge-read { background: var(--surface-2);   color: var(--muted-2); }
.badge-done { background: var(--success-tint); color: var(--success); }

/* ---- Row action buttons ---- */
.row-actions { display: flex; gap: 6px; align-items: center; }
.act-btn {
  padding: 4px 9px; border-radius: 6px; font-size: 11px; font-weight: 500;
  cursor: pointer; border: 1px solid var(--line-2);
  background: transparent; color: var(--muted);
  font-family: var(--mono); letter-spacing: .04em;
  transition: background .1s, color .1s;
}
.act-btn:hover { background: var(--bg); color: var(--ink); }
.act-btn.del { border-color: transparent; color: var(--danger); }
.act-btn.del:hover { background: var(--danger-tint); }

/* ---- Empty state ---- */
.empty-state {
  text-align: center; padding: 52px 24px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.empty-state svg { width: 44px; height: 44px; color: var(--muted-2); }
.empty-state h4  { font-size: 16px; font-weight: 600; color: var(--muted); }
.empty-state p   { font-size: 13px; color: var(--muted-2); max-width: 30ch; }

/* ---- Filter row ---- */
.filters-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 14px 20px; border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.search-input {
  flex: 1; min-width: 200px;
  padding: 8px 12px; border: 1.5px solid var(--line-2);
  border-radius: var(--radius-sm);
  font: inherit; font-size: 13px; color: var(--ink);
  background: var(--surface); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
.filter-select {
  padding: 8px 12px; border: 1.5px solid var(--line-2);
  border-radius: var(--radius-sm);
  font: inherit; font-size: 13px; color: var(--muted);
  background: var(--surface); outline: none; cursor: pointer;
}
.filter-select:focus { border-color: var(--accent); }

/* =============================================================
   MODAL
   ============================================================= */
.modal-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(21,23,26,.6); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--surface); border-radius: var(--radius-lg);
  padding: 32px; width: 100%; max-width: 520px;
  box-shadow: var(--shadow-lg);
  transform: translateY(8px) scale(.98); transition: transform .2s;
  max-height: 85vh; overflow-y: auto;
}
.modal-overlay.open .modal { transform: none; }
.modal h3  { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.modal .sub { font-size: 13px; color: var(--muted); margin-bottom: 20px; }
.modal-field { margin-bottom: 16px; }
.modal-field label {
  display: block; font-size: 12px; font-weight: 500; color: var(--muted);
  font-family: var(--mono); letter-spacing: .06em; text-transform: uppercase; margin-bottom: 6px;
}
.modal-field .value-block {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 12px 14px;
  font-size: 14px; color: var(--ink); white-space: pre-wrap; word-break: break-word;
}
.modal-field input,
.modal-field select,
.modal-field textarea {
  width: 100%; padding: 10px 13px;
  border: 1.5px solid var(--line-2); border-radius: var(--radius-sm);
  font: inherit; font-size: 14px; color: var(--ink);
  background: var(--surface-2); outline: none;
  transition: border-color .15s, box-shadow .15s; resize: vertical;
}
.modal-field input:focus,
.modal-field select:focus,
.modal-field textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint);
}
.modal-actions { display: flex; gap: 10px; margin-top: 24px; justify-content: flex-end; }

/* =============================================================
   SETTINGS
   ============================================================= */
.setting-row {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--line);
}
.setting-row:last-child { border-bottom: none; }
.setting-info h4 { font-size: 14px; font-weight: 600; }
.setting-info p  { font-size: 13px; color: var(--muted); margin-top: 3px; }

/* toggle switch */
.toggle { position: relative; width: 42px; height: 24px; display: inline-block; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-track {
  position: absolute; inset: 0;
  background: var(--line-2); border-radius: 999px;
  cursor: pointer; transition: background .2s;
}
.toggle input:checked + .toggle-track { background: var(--accent); }
.toggle-track::before {
  content: ""; position: absolute;
  width: 18px; height: 18px; border-radius: 999px;
  left: 3px; top: 3px; background: #fff;
  transition: transform .2s; box-shadow: var(--shadow-sm);
}
.toggle input:checked + .toggle-track::before { transform: translateX(18px); }

/* password / account form */
.pw-form { display: grid; gap: 14px; }
.pw-form input {
  width: 100%; padding: 10px 13px;
  border: 1.5px solid var(--line-2); border-radius: var(--radius-sm);
  font: inherit; font-size: 14px; color: var(--ink);
  background: var(--surface-2); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.pw-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
.pw-msg { font-size: 12px; font-family: var(--mono); padding: 8px 12px; border-radius: var(--radius-sm); display: none; }
.pw-msg.ok  { background: var(--success-tint); color: var(--success); display: block; }
.pw-msg.err { background: var(--danger-tint);  color: var(--danger);  display: block; }

/* =============================================================
   OVERVIEW — Activity list & Quick actions
   ============================================================= */
.activity-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.activity-list li {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.activity-list li:last-child { border-bottom: none; }
.act-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--accent); flex-shrink: 0; margin-top: 5px; }
.act-dot.grey { background: var(--line-2); }
.act-body { flex: 1; min-width: 0; }
.act-body strong { font-size: 13.5px; font-weight: 600; display: block; }
.act-body span   { font-size: 12px; color: var(--muted); }
.act-time { font-family: var(--mono); font-size: 11px; color: var(--muted-2); flex-shrink: 0; }

.quick-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.qa-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; color: var(--muted);
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.qa-btn:hover { background: var(--bg); color: var(--ink); border-color: var(--line-2); }
.qa-btn svg { width: 15px; height: 15px; }

/* =============================================================
   LAYOUT HELPERS
   ============================================================= */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

/* =============================================================
   FEEDBACK
   ============================================================= */
.spinner {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff; border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed; bottom: 28px; right: 28px; z-index: 9000;
  background: var(--ink); color: #fff;
  padding: 12px 20px; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  transform: translateY(12px); opacity: 0;
  transition: transform .22s, opacity .22s;
  pointer-events: none; font-family: var(--mono);
}
.toast.show { transform: none; opacity: 1; }

/* =============================================================
   MOBILE WARNING
   ============================================================= */
.mobile-warn {
  display: none; position: fixed; inset: 0; z-index: 10000;
  background: var(--ink); color: #fff;
  flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; padding: 32px; text-align: center;
}
.mobile-warn h3 { color: #fff; font-size: 20px; }
.mobile-warn p  { color: rgba(255,255,255,.6); font-size: 14px; max-width: 30ch; }
@media (max-width: 640px) { .mobile-warn { display: flex; } }

/* =============================================================
   SCROLLBAR
   ============================================================= */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 999px; }
