/* Shared design ---------------------------------------------------------
   The same block opens styles.css in Hide-My-Email, inventory-serverless-aws
   and wiki-serverless-aws; change it in all three. Below it each project
   styles its own page with these variables only. */

:root {
  color-scheme: light dark;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --ink: #16181d;
  --muted: #5f6673;
  --line: #e1e4e9;
  --line-strong: #cbd0d8;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-ink: #ffffff;
  --accent-soft: #eef0fe;
  --accent-text: #4338ca;
  --danger: #c0262d;
  --danger-soft: #fdecec;
  --ok: #157347;
  --ok-soft: #e2f4e9;
  --warn: #855600;
  --warn-soft: #fdf3d7;
  --overlay: rgb(15 18 25 / 50%);
  --shadow-sm: 0 1px 2px rgb(16 24 40 / 6%);
  --shadow-lg: 0 12px 32px rgb(16 24 40 / 14%), 0 2px 6px rgb(16 24 40 / 6%);
  --radius: 8px;
  --radius-lg: 12px;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #171a20;
    --surface-2: #20242c;
    --ink: #e6e8ec;
    --muted: #9aa1ad;
    --line: #2a2f38;
    --line-strong: #3b414c;
    --accent: #818cf8;
    --accent-hover: #a5b4fc;
    --accent-ink: #11132b;
    --accent-soft: #23264a;
    --accent-text: #a5b4fc;
    --danger: #f2867f;
    --danger-soft: #3a1d1d;
    --ok: #63d394;
    --ok-soft: #14301f;
    --warn: #e8c060;
    --warn-soft: #332a10;
    --overlay: rgb(0 0 0 / 60%);
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 40%);
    --shadow-lg: 0 12px 32px rgb(0 0 0 / 50%);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
}

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: 0.55; cursor: default; }

.hidden { display: none !important; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

a { color: var(--accent-text); }

h1, h2, h3, h4 { font-weight: 650; line-height: 1.25; letter-spacing: -0.01em; }

/* Fields */

input:not([type=checkbox], [type=radio], [type=file]), textarea, select {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 8px 10px;
}
input:not([type=checkbox], [type=radio], [type=file]), textarea { width: 100%; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input:not([type=checkbox], [type=radio], [type=file]):focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
textarea { line-height: 1.5; resize: vertical; }

label { display: grid; gap: 6px; font-size: 13px; font-weight: 500; color: var(--muted); }
form { display: grid; gap: 12px; }

.check { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 400; color: var(--ink); }

/* Buttons */

/* Buttons without a class in a dialog look like .ghost. */
.primary, .ghost, .danger, .dialog button:not([class]) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 7px 14px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
  text-decoration: none;
}
.primary { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.primary:hover:not(:disabled) { background: var(--accent-hover); }
.ghost, .dialog button:not([class]) { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.ghost:hover:not(:disabled), .dialog button:not([class]):hover:not(:disabled) { background: var(--surface-2); }
.danger { background: transparent; border-color: var(--line-strong); color: var(--danger); }
.danger:hover:not(:disabled) { background: var(--danger-soft); border-color: var(--danger); }

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  padding: 6px 8px;
  font-size: 14px;
}
.icon-button:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }

.link-button {
  border: 0;
  background: none;
  padding: 0;
  color: var(--accent-text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* A switch of views, e.g. list and photos. */
.seg {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: var(--radius);
  background: var(--surface-2);
}
.seg button {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 5px 12px;
  font-size: 14px;
  font-weight: 500;
}
.seg button:hover { color: var(--ink); }
.seg button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

/* Text */

.muted { color: var(--muted); }
.small { font-size: 13px; line-height: 1.45; }
.mono { font-family: var(--mono); }
.error { color: var(--danger); min-height: 1.2em; margin: 0; font-size: 14px; }
.hint { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.lede { margin: 0; color: var(--muted); line-height: 1.5; }

.demo-note {
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 14px;
  line-height: 1.45;
}

/* Top bar */

.top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 56px;
  padding: 8px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; min-width: 0; }
.brand-mark { width: 28px; height: 28px; flex: none; }
.brand strong { font-size: 16px; font-weight: 650; white-space: nowrap; }
.brand span { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who { color: var(--muted); font-size: 13px; }

/* Sign-in */

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.login-card {
  width: min(400px, 100%);
  display: grid;
  gap: 16px;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.login-mark { width: 40px; height: 40px; }
.login-card h1 { margin: 0; font-size: 22px; }
.login-card h1 + .lede { margin-top: -10px; }
.login-card .primary { width: 100%; padding-block: 9px; }
.login-card > .link-button { justify-self: start; }
/* Room for an error only once there is one. */
.login-card .error:empty { display: none; }
.login-lang { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 13px; }
.login-lang a { color: var(--muted); }
.login-lang select { margin-left: auto; }
.lang-select { width: auto; font-size: 13px; padding: 4px 8px; }

/* Dialogs */

.dialog-wrap {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 16px;
  background: var(--overlay);
}
.dialog, dialog.modal {
  width: min(440px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 20px 24px 24px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.dialog.wide { width: min(760px, 100%); }
dialog.modal::backdrop { background: var(--overlay); }
.dialog h2, .dialog h3 { margin: 0 0 8px; }
.dialog h2 { font-size: 18px; }
.dialog h3 { font-size: 15px; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.dialog-head h2 { margin: 0; }
.dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.dialog-actions.start { justify-content: flex-start; }

.tabs { display: flex; flex-wrap: wrap; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tab {
  margin-bottom: -1px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 500;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--accent); }

/* Settings */

.settings-body { display: grid; gap: 12px; }
.settings-body > p { margin: 0; }
.settings-body .lang-select { justify-self: start; min-width: 200px; font-size: 14px; padding: 7px 10px; }

fieldset.languages { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
fieldset.languages legend { font-weight: 600; margin-bottom: 8px; padding: 0; }

.totp-status, .totp-steps { margin: 0; }
.totp-steps { padding-left: 20px; display: grid; gap: 6px; }
.qr { display: block; width: 200px; height: 200px; border-radius: var(--radius); border: 1px solid var(--line); }
.totp-secret, .secret-note code {
  font-family: var(--mono);
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--ink);
  user-select: all;
  word-break: break-all;
}
.secret-note {
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  font-size: 14px;
}
.secret-note p { margin: 0 0 6px; }
.secret-note p:last-child { margin: 0; }

.invite { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.invite input[type=email] { flex: 1; min-width: 220px; width: auto; }

.table-wrap { overflow-x: auto; }
table.users { border-collapse: collapse; width: 100%; font-size: 14px; }
table.users th, table.users td { border-bottom: 1px solid var(--line); padding: 8px; text-align: left; vertical-align: middle; }
table.users th { color: var(--muted); font-size: 13px; font-weight: 600; }
table.users tr.disabled td { color: var(--muted); }
.admin-toggle { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); font-size: 13px; font-weight: 400; }
.narrow-only { display: none; }
.user-actions, td.row-actions { white-space: nowrap; text-align: right; }
.dialog :is(.user-actions, td.row-actions) button { margin-left: 4px; padding: 3px 10px; font-size: 13px; }

@media (max-width: 640px) {
  table.users thead { display: none; }
  table.users tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
  table.users td { border: 0; padding: 0; }
  .narrow-only { display: inline; }
  .user-actions, td.row-actions { grid-column: 1 / -1; text-align: left; white-space: normal; padding-top: 6px; }
  .dialog :is(.user-actions, td.row-actions) button { margin: 4px 4px 0 0; }
}

/* Badges */

.badge {
  display: inline-flex;
  gap: 6px;
  align-items: baseline;
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 12px;
  font-weight: 500;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
p > .badge { margin-right: 6px; }

/* Settings → Version: the version and the releases that came after it */

.version-facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 4px 16px;
  margin: 0 0 12px;
  font-size: 14px;
}
.version-facts dt { color: var(--muted); }
.version-facts dd { margin: 0; overflow-wrap: anywhere; }
.releases { list-style: none; margin: 8px 0 0; padding: 0; }
.releases li { padding: 10px 0; border-top: 1px solid var(--line); }
.releases .muted { font-size: 13px; }
.release-notes { margin: 6px 0 0; white-space: pre-line; font-size: 13px; color: var(--muted); }

/* Toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 40;
  transform: translateX(-50%);
  max-width: min(520px, calc(100% - 32px));
  padding: 10px 16px;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--bg);
  font-size: 14px;
  box-shadow: var(--shadow-lg);
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}

/* End of the shared design ---------------------------------------------- */

/* Scheduled search ------------------------------------------------------- */

h1, h2, h3 { margin: 0 0 12px; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
h2 .muted { font-weight: 400; font-size: 14px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px;
}

.top .brand { margin-right: auto; }
.who { display: flex; gap: 4px; align-items: center; min-width: 0; }
.who span { margin-right: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.content {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 48px;
  display: grid;
  gap: 16px;
}

.note {
  margin: 0;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 14px;
  line-height: 1.45;
}

.list-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.list-head h2 { margin: 0; }

/* The searches: one row each, the details in a dialog. */
.rows { list-style: none; margin: 0; padding: 0; }
.row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.row-main { display: grid; gap: 2px; min-width: 0; }
.row-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-stat { font-size: 12px; white-space: nowrap; display: grid; gap: 1px; justify-items: end; }
.row .ghost { padding: 4px 10px; font-size: 13px; }
.row.off .row-title { color: var(--muted); }
.row-owner { font-size: 12px; color: var(--accent-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-head .view-select { margin-left: auto; width: auto; max-width: 260px; padding: 6px 8px; font-size: 14px; }
.switch { display: flex; gap: 6px; align-items: center; font-size: 13px; white-space: nowrap; color: var(--ink); }
.status-ok { color: var(--ok); }
.status-warn { color: var(--warn); }
.status-bad { color: var(--danger); }

/* Dialogs: the head stays on top while the body scrolls. */
dialog.modal { width: min(720px, calc(100% - 24px)); padding: 0; }
.modal-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.modal-head h2 { margin: 0; font-size: 18px; overflow-wrap: anywhere; }
.modal-head .close { font-size: 20px; line-height: 1; padding: 2px 10px; }
.modal-body { display: grid; gap: 14px; padding: 18px 24px 24px; }
.modal-body > p { margin: 0; }
.modal-actions { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.actions.start { justify-content: flex-start; }

.fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.fields .wide { grid-column: 1 / -1; }
.fields select { width: 100%; }
.fields textarea { min-height: 72px; }
fieldset.group { border: 1px solid var(--line); border-radius: var(--radius); margin: 0; padding: 10px 12px; display: flex; flex-wrap: wrap; gap: 8px 16px; }
fieldset.group legend { padding: 0 4px; font-size: 13px; font-weight: 500; color: var(--muted); }
.schedule { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; color: var(--ink); font-size: 14px; }
.schedule select { width: auto; }
.days { display: flex; flex-wrap: wrap; gap: 4px; }
.day {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  padding: 3px 10px;
  font-size: 13px;
}
.day.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 4px 16px;
  margin: 0;
  font-size: 14px;
}
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }

/* Results of a preview and of a run. */
.section { display: grid; gap: 10px; padding-top: 16px; border-top: 1px solid var(--line); }
.section h3, .section p { margin: 0; }
.results { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.results li { display: grid; gap: 2px; font-size: 14px; }
.results a { font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.results a:hover { text-decoration: underline; }
.results .seen a { color: var(--muted); font-weight: 500; }
.results .meta { font-size: 12px; color: var(--muted); }
.digest {
  margin: 0;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  font-size: 14px;
  white-space: pre-line;
}
.errors { margin: 0; padding: 0 0 0 18px; font-size: 13px; color: var(--warn); }
.runs { list-style: none; margin: 0; padding: 0; }
.runs > li { border-top: 1px solid var(--line); }
.runs details { padding: 8px 0; }
.runs summary { cursor: pointer; font-size: 14px; display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.runs details > div { display: grid; gap: 10px; padding: 10px 0 4px; }

.badge .link-button { color: inherit; }
.small { margin: 0; }

/* Settings */
.settings-body p { margin: 0; }
.pair { display: grid; gap: 10px; }
.qr { width: auto; height: auto; justify-self: start; image-rendering: pixelated; }
.secret { font-size: 13px; letter-spacing: 0.05em; overflow-wrap: anywhere; }

@media (max-width: 640px) {
  .fields { grid-template-columns: 1fr; }
  .top { flex-wrap: wrap; padding: 8px 14px; }
  .brand span { display: none; }
  .who span { display: none; }
  .card { padding: 14px; }
  .row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .row .row-stat { grid-column: 2 / -1; grid-row: 2; display: flex; flex-wrap: wrap; gap: 2px 10px; justify-items: start; }
  .modal-head, .modal-body { padding-inline: 16px; }
}
