@font-face {
  font-family: "Inter";
  src: url("fonts/inter-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

/* Same tokens as docker-calendar, so the two look like one family. */
:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #f1f1ee;
  --line: #e4e3df;
  --text: #1c1c1e;
  --muted: #6c6c70;
  --accent: #3e63dd;
  --accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
  --accent-ink: #ffffff;
  --danger: #dc3e42;
  --ok: #287c3d;
  --shadow-1: 0 1px 2px rgb(0 0 0 / 0.06), 0 1px 1px rgb(0 0 0 / 0.04);
  --radius: 12px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141519;
    --surface: #1b1c21;
    --surface-2: #23242a;
    --line: #2d2e35;
    --text: #ececf0;
    --muted: #9b9ca5;
    --accent: #7090ff;
    --accent-ink: #0d1020;
    --danger: #ff6369;
    --ok: #5fc274;
    --shadow-1: 0 1px 2px rgb(0 0 0 / 0.4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "cv11", "ss01";
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; letter-spacing: -0.02em; margin: 8px 0 16px; }
h2 { font-size: 16px; margin: 0 0 12px; }
p { margin: 0 0 12px; }
code, .mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13.5px; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }

/* ---------- layout ---------- */

.topbar {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; margin-right: 12px; color: var(--text); }
.topbar .brand img { width: 28px; height: 28px; }
.topbar nav { display: flex; gap: 2px; flex-wrap: wrap; flex: 1; }
.topbar nav a { padding: 7px 12px; border-radius: 8px; color: var(--muted); font-weight: 550; }
.topbar nav a:hover { background: var(--surface-2); text-decoration: none; }
.topbar nav a.active { color: var(--accent); background: var(--accent-soft); }
main { max-width: 860px; margin: 0 auto; padding: 16px 16px 48px; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-1); padding: 16px; margin-bottom: 16px;
}
.card.danger-zone { border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.section-title { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 24px 0 8px; }
.section-title h2 { margin: 0; }

.list { list-style: none; margin: 0; padding: 0; }
.list li {
  display: flex; align-items: center; gap: 12px; padding: 10px 0;
  border-top: 1px solid var(--line);
}
.list li:first-child { border-top: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .title { font-weight: 600; overflow-wrap: anywhere; }
.list .sub { color: var(--muted); font-size: 13.5px; }
.dot { width: 14px; height: 14px; border-radius: 4px; flex: none; background: var(--muted); }
.dot.round { border-radius: 50%; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.inline { display: inline; }

/* ---------- forms ---------- */

.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 13.5px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=password], input[type=url], input[type=file], input[type=search], select {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface-2);
}
input[type=file] { padding: 7px 10px; height: auto; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.row > input, .row > select { flex: 1; min-width: 140px; width: auto; }
.choice { display: flex; gap: 8px; align-items: flex-start; margin: 6px 0; }
.choice input { margin-top: 3px; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.swatches label { cursor: pointer; }
.swatches input { position: absolute; opacity: 0; pointer-events: none; }
.swatches span { display: block; width: 28px; height: 28px; border-radius: 8px; border: 2px solid transparent; }
.swatches input:checked + span { border-color: var(--text); }
.swatches input:focus-visible + span { outline: 2px solid var(--accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 14px; border-radius: 10px; border: 0;
  font-weight: 600; font-size: 14.5px; cursor: pointer;
  background: var(--surface-2); color: var(--text); white-space: nowrap;
}
.btn:hover { text-decoration: none; background: color-mix(in srgb, var(--surface-2) 85%, var(--text)); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, black); }
.btn.danger { color: var(--danger); }
.btn.small { height: 30px; padding: 0 10px; font-size: 13.5px; }
.btn.wide { width: 100%; height: 44px; }

.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 12px; font-weight: 550; }
.flash.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.flash.error { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }

.secret {
  display: block; padding: 12px; border-radius: 10px; background: var(--surface-2);
  font-size: 18px; letter-spacing: 0.04em; user-select: all; overflow-wrap: anywhere;
}
.copyable { display: block; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); user-select: all; overflow-wrap: anywhere; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 16px; }
details summary { cursor: pointer; color: var(--muted); font-weight: 600; margin: 8px 0; }
table { width: 100%; border-collapse: collapse; }
td, th { text-align: left; padding: 6px 8px 6px 0; border-top: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 13px; font-weight: 600; border-top: 0; }

/* ---------- login ---------- */

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 360px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px 24px; box-shadow: var(--shadow-1); }
.login-card h1 { text-align: center; margin: 12px 0 20px; font-size: 20px; }
.login-icon { display: block; margin: 0 auto; }
.login-error { color: var(--danger); font-weight: 550; }

.import-bar { display: block; width: 100%; height: 10px; accent-color: var(--accent); }
form:not(:has(input.existing:checked)) .duplicates { display: none; }
.target-section:not(:has(input[value="new"]:checked)) .new-fields { display: none; }
.target-section + .target-section { margin-top: 20px; }

.contents-bar { justify-content: space-between; margin-bottom: 8px; }
.contents-search { flex: 1 1 180px; max-width: 280px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab {
  border: 0; background: none; padding: 7px 12px; border-radius: 8px; cursor: pointer;
  font: inherit; font-weight: 550; color: var(--muted);
}
.tab:hover { background: var(--surface-2); }
.tab[aria-selected="true"] { color: var(--accent); background: var(--accent-soft); }
.tab .count { font-size: 12px; opacity: 0.8; margin-left: 2px; }
.entries { max-height: 65vh; overflow-y: auto; }
.entries li { display: block; padding: 0; }
.entries li[hidden] { display: none; }
.entries .entry, .entries summary {
  display: flex; align-items: center; gap: 12px; padding: 10px 0; list-style: none;
}
.entries summary { cursor: pointer; margin: 0; color: inherit; font-weight: inherit; }
.entries summary::-webkit-details-marker { display: none; }
.entries .empty { padding: 10px 0; }
.entries .side { color: var(--muted); font-size: 13.5px; white-space: nowrap; }
.entries .side.late { color: var(--danger); font-weight: 600; }
.entries .check { color: var(--muted); }
.entry-details {
  display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px;
  margin: 0 0 12px; font-size: 14px;
}
.entry-details dt { color: var(--muted); }
.entry-details dd { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.duplicates { margin-top: 20px; }
