/* admin.css — FNOTrader unified admin, plain CSS (no framework).
   Dark sidebar + light content. Self-contained: no Bootstrap, no CDN. */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px; color: #1f2937; background: #f4f6f9; -webkit-font-smoothing: antialiased;
}
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── boot spinner ───────────────────────────────────────── */
.boot-spinner { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.spinner {
  width: 34px; height: 34px; border: 3px solid #d1d5db; border-top-color: #2563eb;
  border-radius: 50%; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── login ──────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%); padding: 16px;
}
.login-card {
  width: 380px; max-width: 100%; background: #fff; border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.35); padding: 28px;
}
.login-card h1 { font-size: 22px; font-weight: 700; color: #0f172a; text-align: center; margin: 0; letter-spacing: -0.02em; }
.login-card .sub { text-align: center; color: #6b7280; font-size: 13px; margin: 4px 0 22px; }
.login-card label { display: block; font-size: 12px; color: #6b7280; margin-bottom: 4px; }
.login-card input { width: 100%; padding: 9px 11px; border: 1px solid #d1d5db; border-radius: 7px; font-size: 14px; margin-bottom: 16px; }
.login-card input:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,0.12); }
.login-card .foot { text-align: center; font-size: 11px; color: #9ca3af; margin-top: 14px; }

/* ── layout ─────────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 230px; flex: 0 0 230px; background: #0f172a; color: #cbd5e1;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar-brand { padding: 16px 18px; border-bottom: 1px solid rgba(255,255,255,0.08); }
/* Uniform FNOTrader brand standard: 28px mark in a white badge on dark bg,
   wordmark Inter 17px/800, FNO = base text + Trader = app accent. */
.sidebar-brand .brand-row { display: flex; align-items: center; gap: 8px; }
.sidebar-brand .brand-logo { width: 28px; height: 28px; object-fit: contain; background: #fff; padding: 3px; border-radius: 7px; box-shadow: 0 1px 6px rgba(0,0,0,0.25); display: block; }
.sidebar-brand .logo { font-size: 17px; font-weight: 800; letter-spacing: -0.02em; color: #fff; white-space: nowrap; }
.sidebar-brand .logo .lt-trader { color: #5b9aff; }
.sidebar-brand .logo sup { font-size: 8px; opacity: 0.5; }
.sidebar-brand .tag { font-size: 11px; color: rgba(255,255,255,0.55); margin-top: 4px; }
.nav { padding: 8px 0 24px; }
.nav .section { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; color: #5a6478; padding: 14px 18px 4px; font-weight: 700; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 18px; color: #cbd5e1;
  font-size: 13.5px; border-left: 3px solid transparent;
}
.nav a:hover { background: rgba(255,255,255,0.05); text-decoration: none; color: #fff; }
.nav a.active { background: rgba(37,99,235,0.18); border-left-color: #3b82f6; color: #fff; font-weight: 600; }
.nav a .ic { width: 20px; display: inline-block; text-align: center; }

.content { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; justify-content: flex-end; align-items: center; gap: 12px; padding: 10px 20px; border-bottom: 1px solid #e5e7eb; background: #fff; }
.topbar .who { font-size: 13px; color: #6b7280; }
.topbar .who strong { color: #1f2937; }
.page { padding: 20px 22px; flex: 1; }
.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 20px; font-weight: 700; }
.page-head .meta { font-size: 12px; color: #6b7280; display: flex; align-items: center; gap: 8px; }

/* ── cards / grid ───────────────────────────────────────── */
.grid { display: grid; gap: 14px; }
.grid.c2 { grid-template-columns: repeat(2, 1fr); }
.grid.c3 { grid-template-columns: repeat(3, 1fr); }
.grid.c4 { grid-template-columns: repeat(4, 1fr); }
.grid.c5 { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 1100px) { .grid.c4,.grid.c5 { grid-template-columns: repeat(2,1fr); } .grid.c3 { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 760px)  { .grid.c2,.grid.c3,.grid.c4,.grid.c5 { grid-template-columns: 1fr; } }
.card { background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; overflow: hidden; }
.card-head { padding: 10px 14px; border-bottom: 1px solid #eef0f3; font-weight: 600; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card-head .hint { font-weight: 400; font-size: 12px; color: #9ca3af; }
.card-body { padding: 14px; }
.kpi { background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 14px 16px; }
.kpi .label { font-size: 12px; color: #6b7280; }
.kpi .value { font-size: 26px; font-weight: 700; line-height: 1.1; }
.kpi .vsub { font-size: 12px; color: #9ca3af; }
.bar { height: 6px; background: #eceef1; border-radius: 4px; overflow: hidden; margin: 8px 0; }
.bar > span { display: block; height: 100%; border-radius: 4px; }
.bar .ok { background: #16a34a; } .bar .warn { background: #d97706; } .bar .bad { background: #dc2626; }
.kpi .foot { display: flex; justify-content: space-between; font-size: 11.5px; color: #9ca3af; }

/* ── tables ─────────────────────────────────────────────── */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th, table.tbl td { padding: 7px 10px; text-align: left; border-bottom: 1px solid #eef0f3; white-space: nowrap; }
table.tbl thead th { background: #f9fafb; color: #6b7280; font-weight: 600; font-size: 12px; position: sticky; top: 0; }
table.tbl thead th.sortable { cursor: pointer; user-select: none; }
table.tbl thead th.sortable:hover { color: #1f2937; background: #f1f3f5; }
.sort-arrow { font-size: 10px; color: #2563eb; }
table.tbl tbody tr:hover { background: #f9fafb; }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl td.mut { color: #9ca3af; }
.empty { text-align: center; color: #9ca3af; padding: 22px; }

/* ── badges / pills ─────────────────────────────────────── */
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11.5px; font-weight: 600; line-height: 1.5; }
.badge.green { background: #dcfce7; color: #166534; }
.badge.red { background: #fee2e2; color: #991b1b; }
.badge.amber { background: #fef3c7; color: #92400e; }
.badge.gray { background: #e5e7eb; color: #374151; }
.badge.blue { background: #dbeafe; color: #1e40af; }
.dot { display:inline-block; width:8px; height:8px; border-radius:50%; margin-right:5px; }
.dot.green{background:#16a34a;} .dot.red{background:#dc2626;} .dot.amber{background:#d97706;}

/* ── buttons / forms ────────────────────────────────────── */
button, .btn { font: inherit; cursor: pointer; border-radius: 7px; padding: 7px 13px; border: 1px solid #d1d5db; background: #fff; color: #1f2937; }
button:hover, .btn:hover { background: #f3f4f6; }
button.primary, .btn.primary { background: #111827; color: #fff; border-color: #111827; }
button.primary:hover { background: #1f2937; }
button.sm { padding: 4px 9px; font-size: 12px; }
button:disabled { opacity: 0.55; cursor: not-allowed; }
button.danger { color: #b91c1c; border-color: #fca5a5; }
button.danger:hover { background: #fef2f2; }
input, select, textarea { font: inherit; padding: 7px 10px; border: 1px solid #d1d5db; border-radius: 7px; background: #fff; }
input:focus, select:focus, textarea:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 12px; color: #6b7280; }
.row-form { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar input[type=search], .toolbar input.search { min-width: 240px; }

/* ── misc ───────────────────────────────────────────────── */
.alert { padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }
.alert.err { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.alert.warn { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.alert.info { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }
.muted { color: #9ca3af; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.spin-inline { width: 14px; height: 14px; border: 2px solid #d1d5db; border-top-color: #2563eb; border-radius: 50%; display: inline-block; animation: spin 0.7s linear infinite; vertical-align: -2px; }
.live { display: inline-flex; align-items: center; gap: 4px; color: #16a34a; font-weight: 600; font-size: 12px; }
.stat-row { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid #f3f4f6; }
.stat-row:last-child { border-bottom: none; }
.stat-row .k { color: #6b7280; } .stat-row .v { font-weight: 600; }
.right { text-align: right; } .center { text-align: center; }
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal { background: #fff; border-radius: 12px; width: 520px; max-width: 94vw; max-height: 90vh; overflow: auto; }
.modal-head { padding: 14px 18px; border-bottom: 1px solid #eef0f3; font-weight: 700; display:flex; justify-content:space-between; align-items:center; }
.modal-body { padding: 18px; }
.modal-foot { padding: 12px 18px; border-top: 1px solid #eef0f3; display: flex; justify-content: flex-end; gap: 8px; }
.toast { position: fixed; bottom: 20px; right: 20px; background: #111827; color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 13px; z-index: 60; box-shadow: 0 8px 24px rgba(0,0,0,0.3); }
.toast.err { background: #b91c1c; }
