/* ==========================================================================
   License Care — Reseller Console
   "Radar Deck": dark ops-console theme (amber-on-charcoal, monospace-
   forward, icon-rail navigation), shared with the Customer and Staff
   consoles so all three tiers read as one product family. Token/class
   names are kept stable so this file is a drop-in retheme.
   ========================================================================== */

:root {
  --paper: #10141a;
  --paper-raised: #171c23;
  --paper-sunken: #1e242c;
  --ink: #e9e4d8;
  --ink-soft: #8b93a0;
  --ink-faint: #545c68;
  --seal: #d99a53;
  --seal-deep: #c17f38;
  --seal-tint: rgba(217, 154, 83, 0.14);
  --brass: #d99a53;
  --brass-tint: rgba(217, 154, 83, 0.1);
  --alert: #c15c4e;
  --alert-tint: rgba(193, 92, 78, 0.14);
  --amber: #d99a53;
  --amber-tint: rgba(217, 154, 83, 0.14);
  --line: #2a323c;
  --line-strong: #3a4453;

  --font-display: ui-monospace, "SFMono-Regular", "Cascadia Code", "Roboto Mono", Consolas, monospace;
  --font-body: ui-monospace, "SFMono-Regular", "Cascadia Code", "Roboto Mono", Consolas, monospace;
  --font-mono: ui-monospace, "SFMono-Regular", "Cascadia Code", "Roboto Mono", Consolas, monospace;

  --radius: 8px;
  --shadow-card: none;

  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--seal);
  color: var(--paper);
}

:focus-visible {
  outline: 2px solid var(--seal);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Routes.razor's <FocusOnNavigate Selector="h1" /> programmatically focuses the page heading on
   every navigation for screen readers - Chromium's :focus-visible heuristic treats that the same
   as a real keyboard focus, so without this every page load would show a focus ring around the
   title. The heading keeps its bottom-border treatment either way, so no indicator is lost. */
h1:focus-visible {
  outline: none;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* -- Typography ------------------------------------------------------- */

h1,
h2,
h3 {
  font-family: var(--font-display);
  color: var(--ink);
  font-weight: 700;
  letter-spacing: 0.01em;
  margin: 0 0 0.6em;
}

h1 {
  font-size: 1.7rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--brass);
  display: inline-block;
}

h2 {
  font-size: 1.05rem;
  margin-top: 2.25rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}

h3 {
  font-size: 0.95rem;
  font-family: var(--font-body);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}

p {
  margin: 0 0 1rem;
  max-width: 68ch;
}

a {
  color: var(--seal);
  text-decoration-color: var(--brass);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--seal-deep);
}

code,
pre,
kbd {
  font-family: var(--font-mono);
  font-size: 0.88em;
}

code {
  background: var(--paper-sunken);
  padding: 0.12em 0.4em;
  border-radius: 2px;
  color: var(--seal);
}

pre {
  background: var(--paper-sunken);
  color: var(--ink);
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  overflow-x: auto;
  border-left: 3px solid var(--brass);
  margin: 0.75rem 0 1.25rem;
}

pre code {
  background: none;
  color: inherit;
  padding: 0;
}

/* -- Page shell --------------------------------------------------------- */

.app-shell {
  display: flex;
  min-height: 100vh;
  align-items: stretch;
}

.app-main {
  flex: 1;
  min-width: 0;
  padding: 2.5rem 3rem 4rem;
}

.app-main > *:first-child {
  margin-top: 0;
}

/* -- Sidebar: icon rail --------------------------------------------------
   Narrow icon-only rail. Each nav item is icon + a CSS-only hover tooltip
   (.tip), matching the pattern used across the other License Care consoles. */

.app-sidebar {
  width: 64px;
  flex-shrink: 0;
  background: var(--paper-raised);
  border-right: 1px solid var(--line);
  color: #cdd3da;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.1rem 0;
  gap: 1.4rem;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-name,
.brand-sub {
  display: none;
}

.app-nav {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  align-items: center;
  flex: 1;
}

.app-nav a {
  display: grid;
  place-items: center;
  position: relative;
  width: 40px;
  height: 40px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 16px;
  border-radius: var(--radius);
  border-left: none;
  transition: background-color 120ms ease, color 120ms ease;
}

.app-nav a:hover {
  color: var(--ink);
  background: var(--paper-sunken);
}

.app-nav a.active {
  color: var(--seal);
  background: var(--paper-sunken);
  font-weight: 600;
}

.nav-icon {
  line-height: 1;
}

/* CSS-only hover tooltip, reused by nav links and the icon-only logout button. */
.tip {
  position: absolute;
  left: 52px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--paper-sunken);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 4px 9px;
  font-size: 11px;
  font-family: var(--font-body);
  white-space: nowrap;
  color: var(--ink);
  opacity: 0;
  pointer-events: none;
  transition: opacity 100ms ease;
  z-index: 20;
}

.app-nav a:hover .tip,
.sidebar-foot button:hover .tip,
.sidebar-user:hover .tip {
  opacity: 1;
}

.sidebar-foot {
  margin-top: 0;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.sidebar-foot form {
  margin: 0;
}

.sidebar-foot button {
  width: 40px;
  height: 40px;
  padding: 0;
  display: grid;
  place-items: center;
  position: relative;
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  font-size: 15px;
}

.sidebar-foot button:hover {
  color: var(--ink);
  border-color: var(--line-strong);
  background: var(--paper-sunken);
}

.sidebar-user {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--paper-sunken);
  border: 1px solid var(--line-strong);
  color: var(--seal);
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
  cursor: default;
}

/* -- Seal mark: the brand mark --------------------------------------------
   A ringed dot, matching the amber "radar" mark used across the other
   License Care consoles. */

.seal-mark {
  --seal-size: 26px;
  width: var(--seal-size);
  height: var(--seal-size);
  border-radius: 50%;
  flex-shrink: 0;
  background: transparent;
  border: 1.5px solid var(--seal);
  position: relative;
  box-shadow: none;
}

.seal-mark::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 24%;
  height: 24%;
  border: none;
  border-radius: 50%;
  background: var(--seal);
  transform: none;
}

.seal-mark.sm {
  --seal-size: 13px;
  border-width: 1.5px;
}

/* -- Buttons -------------------------------------------------------------*/

button,
input[type="submit"],
input[type="button"] {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink);
  background: var(--paper-sunken);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0.5rem 1.05rem;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease, transform 60ms ease;
}

button:hover:not(:disabled),
input[type="submit"]:hover:not(:disabled) {
  border-color: var(--seal);
  color: var(--seal);
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

button:disabled {
  background: var(--paper-sunken);
  color: var(--ink-faint);
  border-color: var(--line);
  cursor: not-allowed;
}

/* Secondary/utility buttons: anything not the form's main submit reads
   quieter by default via :not(form > button:last-of-type) is too fragile in
   Blazor markup, so pages opt in explicitly with .btn-quiet / .btn-danger. */

.btn-quiet {
  background: transparent;
  color: var(--ink-soft);
  border-color: var(--line-strong);
}

.btn-quiet:hover:not(:disabled) {
  background: var(--paper-sunken);
  color: var(--ink);
  border-color: var(--line-strong);
}

.btn-danger {
  background: var(--alert-tint);
  color: var(--alert);
  border-color: var(--alert);
}

.btn-danger:hover:not(:disabled) {
  background: var(--alert);
  color: var(--paper);
  border-color: var(--alert);
}

/* -- Forms ---------------------------------------------------------------*/

form {
  max-width: 640px;
}

form div {
  margin-bottom: 1rem;
}

label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
}

/* Inline checkbox/radio labels (e.g. "<label><input type=checkbox/> Foo</label>")
   read as normal-case sentence text, not a field label. */
label:has(> input[type="checkbox"]),
label:has(> input[type="radio"]) {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  text-transform: none;
  font-weight: 500;
  font-size: 0.88rem;
  color: var(--ink);
  letter-spacing: normal;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
input:not([type]),
select,
textarea {
  font-family: var(--font-body);
  font-size: 0.92rem;
  color: var(--ink);
  background: var(--paper-sunken);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0.5rem 0.65rem;
  width: 100%;
  max-width: 420px;
}

textarea {
  max-width: 100%;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--seal);
}

input[type="checkbox"],
input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--seal);
}

fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.2rem 1.2rem;
  margin: 0 0 1.25rem;
  background: var(--paper-raised);
}

fieldset:disabled {
  opacity: 0.6;
}

legend {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--seal);
  padding: 0 0.4rem;
}

/* -- Tables ----------------------------------------------------------- */

.table-wrap {
  overflow-x: auto;
  margin-bottom: 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-raised);
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 480px;
}

th,
td {
  text-align: left;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.88rem;
  vertical-align: middle;
}

th {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  background: var(--paper-sunken);
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--paper-sunken);
}

td code {
  font-size: 0.82em;
}

/* First column of a listing table (IDs) reads as ledger reference numbers */
td:first-child a {
  font-family: var(--font-mono);
  font-weight: 600;
}

/* -- Cards ---------------------------------------------------------------*/

.card {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.5rem;
}

.card > h2:first-child,
.card > h3:first-child {
  margin-top: 0;
}

.page-head {
  margin-bottom: 1.75rem;
}

.eyebrow {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 0.35rem;
}

.lede {
  color: var(--ink-soft);
  margin-top: 0.35rem;
}

/* -- Status badges ---------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.22rem 0.6rem 0.22rem 0.5rem;
  border-radius: 999px;
  background: var(--paper-sunken);
  border: 1px solid var(--line);
  white-space: nowrap;
}

.badge-active {
  color: #7fae7a;
  border-color: rgba(127, 174, 122, 0.4);
}

.badge-expired,
.badge-no {
  color: var(--amber);
  border-color: rgba(217, 154, 83, 0.4);
}

.badge-revoked {
  color: var(--alert);
  border-color: rgba(193, 92, 78, 0.4);
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: currentcolor;
  box-shadow: 0 0 6px currentcolor;
}

/* -- Notices (validation/error/success text) --------------------------
   Pages set inline color:crimson / color:seagreen on <p> - re-skin those
   exact colors so no markup needs to change. */

p[style*="color:crimson"],
p[style*="color: crimson"] {
  background: var(--alert-tint) !important;
  color: var(--alert) !important;
  border: 1px solid rgba(193, 92, 78, 0.4);
  border-radius: var(--radius);
  padding: 0.65rem 0.9rem;
  max-width: 640px;
  font-size: 0.88rem;
}

p[style*="color:seagreen"],
p[style*="color: seagreen"] {
  background: var(--seal-tint) !important;
  color: var(--seal) !important;
  border: 1px solid rgba(217, 154, 83, 0.4);
  border-radius: var(--radius);
  padding: 0.65rem 0.9rem;
  max-width: 640px;
  font-size: 0.88rem;
}

/* -- Misc ----------------------------------------------------------------*/

hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 2rem 0;
}

nav[style*="display:flex"] button:not(:disabled) {
  /* Device-detail-style tab bars ported from other consoles, if reused */
  background: var(--paper-raised);
  color: var(--ink);
  border-color: var(--line-strong);
}

nav[style*="display:flex"] button:disabled {
  /* The active tab is a disabled button - keep it visually distinct (sealed/pressed)
     rather than letting the tab-bar's own background/color rule above flatten it. */
  background: var(--seal-tint);
  color: var(--seal);
  border-color: var(--seal);
  cursor: default;
}

/* -- Login page (StaffLoginEndpoints.cs returns raw HTML, not a component,
   but shares this stylesheet) ------------------------------------------ */

.login-body {
  background: var(--paper);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.login-card {
  width: 100%;
  max-width: 340px;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  padding: 2.25rem 2rem 2rem;
}

.login-mark {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1.5rem;
}

.login-mark .seal-mark {
  --seal-size: 32px;
}

.login-mark .brand-name {
  display: inline;
  color: var(--ink);
  font-size: 1.15rem;
  font-weight: 700;
}

.login-mark .brand-sub {
  display: block;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 0.15rem;
}

.login-card form div {
  margin-bottom: 1.1rem;
}

.login-card button {
  width: 100%;
  padding: 0.65rem;
  font-size: 0.9rem;
}

@media (max-width: 720px) {
  .app-shell {
    flex-direction: column;
  }

  .app-sidebar {
    width: auto;
    flex-direction: row;
    padding: 0.75rem;
  }

  .app-nav {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .app-main {
    padding: 1.5rem 1.25rem 3rem;
  }
}
