/* ==========================================================================
   Apheris vulnerability dashboard - styles
   Same look as the Apheris inventory app (tokens from the Apheris master deck):
   dark teal dominant, accent teal for highlights, coral/orange/amber ONLY for
   severities and warnings, sentence-case titles, Univers -> Inter.
   ========================================================================== */

@font-face { font-family: "Univers"; src: local("Univers"), local("Univers-Regular"), local("UniversLTStd"); font-weight: 400; }
@font-face { font-family: "Univers"; src: local("Univers Bold"), local("Univers-Bold"), local("UniversLTStd-Bold"); font-weight: 700; }
@font-face { font-family: "Univers Light"; src: local("Univers Light"), local("Univers-Light"), local("UniversLTStd-Light"); font-weight: 300; }

:root {
  --dark: #20484D;          /* primary */
  --darkest: #1C423F;       /* gradient end */
  --teal: #429099;          /* accent teal */
  --teal-pale: #CEE7EA;
  --fog: #E9ECEC;           /* off-white */
  --grey-fill: #F2F2F2;
  --border: #DADEDE;
  --text: #000000;
  --muted: var(--text);     /* secondary text is black too, just smaller */
  --coral: #E84661;         /* warnings / critical only */
  --orange: #F26B43;
  --amber: #E0A100;
  --white: #FFFFFF;

  --shadow: 2px 2px 4px rgba(32, 72, 77, 0.20);
  --radius: 8px;
  --font-head: "Univers", "Inter", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Univers Light", "Inter", "Helvetica Neue", Arial, sans-serif;
  --sidebar-w: 248px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--teal); text-decoration: none; }
a:hover { color: var(--dark); }
h1, h2, h3 { font-family: var(--font-head); color: var(--dark); font-weight: 500; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 28px; line-height: 1.2; }
h2 { font-size: 16px; }
.material-symbols-outlined { font-variation-settings: "FILL" 0, "wght" 300, "GRAD" 0, "opsz" 24; font-size: 20px; line-height: 1; vertical-align: middle; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }

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

.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--dark) 0%, var(--darkest) 100%);
  color: var(--white); display: flex; flex-direction: column;
  padding: 28px 16px 20px; overflow: hidden; z-index: 20;
}
.sidebar::after { /* brand sunburst, bleeding off the bottom-left */
  content: ""; position: absolute; width: 520px; height: 520px; left: -260px; bottom: -300px;
  background: url("brand/decor-1.svg") center / contain no-repeat;
  filter: invert(1); opacity: 0.10; pointer-events: none;
}
.brand { display: block; padding: 0 12px 28px; }
.brand img { width: 120px; height: 19px; display: block; }
.brand span { display: block; margin-top: 6px; font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--white); }

.nav { list-style: none; margin: 0; padding: 0; position: relative; z-index: 1; }
.nav-label { font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--white); padding: 18px 12px 6px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 6px;
  color: var(--white); font-family: var(--font-head); font-size: 14px; position: relative;
}
.nav a:hover { background: rgba(255,255,255,0.06); color: var(--white); }
.nav a.active { background: rgba(255,255,255,0.10); color: var(--white); }
.nav a.active::before { content: ""; position: absolute; left: -16px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--teal); }
.nav .count { margin-left: auto; font-size: 11.5px; color: var(--white); font-family: var(--font-body); }
.sidebar-foot { margin-top: auto; padding: 12px; font-size: 11.5px; color: var(--white); position: relative; z-index: 1; }

.main { margin-left: var(--sidebar-w); flex: 1; min-width: 0; }
.main.no-sidebar { margin-left: 0; }
.topbar {
  position: sticky; top: 0; z-index: 10; background: rgba(255,255,255,0.92); backdrop-filter: blur(6px);
  display: flex; align-items: center; gap: 16px; padding: 14px 40px; border-bottom: 1px solid var(--fog);
  min-height: 63px;
}
.topbar .spacer { flex: 1; }
.content { padding: 32px 40px 64px; position: relative; }

/* ---------- Page header (deck-style rule with teal end dot) ------------- */
.page-head { display: flex; align-items: flex-end; gap: 24px; margin-bottom: 8px; }
.page-head .titles { flex: 1; min-width: 0; }
.kicker { font-size: 11px; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; color: var(--teal); margin-bottom: 8px; font-family: var(--font-head); }
.subtitle { margin-top: 6px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.header-rule { position: relative; height: 1px; background: var(--border); margin: 18px 0 28px; }
.header-rule::after { content: ""; position: absolute; right: 0; top: -2.5px; width: 6px; height: 6px; border-radius: 50%; background: var(--teal); }

.decor-rings { position: absolute; right: -180px; top: -120px; width: 520px; height: 520px; opacity: 0.14; pointer-events: none; z-index: 0; }
.content > *:not(.decor-rings) { position: relative; z-index: 1; }

/* ---------- Cards & grid ------------------------------------------------ */
.grid { display: grid; gap: 24px; }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1280px) { .grid-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .grid-5 { grid-template-columns: 1fr 1fr; } }

.card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 24px; border: 1px solid rgba(32,72,77,0.05); }
.card.flat { box-shadow: none; background: var(--grey-fill); border-color: transparent; }
.card.dark { background: var(--dark); color: var(--white); box-shadow: none; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-head h2 { flex: 1; }
.card.pad-0 { padding: 0; }
.card.pad-0 .card-head { padding: 20px 24px 0; }
.section { margin-top: 24px; }

/* KPI */
.kpi { display: block; color: inherit; position: relative; overflow: hidden; }
.kpi .icon { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--fog); color: var(--dark); margin-bottom: 14px; }
.kpi .label { font-family: var(--font-head); color: var(--dark); font-size: 14px; display: flex; align-items: center; gap: 8px; }
.kpi .value { font-family: var(--font-head); font-size: 42px; font-weight: 300; color: var(--dark); line-height: 1.1; margin: 4px 0 0; letter-spacing: -0.02em; }
.kpi.dark .icon { background: rgba(255,255,255,0.12); color: var(--white); }
.kpi.dark .label, .kpi.dark .value { color: var(--white); }
.kpi .icon.sev-critical { background: #FCE4E8; color: #B92D45; }
.kpi .icon.sev-high     { background: #FDEBE3; color: #B5461F; }
.kpi .icon.sev-medium   { background: #FFF1CC; color: #7A5200; }
.kpi .icon.sev-low      { background: var(--grey-fill); color: var(--dark); }

/* ---------- Badges ------------------------------------------------------ */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 8px; border-radius: 999px; font-size: 12px; white-space: nowrap; font-family: var(--font-head); line-height: 1.6; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
/* Severity always comes as colour + label, never colour alone */
.sev-badge-critical { background: #FCE4E8; color: #B92D45; }
.sev-badge-high     { background: #FDEBE3; color: #B5461F; }
.sev-badge-medium   { background: #FFF1CC; color: #7A5200; }
.sev-badge-medium::before { background: var(--amber); }
.sev-badge-low      { background: var(--grey-fill); color: var(--dark); }
.tone-teal { background: var(--teal-pale); color: var(--dark); }
.tone-teal::before { background: var(--teal); }
.tone-dark { background: var(--dark); color: var(--white); }
.tone-dark::before { background: #7FD3DC; }
.tone-grey { background: var(--grey-fill); color: var(--muted); }
.tag { display: inline-block; padding: 1px 8px; border-radius: 4px; background: var(--fog); color: var(--dark); font-size: 12px; }

/* ---------- Notice ------------------------------------------------------ */
.notice { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: 6px; background: var(--teal-pale); color: var(--dark); font-size: 13px; margin-bottom: 24px; }
.notice .material-symbols-outlined { font-size: 18px; }

/* ---------- Buttons ----------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 16px; border-radius: 6px;
  font-family: var(--font-head); font-size: 13.5px; cursor: pointer; border: 1px solid var(--dark);
  background: var(--white); color: var(--dark); transition: background .15s, color .15s, border-color .15s; white-space: nowrap;
}
.btn:hover { background: var(--fog); color: var(--dark); }
.btn.primary { background: var(--dark); color: var(--white); }
.btn.primary:hover { background: var(--teal); border-color: var(--teal); color: var(--white); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--grey-fill); }
.btn.danger { border-color: var(--coral); color: #B92D45; }
.btn.danger:hover { background: #FCE4E8; }
.btn.sm { height: 30px; padding: 0 12px; font-size: 12.5px; }
.btn .material-symbols-outlined { font-size: 18px; }

/* ---------- Forms ------------------------------------------------------- */
input[type=text], input[type=email], select {
  width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--border); border-radius: 6px;
  font: inherit; color: var(--dark); background: var(--white); transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(66,144,153,0.18); }
label { display: block; font-family: var(--font-head); color: var(--dark); font-size: 13px; margin-bottom: 6px; }
.inline-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { margin: 0; }
.inline-form .field.grow { flex: 1 1 280px; max-width: 420px; }
.inline-form .field.role { width: 150px; }
form.inline { display: inline-flex; gap: 6px; margin: 0; }

.chip {
  height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--white);
  font: inherit; font-size: 12.5px; color: var(--text); cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.chip:hover { border-color: var(--teal); }
.chip.on { background: var(--dark); border-color: var(--dark); color: var(--white); }

/* ---------- Tables ------------------------------------------------------ */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th {
  text-align: left; font-family: var(--font-head); font-weight: 500; font-size: 12px; color: var(--dark);
  padding: 10px 14px; border-bottom: 1px solid var(--dark); white-space: nowrap;
}
table.data td { padding: 11px 14px; border-bottom: 1px solid var(--fog); vertical-align: middle; }
table.data tbody tr:hover td { background: #F5F8F8; }
table.data td.primary { color: var(--dark); font-family: var(--font-head); }
table.data td .sub { display: block; font-size: 12px; color: var(--muted); }
table.data td.right { text-align: right; }
.empty { padding: 48px 24px; text-align: center; color: var(--muted); }
.empty .material-symbols-outlined { font-size: 36px; color: var(--border); display: block; margin-bottom: 8px; }

.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--teal-pale); color: var(--dark); font-family: var(--font-head); font-size: 13px;
}
.avatar.sm { width: 30px; height: 30px; font-size: 12px; }
.person { display: flex; align-items: center; gap: 12px; }
.person .primary { display: block; color: var(--dark); font-family: var(--font-head); }
.table-note { margin: 0; padding: 14px 24px 18px; }

/* ---------- Signed-in user, role preview --------------------------------- */
.topbar .who { color: var(--text); display: flex; align-items: center; gap: 10px; }
.who-text { display: flex; flex-direction: column; line-height: 1.25; font-size: 12.5px; }
.who-text b { font-weight: 500; font-family: var(--font-head); color: var(--dark); }
.role-tag { font-size: 11px; }
.role-tag::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; }
.role-tag.role-admin::before { background: var(--dark); }
.role-tag.role-reader::before { background: var(--border); }
.role-switch { display: flex; align-items: center; gap: 6px; padding: 4px 6px 4px 12px; border-radius: 999px; background: var(--grey-fill); }
.role-switch .chip { height: 26px; padding: 0 10px; font-size: 12px; }

/* ---------- Flash toasts ------------------------------------------------ */
.flashes { position: fixed; top: 16px; right: 24px; z-index: 50; display: grid; gap: 8px; max-width: 420px; }
.flash {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 6px; background: var(--dark); color: var(--white);
  box-shadow: 0 6px 24px rgba(32,72,77,0.25); font-size: 13.5px; animation: slide-in .25s ease;
}
.flash.error { background: var(--white); color: #B92D45; border: 1px solid var(--coral); }
.flash button { margin-left: auto; background: none; border: 0; color: inherit; opacity: .6; cursor: pointer; padding: 0; }
@keyframes slide-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.fade-up { animation: fade-up .45s ease backwards; }
.fade-up.d1 { animation-delay: .05s; } .fade-up.d2 { animation-delay: .1s; } .fade-up.d3 { animation-delay: .15s; } .fade-up.d4 { animation-delay: .2s; } .fade-up.d5 { animation-delay: .25s; }
@keyframes fade-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .fade-up, .flash { animation: none; } }

/* ---------- Sign-in / error page (deck cover style) ---------------------- */
.login-page { min-height: 100vh; margin: 0; display: grid; place-items: center; background: var(--darkest); position: relative; overflow: hidden; }
.login-hero { position: absolute; inset: 0; background: url("brand/cover.jpg") center / cover no-repeat; }
.login-hero::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(120deg, rgba(28,66,63,0.92) 0%, rgba(32,72,77,0.65) 55%, rgba(32,72,77,0.85) 100%); }
.login-box { position: relative; z-index: 1; width: min(460px, 92vw); color: var(--white); padding: 40px; }
.login-box img { width: 150px; height: 24px; display: block; }
.login-kicker { margin: 10px 0 36px; font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--white); }
.login-box h1 { color: var(--white); font-size: 34px; font-weight: 400; margin-bottom: 10px; }
.login-box p { color: var(--white); margin: 0 0 28px; font-size: 15px; }
.login-box .login-small { font-size: 12.5px; margin-top: 16px; }
.ms-btn { display: inline-flex; align-items: center; gap: 12px; height: 46px; padding: 0 20px; background: var(--white); color: #000;
  border-radius: 6px; font-family: var(--font-head); font-size: 15px; box-shadow: 0 6px 24px rgba(0,0,0,0.25); }
.ms-btn:hover { background: var(--fog); color: #000; }
.login-error { background: var(--white); color: #B92D45; border-left: 3px solid var(--coral); padding: 10px 14px; border-radius: 4px; margin-bottom: 20px; font-size: 13.5px; }

@media (max-width: 960px) {
  .sidebar { position: static; width: 100%; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 14px 16px; }
  .sidebar::after, .sidebar-foot, .nav-label { display: none; }
  .brand { padding: 0 12px 0 4px; }
  .nav { display: flex; flex-wrap: wrap; gap: 2px; }
  .nav a.active::before { display: none; }
  .app { flex-direction: column; }
  .main { margin-left: 0; }
  .topbar, .content { padding-left: 20px; padding-right: 20px; }
}
