/* Jorone - Signal Orange identity system (brand sheet v1.0) */
:root {
  --bg: #F7F8FA; --panel: #FFFFFF; --panel-2: #F7F8FA; --border: #E5E8EC;
  --text: #131A22; --text-2: #4A5768; --text-3: #8A93A0;
  --accent: #E62E04; --accent-2: #FF6A00; --grad: linear-gradient(135deg,#E62E04,#FF6A00);
  --accent-soft: #FFF0E8; --accent-text: #E62E04;
  --green: #0E9F6E; --green-soft: #E3F6EF; --red: #E02424; --red-soft: #FDECEC;
  --amber: #D97706; --amber-soft: #FDF3E3;
  --shadow: 0 1px 2px rgba(19,26,34,.04), 0 6px 20px rgba(19,26,34,.05);
  --radius: 16px;
  --font: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
[data-theme="dark"] {
  --bg: #131A22; --panel: #232F3E; --panel-2: #1B2530; --border: #37475A;
  --text: #F7F8FA; --text-2: #A9B4C0; --text-3: #6E7B88;
  --accent: #FF6A00; --accent-2: #FF8A3D;
  --accent-soft: rgba(255,106,0,.16); --accent-text: #FF8A3D;
  --green: #34D399; --green-soft: #0C2B21; --red: #F87171; --red-soft: #331515;
  --amber: #F0B45A; --amber-soft: #2E2210;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
}
* { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg); color: var(--text); font-size: 14.5px; line-height: 1.55;
  transition: background .2s, color .2s; letter-spacing: -.003em;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; }
input, select { font: inherit; color: var(--text); background: var(--panel); border: 1.5px solid var(--border); border-radius: 12px; padding: 9px 13px; outline: none; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus { border-color: var(--accent-2); box-shadow: 0 0 0 3px var(--accent-soft); }
code, pre, .mono { font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; letter-spacing: 0; }
h1, h2, h3, .brand, .stat { letter-spacing: -.022em; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 246px 1fr; min-height: 100vh; }
.sidebar { border-right: 1px solid var(--border); background: var(--panel); padding: 20px 14px; display: flex; flex-direction: column; gap: 3px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 12px 20px; font-weight: 600; font-size: 17.5px; }
.brand .logo-mark { width: 30px; height: 30px; display: block; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-radius: 999px; color: var(--text-2); font-weight: 500; font-size: 13.5px; border: none; background: none; width: 100%; text-align: left; transition: background .12s, color .12s; }
.nav-item svg { width: 17px; height: 17px; flex: none; }
.nav-item:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--grad); color: #fff; font-weight: 600; box-shadow: 0 4px 14px rgba(230,46,4,.28); }
.sidebar .spacer { flex: 1; }
.main { min-width: 0; padding: 28px 32px 64px; max-width: 1180px; width: 100%; margin: 0 auto; }
.topbar { display: none; }

.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; font-weight: 600; }
.page-head .sub { color: var(--text-2); font-size: 13.5px; margin-top: 2px; letter-spacing: 0; }

/* ---------- components ---------- */
.grid > * { min-width: 0; }
.grid { display: grid; gap: 16px; }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); transition: border-color .15s; }
.card h3 { font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
.stat { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat-sub { color: var(--text-3); font-size: 12.5px; margin-top: 2px; letter-spacing: 0; }

.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--border); background: var(--panel); color: var(--text); border-radius: 12px; padding: 9px 16px; font-weight: 500; transition: background .15s, border-color .15s, transform .1s, box-shadow .15s; }
.btn:hover { background: var(--panel-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--grad); border: none; color: #fff; font-weight: 600; box-shadow: 0 4px 14px rgba(230,46,4,.3), inset 0 1px 0 rgba(255,255,255,.2); }
.btn.primary:hover { filter: brightness(1.06); background: var(--grad); }
.btn.danger { color: var(--red); }
.btn.sm { padding: 5px 11px; font-size: 13px; border-radius: 10px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; padding: 8px 12px; border-bottom: 1px solid var(--border); }
td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background .1s; }
tbody tr.clickable:hover, .table-card tbody tr:hover { background: var(--panel-2); cursor: pointer; }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.pill.ok { background: var(--green-soft); color: var(--green); }
.pill.err { background: var(--red-soft); color: var(--red); }
.pill.warn { background: var(--amber-soft); color: var(--amber); }
.pill.dim { background: var(--panel-2); color: var(--text-2); border: 1px solid var(--border); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; color: var(--text-2); }

.banner { border-radius: 12px; padding: 12px 14px; font-size: 13.5px; margin-bottom: 16px; letter-spacing: 0; }
.banner.err { background: var(--red-soft); color: var(--red); }
.banner.ok { background: var(--green-soft); color: var(--green); }
.banner.warn { background: var(--amber-soft); color: var(--amber); }

.codeblock { background: #131A22; border: 1px solid #232F3E; color: #D6DEE8; border-radius: 14px; padding: 16px; overflow-x: auto; position: relative; }
.codeblock pre { white-space: pre; }
.codeblock .copy { position: absolute; top: 8px; right: 8px; }
.codeblock .copy.btn { background: #232F3E; border-color: #37475A; color: #F7F8FA; }
[data-theme="dark"] .codeblock { background: #0F161D; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(19,26,34,.5); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--panel); border: 1px solid var(--border); border-radius: 18px; padding: 22px; width: 100%; max-width: 460px; box-shadow: var(--shadow); }
.modal h2 { font-size: 17px; margin-bottom: 12px; }

.drawer-backdrop { position: fixed; inset: 0; background: rgba(19,26,34,.4); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(480px, 94vw); background: var(--panel); border-left: 1px solid var(--border); z-index: 41; padding: 22px; overflow-y: auto; }
.drawer h2 { font-size: 16px; margin-bottom: 14px; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 14px; font-size: 13.5px; }
.kv dt { color: var(--text-3); } .kv dd { word-break: break-word; }

.empty { text-align: center; padding: 48px 16px; color: var(--text-2); }
.empty .icon { font-size: 28px; margin-bottom: 8px; }
.empty.small { padding: 30px 16px; font-size: 13px; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--accent-2); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; vertical-align: -4px; }
@keyframes spin { to { transform: rotate(360deg); } }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab { border: none; background: none; padding: 8px 12px; color: var(--text-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.active { color: var(--accent-text); border-bottom-color: var(--accent-2); }

/* ---------- auth ---------- */
.auth-wrap { padding: 0; display: block; background: var(--bg); }
.auth-split { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; }
.auth-hero {
  position: relative; overflow: hidden; color: #E8EDF4; padding: 56px 60px;
  display: flex; flex-direction: column; justify-content: space-between;
  background:
    radial-gradient(900px 520px at 88% -12%, rgba(255,106,0,.32), transparent 60%),
    radial-gradient(720px 520px at -12% 108%, rgba(230,46,4,.3), transparent 55%),
    linear-gradient(160deg, #1B2530 0%, #131A22 70%);
}
.auth-hero::after {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.12) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: radial-gradient(700px 420px at 70% 20%, black, transparent 75%);
  pointer-events: none;
}
.auth-hero .brand { color: #fff; padding: 0; position: relative; z-index: 1; }
.auth-hero h1 { font-size: 33px; line-height: 1.2; font-weight: 600; color: #fff; max-width: 480px; margin: 0 0 18px; position: relative; z-index: 1; }
.auth-hero p { color: #A9B4C0; font-size: 15px; max-width: 440px; margin-bottom: 26px; position: relative; z-index: 1; }
.auth-hero ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; position: relative; z-index: 1; }
.auth-hero li { color: #D6DEE8; font-size: 13.5px; font-weight: 500; display: flex; gap: 10px; align-items: center; }
.auth-hero li::before { content: ""; width: 7px; height: 7px; border-radius: 2.5px; background: var(--grad); flex: none; }
.auth-hero .hero-foot { color: #6E7B88; font-size: 12.5px; position: relative; z-index: 1; }
.auth-side { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card > .brand { justify-content: center; padding-bottom: 20px; }
.auth-card .foot { text-align: center; margin-top: 16px; font-size: 13.5px; color: var(--text-2); }

/* ---------- docs ---------- */
.doc-section { margin-bottom: 34px; }
.doc-section h2 { font-size: 17px; margin-bottom: 10px; }
.doc-section h4 { font-size: 14px; margin: 16px 0 6px; }
.doc-section p, .doc-section li { color: var(--text-2); }
.doc-section ul { padding-left: 20px; }
.method { font-weight: 700; font-size: 12px; padding: 2px 7px; border-radius: 6px; margin-right: 8px; }
.method.get { background: var(--green-soft); color: var(--green); }
.method.post { background: var(--accent-soft); color: var(--accent-text); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .grid.cols-3 { grid-template-columns: 1fr; }
  .grid.cols-2 { grid-template-columns: 1fr; }
  .auth-split { grid-template-columns: 1fr; }
  .auth-hero { padding: 28px 24px 30px; }
  .auth-hero h1 { font-size: 24px; }
  .auth-hero p, .auth-hero ul { display: none; }
}
@media (max-width: 720px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; bottom: 0; top: auto; left: 0; right: 0; height: auto; flex-direction: row; overflow-x: auto; padding: 8px; border-right: none; border-top: 1px solid var(--border); z-index: 30; gap: 2px; }
  .sidebar .brand, .sidebar .spacer, .sidebar .nav-item .label { display: none; }
  .nav-item { width: auto; padding: 9px 12px; }
  .main { padding: 18px 16px 96px; }
  .topbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--panel); position: sticky; top: 0; z-index: 20; }
  th:nth-child(n+5), td:nth-child(n+5) { display: none; }
  th, td { padding: 8px 8px; }
  table { font-size: 12.5px; }
  th { font-size: 11px; }
  .pg-grid { grid-template-columns: 1fr !important; }
}
canvas { max-width: 100% !important; }
.chart-wrap { min-width: 0; overflow: hidden; }
.chart-box { position: relative; height: 230px; }

/* admin centered auth (app.js auth screens carry their own inline centering) */
.auth-wrap:has(> .auth-card) { display: grid; place-items: center; min-height: 100vh; padding: 20px; }

/* ---------- oauth sign-in buttons ---------- */
.oauth-row { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.btn.oauth { width: 100%; justify-content: center; gap: 10px; background: var(--card); border: 1px solid var(--border); color: var(--text); font-weight: 500; padding: 11px 16px; }
.btn.oauth:hover { border-color: var(--text-3); background: var(--card); color: var(--text); }
.btn.oauth svg { width: 18px; height: 18px; flex: none; }
.auth-divider { display: flex; align-items: center; gap: 12px; color: var(--text-3); font-size: 12px; margin: 0 0 16px; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
