/* SCANOSS tenant dashboard — self-contained styles (no external fonts/CDN). */
/* Space Grotesk — the official SCANOSS brand typeface (self-hosted variable
   font, no external CDN). Used for all text per the SCANOSS design system. */
@font-face {
  font-family: "Space Grotesk";
  src: url("fonts/SpaceGrotesk.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

/* SCANOSS design-system theme (light; brand indigo #6366F1 -> violet #863DFF).
   Values from the official design system tokens (colors/typography/effects). */
:root {
  --bg: #F8FAFC;            /* app canvas (slate-50) */
  --bg-elev: #FFFFFF;       /* cards / surface-card */
  --bg-elev-2: #EFF4F8;     /* inputs, subtle raised (slate-100) */
  --border: #E2E8F0;        /* hairline borders on light (slate-200) */
  --border-strong: #CBD5E1;
  --text: #1E293B;          /* scanoss-dark (headings/strong) */
  --text-dim: #475569;      /* slate-600 */
  --text-faint: #64748B;    /* slate-500 */
  --accent: #6366F1;        /* scanoss-blue (primary) */
  --accent-hover: #863DFF;  /* scanoss-violet (brand link-hover) */
  --accent-soft: rgba(99, 102, 241, 0.10);
  --green: #1FA25C;         /* status-ok */
  --green-soft: rgba(31, 162, 92, 0.12);
  --amber: #FFAC0A;         /* signal-amber / warn */
  --amber-soft: rgba(255, 172, 10, 0.14);
  --red: #FF4B23;           /* signal-orange / risk */
  --red-soft: rgba(255, 75, 35, 0.12);
  --purple: #863DFF;        /* violet (brand gradient partner) */
  --purple-soft: rgba(134, 61, 255, 0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 6px 18px rgba(6, 23, 47, 0.08);  /* soft, cool card shadow */
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: "Space Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Layout */
.app { display: flex; flex-direction: column; min-height: 100vh; }

header.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px; height: 60px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; font-weight: 600; letter-spacing: -0.01em; }
.brand .logo {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  display: grid; place-items: center; font-weight: 800; color: white; font-size: 15px;
}
.brand .logo img { width: 20px; height: 20px; display: block; }
.brand .sub { color: var(--text-faint); font-weight: 400; font-size: 12px; }
.topbar .spacer { flex: 1; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  border: 1px solid var(--border-strong);
  background: var(--bg-elev-2); color: var(--text-dim);
}
.badge.dry { color: var(--amber); border-color: rgba(255,172,10,0.4); background: var(--amber-soft); }
.badge.live { color: var(--green); border-color: rgba(31,162,92,0.4); background: var(--green-soft); }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.user-chip { display: flex; align-items: center; gap: 8px; color: var(--text-dim); font-size: 13px; }
.user-chip .avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-weight: 700; font-size: 12px;
}

main { flex: 1; padding: 28px 24px; max-width: 1240px; width: 100%; margin: 0 auto; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 20px; gap: 16px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 22px; letter-spacing: -0.02em; }
.page-head p { margin: 4px 0 0; color: var(--text-dim); font-size: 13px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--bg-elev-2); color: var(--text);
  transition: all 0.14s ease;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--red); border-color: rgba(255,75,35,0.4); }
.btn.danger:hover { background: var(--red-soft); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn.ghost:hover { background: var(--bg-elev-2); color: var(--text); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.small { padding: 6px 11px; font-size: 12px; }

/* Cards / table */
.card { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }

table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-faint); font-weight: 600; padding: 12px 16px;
  border-bottom: 1px solid var(--border); background: var(--bg-elev-2);
}
tbody td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.12s ease; }
tbody tr:hover { background: var(--bg-elev-2); }
.t-name { font-weight: 600; }
.t-name .ns { color: var(--text-faint); font-weight: 400; font-size: 12px; }

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
}
.pill.dedicated { background: var(--purple-soft); color: var(--purple); }
.pill.shared { background: var(--accent-soft); color: var(--accent); }
.pill.eval { background: var(--amber-soft); color: var(--amber); }
.pill.ok { background: var(--green-soft); color: var(--green); }
.pill.warn { background: var(--amber-soft); color: var(--amber); }
.pill.muted { background: var(--bg-elev-2); color: var(--text-faint); }

.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

.empty { padding: 60px 20px; text-align: center; color: var(--text-dim); }
.empty .big { font-size: 40px; margin-bottom: 10px; }

/* Drawer / modal */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55);
  backdrop-filter: blur(2px); z-index: 40;
  display: none; opacity: 0; transition: opacity 0.16s ease;
}
.overlay.open { display: block; opacity: 1; }

.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: min(720px, 100vw);
  background: var(--bg-elev); border-left: 1px solid var(--border); z-index: 50;
  box-shadow: var(--shadow); transform: translateX(100%);
  transition: transform 0.22s cubic-bezier(0.4,0,0.2,1);
  display: flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--border);
}
.drawer-head h2 { margin: 0; font-size: 17px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 22px; }
.drawer-foot {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 16px 22px; border-top: 1px solid var(--border); background: var(--bg-elev-2);
}

/* Form */
.field { margin-bottom: 16px; }
.field > label { display: block; font-size: 12px; font-weight: 600; color: var(--text-dim); margin-bottom: 6px; }
.field .hint { font-size: 11.5px; color: var(--text-faint); margin-top: 4px; }
input[type=text], input[type=number], select, textarea {
  width: 100%; padding: 9px 12px; font-size: 13px; font-family: var(--sans);
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  transition: border-color 0.14s ease;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
input::placeholder { color: var(--text-faint); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

.section {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 16px; margin-bottom: 16px; background: var(--bg-elev-2);
}
.section h3 { margin: 0 0 12px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); }

.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 3px; }
.seg button {
  border: none; background: transparent; color: var(--text-dim);
  padding: 7px 16px; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 600;
}
.seg button.active { background: var(--accent); color: #fff; }

.rowlist .rl-item { display: grid; gap: 8px; align-items: center; margin-bottom: 8px; }
.rl-endpoint { grid-template-columns: 1fr 90px 90px 90px 34px; }
.rl-key { grid-template-columns: 1fr 2fr 34px; }
.rl-ip { grid-template-columns: 1fr 34px; }
.rl-head { font-size: 11px; color: var(--text-faint); font-weight: 600; }
.icon-btn {
  width: 34px; height: 34px; display: grid; place-items: center;
  border: 1px solid var(--border-strong); background: var(--bg); color: var(--text-dim);
  border-radius: var(--radius-sm); cursor: pointer; font-size: 16px;
}
.icon-btn:hover { color: var(--red); border-color: var(--red); }
.toggle-line { display: flex; align-items: center; gap: 8px; }
.toggle-line input { width: auto; }

/* Preview / code */
.preview-tabs { display: flex; gap: 4px; margin-bottom: 10px; }
.preview-tabs button {
  border: none; background: transparent; color: var(--text-dim); cursor: pointer;
  padding: 6px 12px; border-radius: 6px; font-size: 12.5px; font-weight: 600;
}
.preview-tabs button.active { background: var(--accent-soft); color: var(--accent); }
pre.code {
  margin: 0; padding: 14px 16px; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-family: var(--mono); font-size: 12px;
  overflow-x: auto; white-space: pre; max-height: 340px; overflow-y: auto; color: var(--text);
}
pre.code .add { color: var(--green); }
pre.code .del { color: var(--red); }
pre.code .hunk { color: var(--accent); }
pre.code .meta { color: var(--text-faint); }

.notice { padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 14px; }
.notice.err { background: var(--red-soft); color: var(--red); border: 1px solid rgba(255,75,35,0.3); }
.notice.info { background: var(--accent-soft); color: var(--accent-hover); border: 1px solid rgba(99,102,241,0.3); }

/* Success modal */
.modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -48%);
  width: min(680px, 94vw); background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); z-index: 60;
  display: none; max-height: 88vh; flex-direction: column; overflow: hidden;
}
.modal.open { display: flex; }
.modal-head { padding: 22px 24px 10px; }
.modal-head .ok-icon {
  width: 44px; height: 44px; border-radius: 50%; background: var(--green-soft); color: var(--green);
  display: grid; place-items: center; font-size: 22px; margin-bottom: 12px;
}
.modal-head h2 { margin: 0 0 4px; font-size: 18px; }
.modal-head p { margin: 0; color: var(--text-dim); font-size: 13px; }
.modal-body { padding: 6px 24px 20px; overflow-y: auto; }
.modal-foot { padding: 14px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.kv { display: flex; gap: 10px; font-size: 13px; margin: 6px 0; }
.kv .k { color: var(--text-faint); min-width: 110px; }
.kv .v { color: var(--text); font-family: var(--mono); font-size: 12px; word-break: break-all; }

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

.loading-wrap { display: grid; place-items: center; padding: 80px 0; color: var(--text-dim); }

.filters { display: flex; gap: 8px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.filters input { max-width: 260px; }

@media (max-width: 640px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .rl-endpoint { grid-template-columns: 1fr; }
  main { padding: 18px 14px; }
  header.topbar { padding: 0 14px; }
  .brand .sub { display: none; }
}

/* The SCANOSS theme is light by default (brand identity); no OS-preference
   override — the palette above is the single source of truth. */
