/* DynDir Licensing — interface styles */
:root {
  --paper: #f2f3ee;
  --panel: #ffffff;
  --ink: #1f2b2c;
  --ink-2: #4a5657;
  --muted: #6f7a7a;
  --line: #dcdfd6;
  --line-2: #e9ebe4;
  --brass: #a87a22;
  --brass-soft: #f6efdf;
  --green: #2e7a57;
  --green-soft: #e3f1e9;
  --red: #b03e2e;
  --red-soft: #f8e5e1;
  --amber: #9a6a12;
  --amber-soft: #f7eed8;
  --blue: #2c5d8a;
  --blue-soft: #e4edf5;
  --focus: #a87a22;
  --radius: 6px;
  --radius-lg: 10px;
  --sans: "IBM Plex Sans", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, Menlo, monospace;
  --brand: var(--ink);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.55 var(--sans);
}
a { color: var(--blue); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--ink); }
h1, h2, h3 { line-height: 1.25; margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 26px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { margin: 0 0 12px; }
code, .mono { font-family: var(--mono); font-size: 0.92em; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- App shell ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.sidebar {
  border-right: 1px solid var(--line);
  padding: 20px 14px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 18px;
}
.brandmark { display: flex; align-items: center; gap: 10px; padding: 0 8px; font-weight: 600; color: var(--ink); text-decoration: none; }
.brandmark svg { flex: none; }
.brandmark small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-section { font-size: 12px; color: var(--muted); padding: 12px 10px 4px; }
.nav a {
  display: block; padding: 7px 10px; border-radius: var(--radius);
  color: var(--ink-2); text-decoration: none; border-left: 3px solid transparent;
}
.nav a:hover { background: #e8eae3; color: var(--ink); }
.nav a.active { background: var(--panel); color: var(--ink); border-left-color: var(--brass); font-weight: 500; box-shadow: 0 0 0 1px var(--line); }
.sidebar-foot { margin-top: auto; font-size: 13px; color: var(--muted); padding: 0 8px; }
.sidebar-foot form { display: inline; }
.main { min-width: 0; padding: 28px 36px 60px; max-width: 1240px; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.topbar .sub { color: var(--muted); margin-top: 4px; }
.topbar .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); }
.mobile-bar { display: none; }
.impersonating { background: var(--amber-soft); border-bottom: 1px solid #e3cf9c; padding: 8px 36px; font-size: 14px; display: flex; gap: 12px; align-items: center; }
.impersonating form { margin: 0; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 30% 0 0; z-index: 40; background: var(--paper); transform: translateX(-102%); transition: transform .18s ease; height: 100vh; box-shadow: 4px 0 20px rgba(31,43,44,.15); }
  .sidebar.open { transform: none; }
  .mobile-bar { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--paper); position: sticky; top: 0; z-index: 30; }
  .main { padding: 20px 16px 48px; }
  .impersonating { padding: 8px 16px; }
}

/* ---------- Panels & layout ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.panel + .panel, .panel + .grid, .grid + .panel, .grid + .grid, .tabs + .panel { margin-top: 18px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.panel-head p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.panel-body { padding: 18px; }
.panel-body > :last-child { margin-bottom: 0; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-side { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 960px) { .grid-2, .grid-3, .grid-side { grid-template-columns: 1fr; } }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
hr.sep { border: 0; border-top: 1px solid var(--line-2); margin: 18px 0; }

/* Figures: plain numbers in a row, separated by rules rather than boxed cards */
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.figure { padding: 16px 18px; border-right: 1px solid var(--line-2); }
.figure:last-child { border-right: 0; }
.figure .label { font-size: 13px; color: var(--muted); }
.figure .value { font-size: 24px; font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; }
.figure .note { font-size: 12px; color: var(--muted); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; font-weight: 500; color: var(--muted); padding: 10px 18px; border-bottom: 1px solid var(--line); white-space: nowrap; font-size: 13px; }
table.data td { padding: 11px 18px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr.link-row { cursor: pointer; }
table.data tr.link-row:hover td { background: #fafaf7; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { padding: 34px 18px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--ink); font-weight: 500; margin-bottom: 4px; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line-2); font-size: 14px; color: var(--muted); }

dl.kv { display: grid; grid-template-columns: minmax(120px, 34%) 1fr; gap: 9px 16px; margin: 0; font-size: 14px; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* ---------- Status badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 1px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 500; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.blue { background: var(--blue-soft); color: var(--blue); }
.badge.plain::before { display: none; }

/* ---------- The license key: the one decorated object ---------- */
.keychip {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-weight: 500; letter-spacing: .04em;
  background: var(--brass-soft); color: #3d2f10;
  border: 1px solid #e2cf9f; border-left: 4px solid var(--brass);
  border-radius: var(--radius); padding: 6px 8px 6px 12px;
  max-width: 100%; overflow-wrap: anywhere;
}
.keychip.lg { font-size: 20px; padding: 12px 12px 12px 18px; }
.keychip.block { display: flex; justify-content: space-between; }
.keychip .copy { font-family: var(--sans); letter-spacing: 0; }
.id { font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); }
.codeblock { background: #20292a; color: #e8ebe3; font-family: var(--mono); font-size: 13px; line-height: 1.6; padding: 14px 16px; border-radius: var(--radius); overflow-x: auto; white-space: pre; margin: 0 0 12px; }
.codeblock .c { color: #9aa79f; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: 500 14px/1 var(--sans); padding: 9px 14px; border-radius: var(--radius);
  border: 1px solid var(--ink); background: var(--ink); color: #fff; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: #2f3e3f; color: #fff; }
.btn.secondary { background: var(--panel); color: var(--ink); border-color: var(--line); }
.btn.secondary:hover { border-color: #b9beb2; background: #fafaf7; }
.btn.danger { background: var(--panel); color: var(--red); border-color: #e7c4bd; }
.btn.danger:hover { background: var(--red-soft); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); padding-left: 8px; padding-right: 8px; }
.btn.ghost:hover { background: #e8eae3; }
.btn.sm { padding: 6px 10px; font-size: 13px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.store .btn:not(.secondary):not(.ghost):not(.danger) { background: var(--brand); border-color: var(--brand); }
.store .btn:not(.secondary):not(.ghost):not(.danger):hover { filter: brightness(1.12); }
form.inline { display: inline; margin: 0; }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field label, .label { display: block; font-weight: 500; font-size: 14px; margin-bottom: 5px; }
.field .hint { font-size: 13px; color: var(--muted); margin-top: 4px; }
.field-error { font-size: 13px; color: var(--red); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=date], input[type=search], select, textarea {
  width: 100%; font: 15px/1.4 var(--sans); color: var(--ink);
  background: #fff; border: 1px solid #cdd1c6; border-radius: var(--radius); padding: 9px 11px;
}
textarea { min-height: 96px; resize: vertical; }
textarea.code, input.code { font-family: var(--mono); font-size: 13.5px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brass); box-shadow: 0 0 0 3px rgba(168,122,34,.18); }
input[type=color] { width: 54px; height: 38px; padding: 2px; border: 1px solid #cdd1c6; border-radius: var(--radius); background: #fff; }
.check { display: flex; gap: 9px; align-items: flex-start; font-size: 14px; margin-bottom: 12px; }
.check input { margin-top: 3px; accent-color: var(--ink); }
.check small { display: block; color: var(--muted); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 16px; }
.form-actions { display: flex; gap: 10px; align-items: center; padding-top: 4px; flex-wrap: wrap; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; padding: 12px 18px; border-bottom: 1px solid var(--line-2); }
.filters input, .filters select { width: auto; min-width: 160px; padding: 7px 10px; font-size: 14px; }
.filters input[type=search] { min-width: 240px; flex: 1; }
.input-prefix { display: flex; align-items: stretch; }
.input-prefix span { display: flex; align-items: center; padding: 0 10px; background: var(--line-2); border: 1px solid #cdd1c6; border-right: 0; border-radius: var(--radius) 0 0 var(--radius); color: var(--muted); font-size: 14px; white-space: nowrap; }
.input-prefix input { border-radius: 0 var(--radius) var(--radius) 0; }

/* ---------- Alerts ---------- */
.flash { padding: 11px 14px; border-radius: var(--radius); margin-bottom: 18px; font-size: 14px; border: 1px solid; }
.flash.success { background: var(--green-soft); border-color: #bcdcc9; color: #1f5a3f; }
.flash.error { background: var(--red-soft); border-color: #e9c1b9; color: #7f2b1f; }
.flash.info { background: var(--blue-soft); border-color: #c4d6e6; color: #22496c; }
.flash.warning { background: var(--amber-soft); border-color: #e6d3a5; color: #6e4b0c; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--ink-2); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a.active { color: var(--ink); border-bottom-color: var(--brass); font-weight: 500; }

/* Setup checklist: a genuine sequence, so it is numbered */
.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 30px 1fr auto; gap: 12px; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--line-2); }
.steps li:last-child { border-bottom: 0; }
.steps li::before { content: counter(step); width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; font-size: 13px; color: var(--muted); }
.steps li.done::before { content: "✓"; background: var(--green-soft); border-color: #bcdcc9; color: var(--green); }
.steps li.done .t { color: var(--muted); }

/* Bar chart (server-rendered) */
.chart { display: flex; align-items: flex-end; gap: 3px; height: 150px; padding: 8px 0 0; }
.chart .bar { flex: 1; background: #cfd8c9; border-radius: 3px 3px 0 0; min-height: 2px; position: relative; }
.chart .bar.trial { background: var(--brass); opacity: .55; }
.chart .bar:hover { background: var(--ink); }
.chart-axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 6px; }
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.hbar { display: grid; grid-template-columns: minmax(80px, 34%) 1fr 48px; gap: 10px; align-items: center; font-size: 14px; padding: 4px 0; }
.hbar .track { background: var(--line-2); border-radius: 3px; height: 8px; }
.hbar .fill { background: var(--ink-2); border-radius: 3px; height: 8px; }

/* ---------- Auth & public ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; }
.auth-card { width: 100%; max-width: 410px; }
.auth-card .panel-body { padding: 26px; }
.auth-card h1 { font-size: 22px; margin-bottom: 4px; }
.auth-card .sub { color: var(--muted); margin-bottom: 20px; }
.auth-foot { text-align: center; margin-top: 16px; font-size: 14px; color: var(--muted); }

.site-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 32px; max-width: 1160px; margin: 0 auto; }
.site-head nav { display: flex; gap: 18px; align-items: center; font-size: 15px; }
.site-head nav a:not(.btn) { color: var(--ink-2); text-decoration: none; }
.hero { max-width: 1160px; margin: 0 auto; padding: 56px 32px 40px; display: grid; grid-template-columns: 1.05fr 1fr; gap: 48px; align-items: center; }
.hero h1 { font-size: 46px; line-height: 1.08; letter-spacing: -0.025em; max-width: 14ch; }
.hero p.lead { font-size: 18px; color: var(--ink-2); max-width: 46ch; margin: 18px 0 26px; }
.terminal { background: #20292a; border-radius: var(--radius-lg); padding: 22px; color: #e8ebe3; font: 14px/1.7 var(--mono); box-shadow: 0 18px 40px -18px rgba(31,43,44,.45); }
.terminal .k { color: #e7c77f; }
.terminal .ok { color: #8fd1ae; }
.terminal .c { color: #8c9a92; }
.features { max-width: 1160px; margin: 0 auto; padding: 24px 32px 72px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border-top: 1px solid var(--line); }
.features div { padding: 26px 26px 0 0; }
.features h3 { margin-bottom: 6px; }
.features p { color: var(--ink-2); font-size: 15px; }
.site-foot { border-top: 1px solid var(--line); padding: 22px 32px; text-align: center; color: var(--muted); font-size: 13px; }
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding: 32px 16px; gap: 28px; }
  .hero h1 { font-size: 34px; }
  .features { grid-template-columns: 1fr; padding: 8px 16px 40px; }
  .site-head { padding: 14px 16px; }
}

/* ---------- Vendor store ---------- */
.store-head { background: var(--panel); border-bottom: 1px solid var(--line); border-top: 4px solid var(--brand); }
.store-head .inner { max-width: 1060px; margin: 0 auto; padding: 16px 24px; display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.store-head .name { font-weight: 600; font-size: 18px; color: var(--ink); text-decoration: none; }
.store-head nav { display: flex; gap: 16px; align-items: center; font-size: 14px; }
.store-head nav a:not(.btn) { color: var(--ink-2); text-decoration: none; }
.store-main { max-width: 1060px; margin: 0 auto; padding: 32px 24px 64px; }
.store-intro { margin-bottom: 28px; max-width: 62ch; }
.store-intro h1 { font-size: 30px; margin-bottom: 8px; }
.product-list > .product + .product { margin-top: 28px; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); border-top: 1px solid var(--line-2); }
.plan { padding: 18px; border-right: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 10px; }
.plan:last-child { border-right: 0; }
.plan .price { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
.plan .price small { font-size: 14px; color: var(--muted); font-weight: 400; }
.plan ul { margin: 0; padding-left: 18px; color: var(--ink-2); font-size: 14px; }
.plan form { margin-top: auto; }
.reseller-note { background: var(--brass-soft); border: 1px solid #e2cf9f; border-radius: var(--radius); padding: 10px 14px; font-size: 14px; margin-bottom: 22px; }
.store-foot { text-align: center; color: var(--muted); font-size: 13px; padding: 24px; }

/* Error page */
.error-page { min-height: 70vh; display: grid; place-items: center; text-align: center; padding: 24px; }
.error-page .code { font: 600 64px/1 var(--mono); color: var(--brass); }

/* Utilities */
.copy-btn[data-copied]::after { content: " ✓"; }
.hide { display: none !important; }
details.more summary { cursor: pointer; color: var(--blue); font-size: 14px; }
details.more[open] summary { margin-bottom: 10px; }
