/* i2G Protect Control Panel. Colours follow the i2G Protect ITSM app: a dark slate page with darker panels and the
   sky accent. */
:root {
  color-scheme: dark;
  --page: #393e48;
  --panel: #262a31;
  --panel-deep: #1f2228;
  --line: #1a1d22;
  --line-strong: #111317;
  --chip: #3a3f4a;
  --text: #e6e8ec;
  --text-soft: #c3c8d1;
  --muted: #abb2bf;
  --accent: #61afef;
  --accent-strong: #568af2;
  --accent-ink: #0f1a24;
  --ok: #98c379;
  --ok-bg: rgba(152, 195, 121, 0.14);
  --warn: #e5c07b;
  --warn-bg: rgba(229, 192, 123, 0.14);
  --bad: #e06c75;
  --bad-bg: rgba(224, 108, 117, 0.14);
  --info: #61afef;
  --info-bg: rgba(97, 175, 239, 0.14);
  --radius: 14px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--page);
  color: var(--text);
  font: 15px/1.5 var(--font);
  min-height: 100vh;
}
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* Brand */
.brand { display: inline-flex; align-items: center; gap: 10px; user-select: none; }
.brand-logo {
  height: 36px; width: auto;
  filter: brightness(1.1) drop-shadow(0 0 1px rgba(215, 218, 224, 0.85)) drop-shadow(0 0 10px rgba(97, 175, 239, 0.25));
}
.brand-logo-lg { height: 56px; }
.brand-text {
  display: flex; flex-direction: column; justify-content: center; line-height: 1;
  padding-left: 10px; border-left: 1px solid var(--line-strong); font-family: var(--mono);
}
.brand-product { color: var(--accent); font-weight: 800; letter-spacing: 0.16em; font-size: 12px; }
.brand-sub { color: var(--muted); letter-spacing: 0.12em; font-size: 10px; margin-top: 3px; white-space: nowrap; }
.brand-stacked { justify-content: center; }

/* Buttons and inputs */
.button {
  font: inherit; font-weight: 600; font-size: 14px; white-space: nowrap;
  border-radius: 10px; padding: 8px 16px; cursor: pointer;
  border: 1px solid transparent; transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}
.button:disabled { opacity: 0.6; cursor: progress; }
.button:focus-visible, .input:focus-visible, .field input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.button-primary { background: var(--accent); color: var(--accent-ink); }
.button-primary:hover:not(:disabled) { background: #7fbff3; }
.button-ghost { background: var(--chip); color: var(--text); border-color: var(--line); }
.button-ghost:hover:not(:disabled) { border-color: var(--line-strong); background: #424854; }
.button-block { width: 100%; padding: 11px 16px; }
.input, .field input {
  font: inherit; color: var(--text); background: var(--panel-deep);
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; min-width: 0;
}
.input::placeholder { color: var(--muted); }

.notice { border-radius: 10px; padding: 10px 12px; font-size: 13px; border: 1px solid; margin: 0 0 16px; }
.notice-bad { background: var(--bad-bg); border-color: rgba(224, 108, 117, 0.45); color: #f2b8bd; }
.notice-info { background: var(--info-bg); border-color: rgba(97, 175, 239, 0.45); color: #c0dff9; }

/* Sign-in */
.login-page { display: flex; align-items: center; justify-content: center; padding: 32px 16px; }
.login-card {
  width: 100%; max-width: 420px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 24px; padding: 32px 28px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}
.login-title { font-size: 20px; text-align: center; margin: 20px 0 4px; }
.login-lede { text-align: center; color: var(--muted); margin: 0 0 20px; font-size: 14px; }
.login-form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-soft); }
.field input { padding: 10px 12px; font-size: 15px; font-weight: 400; }
.login-foot { color: var(--muted); font-size: 12px; text-align: center; margin: 18px 0 0; }

/* Control panel */
.topbar {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 24px; background: var(--panel-deep); border-bottom: 1px solid var(--line-strong);
}
.user { display: flex; align-items: center; gap: 14px; min-width: 0; }
.user-text { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; min-width: 0; }
.user-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
.user-profile { color: var(--muted); font-size: 12px; }

.page { max-width: 1200px; margin: 0 auto; padding: 28px 24px 64px; }
.page-title { font-size: 22px; margin: 0; }
.page-lede { color: var(--muted); margin: 4px 0 20px; }

.function-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.card {
  display: flex; flex-direction: column; gap: 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px;
}
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.card-title { margin: 0; font-size: 16px; }
.card-text { margin: 0; color: var(--text-soft); font-size: 14px; flex: 1; }
.card-actions { display: flex; justify-content: flex-end; }

.tag, .badge {
  display: inline-block; white-space: nowrap; font-size: 11px; font-weight: 700;
  padding: 3px 8px; border-radius: 999px; letter-spacing: 0.02em;
}
.tag-info, .badge-info { background: var(--info-bg); color: var(--info); }
.tag-warn, .badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-bad { background: var(--bad-bg); color: var(--bad); }

.result {
  margin-top: 28px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; scroll-margin-top: 80px;
}
.result-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
.result-title { margin: 0; font-size: 18px; }
.result-meta { margin: 0; }
.result-summary { font-size: 15px; margin: 4px 0 16px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat {
  display: flex; flex-direction: column; gap: 2px; padding: 14px 16px;
  background: var(--panel-deep); border: 1px solid var(--line); border-radius: 12px; border-left-width: 4px;
}
.stat-value { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-label { color: var(--muted); font-size: 13px; }
.stat-ok { border-left-color: var(--ok); }
.stat-warn { border-left-color: var(--warn); }
.stat-bad { border-left-color: var(--bad); }
.stat-info { border-left-color: var(--info); }

.table-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
.table-tools input[type="search"] { flex: 1 1 220px; }
.table-count { margin-left: auto; }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th {
  position: sticky; top: 0; background: var(--panel-deep); color: var(--muted);
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap;
}
.table tbody tr:nth-child(even) { background: rgba(255, 255, 255, 0.02); }
.table tbody tr:hover { background: rgba(97, 175, 239, 0.06); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 13px; }
.table .empty { text-align: center; padding: 24px; }

.spinner {
  width: 28px; height: 28px; margin: 24px auto; border-radius: 50%;
  border: 3px solid var(--chip); border-top-color: var(--accent); animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

@media (max-width: 640px) {
  .topbar { padding: 10px 16px; }
  .brand-logo { height: 28px; }
  .user-profile { display: none; }
  .page { padding: 20px 16px 48px; }
  .function-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .user-name { max-width: 30vw; }
  .result { padding: 16px; }
  .table-count { margin-left: 0; }
}
