/* License Server — design tokens theo design_handoff_license_server/README.md */

:root {
  --bg-root: #09090B;
  --bg-canvas: #0A0A0C;
  --bg-panel: #111114;
  --bg-panel-alt: #141417;
  --bg-surface: #1A1A1E;
  --bg-subtle: #0D0D10;
  --border-hairline: #1E1E23;
  --border-hairline-2: #26262C;
  --border-input: #2A2A30;
  --border-strong: #34343C;
  --border-strong-hover: #4A4A54;
  --border-row: #161619;

  --text-primary: #EDEDF0;
  --text-table: #DCDCE0;
  --text-table-2: #C4C4CC;
  --text-secondary: #A1A1AB;
  --text-muted: #8A8A94;
  --text-faint: #6E6E78;
  --text-placeholder: #52525B;

  --accent: #2DD4A7;
  --accent-hover: #3EE0B5;
  --accent-text-on: #04241B;
  --danger: #E5493A;
  --danger-hover: #F0553F;
  --warning: #EAA72D;
  --warning-text-on: #231702;
  --focus-ring: 0 0 0 3px rgba(45, 212, 167, 0.15);

  --st-active-text: #5EE08B; --st-active-bg: rgba(56,201,90,0.12); --st-active-border: rgba(56,201,90,0.25); --st-active-dot: #38C95A;
  --st-unused-text: #B4B4BD; --st-unused-bg: rgba(255,255,255,0.05); --st-unused-border: rgba(255,255,255,0.1); --st-unused-dot: #6E6E78;
  --st-blocked-text: #FF8A7F; --st-blocked-bg: rgba(240,82,63,0.13); --st-blocked-border: rgba(240,82,63,0.28); --st-blocked-dot: #F0523F;
  --st-expired-text: #F2BF5A; --st-expired-bg: rgba(242,177,58,0.13); --st-expired-border: rgba(242,177,58,0.28); --st-expired-dot: #EAA72D;
  --st-revoked-text: #8A8A94; --st-revoked-bg: rgba(255,255,255,0.03); --st-revoked-border: rgba(255,255,255,0.08); --st-revoked-dot: #52525B;

  --log-ok-text: #5EE08B; --log-ok-bg: rgba(56,201,90,0.1); --log-ok-border: rgba(56,201,90,0.22);
  --log-fail-text: #FF8A7F; --log-fail-bg: rgba(240,82,63,0.1); --log-fail-border: rgba(240,82,63,0.25);

  --flash-success-text: #8fe6a9; --flash-success-bg: rgba(56,201,90,0.1); --flash-success-border: rgba(56,201,90,0.28);
  --flash-error-text: #ff9a90; --flash-error-bg: rgba(240,82,63,0.1); --flash-error-border: rgba(240,82,63,0.3);
  --flash-warning-text: #f2c874; --flash-warning-bg: rgba(242,177,58,0.1); --flash-warning-border: rgba(242,177,58,0.3);

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-card: 12px;
  --radius-modal: 14px;
  --radius-pill: 999px;

  --font-ui: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg-root);
  color: var(--text-primary);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(45, 212, 167, 0.3); }

a { color: inherit; }

.mono { font-family: var(--font-mono); }

/* ===== Layout: app shell ===== */
.app-canvas { background: var(--bg-canvas); min-height: 100vh; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 22px; border-bottom: 1px solid var(--bg-surface); background: #0c0c0e;
}
.topbar-left { display: flex; align-items: center; gap: 22px; }
.topbar-brand { display: flex; align-items: center; gap: 9px; text-decoration: none; }
.topbar-logo {
  width: 24px; height: 24px; border-radius: var(--radius-sm); background: var(--accent);
  display: flex; align-items: center; justify-content: center; color: var(--accent-text-on);
  font-weight: 700; font-size: 13px;
}
.topbar-brand-name { font-weight: 600; font-size: 14px; color: var(--text-primary); }
.topbar-nav { display: flex; gap: 4px; }
.topbar-nav a {
  font-size: 13px; color: var(--text-muted); font-weight: 500; padding: 6px 12px;
  border-radius: 7px; text-decoration: none;
}
.topbar-nav a.active { color: var(--text-primary); background: var(--bg-surface); }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar-user { font-size: 13px; color: var(--text-secondary); }
.topbar-avatar {
  width: 28px; height: 28px; border-radius: 50%; background: var(--bg-surface);
  border: 1px solid var(--border-strong); display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--text-secondary);
}

.page-body { padding: 24px 22px; display: flex; flex-direction: column; gap: 20px; max-width: 1200px; margin: 0 auto; }

/* ===== Typography ===== */
h1.page-title { margin: 0; font-size: 34px; font-weight: 700; letter-spacing: -0.02em; }
h2.section-title { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.card-title { font-size: 14px; font-weight: 600; }
.label { font-size: 12px; color: var(--text-secondary); font-weight: 500; }
.col-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); font-weight: 600; }

/* ===== Card ===== */
.card { background: var(--bg-panel); border: 1px solid var(--border-hairline); border-radius: var(--radius-card); padding: 20px; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: var(--radius-md); font-weight: 600; font-size: 13px; cursor: pointer;
  font-family: inherit; padding: 9px 16px; border: 1px solid transparent; white-space: nowrap;
}
.btn-primary { background: var(--accent); color: var(--accent-text-on); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--bg-surface); color: var(--text-primary); border-color: var(--border-strong); font-weight: 500; }
.btn-secondary:hover { border-color: var(--border-strong-hover); }
.btn-ghost { background: transparent; color: var(--text-secondary); border-color: var(--border-input); font-weight: 500; }
.btn-ghost:hover { color: var(--text-primary); border-color: #3A3A42; }
.btn-warning { background: rgba(234, 167, 45, 0.08); color: #F2BF5A; border-color: rgba(234, 167, 45, 0.4); }
.btn-warning:hover { background: rgba(234, 167, 45, 0.16); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-hover); }
.btn:disabled { cursor: not-allowed; background: var(--bg-surface); color: var(--text-faint); border-color: var(--border-input); }
.btn-block { width: 100%; }

/* ===== Inputs ===== */
.field { display: flex; flex-direction: column; gap: 6px; }
.input {
  background: var(--bg-surface); border: 1px solid var(--border-input); color: var(--text-primary);
  padding: 10px 12px; border-radius: var(--radius-md); font-size: 14px; font-family: inherit; outline: none;
  width: 100%;
}
.input:focus { border-color: var(--accent); box-shadow: var(--focus-ring); }
.input-error { border-color: rgba(240, 82, 63, 0.5) !important; }
.input-sm { padding: 9px 12px; font-size: 13px; }

.search-wrap { position: relative; flex: 1; min-width: 240px; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-placeholder); font-size: 14px; }
.search-wrap .input { padding-left: 32px; background: var(--bg-panel-alt); }

/* ===== Badge (status) ===== */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 600; border: 1px solid transparent; white-space: nowrap;
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; }
.badge-active { color: var(--st-active-text); background: var(--st-active-bg); border-color: var(--st-active-border); }
.badge-active .badge-dot { background: var(--st-active-dot); }
.badge-unused { color: var(--st-unused-text); background: var(--st-unused-bg); border-color: var(--st-unused-border); }
.badge-unused .badge-dot { background: var(--st-unused-dot); }
.badge-blocked { color: var(--st-blocked-text); background: var(--st-blocked-bg); border-color: var(--st-blocked-border); }
.badge-blocked .badge-dot { background: var(--st-blocked-dot); }
.badge-expired { color: var(--st-expired-text); background: var(--st-expired-bg); border-color: var(--st-expired-border); }
.badge-expired .badge-dot { background: var(--st-expired-dot); }
.badge-revoked { color: var(--st-revoked-text); background: var(--st-revoked-bg); border-color: var(--st-revoked-border); }
.badge-revoked .badge-dot { background: var(--st-revoked-dot); }

.log-badge { display: inline-flex; padding: 2px 8px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 600; }
.log-ok { color: var(--log-ok-text); background: var(--log-ok-bg); border: 1px solid var(--log-ok-border); }
.log-fail { color: var(--log-fail-text); background: var(--log-fail-bg); border: 1px solid var(--log-fail-border); }

/* ===== Flash ===== */
.flash { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--radius-md); font-size: 13px; }
.flash b { font-family: var(--font-mono); }
.flash-icon { font-weight: 700; }
.flash-success { background: var(--flash-success-bg); border: 1px solid var(--flash-success-border); color: var(--flash-success-text); }
.flash-error { background: var(--flash-error-bg); border: 1px solid var(--flash-error-border); color: var(--flash-error-text); }
.flash-warning { background: var(--flash-warning-bg); border: 1px solid var(--flash-warning-border); color: var(--flash-warning-text); }

/* ===== Segmented control ===== */
.segmented { display: flex; gap: 6px; background: var(--bg-subtle); border: 1px solid var(--border-hairline-2); border-radius: 9px; padding: 4px; }
.segmented label { font-size: 13px; color: var(--text-muted); padding: 6px 12px; border-radius: 6px; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; width: 0; height: 0; }
.segmented input:checked + label { color: var(--accent-text-on); font-weight: 600; background: var(--accent); }

/* ===== Table ===== */
.table-wrap { background: var(--bg-subtle); border: 1px solid var(--border-hairline); border-radius: var(--radius-card); overflow: hidden; }
.table-scroll { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; }
.data-table thead tr { background: var(--bg-panel); }
.data-table th { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--border-hairline); }
.data-table th:first-child { padding-left: 16px; }
.data-table td { padding: 13px 12px; border-bottom: 1px solid var(--border-row); font-size: 13px; color: var(--text-table-2); }
.data-table td:first-child { padding-left: 16px; }
.data-table tbody tr:hover { background: var(--bg-panel); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table a.row-link { color: var(--text-faint); text-decoration: none; font-size: 13px; }
.data-table a.row-link:hover { color: var(--text-secondary); }

.key-cell { display: flex; align-items: center; gap: 8px; }
.key-code { font-family: var(--font-mono); font-size: 13px; color: var(--text-table); font-weight: 500; }
.reveal-btn {
  font-size: 11px; color: var(--accent); background: rgba(45, 212, 167, 0.08); border: 1px solid rgba(45, 212, 167, 0.2);
  border-radius: 5px; padding: 2px 7px; cursor: pointer; font-family: inherit;
}

/* ===== Empty state ===== */
.empty-state {
  background: var(--bg-subtle); border: 1px solid var(--border-hairline); border-radius: var(--radius-card);
  padding: 64px 24px; display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center;
}
.empty-icon {
  width: 52px; height: 52px; border-radius: 13px; background: var(--bg-panel-alt); border: 1px solid var(--border-hairline-2);
  display: flex; align-items: center; justify-content: center; font-family: var(--font-mono); font-size: 22px; color: #3A3A42;
}
.empty-title { font-size: 16px; font-weight: 600; }
.empty-desc { font-size: 13px; color: var(--text-muted); margin-top: 6px; max-width: 340px; line-height: 1.6; }

/* ===== Login ===== */
.login-shell {
  min-height: 100vh; display: flex; justify-content: center; align-items: flex-start;
  padding: 96px 24px; background: var(--bg-canvas);
  background-image: radial-gradient(circle at 50% 0%, rgba(45, 212, 167, 0.05), transparent 55%);
}
.login-col { width: 380px; display: flex; flex-direction: column; gap: 24px; }
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.login-logo {
  width: 44px; height: 44px; border-radius: 11px; background: var(--accent); display: flex;
  align-items: center; justify-content: center; color: var(--accent-text-on); font-weight: 700; font-size: 22px;
}
.login-brand-name { font-size: 19px; font-weight: 600; text-align: center; }
.login-brand-sub { font-size: 13px; color: var(--text-faint); margin-top: 2px; text-align: center; }
.login-card { background: var(--bg-panel); border: 1px solid var(--border-hairline); border-radius: var(--radius-modal); padding: 26px; display: flex; flex-direction: column; gap: 16px; }
.login-step { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-faint); }
.login-step-num {
  display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent); color: var(--accent-text-on); font-size: 11px; font-weight: 700;
}
.login-footnote { text-align: center; font-size: 12px; color: var(--text-placeholder); }
.login-back { text-align: center; font-size: 12px; color: var(--text-placeholder); text-decoration: none; display: block; cursor: pointer; }
.login-back:hover { color: var(--text-muted); }

.totp-row { display: flex; gap: 8px; justify-content: space-between; }
.totp-box {
  width: 44px; height: 52px; background: var(--bg-surface); border: 1px solid var(--border-input); border-radius: var(--radius-md);
  text-align: center; font-family: var(--font-mono); font-size: 22px; color: var(--text-primary); outline: none;
}
.totp-box:focus { border-color: var(--accent); box-shadow: var(--focus-ring); }

.locked-card {
  background: var(--bg-panel); border: 1px solid rgba(240, 82, 63, 0.25); border-radius: var(--radius-modal); padding: 24px;
  display: flex; flex-direction: column; gap: 16px; align-items: center; text-align: center;
}
.locked-icon {
  width: 44px; height: 44px; border-radius: 11px; background: rgba(240, 82, 63, 0.14); border: 1px solid rgba(240, 82, 63, 0.35);
  display: flex; align-items: center; justify-content: center; color: #FF8A7F; font-size: 22px;
}
.locked-title { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.locked-desc { font-size: 13px; color: var(--text-secondary); line-height: 1.6; margin-top: 6px; }
.locked-countdown {
  width: 100%; background: var(--bg-subtle); border: 1px solid var(--border-hairline-2); border-radius: var(--radius-md);
  padding: 12px; display: flex; flex-direction: column; gap: 4px;
}
.locked-countdown-label { font-size: 11px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.06em; }
.locked-countdown-value { font-family: var(--font-mono); font-size: 20px; font-weight: 600; color: #F2BF5A; }
.locked-countdown-abs { font-size: 11px; color: var(--text-placeholder); }

/* ===== Key detail ===== */
.back-link { font-size: 13px; color: var(--text-faint); text-decoration: none; cursor: pointer; }
.back-link:hover { color: var(--text-secondary); }
.detail-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.detail-key { font-family: var(--font-mono); font-size: 22px; font-weight: 600; color: var(--accent); letter-spacing: 0.02em; }
.detail-sub { font-size: 13px; color: var(--text-muted); }
.detail-sub b { color: var(--text-secondary); }

.info-grid { background: var(--bg-subtle); border: 1px solid var(--border-hairline); border-radius: var(--radius-card); padding: 4px 20px; }
.info-grid-inner { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; }
.info-item { padding: 16px 0; border-bottom: 1px solid var(--border-row); }
.info-item:nth-last-child(-n+4) { border-bottom: none; }
.info-item-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); margin-bottom: 6px; }
.info-item-value { font-size: 14px; color: var(--text-primary); }

.danger-zone { border: 1px solid rgba(240, 82, 63, 0.28); border-radius: var(--radius-card); overflow: hidden; margin-top: 4px; }
.danger-zone-header { background: rgba(240, 82, 63, 0.06); padding: 12px 20px; border-bottom: 1px solid rgba(240, 82, 63, 0.18); display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: #FF9A90; }
.danger-zone-body { background: var(--bg-subtle); }
.danger-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--border-row); }
.danger-row:last-child { border-bottom: none; }
.danger-row-title { font-size: 14px; font-weight: 500; color: var(--text-primary); }
.danger-row-desc { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.danger-row-desc b { color: var(--text-secondary); }
.danger-row-desc b.emph { color: #FF9A90; }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(6, 6, 8, 0.72); backdrop-filter: blur(2px);
  display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal-box {
  width: 440px; max-width: 100%; background: var(--bg-panel-alt); border: 1px solid var(--border-strong); border-radius: var(--radius-modal);
  padding: 24px; display: flex; flex-direction: column; gap: 16px; box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
}
.modal-head { display: flex; align-items: center; gap: 12px; }
.modal-icon { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; }
.modal-icon-warning { background: rgba(234, 167, 45, 0.14); border: 1px solid rgba(234, 167, 45, 0.35); color: #F2BF5A; }
.modal-icon-danger { background: rgba(240, 82, 63, 0.14); border: 1px solid rgba(240, 82, 63, 0.35); color: #FF8A7F; }
.modal-title { font-size: 16px; font-weight: 600; }
.modal-desc { font-size: 13px; color: var(--text-secondary); line-height: 1.6; }
.modal-key-box { background: var(--bg-subtle); border: 1px solid var(--border-hairline-2); border-radius: var(--radius-md); padding: 12px; font-family: var(--font-mono); font-size: 14px; color: var(--text-table); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 2px; }

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .info-grid-inner { grid-template-columns: repeat(2, 1fr); }
  .info-item:nth-last-child(-n+4) { border-bottom: 1px solid var(--border-row); }
  .info-item:nth-last-child(-n+2) { border-bottom: none; }
}
