/* UISAP license server — admin UI.
   Layout and tone follow the Microsoft Entra / Azure portal (Fluent 2):
   brand top bar, left navigation, breadcrumb + titled page, command bar,
   quiet tables, message bars. The brand ramp is UISAP petrol instead of
   Azure blue. No inline styles anywhere: the CSP is style-src 'self'. */

:root {
  --font: "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Roboto, Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Roboto, Arial, sans-serif;
  --mono: "Cascadia Mono", "Cascadia Code", Consolas, "SFMono-Regular", Menlo, monospace;

  /* brand ramp (UISAP petrol) */
  --brand-top: #0b3a46;
  --brand-80: #0a4d5c;
  --brand-70: #0c5b6c;
  --brand: #0f6b7f;
  --brand-hover: #0c5b6c;
  --brand-pressed: #0a4d5c;
  --brand-tint: #e7f2f4;
  --brand-tint-2: #d2e7eb;
  --brand-fg: #0c5b6c;

  /* neutrals (Fluent 2) */
  --bg: #ffffff;
  --bg-2: #fafafa;
  --bg-3: #f5f5f5;
  --hover: #f5f5f5;
  --pressed: #ebebeb;
  --fg: #242424;
  --fg-2: #424242;
  --fg-3: #616161;
  --fg-4: #8a8a8a;
  --stroke: #e0e0e0;
  --stroke-2: #d1d1d1;
  --stroke-input: #c7c7c7;
  --stroke-input-b: #616161;
  --divider: #ebebeb;

  /* status */
  --ok: #107c10;
  --ok-bg: #f1faf1;
  --ok-stroke: #9fd89f;
  --warn: #8a5100;
  --warn-bg: #fff9f5;
  --warn-stroke: #fdcfb4;
  --warn-icon: #da3b01;
  --err: #b10e1c;
  --err-bg: #fdf3f4;
  --err-stroke: #eeacb2;
  --info-bg: #f0f7f9;

  --radius: 4px;
  --radius-lg: 8px;
  --shadow-2: 0 0 2px rgba(0, 0, 0, .12), 0 1px 2px rgba(0, 0, 0, .14);
  --shadow-8: 0 0 2px rgba(0, 0, 0, .12), 0 4px 8px rgba(0, 0, 0, .14);
  --shadow-16: 0 0 2px rgba(0, 0, 0, .12), 0 8px 16px rgba(0, 0, 0, .14);
  --top: 48px;
  --nav: 232px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 400 14px/20px var(--font);
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-fg); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
code { background: var(--bg-3); border: 1px solid var(--divider); border-radius: 3px; padding: 0 4px; }
strong { font-weight: 600; }
.muted { color: var(--fg-3); }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.pre { white-space: pre-wrap; }
.hint { color: var(--fg-3); font-size: 12px; line-height: 16px; margin: 6px 0 0; }
p.hint { margin: 8px 0 16px; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
svg.ic { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
svg.ic-20 { width: 20px; height: 20px; }
svg.ic-24 { width: 24px; height: 24px; }

/* ---------------------------------------------------------------- top bar */
.top {
  position: fixed; inset: 0 0 auto 0; height: var(--top); z-index: 20;
  display: flex; align-items: center; gap: 8px;
  background: var(--brand-top); color: #fff; padding: 0 12px 0 0;
}
.top-waffle { width: 48px; height: var(--top); display: grid; place-items: center; color: #fff; }
.top-waffle:hover { background: rgba(255, 255, 255, .08); text-decoration: none; }
.top-brand { display: flex; align-items: center; gap: 10px; color: #fff; font: 600 16px/1 var(--font-display); white-space: nowrap; }
.top-brand:hover { text-decoration: none; }
.top-brand small { font-weight: 400; color: rgba(255, 255, 255, .78); }
.brand-mark {
  width: 18px; height: 18px; flex: none; display: grid; grid-template-columns: 1fr 1fr; gap: 2px;
}
.brand-mark i { display: block; background: #fff; border-radius: 1.5px; }
.brand-mark i:nth-child(2) { opacity: .5; }
.brand-mark i:nth-child(3) { visibility: hidden; }
.brand-mark i:nth-child(4) { background: #f7630c; }
.top-search { flex: 1; display: flex; justify-content: center; padding: 0 16px; }
.top-search form { position: relative; width: min(100%, 520px); }
.top-search svg { position: absolute; left: 10px; top: 8px; color: var(--fg-3); pointer-events: none; }
.top-search input {
  width: 100%; height: 32px; border-radius: var(--radius); border: 1px solid transparent;
  background: #fff; color: var(--fg); padding: 0 12px 0 34px; font: inherit;
}
.top-search input:focus { outline: 2px solid #fff; outline-offset: 0; }
.top-me { display: flex; align-items: center; gap: 4px; }
.top-me form { margin: 0; }
.top-icon {
  width: 40px; height: 40px; display: grid; place-items: center; color: #fff; background: none;
  border: 0; border-radius: var(--radius); cursor: pointer;
}
.top-icon:hover { background: rgba(255, 255, 255, .1); }
.top-user { display: flex; align-items: center; gap: 10px; padding: 0 6px 0 8px; color: #fff; }
.top-user .who { text-align: right; line-height: 15px; }
.top-user .who b { display: block; font-weight: 600; font-size: 13px; }
.top-user .who span { font-size: 11px; color: rgba(255, 255, 255, .75); text-transform: uppercase; letter-spacing: .02em; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: #cfe8ec; color: var(--brand-80); font: 600 12px/1 var(--font); text-transform: uppercase;
}

/* ----------------------------------------------------------------- frame */
.frame { display: flex; padding-top: var(--top); min-height: 100vh; }
.side {
  position: fixed; top: var(--top); bottom: 0; left: 0; width: var(--nav); overflow-y: auto;
  background: var(--bg-2); border-right: 1px solid var(--stroke); padding: 12px 8px 24px;
}
.side .grp { margin: 16px 8px 4px; font-size: 12px; font-weight: 600; color: var(--fg-3); }
.side a {
  position: relative; display: flex; align-items: center; gap: 12px; height: 36px; padding: 0 10px;
  border-radius: var(--radius); color: var(--fg); font-size: 14px;
}
.side a:hover { background: var(--hover); text-decoration: none; }
.side a svg { color: var(--brand); }
.side a.on { background: var(--brand-tint); font-weight: 600; }
.side a.on::before {
  content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px; border-radius: 2px; background: var(--brand);
}
.side .foot { margin: 24px 10px 0; font-size: 11px; line-height: 15px; color: var(--fg-4); }
.content { flex: 1; min-width: 0; margin-left: var(--nav); padding: 14px 28px 48px; }

/* ------------------------------------------------- breadcrumb + page title */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 13px; color: var(--fg-3); margin-bottom: 10px; }
.crumbs a { color: var(--brand-fg); }
.crumbs svg { width: 12px; height: 12px; color: var(--fg-4); }
.title { display: flex; align-items: center; gap: 12px; margin: 0 0 4px; }
.title-icon {
  width: 36px; height: 36px; flex: none; border-radius: 6px; display: grid; place-items: center;
  background: var(--brand-tint); color: var(--brand);
}
.title h1 { margin: 0; font: 600 24px/32px var(--font-display); letter-spacing: -.01em; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.title h1 .sep { font-weight: 300; color: var(--fg-4); }
.title h1 .page { font-weight: 400; }
.title .chip { font-size: 12px; }
.sub { color: var(--fg-3); font-size: 13px; margin: 2px 0 0 48px; }
.page-head { margin-bottom: 4px; }

/* -------------------------------------------------------------- command bar */
.cmdbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px; margin: 14px 0 18px;
  padding: 4px 0; border-bottom: 1px solid var(--divider);
}
.cmdbar .sep { width: 1px; height: 20px; background: var(--stroke); margin: 0 6px; }
.cmdbar .grow { flex: 1; }
.cmd {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px; border: 0; border-radius: var(--radius);
  background: none; color: var(--fg); font: inherit; cursor: pointer; white-space: nowrap;
}
.cmd svg { color: var(--brand); }
.cmd:hover { background: var(--hover); text-decoration: none; }
.cmd:active { background: var(--pressed); }
.cmdbar form { margin: 0; display: flex; align-items: center; gap: 8px; }

/* ------------------------------------------------------------------ buttons */
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 32px; padding: 5px 16px; border-radius: var(--radius); border: 1px solid var(--brand);
  background: var(--brand); color: #fff; font: 600 14px/20px var(--font); cursor: pointer; white-space: nowrap;
  text-decoration: none;
}
button:hover, .btn:hover { background: var(--brand-hover); border-color: var(--brand-hover); text-decoration: none; }
button:active, .btn:active { background: var(--brand-pressed); }
button:focus-visible, .btn:focus-visible, .cmd:focus-visible, a:focus-visible { outline: 2px solid var(--fg); outline-offset: 1px; }
.btn-ghost, button.btn-ghost { background: #fff; color: var(--fg); border-color: var(--stroke-2); font-weight: 600; }
.btn-ghost:hover, button.btn-ghost:hover { background: var(--hover); border-color: var(--stroke-input); }
.btn-sm, button.btn-sm { min-height: 24px; padding: 1px 10px; font-size: 12px; line-height: 18px; }
.btn-warn, button.btn-warn { background: #fff; color: var(--warn); border-color: var(--warn-stroke); }
.btn-warn:hover, button.btn-warn:hover { background: var(--warn-bg); border-color: #f4a96f; }
.btn-danger, button.btn-danger { background: var(--err); border-color: var(--err); color: #fff; }
.btn-danger:hover, button.btn-danger:hover { background: #8f0b17; border-color: #8f0b17; }

/* --------------------------------------------------------------------- cards */
.block, .card {
  background: #fff; border: 1px solid var(--stroke); border-radius: var(--radius-lg); margin-bottom: 20px;
  box-shadow: var(--shadow-2); overflow: hidden;
}
.block > header {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; padding: 14px 20px 10px;
}
.block > header h2, h2 { margin: 0; font: 600 16px/22px var(--font-display); }
.block > header .muted { font-size: 12px; }
.block > header .right { margin-left: auto; }
.block > .body { padding: 4px 20px 18px; }
.block > .empty { border-top: 1px solid var(--divider); }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 0 20px; }
.section-title { margin: 28px 0 12px; font: 600 16px/22px var(--font-display); }

/* Entra "Basic information" — label / value columns */
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 48px; }
.kv dl, dl.facts { display: grid; grid-template-columns: minmax(120px, 170px) 1fr; gap: 0; margin: 0; }
.kv dt, dl.facts dt { color: var(--fg); font-weight: 600; padding: 9px 0; font-size: 13px; }
.kv dd, dl.facts dd { margin: 0; padding: 9px 0; color: var(--fg-2); min-width: 0; overflow-wrap: anywhere; }

/* stat tiles (dashboard) */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin: 0 0 24px; }
.stat {
  display: block; background: #fff; border: 1px solid var(--stroke); border-radius: var(--radius-lg); padding: 14px 16px 12px;
  color: var(--fg); box-shadow: var(--shadow-2);
}
a.stat:hover { text-decoration: none; box-shadow: var(--shadow-8); }
.stat .l { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--fg-3); }
.stat .l svg { color: var(--brand); }
.stat .n { margin-top: 6px; font: 600 28px/34px var(--font-display); color: var(--brand-fg); font-variant-numeric: tabular-nums; }
.stat.warn .n { color: var(--warn-icon); }
.stat.warn .l svg { color: var(--warn-icon); }

/* -------------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; font-weight: 600; font-size: 13px; color: var(--fg-2); padding: 0 12px; height: 40px;
  border-bottom: 1px solid var(--stroke); white-space: nowrap; background: #fff;
}
td { padding: 10px 12px; border-bottom: 1px solid var(--divider); vertical-align: middle; }
th:first-child, td:first-child { padding-left: 20px; }
th:last-child, td:last-child { padding-right: 20px; }
tbody tr:hover td { background: var(--hover); }
tbody tr:last-child td { border-bottom: 0; }
tr.dim td { color: var(--fg-4); }
tr.dim td a { color: var(--fg-3); }
td form { display: inline-flex; margin: 0 4px 0 0; vertical-align: middle; }
td.row-actions form { display: flex; margin: 0 0 4px; }
td.row-actions button { width: 100%; white-space: nowrap; }
td .usage { max-width: 220px; }
.empty { padding: 28px 20px; text-align: center; color: var(--fg-3); }

/* --------------------------------------------------------------- status chips */
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 11px;
  font: 600 12px/1 var(--font); white-space: nowrap; border: 1px solid transparent; vertical-align: middle;
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip-ok { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-stroke); }
.chip-warn { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-stroke); }
.chip-alert { color: var(--err); background: var(--err-bg); border-color: var(--err-stroke); }
.chip-mute, .chip-plain { color: var(--fg-3); background: var(--bg-3); border-color: var(--stroke); }
.chip-plain::before { display: none; }

/* ------------------------------------------------------------- message bars */
.flash, .alert, .note {
  display: flex; align-items: flex-start; gap: 10px; padding: 9px 14px; border-radius: var(--radius);
  border: 1px solid; margin: 0 0 16px; font-size: 13px; line-height: 19px;
}
.flash svg, .alert svg, .note svg { margin-top: 1px; }
.flash { background: var(--ok-bg); border-color: var(--ok-stroke); color: var(--fg); }
.flash svg { color: var(--ok); }
.alert { background: var(--err-bg); border-color: var(--err-stroke); color: var(--fg); }
.alert svg { color: var(--err); }
.note { background: var(--info-bg); border-color: var(--brand-tint-2); color: var(--fg); }
.note svg { color: var(--brand); }
.alert.warn { background: var(--warn-bg); border-color: var(--warn-stroke); }
.alert.warn svg { color: var(--warn-icon); }

/* ---------------------------------------------------------------- product key */
.keybox {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: 0 0 6px; padding: 16px 20px;
  background: #fff; border: 1px solid var(--stroke); border-left: 4px solid var(--brand); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
}
.keybox .lbl { width: 100%; font-size: 12px; font-weight: 600; color: var(--fg-3); }
.keybox .key { font: 600 22px/28px var(--mono); letter-spacing: .04em; color: var(--fg); }

/* --------------------------------------------------------------------- forms */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px 24px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
label, .field > label { font-size: 14px; font-weight: 600; color: var(--fg); }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=number], input[type=date], select, textarea {
  width: 100%; min-height: 32px; padding: 5px 10px; font: 400 14px/20px var(--font); color: var(--fg);
  background: #fff; border: 1px solid var(--stroke-input); border-bottom-color: var(--stroke-input-b); border-radius: var(--radius);
}
textarea { min-height: 96px; resize: vertical; }
textarea.code { min-height: 110px; font: 12.5px/18px var(--mono); }
input:hover, select:hover, textarea:hover { border-color: var(--stroke-2); border-bottom-color: var(--fg-2); }
input:focus, select:focus, textarea:focus {
  outline: 0; border-color: var(--stroke-input); border-bottom: 2px solid var(--brand); padding-bottom: 4px;
}
textarea:focus { padding-bottom: 4px; }
.err { color: var(--err); font-size: 12px; }
.form-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 20px; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px 24px; }
.checks label { display: flex; align-items: center; gap: 8px; font-weight: 400; cursor: pointer; }
.checks code { margin-left: auto; color: var(--fg-3); }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--brand); margin: 0; }
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin: 0; }
.inline-form .field { min-width: 160px; }
.inline-form > input, .inline-form > select { width: auto; }
.inline-form input[type=search] { min-width: 260px; }
.inline-form > select { min-width: 160px; }
.inline-form .checks { display: flex; align-self: center; }
.danger-zone { display: grid; gap: 16px; }
.danger-zone form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin: 0; padding: 14px; border: 1px solid var(--divider); border-radius: var(--radius-lg); background: var(--bg-2); }
.danger-zone .field { flex: 1; min-width: 220px; }

/* usage vs limits in the activations table */
.usage { display: flex; flex-wrap: wrap; gap: 4px; }
.usage span { font-size: 12px; padding: 1px 6px; border-radius: 3px; background: var(--bg-3); white-space: nowrap; }
.usage span.over { background: var(--err-bg); color: var(--err); font-weight: 600; }
.pager { display: flex; justify-content: center; gap: 8px; padding: 14px; border-top: 1px solid var(--divider); }

/* --------------------------------------------------------------------- sign-in */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: linear-gradient(160deg, #eef5f7 0%, #f7f7f7 55%, #ffffff 100%);
}
.login {
  width: min(100%, 440px); background: #fff; padding: 44px 44px 36px; box-shadow: 0 2px 6px rgba(0, 0, 0, .2);
  display: flex; flex-direction: column; gap: 16px;
}
.login .brand { display: flex; align-items: center; gap: 10px; font: 600 15px/1 var(--font-display); color: var(--fg-2); }
.login .brand .brand-mark i { background: var(--brand); }
.login .brand .brand-mark i:nth-child(4) { background: #f7630c; }
.login h1 { margin: 8px 0 0; font: 600 24px/32px var(--font-display); }
.login .sub { margin: -8px 0 0; }
.login input[type=text], .login input[type=password] {
  border: 0; border-bottom: 1px solid var(--fg-3); border-radius: 0; padding-left: 0; min-height: 36px;
}
.login input:focus { border-bottom: 2px solid var(--brand); }
.login button { align-self: flex-end; min-width: 108px; margin-top: 8px; }
.login .foot { margin-top: 10px; font-size: 12px; color: var(--fg-3); }

/* ------------------------------------------------------------------- mobile */
@media (max-width: 900px) {
  .side { position: static; width: auto; display: flex; gap: 4px; overflow-x: auto; padding: 6px 8px; border-right: 0; border-bottom: 1px solid var(--stroke); }
  .side .grp, .side .foot { display: none; }
  .side a { flex: none; }
  .side a.on::before { top: auto; bottom: 0; left: 10px; right: 10px; width: auto; height: 3px; }
  .frame { flex-direction: column; }
  .content { margin-left: 0; padding: 12px 16px 40px; }
  .top-search, .top-user .who { display: none; }
  .top-me { margin-left: auto; }
  .sub { margin-left: 0; }
}
