/* S3 → Dropbox operations UI. Neutral greys, one accent, semantic state colours. */
:root {
  color-scheme: light dark;
  --bg-primary: #ffffff;
  --bg-secondary: #f6f6f8;
  --bg-tertiary: #ebebef;
  --border: #e1e1e7;
  --input-border: #8a8a94; /* 3:1 against the page so empty fields are visible */
  --text: #1b1b20;
  --text-secondary: #67676f;
  --accent: #2752c4;
  --accent-strong: #1f44a6;
  --selected-bg: #e9eefb;
  --success: #1e7744;
  --error: #c0352c;
  --warning: #9a5a07;
  --error-bg: #fdf0ef;
  --warning-bg: #fdf5e8;
  --radius: 8px;
  --sans: Pretendard, "Pretendard Variable", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
    "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #131316;
    --bg-secondary: #1a1a1e;
    --bg-tertiary: #25252b;
    --border: #2d2d34;
    --input-border: #6b6b76;
    --text: #ececf0;
    --text-secondary: #9b9ba6;
    --accent: #86a6f4;
    --accent-strong: #a9c0f8;
    --selected-bg: #1e2741;
    --success: #5fc48c;
    --error: #f2847a;
    --warning: #e2aa58;
    --error-bg: #2b1817;
    --warning-bg: #2a2115;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 64px; }
body {
  margin: 0;
  background: var(--bg-primary);
  color: var(--text);
  font: 14px/1.5 var(--sans);
  letter-spacing: -0.005em;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 20px; }
h2 { font-size: 15px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
::placeholder { color: var(--text-secondary); opacity: 1; }
a.skip {
  position: absolute; left: 12px; top: -60px; z-index: 30; padding: 8px 14px;
  background: var(--bg-primary); border: 1px solid var(--accent); border-radius: var(--radius);
}
a.skip:focus { top: 8px; }
main:focus { outline: none; }

.ok { color: var(--success); }
.bad { color: var(--error); }
.wait { color: var(--warning); }
.run { color: var(--accent); }
.dim { color: var(--text-secondary); }
.mono { font-family: var(--mono); font-size: 13px; }
.ok a, .bad a, .wait a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 24px;
  padding: 0 24px; height: 48px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}
.brand { color: var(--text); font-weight: 700; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.tabs, .me { display: flex; align-items: stretch; gap: 18px; height: 100%; }
.tabs { flex: 1; overflow-x: auto; scrollbar-width: none; }
.tabs a, .me a {
  display: flex; align-items: center; white-space: nowrap;
  color: var(--text-secondary); border-bottom: 2px solid transparent;
}
.tabs a:hover, .me a:hover { color: var(--text); text-decoration: none; }
.tabs a.on, .me a.on { color: var(--accent); font-weight: 600; border-bottom-color: var(--accent); }
.me { gap: 14px; }
.me .who { color: var(--text); }
.tabs a:focus-visible, .me a:focus-visible { outline-offset: -6px; }
.segmented a:focus-visible { outline-offset: -3px; }

.testmode-banner {
  margin: 0; padding: 9px 24px; font-size: 13.5px;
  background: var(--warning-bg); color: var(--text); border-bottom: 1px solid color-mix(in srgb, var(--warning) 35%, transparent);
}
.testmode-banner strong { color: var(--warning); }

/* Page */
.page { max-width: 1240px; margin: 0 auto; padding: 20px 24px 48px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.meta { margin: 0; color: var(--text-secondary); font-variant-numeric: tabular-nums; }

.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.segmented a { padding: 5px 14px; color: var(--text-secondary); border-left: 1px solid var(--border); }
.segmented a:first-child { border-left: 0; }
.segmented a:hover { color: var(--text); background: var(--bg-secondary); text-decoration: none; }
.segmented a.on { color: var(--accent); background: var(--selected-bg); font-weight: 600; }

.banner {
  margin: 0 0 14px; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: var(--radius);
}
.banner.bad { background: var(--error-bg); border-color: color-mix(in srgb, var(--error) 30%, transparent); }
.banner.warn { background: var(--warning-bg); color: var(--warning); }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat { padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-secondary); }
.stat .n { display: block; font-size: 26px; font-weight: 650; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat .t { display: block; margin-top: 2px; color: var(--text-secondary); font-size: 13px; }
a.stat { color: var(--text); transition: border-color .15s, background-color .15s; }
a.stat:hover { text-decoration: none; border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
a.stat:active { transform: translateY(1px); }
a.stat.on { border-color: var(--accent); background: var(--selected-bg); box-shadow: inset 0 0 0 1px var(--accent); }
.filter-note { margin: -4px 0 12px; color: var(--text-secondary); }
.page-head h1 .dim { margin-left: 4px; font-size: 15px; font-weight: 500; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.page-head .meta { margin-top: 4px; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table.grid { width: 100%; border-collapse: collapse; }
.grid th {
  text-align: left; font-weight: 500; font-size: 13px; color: var(--text-secondary);
  padding: 9px 14px; background: var(--bg-secondary); border-bottom: 1px solid var(--border); white-space: nowrap;
}
.grid td { padding: 9px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid tbody tr:hover td { background: color-mix(in srgb, var(--bg-secondary) 70%, transparent); }
.grid .num { font-variant-numeric: tabular-nums; white-space: nowrap; width: 1%; }
.grid td:last-child { white-space: nowrap; width: 1%; }
.ds-cell .ds { display: block; overflow-wrap: anywhere; }
.grid td .sub { display: block; color: var(--text-secondary); font-size: 13px; }
.empty { color: var(--text-secondary); padding: 20px 4px; margin: 0; }
.empty-box { margin: 0; padding: 28px 16px; text-align: center; color: var(--text-secondary); border: 1px dashed var(--border); border-radius: var(--radius); }
.grid td.empty { text-align: center; padding: 28px 14px; }

/* Buttons and fields */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 6px 14px; border: 1px solid var(--accent); border-radius: 6px;
  background: transparent; color: var(--accent); font: inherit; font-size: 13.5px; font-weight: 550;
  cursor: pointer; transition: background-color .15s ease, color .15s ease, transform .1s ease;
}
.btn:hover { background: var(--selected-bg); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.fill { background: var(--accent); color: #fff; }
.btn.fill:hover { background: var(--accent-strong); }
@media (prefers-color-scheme: dark) { .btn.fill { color: #0f1424; } }
.btn.wide { width: 100%; padding: 9px 14px; }
button.link { min-height: 24px; padding: 0; border: 0; background: none; color: var(--text-secondary); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
button.link:hover { color: var(--text); }

.field { display: grid; gap: 6px; margin: 18px 0; }
.field label { font-weight: 550; font-size: 13px; }
input[type="text"], input[type="password"], input:not([type]), select, textarea {
  width: 100%; padding: 8px 10px; font: inherit; color: var(--text);
  background: var(--bg-primary); border: 1px solid var(--input-border); border-radius: 6px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible { outline-offset: 2px; }
.field-error { margin: 0; color: var(--error); font-size: 13px; }
.search-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }

/* Login and identity */
.gate { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.gate-card {
  width: min(420px, 100%); padding: 28px; background: var(--bg-secondary);
  border: 1px solid var(--border); border-radius: 12px;
}
.lead { margin: 8px 0 0; color: var(--text-secondary); }
.people { list-style: none; margin: 0 0 16px; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.people li + li { border-top: 1px solid var(--border); }
.person {
  display: flex; justify-content: space-between; gap: 12px; width: 100%;
  padding: 10px 12px; border: 0; background: var(--bg-primary); color: var(--text); font: inherit; cursor: pointer; text-align: left;
}
.person:hover { background: var(--selected-bg); }
.person .handle { color: var(--text-secondary); font-size: 13px; }
.skip-name { margin-top: 8px; }
.person:focus-visible { outline-offset: -3px; background: var(--selected-bg); }

/* S3 browser */
.browser-page { padding-bottom: 20px; }
.browser {
  display: grid; grid-template-columns: minmax(280px, 1.25fr) minmax(200px, 0.75fr) minmax(320px, 1fr);
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  height: calc(100dvh - 48px - 96px);
}
.col { padding: 12px; overflow-y: auto; border-right: 1px solid var(--border); min-width: 0; }
.col:last-child { border-right: 0; background: var(--bg-secondary); }
.label { margin: 4px 0 8px; color: var(--text-secondary); font-size: 13px; font-weight: 550; }
.detail .label { margin-top: 16px; }
.item { display: block; padding: 6px 8px; border-radius: 6px; color: var(--text); font-variant-numeric: tabular-nums; }
.item:hover { background: var(--bg-secondary); text-decoration: none; }
.item.sel { background: var(--selected-bg); color: var(--accent); font-weight: 600; }
.item:focus-visible, .ds-row:focus-visible { outline-offset: -2px; }
.ds-row {
  display: grid; gap: 1px; padding: 7px 10px; border-radius: 6px; color: var(--text);
  border-left: 3px solid transparent;
}
.ds-row + .ds-row { margin-top: 1px; }
.ds-row:hover { background: var(--bg-secondary); text-decoration: none; }
.ds-row.sel { background: var(--selected-bg); border-left-color: var(--accent); }
.ds-row .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ds-row .tag { color: var(--text-secondary); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.browser-page .page-head { margin-bottom: 10px; }
.list-filter { position: sticky; top: -12px; z-index: 2; margin: 0 0 8px; box-shadow: 0 0 0 6px var(--bg-primary); }
.item.date-row { display: grid; gap: 1px; padding: 7px 10px; }
.item.date-row .tag { color: var(--text-secondary); font-size: 13px; font-weight: 400; font-variant-numeric: tabular-nums; }
.item.date-row.sel .tag { color: var(--text-secondary); }
.date-jump { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.date-jump input[type="date"] { width: auto; }
.detail h2 { overflow-wrap: anywhere; }
.kv { margin: 6px 0; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.path {
  margin: 4px 0; padding: 7px 9px; border-radius: 6px; background: var(--bg-primary);
  font-family: var(--mono); font-size: 13px; overflow-wrap: anywhere;
}
.btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

/* Panels and forms (rules, settings, manual load) */
.banner.ok { background: color-mix(in srgb, var(--success) 10%, transparent); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.banner.warn { border-color: color-mix(in srgb, var(--warning) 30%, transparent); }
.banner ul { margin: 4px 0 0; padding-left: 18px; }
.banner strong { font-weight: 600; }
.panel { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-secondary); margin-bottom: 16px; }
.panel .ph {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 16px; border-bottom: 1px solid var(--border); font-weight: 600;
}
.panel .body { padding: 16px; }
.panel .body > .hint:first-child { margin-top: 0; }
.rule-form, .danger-zone, form.settings, .seed-panel { max-width: 920px; }
.row { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 12px; align-items: start; margin-bottom: 16px; }
.row:last-child { margin-bottom: 0; }
.row .k { padding-top: 8px; color: var(--text-secondary); font-size: 13px; }
.hint { margin: 4px 0 0; color: var(--text-secondary); font-size: 13px; }
.path-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; margin-bottom: 6px; }
button.link.add { color: var(--accent); text-decoration: none; }
button.link.add:hover { text-decoration: underline; }
button.link.bad { color: var(--error); }
.check { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; }
.check input { margin: 0; accent-color: var(--accent); }
.panel .body > .check { display: flex; margin: 0 0 12px; }
.choices { display: grid; gap: 6px; padding-top: 6px; }
.checks { display: flex; gap: 18px; padding-top: 7px; }
.form-actions { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }
.settings .form-actions { border-top: 0; padding: 0; }
.seed-panel { margin-top: 24px; }
#summary_times { max-width: 22em; }
/* the run button stays reachable under a long preview */
.manual-form .form-actions { position: sticky; bottom: 0; z-index: 5; background: var(--bg-secondary); border-radius: 0 0 var(--radius) var(--radius); }
.danger-zone { margin-top: 4px; }
select { appearance: auto; }
.field .label { font-weight: 550; font-size: 13px; }
.form-grid td { padding: 6px 8px; }
.form-grid tbody tr:hover td { background: transparent; }
.new-row input::placeholder { color: var(--text-secondary); }
input[type="time"] { width: auto; padding: 7px 9px; font: inherit; color: var(--text); background: var(--bg-primary); border: 1px solid var(--input-border); border-radius: 6px; }
input[type="search"] { width: 100%; padding: 8px 10px; font: inherit; color: var(--text); background: var(--bg-primary); border: 1px solid var(--input-border); border-radius: 6px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips:not(:empty) { margin-bottom: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 8px;
  border: 1px solid var(--border); border-radius: 6px; background: var(--bg-primary); font-size: 13px;
}
.chip-x { border: 0; background: none; color: var(--text-secondary); font: inherit; line-height: 1; padding: 2px 4px; cursor: pointer; border-radius: 4px; }
.chip-x:hover { color: var(--text); background: var(--bg-tertiary); }
.picker-search { position: relative; max-width: 420px; }
.picker-results {
  position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px; list-style: none;
  max-height: 260px; overflow-y: auto; background: var(--bg-primary); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 8px 24px -12px color-mix(in srgb, var(--text) 35%, transparent);
}
.picker-results [role="option"] {
  display: flex; justify-content: space-between; gap: 10px; padding: 7px 9px; border-radius: 6px; cursor: pointer;
}
.picker-results [role="option"]:hover, .picker-results [aria-selected="true"] { background: var(--selected-bg); }
.picker-results .kind { color: var(--text-secondary); font-size: 13px; }
.picker-results .empty, .folder-list .empty { padding: 8px 9px; font-size: 13px; }

.folder-dialog {
  width: min(560px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--border); border-radius: 12px;
  background: var(--bg-primary); color: var(--text);
}
.folder-dialog::backdrop { background: color-mix(in srgb, #0b0b0e 45%, transparent); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.crumbs { padding: 10px 16px; font-size: 13px; color: var(--text-secondary); overflow-wrap: anywhere; }
.crumbs button.link { color: var(--accent); text-decoration: none; }
.folder-filter { padding: 0 16px 8px; }
.folder-status { margin: 0; padding: 0 16px 6px; min-height: 1.5em; color: var(--text-secondary); font-size: 13px; }
.folder-list { list-style: none; margin: 0; padding: 4px 8px; height: min(50vh, 420px); overflow-y: auto; }
.folder-list .folder {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: 0; border-radius: 6px; background: none;
  color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.folder-list .folder::after { content: "›"; margin-left: auto; color: var(--text-secondary); }
.folder-list .folder:hover, .folder-list .folder:focus-visible { background: var(--bg-secondary); }
.folder-dialog .field-error { padding: 0 16px; }
.folder-dialog .actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border); }
.folder-dialog .actions .current { min-width: 0; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Rule list */
.toggle-cell { white-space: nowrap; }
.toggle-cell form { display: inline; margin-left: 8px; }
.state { display: inline-flex; align-items: center; gap: 6px; color: var(--text-secondary); font-size: 13px; }
.state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .55; }
.state.on { color: var(--success); font-weight: 600; }
.state.on::before { opacity: 1; }
.banner.undo { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.req { margin-left: 2px; color: var(--error); }
input[aria-invalid="true"] { border-color: var(--error); }
tr.off td { color: var(--text-secondary); }
td.mono { overflow-wrap: anywhere; }

/* Manual load and history */
.manual-form { max-width: 920px; }
.step {
  display: inline-grid; place-items: center; width: 18px; height: 18px; margin-right: 6px; border-radius: 50%;
  background: var(--bg-tertiary); color: var(--text-secondary); font-size: 13px; font-weight: 600;
}
.inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
input[type="date"] { padding: 7px 9px; font: inherit; color: var(--text); background: var(--bg-primary); border: 1px solid var(--input-border); border-radius: 6px; }
.ml { margin-left: 22px; }
.choices .path.ml { margin-top: 0; }
.dataset-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; margin-bottom: 6px; }
.hint.first { margin: 6px 0 8px; }
.chip.static { padding: 1px 8px; }
.preview { margin-top: 18px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-primary); }
.preview:focus { outline: none; }
.preview.stale > :not(.stale-note) { opacity: .45; }
.stale-note { margin: 0 0 8px; color: var(--warning); font-weight: 600; }
.plan { margin: 8px 0 0; padding-left: 18px; }
.plan li { margin: 4px 0; overflow-wrap: anywhere; }
.plan.excluded { color: var(--text-secondary); font-size: 13px; }
.filters .inline { margin-left: auto; }
input.narrow { width: 150px; }
.filters select { width: auto; }
.history td { font-size: 13px; word-break: keep-all; }
.history td .sub, .history td .mono { overflow-wrap: anywhere; }
.history .path-text { max-width: 360px; }
.history .result { min-width: 11em; }
.history .when, .history .how { white-space: nowrap; }
.more { margin-top: 4px; }
.more summary { cursor: pointer; color: var(--text-secondary); font-size: 13px; width: fit-content; }
.more summary:hover { color: var(--accent); }
.more dl { margin: 6px 0 2px; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 3px 10px; font-size: 13px; }
.more dt { color: var(--text-secondary); white-space: nowrap; }
.more dd { margin: 0; overflow-wrap: anywhere; }
.filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filters input[type="date"], .filters select { width: auto; }
.filters .clear { font-size: 13px; }
.inline-form { display: inline; margin-left: 6px; }

.files { margin: 8px 0 4px; }
.files summary { cursor: pointer; color: var(--accent); font-size: 13px; }
.files ul { margin: 6px 0 0; padding-left: 18px; max-height: 180px; overflow-y: auto; }
.files li { font-size: 13px; overflow-wrap: anywhere; }
.inline-link { margin-left: 6px; font-size: 13px; text-decoration: underline; text-underline-offset: 2px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.count { margin-left: 8px; color: var(--text-secondary); font-size: 13px; font-weight: 400; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .search { width: min(340px, 100%); }
.toolbar select { width: auto; }
.result-count { margin: -4px 0 10px; }

@media (max-width: 767px) {
  .topbar { flex-wrap: wrap; height: auto; column-gap: 14px; row-gap: 0; padding: 0 16px; }
  .brand { line-height: 44px; }
  .me { margin-left: auto; height: 44px; }
  .tabs { order: 3; flex: 1 0 100%; height: 40px; gap: 16px; }
  html { scroll-padding-top: 100px; }
  .page { padding: 16px 16px 40px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row { grid-template-columns: 1fr; gap: 4px; }
  .row .k { padding-top: 0; }
  .path-row { grid-template-columns: minmax(0, 1fr) auto; }
  .path-row [data-remove-row] { grid-column: 2; }
  /* home rows: name, then times, then the state on its own line */
  table.status-table thead { display: none; }
  table.status-table, table.status-table tbody { display: block; }
  table.status-table tr { display: grid; grid-template-columns: auto auto 1fr; column-gap: 14px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
  table.status-table tr:last-child { border-bottom: 0; }
  table.status-table td { padding: 0; border: 0; }
  table.status-table td.ds-cell, table.status-table td:last-child, table.status-table td.empty { grid-column: 1 / -1; }
  table.status-table td.num { text-align: left; color: var(--text-secondary); font-size: 13px; }
  table.status-table td.num::before { content: attr(data-label) " "; }
  table.status-table td:last-child { margin-top: 3px; }
  /* history rows become cards */
  table.history thead { display: none; }
  table.history, table.history tbody, table.history tr, table.history td { display: block; width: 100%; }
  table.history tr { padding: 12px 14px; border-bottom: 1px solid var(--border); }
  table.history tr:last-child { border-bottom: 0; }
  table.history td { padding: 2px 0; border: 0; text-align: left; }
  table.history td .sub { display: inline; margin-left: 6px; }
  table.history td.ds-cell .sub, table.history td.result .sub { display: block; margin-left: 0; }
  table.history td[data-label]::before { content: attr(data-label); display: inline-block; min-width: 6.5em; color: var(--text-secondary); font-size: 13px; }
  table.history .path-text { max-width: none; }
}

@media (forced-colors: active) {
  .tabs a.on, .me a.on, .segmented a.on, a.stat.on, .item.sel, .ds-row.sel { outline: 2px solid CanvasText; outline-offset: -2px; }
  .preview.stale > :not(.stale-note) { opacity: 1; }
}

.error-page { max-width: 560px; padding-top: 32px; }
.error-page .code { margin: 0 0 6px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.error-page .lead { margin: 8px 0 16px; color: var(--text-secondary); }

.rule-paths { margin: 4px 0 8px; padding-left: 0; list-style: none; display: grid; gap: 4px; font-size: 13px; overflow-wrap: anywhere; }

.ph h2 { font-size: 14px; font-weight: 600; }
input.time { width: 7.5em; }
.sub-note { margin: 6px 0 0; }

/* links inside sentences are underlined, not told apart by colour alone */
.kv a, .filter-note a, .banner a, .testmode-banner a, .hint a, .sub-note a, .more dd a, td .sub a { text-decoration: underline; text-underline-offset: 2px; }
.more summary { padding: 3px 0; }
.inline-link { display: inline-flex; align-items: center; min-height: 24px; }
.chip-x { min-width: 24px; min-height: 24px; }
/* rule list: names and folders wrap by word, not by syllable */
.rules-table .name-cell { min-width: 11em; word-break: keep-all; }
.rules-table .pattern-cell { min-width: 14em; }
.rules-table td.mono:not(.pattern-cell) { max-width: 16em; overflow-wrap: anywhere; }
@media (max-width: 899px) {
  .browser { grid-template-columns: 1fr; height: auto; }
  .col { border-right: 0; border-bottom: 1px solid var(--border); max-height: 50vh; }
  .col:last-child { border-bottom: 0; max-height: none; }
  .col.dates { max-height: 40vh; }
}
@media (max-width: 767px) {
  /* rule list rows become cards */
  table.rules-table thead { display: none; }
  table.rules-table, table.rules-table tbody, table.rules-table tr, table.rules-table td { display: block; width: 100%; }
  table.rules-table tr { padding: 12px 14px; border-bottom: 1px solid var(--border); }
  table.rules-table tr:last-child { border-bottom: 0; }
  table.rules-table td { padding: 2px 0; border: 0; text-align: left; max-width: none; min-width: 0; }
  table.rules-table td[data-label]::before { content: attr(data-label); display: inline-block; min-width: 6.5em; color: var(--text-secondary); font-family: var(--sans); font-size: 13px; }
  table.rules-table .toggle-cell { margin-bottom: 4px; }
}
@media (forced-colors: active) {
  .picker-results [aria-selected="true"] { outline: 2px solid Highlight; outline-offset: -2px; }
}

/* new datasets and refreshing */
.tag.new {
  display: inline-block; margin-left: 2px; padding: 0 7px; border: 1px solid transparent; border-radius: 999px;
  background: var(--selected-bg); color: var(--accent); font-size: 12px; font-weight: 600; line-height: 18px;
  vertical-align: 1px; white-space: nowrap;
}
.ds-row .tag .tag.new { margin: 0 4px 0 0; overflow: visible; }
.refresh-line .btn { margin-left: 6px; padding: 2px 10px; font-size: 13px; }
.refresh-line .btn[aria-busy="true"] { opacity: .6; cursor: progress; }

/* 사용 가이드 */
.guide { display: grid; grid-template-columns: 188px minmax(0, 1fr); gap: 36px; align-items: start; }
.guide-toc { position: sticky; top: 16px; }
.guide-toc ol { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; }
.guide-toc a { display: block; padding: 6px 10px; border-radius: 6px; color: var(--text-secondary); }
.guide-toc a:hover { background: var(--bg-secondary); color: var(--text); text-decoration: none; }
.guide-body { max-width: 760px; }
.guide-body section { margin-bottom: 28px; padding-bottom: 28px; border-bottom: 1px solid var(--border); scroll-margin-top: 16px; }
.guide-body section:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: 0; }
.guide-body h2 { margin-bottom: 10px; font-size: 18px; }
.guide-body h3 { margin: 18px 0 6px; font-size: 14px; font-weight: 650; }
.guide-body p { margin: 0 0 10px; }
.guide-body p, .guide-body li, .guide-body dd { line-height: 1.7; }
.guide-body p a, .guide-body li a { text-decoration: underline; text-underline-offset: 2px; }
.path-example { margin: 6px 0 12px; padding: 8px 10px; border-radius: 6px; background: var(--bg-secondary); overflow-wrap: anywhere; }
.path-example strong { color: var(--accent); font-weight: 650; }
.flow { margin: 14px 0 4px; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; counter-reset: flow; }
.flow li { counter-increment: flow; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-secondary); }
.flow li::before {
  content: counter(flow); display: inline-grid; place-items: center; width: 20px; height: 20px; margin-right: 6px;
  border-radius: 50%; background: var(--selected-bg); color: var(--accent); font-size: 12px; font-weight: 700; vertical-align: 1px;
}
.flow strong { font-weight: 600; }
.flow span { display: block; margin-top: 4px; color: var(--text-secondary); font-size: 13px; line-height: 1.5; }
.steps { margin: 10px 0 12px; padding-left: 20px; display: grid; gap: 8px; }
.timeline { margin: 10px 0 12px; padding: 0; list-style: none; display: grid; gap: 8px; }
.timeline li { display: grid; grid-template-columns: 10em minmax(0, 1fr); gap: 12px; }
.timeline .t { color: var(--accent); font-weight: 600; font-variant-numeric: tabular-nums; }
.screens { margin: 10px 0 0; display: grid; grid-template-columns: 6.5em minmax(0, 1fr); gap: 10px 16px; }
.screens dt { font-weight: 600; line-height: 1.7; }
.screens dd { margin: 0; }
.state-table td:first-child { white-space: nowrap; font-weight: 600; }
.state-table td:last-child { width: auto; white-space: normal; }
.faq { padding: 10px 0; border-bottom: 1px solid var(--border); }
.faq:last-child { border-bottom: 0; }
.faq summary { min-height: 24px; font-weight: 600; cursor: pointer; }
.faq p { margin: 8px 0 2px; }

@media (max-width: 899px) {
  .guide { grid-template-columns: 1fr; gap: 16px; }
  .guide-toc { position: static; }
  .guide-toc ol { display: flex; flex-wrap: wrap; gap: 6px; }
  .guide-toc a { padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; }
  .flow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .timeline li, .screens { grid-template-columns: 1fr; gap: 2px; }
  .screens dd { margin-bottom: 8px; }
}

/* group accounts */
.me .account { display: inline-flex; align-items: center; padding: 0 8px; border-radius: 999px; background: var(--selected-bg); color: var(--accent); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.gate-card .accounts { margin: 0 0 14px; padding: 0; border: 0; display: flex; gap: 16px; flex-wrap: wrap; }
.gate-card .accounts legend { margin-bottom: 6px; padding: 0; font-weight: 550; font-size: 13px; color: var(--text-secondary); }
.row p.static { margin: 0; padding-top: 8px; font-weight: 600; }
.dry-run { padding: 8px 0; border-bottom: 1px solid var(--border); }
.dry-run:last-child { border-bottom: 0; }
.dry-run pre { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font: 13px/1.5 var(--mono); }
