/* otto360 dashboard. Hand-written, no build step. */
:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --text: #1c2230;
  --muted: #667085;
  --faint: #98a2b3;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --accent: #3b4fd8;
  --accent-hover: #2f40b8;
  --accent-soft: #eef0fd;
  --danger: #c43c3c;
  --danger-hover: #a52f2f;
  --sidebar: #141a26;
  --sidebar-text: #c2c8d4;
  --sidebar-active: #ffffff;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
  --green-bg: #e7f6ec; --green-fg: #146c34;
  --amber-bg: #fdf3dc; --amber-fg: #8a5a00;
  --red-bg: #fdecec;   --red-fg: #a52f2f;
  --blue-bg: #e8efff;  --blue-fg: #2742a8;
  --slate-bg: #eef0f3; --slate-fg: #475467;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 20px; font-weight: 650; }
h2 { font-size: 15px; font-weight: 650; }
h3 { font-size: 13px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
pre { font-family: var(--mono); font-size: 12px; background: #0f1420; color: #d6deeb; padding: 12px;
      border-radius: var(--radius); overflow: auto; max-height: 420px; margin: 0; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }

/* ---- shell ---- */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--sidebar); color: var(--sidebar-text); padding: 18px 12px; position: sticky; top: 0;
           height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 8px; color: #fff; font-weight: 700; font-size: 17px;
         padding: 4px 10px 18px; letter-spacing: -.01em; }
.brand-dot { width: 10px; height: 10px; border-radius: 50%; background: #6f80ff; box-shadow: 0 0 0 3px rgba(111,128,255,.25); }
.nav-section { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #6b7384; padding: 14px 10px 6px; }
.nav-link { display: flex; align-items: center; justify-content: space-between; padding: 7px 10px; border-radius: 6px;
            color: var(--sidebar-text); font-weight: 500; }
.nav-link:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav-active { background: rgba(111,128,255,.18); color: var(--sidebar-active); }
.nav-count { background: #d98e04; color: #fff; font-size: 11px; font-weight: 700; border-radius: 10px; padding: 0 7px; }
.main { min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 24px;
          background: var(--panel); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.topbar-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-user { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.content { padding: 22px 24px 48px; max-width: 1400px; }
.topbar .nav-toggle { display: none; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; position: fixed; inset: 0 auto 0 0; width: 250px; z-index: 30; }
  .sidebar.sidebar-open { display: block; }
  .topbar .nav-toggle { display: inline-flex; }
  .content { padding: 16px; }
  .topbar { padding: 12px 16px; }
  .hide-sm { display: none; }
}

/* ---- layout helpers ---- */
.stack > * + * { margin-top: 16px; }
.stack-sm > * + * { margin-top: 8px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.between { justify-content: space-between; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-side { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-side { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.strong { font-weight: 600; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }
.mt-sm { margin-top: 8px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }

/* ---- cards ---- */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px;
               border-bottom: 1px solid var(--border); }
.card-body { padding: 16px; }
.card-flush { overflow-x: auto; }
.stat { padding: 14px 16px; }
.stat-label { color: var(--muted); font-size: 12.5px; }
.stat-value { font-size: 22px; font-weight: 650; margin-top: 2px; letter-spacing: -.01em; }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat-warn .stat-value { color: var(--amber-fg); }
.stat-bad .stat-value { color: var(--red-fg); }
.empty { padding: 20px 16px; color: var(--muted); text-align: center; }

/* ---- tables ---- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 8px 12px;
            border-bottom: 1px solid var(--border); background: #fafbfc; white-space: nowrap; }
.table td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fafbff; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---- key/value lists ---- */
.kv { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 6px 12px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* ---- badges ---- */
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600;
         text-transform: capitalize; white-space: nowrap; }
.badge-green { background: var(--green-bg); color: var(--green-fg); }
.badge-amber { background: var(--amber-bg); color: var(--amber-fg); }
.badge-red { background: var(--red-bg); color: var(--red-fg); }
.badge-blue { background: var(--blue-bg); color: var(--blue-fg); }
.badge-slate { background: var(--slate-bg); color: var(--slate-fg); }

/* ---- buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 12px;
       border-radius: 6px; border: 1px solid var(--border-strong); background: var(--panel); color: var(--text);
       font: inherit; font-weight: 550; cursor: pointer; white-space: nowrap; line-height: 1.2; }
.btn:hover { background: #f4f5f7; text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-sm { padding: 4px 9px; font-size: 12.5px; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-group { display: flex; flex-wrap: wrap; gap: 6px; }
.link-button { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; }

/* ---- forms ---- */
.input, .select, .textarea { width: 100%; padding: 7px 10px; border: 1px solid var(--border-strong); border-radius: 6px;
                              font: inherit; background: #fff; color: var(--text); }
.input:focus, .select:focus, .textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.textarea { font-family: var(--mono); font-size: 12.5px; }
.checkbox { width: 16px; height: 16px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-weight: 550; margin-bottom: 4px; }
.field .help { color: var(--muted); font-size: 12px; margin-top: 3px; }
.field .error, .form-error { color: var(--red-fg); font-size: 12.5px; margin-top: 3px; }
.form-error { background: var(--red-bg); padding: 8px 10px; border-radius: 6px; margin-bottom: 12px; }
.field-check { display: flex; align-items: center; gap: 8px; }
.field-check label { margin: 0; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.filters .input, .filters .select { width: auto; min-width: 150px; }
.filters .grow { flex: 1 1 240px; }

/* ---- alerts ---- */
.alert { padding: 10px 14px; border-radius: var(--radius); border: 1px solid; margin-bottom: 12px; }
.alert-success { background: var(--green-bg); color: var(--green-fg); border-color: #bfe5cb; }
.alert-info { background: var(--blue-bg); color: var(--blue-fg); border-color: #c9d6fb; }
.alert-warning { background: var(--amber-bg); color: var(--amber-fg); border-color: #f1dca8; }
.alert-error { background: var(--red-bg); color: var(--red-fg); border-color: #f2c6c6; }
.key-box { display: flex; gap: 8px; align-items: center; padding: 10px 12px; background: #0f1420; color: #e7ecf5;
           border-radius: var(--radius); font-family: var(--mono); font-size: 13px; overflow-wrap: anywhere; }
.key-box code { flex: 1; min-width: 0; }

/* ---- modal ---- */
.modal { border: 0; border-radius: 10px; padding: 0; background: var(--panel); color: var(--text); width: min(560px, 94vw); box-shadow: 0 20px 50px rgba(16,24,40,.25); }
.modal::backdrop { background: rgba(16, 24, 40, .45); }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px;
                border-bottom: 1px solid var(--border); }
.modal-body { padding: 18px; max-height: 70vh; overflow-y: auto; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border);
                background: #fafbfc; border-radius: 0 0 10px 10px; }
.modal-wide { width: min(860px, 96vw); }

/* ---- timeline ---- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 12px; padding: 9px 16px;
               border-bottom: 1px solid var(--border); }
.timeline li:last-child { border-bottom: 0; }
.timeline time { color: var(--muted); font-size: 12.5px; }

/* ---- pagination ---- */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 16px;
              border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }

/* ---- login ---- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(380px, 100%); }

.htmx-request.htmx-indicator, .htmx-request .htmx-indicator { opacity: 1; }
.htmx-indicator { opacity: 0; transition: opacity .2s; }
