[hidden] { display: none !important; }
:root {
  --bg: #141414; --panel: #1d1d1d; --line: #333; --text: #f2f2f2;
  --muted: #a0a0a0; --accent: #29abe2; --bad: #ff6b6b; --good: #5fd38d;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.4 -apple-system, system-ui, "Segoe UI", sans-serif; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 17px; margin: 0 0 12px; }
.muted { color: var(--muted); }
.error { color: var(--bad); min-height: 1.4em; }
.center { min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px; padding: 16px; }
.bar { display: flex; justify-content: space-between; align-items: center;
  padding: 16px 24px; border-bottom: 1px solid var(--line); gap: 12px; flex-wrap: wrap; }
.bar-right { display: flex; align-items: center; gap: 12px; }
.panel { background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; margin: 20px auto; padding: 20px; max-width: 1100px;
  width: calc(100% - 32px); }
.grid { display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); align-items: end; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
input, select, textarea { background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; padding: 10px; font: inherit; }
input[type=color] { padding: 2px; height: 40px; width: 70px; }
input[type=checkbox] { width: 20px; height: 20px; }
.color-row { display: flex; align-items: center; gap: 10px; }
textarea { width: 100%; margin-top: 10px; font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.btn { background: var(--bg); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 16px; font: inherit; font-weight: 600; cursor: pointer; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.danger { color: var(--bad); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: .5; cursor: default; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.filters { display: flex; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.filters input { flex: 1; min-width: 200px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
td.code { font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.pill { padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.pill.unused { background: #1f3a2a; color: var(--good); }
.pill.used { background: #3a3a3a; color: var(--muted); }
td.actions { text-align: right; }
td.actions .btn { margin-left: 6px; }

.card { width: 100%; max-width: 420px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 18px; padding: 40px 32px; display: flex; flex-direction: column;
  align-items: center; gap: 12px; text-align: center; }
.card h1 { font-size: 28px; font-weight: 800; }
.card .muted { margin: 0 0 12px; }
.logo { border-radius: 22px; }
.card .error { margin: 4px 0 0; min-height: 0; }
.error:empty { display: none; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { border-radius: 8px; }
/* Google's dark-theme sign-in button */
.g-btn { display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  height: 44px; padding: 0 16px; min-width: 240px; background: #131314; color: #e3e3e3;
  border: 1px solid #8e918f; border-radius: 22px; font: 500 15px/1 Roboto, Arial, sans-serif;
  cursor: pointer; }
.g-btn:hover { background: #1f1f20; }
.g-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.g-icon { flex: none; }

.wide { grid-column: 1 / -1; }
.swatch { width: 40px; height: 40px; border-radius: 8px; border: 1px solid var(--line); flex: none; }
.color-row select { flex: 1; }
.kv { border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin: 0; }
.kv legend { color: var(--muted); font-size: 13px; padding: 0 6px; }
.kv-row { display: flex; gap: 8px; margin-bottom: 8px; }
.kv-row input { flex: 1; min-width: 0; }
.kv-row .k { max-width: 220px; }
details.group { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 12px; overflow: hidden; }
details.group > summary { cursor: pointer; padding: 12px 14px; font-weight: 700;
  display: flex; gap: 10px; align-items: baseline; list-style-position: inside; }
details.group > summary .muted { font-weight: 400; font-size: 13px; }
details.group .table-wrap { padding: 0 8px 8px; }
.chips { display: inline-flex; gap: 6px; }
.chip { background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
  padding: 1px 8px; font: 12px ui-monospace, Menlo, monospace; display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
td.comment { white-space: normal; min-width: 160px; max-width: 280px; color: var(--muted); }

select { appearance: none; -webkit-appearance: none; padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23a0a0a0' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 12px 8px; }

th.c, td.c { text-align: center; width: 64px; }
.batch { display: inline-block; min-width: 30px; padding: 2px 8px; border-radius: 6px;
  background: var(--bg); border: 1px solid var(--line); font-weight: 700;
  font-variant-numeric: tabular-nums; }
td.when { color: var(--muted); font-size: 13px; }
td.actions { width: 1%; }
.btns { display: inline-flex; gap: 6px; }
.icon-btn { position: relative; width: 34px; height: 34px; display: inline-flex;
  align-items: center; justify-content: center; padding: 0; background: var(--bg);
  color: var(--text); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.icon-btn:hover { border-color: var(--muted); }
.icon-btn.danger { color: var(--bad); }
.icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon-btn[data-tip]::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 6px);
  left: 50%; transform: translateX(-50%); background: #000; color: #fff; font-size: 12px;
  padding: 4px 8px; border-radius: 6px; white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity .12s; z-index: 5; }
.icon-btn[data-tip]:hover::after, .icon-btn[data-tip]:focus-visible::after { opacity: 1; }
.kv-row { align-items: center; }
.kv-row .t { width: 110px; flex: none; }
.vwrap { flex: 1; display: flex; gap: 8px; align-items: center; min-width: 0; }
.vwrap .v { flex: 1; min-width: 0; }
.kv-row .k { flex: none; width: 200px; }
@media (max-width: 640px) { .kv-row { flex-wrap: wrap; } .kv-row .k { width: 100%; } }

table.codes { table-layout: fixed; min-width: 960px; }
table.codes .c-batch { width: 70px; }
table.codes .c-code { width: 200px; }
table.codes .c-config { width: 230px; }
table.codes .c-status { width: 90px; }
table.codes .c-used { width: 170px; }
table.codes .c-act { width: 130px; }
table.codes td.actions { width: auto; text-align: left; }
table.codes td { overflow: hidden; text-overflow: ellipsis; }
table.codes td.actions, table.codes td.comment { overflow: visible; }
