:root {
  --ink: #152019;
  --muted: #66736a;
  --line: #dfe6e0;
  --paper: #ffffff;
  --canvas: #f2f5f1;
  --green: #176b45;
  --green-dark: #0c4c30;
  --green-soft: #e4f2e9;
  --amber: #9a5b08;
  --amber-soft: #fff2d8;
  --red: #a52a2a;
  --red-soft: #fce8e6;
  --blue: #205d85;
  --blue-soft: #e6f1f8;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; background: radial-gradient(circle at 95% -20%, #d7eadb 0, transparent 34rem), var(--canvas); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: var(--green); }

.topbar {
  height: 68px; padding: 0 max(24px, calc((100vw - 1460px) / 2));
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(255,255,255,.92); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 11px; letter-spacing: .01em; }
.brand > span:last-child { display: flex; flex-direction: column; line-height: 1.1; }
.brand small { color: var(--muted); font-size: 11px; margin-top: 4px; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; color: white; background: var(--green); font-weight: 800; }
.top-actions, .workspace-actions, .inline-form, .dialog-actions, .actions { display: flex; align-items: center; gap: 9px; }
.top-actions { color: var(--muted); font-size: 14px; }

main { max-width: 1460px; margin: 0 auto; padding: 36px 24px 72px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: clamp(28px, 3vw, 42px); letter-spacing: -.04em; }
h2 { margin-bottom: 5px; font-size: 20px; letter-spacing: -.015em; }
h3 { margin: 0 0 12px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.eyebrow { color: var(--green); font-weight: 750; text-transform: uppercase; letter-spacing: .12em; font-size: 11px; margin-bottom: 8px; }
.muted, .panel-head p { color: var(--muted); }
.panel-head p { margin-bottom: 0; font-size: 13px; }

.login-card { width: min(430px, 100%); margin: 8vh auto; padding: 34px; border-radius: 18px; background: var(--paper); border: 1px solid var(--line); box-shadow: 0 18px 50px rgba(26,54,36,.08); }
form label, label.compact { display: flex; flex-direction: column; gap: 7px; margin: 18px 0; font-size: 13px; font-weight: 650; }
label small { color: var(--muted); font-weight: 400; }
input, select, textarea { border: 1px solid #cbd5cd; border-radius: 9px; background: white; padding: 10px 12px; color: var(--ink); outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(23,107,69,.12); }
textarea { resize: vertical; }
.compact { margin: 0 !important; flex-direction: row !important; align-items: center; color: var(--muted); }
.compact select { min-width: 210px; }
.form-error { min-height: 20px; color: var(--red); font-size: 13px; margin: 12px 0 0; }
.form-link { margin: 4px 0 0; text-align: center; color: var(--muted); font-size: 13px; }
.registration-card { width: min(520px, 100%); margin-top: 4vh; }
.button-link { display: flex; align-items: center; justify-content: center; text-decoration: none; }

.button { border: 1px solid #c7d1c9; border-radius: 9px; padding: 9px 13px; background: white; color: var(--ink); font-weight: 650; font-size: 13px; white-space: nowrap; text-decoration: none; }
.button:hover { border-color: #91a398; background: #f9fbf9; }
.button.primary { border-color: var(--green); background: var(--green); color: white; }
.button.primary:hover { background: var(--green-dark); }
.button.danger { border-color: var(--red); color: white; background: var(--red); }
.button.ghost { background: transparent; }
.button.small { padding: 6px 9px; font-size: 12px; }
.button.wide { width: 100%; padding: 11px; }
.button:disabled { cursor: wait; opacity: .55; }

.workspace-head { display: flex; justify-content: space-between; align-items: end; margin-bottom: 24px; }
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.summary-card { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.summary-card strong { display: block; font-size: 30px; line-height: 1; margin-bottom: 9px; }
.summary-card span { color: var(--muted); font-size: 13px; }

.admin-tabs {
  display: flex; gap: 4px; margin: 20px 0 0; padding: 5px;
  border: 1px solid var(--line); border-radius: 13px; background: #e8eee9;
  width: fit-content; max-width: 100%; overflow-x: auto;
}
.admin-tab {
  min-width: 120px; border: 0; border-radius: 9px; padding: 10px 18px;
  color: var(--muted); background: transparent; font-weight: 700; white-space: nowrap;
}
.admin-tab:hover { color: var(--ink); background: rgba(255,255,255,.55); }
.admin-tab.active, .admin-tab[aria-selected="true"] {
  color: var(--green-dark); background: var(--paper); box-shadow: 0 1px 5px rgba(20,48,30,.12);
}
.admin-tab:focus-visible { outline: 3px solid rgba(23,107,69,.2); outline-offset: 1px; }
.tab-panel { animation: tab-in .14s ease-out; }
@keyframes tab-in { from { opacity: .55; transform: translateY(3px); } }

.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 20px; margin-top: 16px; box-shadow: 0 5px 18px rgba(26,54,36,.035); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.split { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(360px, .75fr); gap: 26px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { color: var(--muted); font-size: 11px; text-align: left; text-transform: uppercase; letter-spacing: .06em; padding: 10px 9px; border-bottom: 1px solid var(--line); }
td { padding: 13px 9px; border-bottom: 1px solid #edf1ed; vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td strong, td small { display: block; }
td small { color: var(--muted); margin-top: 4px; }
.empty { padding: 28px 10px; color: var(--muted); text-align: center; }
.mono { font: 12px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-wrap: anywhere; }
.actions { flex-wrap: wrap; min-width: 165px; }

.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 4px 8px; font-size: 11px; font-weight: 750; background: #eef1ee; color: #566158; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.active, .pill.claimed, .pill.success { color: var(--green); background: var(--green-soft); }
.pill.pending, .pill.approved, .pill.suspended { color: var(--amber); background: var(--amber-soft); }
.pill.retired, .pill.rejected, .pill.failure, .pill.expired, .pill.disabled { color: var(--red); background: var(--red-soft); }
.pill.online { color: var(--blue); background: var(--blue-soft); }
.pill.offline, .pill.unknown { color: #566158; background: #eef1ee; }

.security-note { color: var(--muted); font-size: 12px; margin: 16px 2px 0; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 100; max-width: 420px; color: white; background: #233027; padding: 13px 16px; border-radius: 10px; box-shadow: 0 12px 30px rgba(0,0,0,.18); }
.toast.error { background: var(--red); }

dialog { width: min(560px, calc(100vw - 32px)); border: 0; border-radius: 18px; padding: 0; box-shadow: 0 25px 80px rgba(9,30,17,.28); }
dialog::backdrop { background: rgba(16,28,20,.52); backdrop-filter: blur(2px); }
.dialog-card { margin: 0; padding: 26px; }
.dialog-card label { margin: 14px 0; }
.dialog-actions { justify-content: flex-end; margin-top: 20px; }
#secret-value { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.detail-dialog { width: min(1050px, calc(100vw - 32px)); }
.detail-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 16px 0 24px; }
.detail-item { border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.detail-item small { display: block; color: var(--muted); margin-bottom: 5px; }
.detail-section { margin-top: 24px; }

@media (max-width: 1000px) {
  .summary-grid { grid-template-columns: repeat(3, 1fr); }
  .split { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 700px) {
  main { padding: 24px 12px 48px; }
  .topbar { padding: 0 14px; }
  .workspace-head, .panel-head { align-items: stretch; flex-direction: column; }
  .workspace-actions, .inline-form { align-items: stretch; flex-wrap: wrap; }
  .compact { align-items: stretch !important; flex-direction: column !important; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-tabs { width: 100%; }
  .admin-tab { flex: 1 0 auto; min-width: 108px; padding-inline: 14px; }
  .panel { padding: 15px; border-radius: 12px; }
  .top-actions > span { display: none; }
}
