:root {
  --radius: 8px;
}

html[data-theme="dark"], :root {
  --bg: #0f1419;
  --surface: #1a2027;
  --surface-2: #232b34;
  --border: #2e3742;
  --text: #e6eaf0;
  --muted: #8b96a5;
  --primary: #6ea8d8;
  --primary-hover: #8fbde4;
  --primary-soft: rgba(110, 168, 216, 0.14);
  --danger: #e54b4b;
  --danger-hover: #f06b6b;
  --success: #4caf50;
  --warning: #f0ad4e;
  --shadow: 0 1px 2px rgba(0,0,0,.35);
}

html[data-theme="light"] {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #f1f4f8;
  --border: #d8dee6;
  --text: #1c2230;
  --muted: #5b6776;
  --primary: #2f6fb5;
  --primary-hover: #245793;
  --primary-soft: rgba(47, 111, 181, 0.10);
  --danger: #d23535;
  --danger-hover: #b02828;
  --success: #2e8b40;
  --warning: #b56a00;
  --shadow: 0 1px 2px rgba(15,20,30,.06);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  transition: background-color .2s ease, color .2s ease;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: .8rem 1.4rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar .brand a { color: var(--text); font-weight: 600; font-size: 1.1rem; }
.topbar nav { display: flex; gap: .55rem; align-items: center; }
.topbar nav a { color: var(--muted); }
.topbar nav a:hover { color: var(--text); text-decoration: none; }

.user-menu { position: relative; display: inline-block; }

.user-pill {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  height: 32px;
  padding: 0 10px 0 12px;
  border-radius: 999px;
  font-size: .85rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  cursor: pointer;
  font-family: inherit;
  box-sizing: border-box;
  transition: background-color .15s, border-color .15s, color .15s;
}
.user-pill:hover,
.user-menu.open .user-pill { background: var(--border); border-color: var(--primary); }
.user-pill .user-name { font-weight: 500; }
.user-pill-caret {
  width: 14px; height: 14px;
  color: var(--muted);
  transition: transform .15s;
}
.user-menu.open .user-pill-caret { transform: rotate(180deg); color: var(--primary); }

.user-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 160px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  padding: .35rem;
  margin: 0;
  list-style: none;
  z-index: 50;
}
.user-dropdown[hidden] { display: none; }
.user-dropdown a[role="menuitem"],
.user-dropdown button[role="menuitem"] {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .5rem .7rem;
  border-radius: 6px;
  color: var(--text) !important;
  text-decoration: none !important;
  font-size: .9rem;
  white-space: nowrap;
  width: 100%;
  background: transparent;
  border: 0;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
}
.user-dropdown a[role="menuitem"]:hover,
.user-dropdown a[role="menuitem"]:focus,
.user-dropdown button[role="menuitem"]:hover,
.user-dropdown button[role="menuitem"]:focus {
  background: var(--surface-2);
  color: var(--primary) !important;
  outline: none;
}
.user-dropdown a[role="menuitem"].is-active {
  background: var(--surface-2);
  color: var(--primary) !important;
  font-weight: 500;
  position: relative;
}
.user-dropdown a[role="menuitem"].is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--primary);
  border-radius: 0 2px 2px 0;
}
.user-dropdown a[role="menuitem"].is-active .user-dropdown-icon { color: var(--primary); }
.user-dropdown-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--muted);
}
.user-dropdown a[role="menuitem"]:hover .user-dropdown-icon,
.user-dropdown a[role="menuitem"]:focus .user-dropdown-icon,
.user-dropdown button[role="menuitem"]:hover .user-dropdown-icon,
.user-dropdown button[role="menuitem"]:focus .user-dropdown-icon { color: var(--primary); }
.user-dropdown-form { margin: 0; }
.user-dropdown-sep {
  height: 1px;
  background: var(--border);
  margin: .3rem .25rem;
  list-style: none;
}

.container {
  max-width: 1100px;
  margin: 1.5rem auto;
  padding: 0 1.2rem;
}

.footer {
  text-align: center;
  padding: 1.2rem;
  color: var(--muted);
  font-size: .85rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
  margin-bottom: 1.2rem;
}
.card h2 { margin: 0 0 .8rem; font-size: .95rem; }
.card h3 { margin: 1rem 0 .5rem; font-size: 1rem; color: var(--muted); }

.row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.big-ip {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.5rem;
  margin: .25rem 0 .8rem;
  color: var(--text);
  font-weight: 600;
  letter-spacing: .01em;
}

.version-info { text-align: right; }

.query-form {
  display: flex; gap: .5rem; flex-wrap: wrap; align-items: center;
}
.query-form input[type="text"] {
  flex: 1; min-width: 240px;
}

input[type="text"], input[type="password"], input[type="file"] {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: .55rem .75rem;
  border-radius: var(--radius);
  font-size: .95rem;
  width: 100%;
}
input[type="text"]:focus, input[type="password"]:focus {
  outline: none;
  border-color: var(--primary);
}

label { display: block; margin: .4rem 0; font-size: .9rem; color: var(--muted); }
label.inline { display: inline-flex; align-items: center; gap: .35rem; color: var(--text); }

.btn {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: .55rem 1rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: .9rem;
}
.btn:hover { background: var(--border); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); color: #fff; }
.btn-ghost { background: transparent; }
.btn-small { padding: .35rem .65rem; font-size: .8rem; }

.tabs {
  display: flex; gap: .25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}
.tab {
  background: transparent;
  color: var(--muted);
  border: none;
  padding: .55rem 1rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  font-size: .92rem;
}
.tab.active {
  color: var(--text);
  border-bottom-color: var(--primary);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.map-container {
  height: 480px;
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  overflow: hidden;
}
.map-container .leaflet-container {
  height: 100%;
  width: 100%;
  background: var(--surface-2);
  font-family: inherit;
}
.leaflet-popup-content-wrapper {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  padding: 0;
}
.leaflet-popup-tip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 0;
  border-left: 0;
  box-shadow: none;
}
.leaflet-popup-content {
  margin: 0;
  line-height: 1.45;
  width: auto !important;
}
.leaflet-popup-close-button {
  color: var(--text-muted) !important;
  padding: 6px 8px 0 0 !important;
  font-size: 18px !important;
}
.leaflet-popup-close-button:hover { color: var(--text) !important; }
.leaflet-control-attribution {
  background: rgba(255, 255, 255, 0.85) !important;
  color: #333 !important;
}
.leaflet-control-attribution a { color: var(--primary) !important; }

.geoip-popup .pp { font-family: inherit; min-width: 220px; }
.geoip-popup .pp-head {
  padding: 12px 14px 10px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-strong, var(--primary)) 100%);
  color: #fff;
  border-radius: 12px 12px 0 0;
}
.geoip-popup .pp-ip {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.2px;
  font-variant-numeric: tabular-nums;
  word-break: break-all;
}
.geoip-popup .pp-loc {
  margin-top: 4px;
  font-size: 12.5px;
  opacity: 0.92;
  display: flex;
  align-items: center;
  gap: 6px;
}
.geoip-popup .pp-flag { font-size: 15px; line-height: 1; }
.geoip-popup .pp-body { padding: 10px 14px 12px; }
.geoip-popup .pp-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
  font-size: 12.5px;
  border-bottom: 1px dashed var(--border);
}
.geoip-popup .pp-row:last-child { border-bottom: 0; }
.geoip-popup .pp-k {
  color: var(--text-muted);
  flex-shrink: 0;
  font-weight: 500;
}
.geoip-popup .pp-v {
  color: var(--text);
  text-align: right;
  word-break: break-word;
}
@media (max-width: 720px) {
  .map-container { height: 360px; }
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .8rem;
}
.info-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .6rem .8rem;
}
.info-item .k { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; }
.info-item .v { font-size: 1rem; word-break: break-word; }

.map-container { height: 420px; border-radius: var(--radius); border: 1px solid var(--border); }

.raw {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  overflow-x: auto;
  font-size: .85rem;
}

.history-list {
  list-style: none; margin: 0; padding: 0;
}
.history-list li {
  display: flex;
  justify-content: space-between;
  padding: .6rem .8rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.history-list li:hover { background: var(--surface-2); }
.history-list li:last-child { border-bottom: none; }
.history-list .ip { font-family: ui-monospace, monospace; color: var(--text); }
.history-list .meta { color: var(--muted); font-size: .82rem; }

.flashes { margin-bottom: 1rem; }
.flash {
  padding: .65rem 1rem;
  border-radius: var(--radius);
  margin-bottom: .5rem;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.flash-success { border-color: var(--success); }
.flash-danger  { border-color: var(--danger); }
.flash-warning { border-color: var(--warning); }
.flash-info    { border-color: var(--primary); }

.login-card {
  max-width: 380px;
  margin: 4rem auto;
  padding: 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.login-card h1 { margin: 0 0 .25rem; }
.login-card form button { width: 100%; margin-top: .8rem; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: .5rem;
}
.data-table th, .data-table td {
  text-align: left;
  padding: .55rem .65rem;
  border-bottom: 1px solid var(--border);
  font-size: .9rem;
  vertical-align: middle;
}
.data-table th { color: var(--muted); font-weight: 500; font-size: .78rem; text-transform: uppercase; }
.data-table .actions { display: flex; gap: .35rem; flex-wrap: wrap; align-items: center; }

.badge {
  background: var(--surface-2);
  padding: .15rem .55rem;
  border-radius: 999px;
  font-size: .75rem;
  border: 1px solid var(--border);
}
.badge-active { background: var(--success); border-color: var(--success); color: #fff; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: .8rem;
}
.form-inline {
  display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-top: .5rem;
}
.form-inline input[type="text"], .form-inline input[type="password"] { width: auto; flex: 1; min-width: 160px; }

.icon-btn {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  width: 32px; height: 32px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .82rem;
  font-weight: 600;
  padding: 0;
  text-decoration: none !important;
  transition: background-color .15s, border-color .15s, color .15s;
}
.icon-btn:hover { background: var(--border); color: var(--primary); border-color: var(--primary); }

.theme-icon-light, .theme-icon-dark { display: none; width: 16px; height: 16px; }
html[data-theme="dark"]  .theme-icon-light { display: block; }
html[data-theme="light"] .theme-icon-dark  { display: block; }

.lang-pill {
  display: inline-flex;
  align-items: center;
  gap: 0;
  height: 32px;
  padding: 3px;
  margin: 0;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  text-decoration: none !important;
  cursor: pointer;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: .85rem;
  line-height: 1;
  box-sizing: border-box;
  vertical-align: middle;
}
.lang-pill:hover { border-color: var(--primary); text-decoration: none; }
.lang-pill .lang-seg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 24px;
  min-width: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 500;
  color: var(--muted);
  line-height: 1;
  box-sizing: border-box;
  transition: background-color .15s ease, color .15s ease;
}
.lang-pill .lang-seg.is-active {
  background: var(--border);
  color: var(--text);
}

.card, .data-table th, .info-item, .raw, .flash, .login-card, .topbar, .footer, .badge, .btn, .icon-btn, .lang-pill,
input[type="text"], input[type="password"], input[type="file"] {
  transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}

html[data-theme="light"] .raw { background: var(--surface-2); }
html[data-theme="light"] .badge { color: var(--text); }
html[data-theme="light"] .badge-active { color: #fff; }

.input-wrap {
  position: relative;
  flex: 1;
  min-width: 240px;
  display: flex;
}
.input-wrap > input[type="text"] {
  padding-right: 2.2rem;
}
.input-clear {
  position: absolute;
  right: .35rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 999px;
  border: none;
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.input-clear:hover { background: var(--border); color: var(--text); }
.input-clear[hidden] { display: none; }

.reset-form {
  display: inline-flex;
  align-items: stretch;
  gap: 0;
  flex-wrap: nowrap;
}
.reset-form input[type="password"] {
  width: auto;
  min-width: 130px;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-right: none;
}
.reset-form .btn {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  white-space: nowrap;
}
.delete-form {
  display: inline-flex;
  margin-left: .9rem;
}
.data-table .actions { gap: 0; flex-wrap: nowrap; }
@media (max-width: 720px) {
  .data-table .actions { flex-wrap: wrap; gap: .4rem; }
  .delete-form { margin-left: 0; }
}

.form-grid .full-row { grid-column: 1 / -1; }

.admin-shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1.5rem;
  align-items: start;
}
.admin-sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  position: sticky;
  top: 1rem;
}
.admin-sidebar-title {
  display: flex;
  align-items: center;
  gap: .55rem;
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .02em;
  color: var(--text);
  padding: .15rem .25rem .75rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: .65rem;
}
.admin-sidebar-bar {
  width: 3px;
  height: 1em;
  background: var(--primary);
  border-radius: 2px;
  flex-shrink: 0;
}
.admin-sidebar-text { white-space: nowrap; }
.admin-nav { display: flex; flex-direction: column; gap: .15rem; }
.admin-nav-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .55rem .7rem;
  border-radius: 6px;
  color: var(--text);
  font-size: .92rem;
  text-decoration: none !important;
  border: 1px solid transparent;
}
.admin-nav-item:hover { background: var(--surface-2); }
.admin-nav-item.active {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--primary);
  font-weight: 600;
}
.admin-nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--muted);
}
.admin-nav-item.active .admin-nav-icon,
.admin-nav-item:hover .admin-nav-icon { color: var(--primary); }
.admin-main { min-width: 0; }
.admin-main .card:last-child { margin-bottom: 0; }

@media (max-width: 800px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-sidebar { position: static; }
  .admin-nav { flex-direction: row; flex-wrap: wrap; }
  .admin-nav-item { flex: 1; min-width: 0; justify-content: center; }
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: .9rem;
}
.card-head h2 { margin: 0; }
.card-head .card-sub {
  margin: .25rem 0 0;
  font-size: .85rem;
  line-height: 1.5;
  max-width: 60ch;
}
.card-head > div:first-child { min-width: 0; flex: 1; }
.card-head > div:first-child .card-sub { max-width: none; }

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: .25rem;
}
.data-table { margin-top: 0; }
.data-table th, .data-table td { border-bottom: 1px solid var(--border); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table thead th {
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  letter-spacing: .04em;
}
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table tbody tr.row-muted td { opacity: .55; }
.data-table td.nowrap, .data-table th.nowrap { white-space: nowrap; }
.data-table .col-id { width: 56px; }
.data-table .col-status { width: 110px; }
.data-table .col-created { width: 170px; white-space: nowrap; }
.data-table .col-actions { width: 1%; white-space: nowrap; }
.data-table .empty-row { text-align: center; padding: 2rem 1rem; }

.versions-table { table-layout: fixed; width: 100%; }
.versions-table .col-name { width: 180px; }
.versions-table .col-folder { width: 110px; }
.versions-table .col-note { width: auto; }
.versions-table .col-created { width: 180px; padding-right: 1rem; }
.versions-table .col-status { width: 96px; text-align: center; }
.versions-table .col-actions { width: 110px; }
.versions-table th.col-status { text-align: center; }
.versions-table td.col-folder .ellipsis,
.versions-table td.col-note .ellipsis {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.versions-table .col-name strong { display: inline-block; vertical-align: middle; font-size: .88rem; }
.versions-table .id-badge { margin-left: .45rem; opacity: .55; }

.users-table { width: 100%; }
.users-table .reset-form input[type="password"] { min-width: 140px; }

.version-delete-form {
  display: inline-flex;
  align-items: center;
  margin-left: .4rem;
}
.btn.icon-only {
  width: 28px;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
}
.tiny { font-size: .72rem; }

.upload-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.upload-form .form-row {
  display: grid;
  gap: .8rem;
}
.upload-form .form-row.two-col {
  grid-template-columns: 1fr 1fr;
}
.upload-form label:not(.inline) { display: flex; flex-direction: column; gap: .3rem; }
.upload-form .lbl {
  font-size: .78rem;
  color: var(--muted);
  font-weight: 500;
}
.file-group {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 1rem 1.1rem .9rem;
  display: flex;
  flex-direction: column;
  gap: .7rem;
  background: color-mix(in srgb, var(--surface-2) 50%, transparent);
}
.file-group legend {
  padding: 0 .4rem;
  font-size: .82rem;
  color: var(--muted);
  font-weight: 600;
}
.file-row {
  display: grid !important;
  grid-template-columns: 90px 1fr;
  align-items: center;
  gap: .8rem !important;
}
.file-row .lbl { font-weight: 500; color: var(--text); }
.file-row input[type="file"] {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .35rem .5rem;
  font-size: .85rem;
}
.form-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding-top: .4rem;
  border-top: 1px solid var(--border);
  margin-top: .3rem;
  padding-top: 1rem;
}

.add-user-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto auto;
  gap: .8rem;
  align-items: end;
}
.add-user-form label:not(.inline) { display: flex; flex-direction: column; gap: .3rem; }
.add-user-form .lbl {
  font-size: .78rem;
  color: var(--muted);
  font-weight: 500;
}
.add-user-form .checkbox-label { padding-bottom: .55rem; }
.add-user-form > button[type="submit"] { align-self: end; margin-bottom: 7px; }

@media (max-width: 900px) {
  .upload-form .form-row.two-col { grid-template-columns: 1fr; }
  .add-user-form { grid-template-columns: 1fr; }
  .add-user-form .checkbox-label { padding-bottom: 0; }
  .form-foot { flex-direction: column; align-items: stretch; }
  .form-foot .btn { width: 100%; }
}
.versions-table .col-folder { display: none; }
@media (min-width: 1300px) {
  .versions-table .col-folder { display: table-cell; }
}

.new-key-banner {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid #f59e0b;
  border-radius: 6px;
  padding: .75rem .9rem;
  margin-bottom: 1rem;
}
.new-key-warning {
  font-size: .82rem;
  color: #d97706;
  margin-bottom: .5rem;
  font-weight: 500;
}
[data-theme="dark"] .new-key-warning { color: #fbbf24; }
.new-key-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .4rem .55rem;
}
.new-key-value {
  flex: 1;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .82rem;
  word-break: break-all;
  color: var(--text);
  background: transparent;
  border: 0;
}
.new-key-meta { margin-top: .4rem; }

.keys-create-form {
  grid-template-columns: 1fr auto !important;
  margin-bottom: 1rem;
}
.keys-table { table-layout: auto; width: 100%; }
.keys-table .col-prefix { width: 110px; }
.keys-table .col-calls { width: 60px; text-align: right; }
.keys-table .col-created { width: 132px; white-space: nowrap; }
.keys-table .col-status { width: 88px; }
.keys-table .col-actions { width: 80px; }
.keys-table td.col-calls, .keys-table td.small { text-align: right; }
.keys-table th, .keys-table td { padding-left: .5rem; padding-right: .5rem; }
.keys-table th:first-child, .keys-table td:first-child { padding-left: .75rem; }
.keys-table th:last-child, .keys-table td:last-child { padding-right: .75rem; }

.key-stats {
  display: flex;
  gap: .8rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.key-stat {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .55rem .8rem;
  display: flex;
  flex-direction: column;
  gap: .1rem;
  min-width: 100px;
}
.key-stat strong { font-size: 1.15rem; }

.key-usage {
  margin-top: 1rem;
  padding-top: .8rem;
  border-top: 1px solid var(--border);
}
.usage-snippet {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .55rem .7rem;
  margin: .4rem 0 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .78rem;
  overflow-x: auto;
  color: var(--text);
}

@media (max-width: 900px) {
  .keys-create-form { grid-template-columns: 1fr !important; }
}
