/* googleadschangehistory.com — styled after the Google Ads "Change history" screen.
   Values taken from the Google Ads design tokens (acx-sys-color) and Material chip/table specs. */

:root {
  --primary: #1a73e8;
  --primary-hover: #174ea6;
  --on-primary-container: #1967d2;
  --primary-container: #e8f0fe;
  --primary-container-hover: rgba(25, 103, 210, .04);
  --text: #202124;
  --text-2: #3c4043;
  --text-3: #5f6368;
  --text-disabled: rgba(60, 64, 67, .38);
  --hairline: #dadce0;
  --surface: #ffffff;
  --surface-variant: #f1f3f4;
  --surface-2: #f8f9fa;
  --surface-hover: rgba(60, 64, 67, .04);
  --bg: #ffffff;
  --red: #d93025;
  --green: #188038;
  --yellow: #f9ab00;
  --shadow-1: 0 1px 2px 0 rgba(60, 64, 67, .3), 0 1px 3px 1px rgba(60, 64, 67, .15);
  --shadow-2: 0 1px 3px 0 rgba(60, 64, 67, .3), 0 4px 8px 3px rgba(60, 64, 67, .15);
  --font-display: "Google Sans Flex", "Google Sans", Roboto, Arial, sans-serif;
  --font-body: Roboto, Arial, sans-serif;
  --rail-w: 104px;
  color-scheme: light;
}

html[data-theme="dark"] {
  --primary: #a8c7fa;
  --primary-hover: #d3e3fd;
  --on-primary-container: #a8c7fa;
  --primary-container: #1f3a5f;
  --primary-container-hover: rgba(168, 199, 250, .08);
  --text: #e3e3e3;
  --text-2: #c4c7c5;
  --text-3: #9aa0a6;
  --text-disabled: rgba(228, 228, 228, .38);
  --hairline: #444746;
  --surface: #1f1f1f;
  --surface-variant: #2d2e30;
  --surface-2: #28292a;
  --surface-hover: rgba(232, 234, 237, .06);
  --bg: #131314;
  --red: #f28b82;
  --green: #81c995;
  --shadow-1: 0 1px 2px 0 rgba(0, 0, 0, .5), 0 1px 3px 1px rgba(0, 0, 0, .3);
  --shadow-2: 0 1px 3px 0 rgba(0, 0, 0, .5), 0 4px 8px 3px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 14px/20px var(--font-body);
  color: var(--text-2);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  min-width: 360px;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); text-decoration: underline; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, select { font: inherit; }
.ms {
  font-family: "Material Symbols Outlined";
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  direction: ltr;
  -webkit-font-feature-settings: "liga";
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
  user-select: none;
}
.ms.fill { font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- Top app bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: 64px;
  display: flex; align-items: center;
  padding: 0 16px 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--hairline);
}
.menu-btn {
  width: 48px; height: 48px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-variant); color: var(--text-2);
  margin-right: 12px; flex: none;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font: 400 22px/28px var(--font-display); color: var(--text-3);
  white-space: nowrap; flex: none; margin-right: 32px;
}
.brand:hover { text-decoration: none; }
.brand .logo { width: 32px; height: 32px; display: block; }
.brand b { font-weight: 500; color: var(--text-2); }
.search {
  flex: 0 1 660px; min-width: 220px; margin: 0 24px 0 auto; height: 48px;
  border: 1px solid var(--hairline); border-radius: 8px;
  display: flex; align-items: center; gap: 12px; padding: 0 14px;
  background: var(--surface); color: var(--text-3);
}
.search:focus-within { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.search input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  font: 16px/24px var(--font-body); color: var(--text);
}
.search input::placeholder { color: var(--text-3); }
.search .clear { display: none; color: var(--text-3); }
.search.has-q .clear { display: inline-flex; }
.topbar-actions { display: flex; align-items: flex-start; gap: 2px; margin-left: auto; flex: none; }
.tb-action {
  display: flex; flex-direction: column; align-items: center;
  width: 78px; padding: 6px 0 4px; border-radius: 8px;
  font-size: 12px; line-height: 16px; color: var(--text-3);
  position: relative; text-decoration: none;
}
.tb-action:hover { background: var(--surface-hover); color: var(--text-2); text-decoration: none; }
.tb-action .ms { font-size: 24px; margin-bottom: 2px; color: var(--text-2); }
.tb-action .badge {
  position: absolute; top: 2px; left: calc(50% + 4px);
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: var(--red); color: #fff; font: 500 11px/16px var(--font-body);
  border: 2px solid var(--surface); box-sizing: content-box;
}
.tb-action .beta {
  position: absolute; top: -2px; right: 4px;
  font: 500 9px/12px var(--font-body); color: var(--green); letter-spacing: .3px;
}
.account {
  display: flex; align-items: center; margin-left: 12px; padding-left: 16px;
  border-left: 1px solid var(--hairline); flex: none;
}
.account .who { text-align: right; font-size: 12px; line-height: 16px; color: var(--text-3); }
.account .who b { display: block; font-weight: 400; color: var(--text-2); }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; margin-left: 12px; flex: none;
  background: linear-gradient(135deg, #4285f4, #34a853); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font: 500 14px var(--font-display);
}

/* ---------- Left rail ---------- */
.rail {
  position: fixed; left: 0; top: 64px; bottom: 0; width: var(--rail-w); z-index: 20;
  display: flex; flex-direction: column; align-items: center;
  padding-top: 16px; gap: 2px; background: var(--surface);
  overflow-y: auto;
}
.rail .create {
  display: flex; flex-direction: column; align-items: center;
  font-size: 12px; color: var(--text-3); margin-bottom: 12px; text-decoration: none;
}
.rail .create .circle {
  width: 72px; height: 72px; border-radius: 50%; margin-bottom: 8px;
  background: var(--surface); box-shadow: var(--shadow-2);
  display: flex; align-items: center; justify-content: center;
}
.rail .create .circle svg { width: 36px; height: 36px; }
.rail .item {
  display: flex; flex-direction: column; align-items: center;
  width: 88px; padding: 6px 0 8px; border-radius: 8px;
  font-size: 12px; line-height: 16px; color: var(--text-3); text-decoration: none;
}
.rail .item .ms {
  width: 56px; height: 32px; border-radius: 16px; margin-bottom: 4px;
  display: flex; align-items: center; justify-content: center; color: var(--text-2);
  position: relative;
}
.rail .item:hover .ms { background: var(--surface-hover); }
.rail .item.active { color: var(--primary); }
.rail .item.active .ms { background: var(--primary-container); color: var(--on-primary-container); font-variation-settings: "FILL" 1; }
.rail .item .dot {
  position: absolute; top: 4px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--red);
}

/* ---------- Main ---------- */
.main { margin-left: var(--rail-w); padding: 16px 24px 40px; min-height: calc(100vh - 64px); }
.scope-row { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 12px; flex-wrap: wrap; }
.scope-btn {
  min-width: 200px; padding: 6px 12px 8px; text-align: left;
  border: 1px solid var(--hairline); border-radius: 8px; background: var(--surface);
  box-shadow: var(--shadow-1); position: relative; overflow: hidden;
}
.scope-btn .eyebrow { font-size: 12px; line-height: 16px; color: var(--text-3); letter-spacing: .3px; }
.scope-btn .val { display: flex; align-items: center; gap: 8px; font: 400 16px/24px var(--font-display); color: var(--text); }
.scope-btn .val .ms { font-size: 22px; color: var(--text-2); }
.scope-btn .val .caret { margin-left: auto; color: var(--text-3); }
.scope-btn.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--primary); }
.scope-btn.plain { box-shadow: none; }
.save-btn { margin-left: auto; }

.filters-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; color: var(--text-3); }
.filters-row .label { font-size: 14px; margin-right: 8px; }
.pill {
  height: 32px; padding: 0 8px 0 12px; border: 1px solid var(--hairline); border-radius: 16px;
  display: inline-flex; align-items: center; gap: 4px; background: var(--surface);
  font: 14px/20px var(--font-body); color: var(--text-2); white-space: nowrap;
}
.pill b { font-weight: 400; color: var(--text); }
.pill .x { font-size: 18px; color: var(--text-3); margin-left: 2px; border-radius: 50%; }
.pill .x:hover { background: var(--surface-hover); color: var(--text); }
.pill.ghost { border: 0; color: var(--text-3); padding: 0 8px; }
.pill.ghost:hover { color: var(--text-2); background: var(--surface-hover); }

.page-head { display: flex; align-items: center; gap: 16px; margin: 4px 0 16px; flex-wrap: wrap; }
h1.title { font: 400 28px/36px var(--font-display); color: var(--text); margin: 0; }
.date-controls { margin-left: auto; display: flex; align-items: center; gap: 8px; position: relative; }
.range-label { color: var(--text-3); font: 400 16px var(--font-display); margin-right: 8px; }
.range-btn {
  height: 48px; padding: 0 8px 0 16px; border: 1px solid var(--hairline); border-radius: 8px;
  display: inline-flex; align-items: center; gap: 12px; background: var(--surface);
  font: 400 16px var(--font-display); color: var(--text);
}
.range-btn:hover { background: var(--surface-hover); }
.range-btn .ms { color: var(--text-2); }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-2);
}
.icon-btn:hover { background: var(--surface-hover); }
.icon-btn:disabled { color: var(--text-disabled); }
.text-btn {
  height: 36px; padding: 0 8px; border-radius: 4px;
  font: 500 15px var(--font-display); color: var(--primary); letter-spacing: .1px;
}
.text-btn:hover { background: var(--primary-container-hover); color: var(--primary-hover); }
.text-btn.lg { font-size: 16px; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--hairline); border-radius: 8px; margin-bottom: 16px; }
.overview { padding: 24px 32px 16px; }
.overview.collapsed .ov-body { display: none; }
.overview-head { display: flex; align-items: center; }
.overview-head h2 { font: 400 16px/24px var(--font-display); color: var(--text); margin: 0; }
.overview-head .icon-btn { margin-left: auto; }
.overview.collapsed .overview-head .ms { transform: rotate(180deg); }
.tabs { display: flex; gap: 32px; border-bottom: 1px solid var(--hairline); margin: 24px 0 0; }
.tab {
  padding: 12px 4px 10px; margin-bottom: -1px;
  font: 500 16px var(--font-display); color: var(--text-3); letter-spacing: .1px;
  border-bottom: 3px solid transparent;
}
.tab:hover { color: var(--text-2); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.ov-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.ov-table th { text-align: left; font-weight: 500; color: var(--text-2); padding: 14px 8px; border-bottom: 1px solid var(--hairline); }
.ov-table td { padding: 12px 8px; border-bottom: 1px solid var(--hairline); color: var(--text-2); vertical-align: middle; }
.ov-table tr:last-child td { border-bottom: 0; }
.ov-table .num { width: 90px; white-space: nowrap; color: var(--text-2); }
.ov-table .barcell { width: 26%; }
.ov-table .bar { height: 22px; background: var(--primary); min-width: 4px; }
.ov-table .action { width: 140px; }
.ov-empty { text-align: center; color: var(--text-3); padding: 24px 0 8px; }

.tiles { display: flex; align-items: stretch; border-bottom: 1px solid var(--hairline); }
.tile {
  flex: 0 0 236px; padding: 20px 28px 22px; text-align: left;
  border-right: 1px solid var(--hairline); color: var(--text-2);
}
.tile:hover { background: var(--surface-hover); }
.tile .name { font-size: 16px; line-height: 24px; }
.tile .val { display: inline-block; font: 400 36px/44px var(--font-display); color: var(--text); border-bottom: 1px dashed var(--hairline); padding-bottom: 2px; margin: 2px 0 6px; }
.tile .delta { font-size: 14px; color: var(--text-3); display: flex; align-items: center; gap: 2px; }
.tile .delta .ms { font-size: 16px; }
.tile.active { background: var(--primary); }
.tile.active .name, .tile.active .val, .tile.active .delta { color: #fff; }
.tile.active .val { border-color: rgba(255, 255, 255, .7); }
html[data-theme="dark"] .tile.active .name, html[data-theme="dark"] .tile.active .val, html[data-theme="dark"] .tile.active .delta { color: #062e6f; }
html[data-theme="dark"] .tile.active .val { border-color: rgba(6, 46, 111, .6); }
.tile-actions { margin-left: auto; display: flex; align-items: flex-start; gap: 4px; padding: 8px 8px 0 0; }
.tool-action {
  display: flex; flex-direction: column; align-items: center; width: 84px; padding: 6px 0 4px; border-radius: 8px;
  font-size: 12px; line-height: 16px; color: var(--text-2); position: relative; text-decoration: none;
}
.tool-action .ms { font-size: 24px; margin-bottom: 4px; color: var(--text-2); }
.tool-action:hover { background: var(--surface-hover); text-decoration: none; }
.tool-action .count { position: absolute; top: 0; right: 16px; min-width: 18px; height: 18px; border-radius: 9px; padding: 0 5px; background: var(--primary); color: #fff; font: 500 11px/18px var(--font-body); }
.chart-wrap { padding: 24px 24px 4px 8px; position: relative; }
.chart-wrap svg { width: 100%; height: 220px; display: block; overflow: visible; }
.chart-wrap .grid-line { stroke: var(--hairline); stroke-width: 1; }
.chart-wrap .axis-label { fill: var(--text-3); font: 12px var(--font-body); }
.chart-wrap .series { fill: none; stroke: var(--primary); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-wrap .series.prev { stroke: var(--text-3); stroke-dasharray: 4 4; opacity: .7; }
.chart-wrap .crosshair { stroke: var(--text-3); stroke-width: 1; stroke-dasharray: 2 3; }
.chart-wrap .hover-dot { fill: var(--primary); stroke: var(--surface); stroke-width: 2; }
.chart-wrap .hit { fill: transparent; }
.chart-tip {
  position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--hairline);
  border-radius: 8px; box-shadow: var(--shadow-2); padding: 8px 12px; font-size: 12px; line-height: 18px; color: var(--text-2);
  transform: translate(-50%, -100%); white-space: nowrap; display: none;
}
.chart-tip b { color: var(--text); font-weight: 500; }
.chart-tip .prev { color: var(--text-3); }
.chart-foot { display: flex; align-items: center; gap: 12px; padding: 0 24px 12px 60px; font-size: 12px; color: var(--text-3); }
.chart-foot .seg { display: inline-flex; border: 1px solid var(--hairline); border-radius: 16px; overflow: hidden; }
.chart-foot .seg button { padding: 4px 12px; font-size: 12px; color: var(--text-3); }
.chart-foot .seg button.on { background: var(--primary-container); color: var(--on-primary-container); }
.chart-foot .cmp { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; }

/* ---------- Suggestion chips ---------- */
.suggest { display: flex; gap: 16px; margin: 0 0 16px; flex-wrap: wrap; }
.suggest button {
  height: 48px; padding: 0 20px 0 16px; border: 1px solid var(--hairline); border-radius: 24px;
  background: var(--surface); font: 400 16px var(--font-display); color: var(--text);
  display: inline-flex; align-items: center; gap: 12px; box-shadow: none;
}
.suggest button:hover { background: var(--surface-hover); }
.suggest .ms { font-size: 20px; color: var(--primary); }

/* ---------- Change type chips ---------- */
.chips-row { display: flex; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--hairline); overflow-x: auto; }
.chip {
  height: 32px; padding: 0 12px; border: 1px solid var(--hairline); border-radius: 16px;
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  font: 14px/20px var(--font-body); color: var(--text-3); background: var(--surface);
}
.chip .ms { font-size: 18px; margin-left: -4px; }
.chip:hover { background: var(--surface-hover); color: var(--text-2); }
.chip.sel { background: var(--primary-container); border-color: var(--primary-container); color: var(--on-primary-container); font-weight: 500; }
.chip.sel:hover { background: var(--primary-container); }
.chip.dis { color: var(--text-disabled); pointer-events: none; }

/* ---------- Table toolbar ---------- */
.toolbar { display: flex; align-items: center; min-height: 64px; padding: 6px 12px 6px 16px; border-bottom: 1px solid var(--hairline); flex-wrap: wrap; gap: 8px; }
.toolbar .add-filter { display: inline-flex; align-items: center; gap: 24px; color: var(--text-3); font-size: 16px; padding: 8px 8px 8px 4px; border-radius: 4px; }
.toolbar .add-filter .ms { color: var(--text-2); }
.toolbar .add-filter:hover { background: var(--surface-hover); }
.toolbar .active-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.toolbar-right { margin-left: auto; display: flex; gap: 2px; }

/* ---------- Grid ---------- */
.grid-wrap { overflow-x: auto; }
.grid { width: 100%; min-width: 980px; border-collapse: collapse; table-layout: fixed; }
.grid th, .grid td { padding: 14px 8px; border-bottom: 1px solid var(--hairline); border-right: 1px solid var(--hairline); text-align: left; vertical-align: top; }
.grid th:last-child, .grid td:last-child { border-right: 0; }
.grid th { font-weight: 500; color: var(--text-2); white-space: nowrap; user-select: none; }
.grid th.sortable { cursor: pointer; }
.grid th .ms { font-size: 18px; vertical-align: -4px; color: var(--text-2); }
.grid .col-check { width: 44px; text-align: center; }
.grid .col-date { width: 210px; }
.grid .col-product { width: 150px; }
.grid .col-cat { width: 170px; }
.grid .col-area { width: 140px; }
.grid .col-status { width: 110px; }
.grid .col-impact { width: 96px; }
.grid tbody tr.row:hover td { background: var(--surface-hover); }
.grid tbody tr.row.open td { background: var(--surface-2); }
.check { display: inline-block; width: 18px; height: 18px; border: 2px solid var(--text-3); border-radius: 2px; background: var(--surface); vertical-align: -3px; }
.grid .date-cell .who { color: var(--text-2); }
.grid .date-cell .when { color: var(--text-2); }
.grid .date-cell .srcbtn { display: inline-block; margin-top: 10px; font: 500 14px var(--font-display); color: var(--primary); }
.grid .change-cell { display: flex; align-items: flex-start; gap: 8px; }
.grid .zippy { width: 24px; height: 24px; margin: -2px 0 0 4px; flex: none; color: var(--text-2); border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; transition: transform .15s; }
.grid .zippy:hover { background: var(--surface-hover); }
.grid tr.open .zippy { transform: rotate(180deg); }
.grid .change-title { color: var(--text-2); }
.grid .cat-link { color: var(--primary); }
.grid .cat-link:hover { text-decoration: underline; }
.grid tr.sub td { border-bottom: 0; padding-top: 4px; padding-bottom: 4px; color: var(--text-2); }
.grid tr.sub.last td { border-bottom: 1px solid var(--hairline); padding-bottom: 14px; }
.grid tr.sub .sub-text { padding-left: 52px; }
.grid tr.sub .sub-text a { color: var(--primary); }
.grid tr.sub .sub-text .dash { color: var(--text-2); margin-right: 2px; }
.grid tr.sub .summary { padding-left: 52px; color: var(--text-2); max-width: 78ch; }
.grid tr.sub .details { padding-left: 52px; color: var(--text-2); max-width: 78ch; }
.grid tr.sub .details p { margin: 6px 0; }
.grid tr.sub .details ul { margin: 6px 0; padding-left: 20px; }
.grid .impact { display: inline-flex; align-items: center; gap: 6px; }
.grid .impact::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.grid .impact.High::before { background: var(--red); }
.grid .impact.Medium::before { background: var(--yellow); }
.grid .impact.Low::before { background: var(--green); }
.grid .empty td { text-align: center; color: var(--text-3); padding: 40px 0; border-right: 0; }
.grid .kind { font-size: 12px; color: var(--text-3); }
.grid-foot { display: flex; align-items: center; gap: 24px; padding: 10px 16px; justify-content: flex-end; color: var(--text-2); font-size: 14px; }
.grid-foot select { border: 0; background: transparent; color: var(--text-2); font: 14px var(--font-body); }
.grid-foot .pager { display: inline-flex; align-items: center; gap: 4px; }

/* Expanded (full screen table) mode */
body.expanded .rail, body.expanded .overview, body.expanded .suggest, body.expanded .scope-row, body.expanded .filters-row { display: none; }
body.expanded .main { margin-left: 0; }

/* ---------- Popups ---------- */
.popup {
  position: absolute; z-index: 40; background: var(--surface); border-radius: 8px;
  box-shadow: var(--shadow-2); border: 1px solid var(--hairline); min-width: 220px;
}
.popup .menu-item { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 10px 16px; font-size: 14px; color: var(--text-2); }
.popup .menu-item:hover, .popup .menu-item.on { background: var(--surface-hover); }
.popup .menu-item .ms { font-size: 20px; color: var(--text-3); }
.popup .menu-item .cnt { margin-left: auto; color: var(--text-3); font-size: 12px; }
.popup .menu-head { padding: 8px 16px 4px; font-size: 12px; color: var(--text-3); text-transform: uppercase; letter-spacing: .5px; }
.popup .search-inner { display: flex; align-items: center; gap: 8px; padding: 8px 16px; border-bottom: 1px solid var(--hairline); }
.popup .search-inner input { border: 0; outline: 0; flex: 1; font: 16px var(--font-body); background: transparent; color: var(--text); }
.popup.filter-popup { width: 300px; max-height: 480px; overflow: auto; }
.popup .sub-list { padding: 4px 0 8px; }
.popup .back { display: flex; align-items: center; gap: 8px; padding: 10px 12px; color: var(--text-2); border-bottom: 1px solid var(--hairline); width: 100%; text-align: left; }

/* Date picker */
.datepicker { width: 700px; max-width: calc(100vw - 32px); display: flex; right: 0; top: 56px; }
.datepicker .presets { width: 300px; border-right: 1px solid var(--hairline); padding: 8px 0; }
.datepicker .presets button { display: block; width: 100%; text-align: left; padding: 12px 20px; font: 16px var(--font-display); color: var(--text); }
.datepicker .presets button:hover, .datepicker .presets button.on { background: var(--primary-container-hover); }
.datepicker .presets button.on { background: var(--primary-container); color: var(--on-primary-container); }
.datepicker .presets .custom-days { display: flex; flex-direction: column; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--hairline); }
.datepicker .presets .custom-days label { display: flex; align-items: center; gap: 10px; font-size: 16px; color: var(--text); }
.datepicker .presets .custom-days input { width: 64px; height: 44px; border: 1px solid var(--hairline); border-radius: 4px; padding: 0 10px; font-size: 16px; text-align: center; background: var(--surface); color: var(--text); }
.datepicker .presets .compare { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-top: 1px solid var(--hairline); font: 16px var(--font-display); color: var(--text); }
.toggle { width: 40px; height: 22px; border-radius: 11px; background: var(--hairline); position: relative; transition: background .15s; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-1); transition: left .15s; }
.toggle.on { background: var(--primary); }
.toggle.on::after { left: 21px; }
.datepicker .cal { flex: 1; padding: 16px 20px; }
.datepicker .inputs { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.datepicker .inputs label { display: flex; flex-direction: column; font-size: 12px; color: var(--text-3); flex: 1; }
.datepicker .inputs input { height: 44px; border: 1px solid var(--hairline); border-radius: 4px; padding: 0 12px; font-size: 16px; background: var(--surface); color: var(--text); }
.datepicker .inputs .dash { color: var(--text-3); padding-top: 12px; }
.datepicker .cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.datepicker .cal-head b { font: 500 14px var(--font-display); color: var(--text); }
.datepicker .months { display: flex; gap: 16px; }
.datepicker .month { flex: 1; }
.datepicker .month .mname { font: 500 12px var(--font-display); color: var(--text-2); margin: 8px 0 4px; }
.datepicker .dow { display: grid; grid-template-columns: repeat(7, 1fr); font-size: 12px; color: var(--text-3); text-align: center; }
.datepicker .days { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 2px; }
.datepicker .day { height: 32px; width: 100%; font-size: 13px; color: var(--text); border-radius: 0; position: relative; }
.datepicker .day:hover { background: var(--surface-hover); }
.datepicker .day.in { background: var(--primary-container); }
.datepicker .day.start, .datepicker .day.end { background: var(--primary); color: #fff; border-radius: 50%; }
.datepicker .day.start { border-top-left-radius: 50%; border-bottom-left-radius: 50%; }
.datepicker .day.muted { color: var(--text-disabled); }
.datepicker .day.today { box-shadow: inset 0 0 0 1px var(--primary); border-radius: 50%; }
.datepicker .cal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.btn-filled { height: 36px; padding: 0 24px; border-radius: 4px; background: var(--primary); color: #fff; font: 500 14px var(--font-display); }
.btn-filled:hover { box-shadow: var(--shadow-1); }
html[data-theme="dark"] .btn-filled { color: #062e6f; }

/* Notifications */
.notif-popup { width: 380px; right: 0; top: 60px; max-height: 70vh; overflow: auto; }
.notif-popup .n-head { padding: 12px 16px; font: 500 16px var(--font-display); color: var(--text); border-bottom: 1px solid var(--hairline); display: flex; align-items: center; }
.notif-popup .n-head span { margin-left: auto; font: 12px var(--font-body); color: var(--text-3); }
.notif-popup .n-item { display: block; padding: 10px 16px; border-bottom: 1px solid var(--hairline); color: var(--text-2); font-size: 13px; line-height: 18px; }
.notif-popup .n-item:hover { background: var(--surface-hover); text-decoration: none; }
.notif-popup .n-item small { display: block; color: var(--text-3); font-size: 12px; }
.notif-popup .n-empty { padding: 24px 16px; color: var(--text-3); text-align: center; }

/* Modal */
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--surface); border-radius: 8px; box-shadow: var(--shadow-2); width: 520px; max-width: 100%; max-height: 90vh; overflow: auto; padding: 24px; }
.modal h2 { font: 400 22px/28px var(--font-display); color: var(--text); margin: 0 0 8px; }
.modal p { margin: 0 0 16px; color: var(--text-2); }
.modal label { display: block; font-size: 12px; color: var(--text-3); margin: 12px 0 4px; }
.modal input, .modal textarea, .modal select { width: 100%; border: 1px solid var(--hairline); border-radius: 4px; padding: 10px 12px; font: 14px var(--font-body); background: var(--surface); color: var(--text); }
.modal textarea { min-height: 96px; resize: vertical; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.modal .rss { display: flex; align-items: center; gap: 8px; padding: 12px; border: 1px solid var(--hairline); border-radius: 8px; margin-top: 8px; }
.modal code { background: var(--surface-variant); padding: 2px 6px; border-radius: 4px; font-size: 12px; user-select: all; }

/* ---------- Entry page ---------- */
.entry { max-width: 920px; }
.entry .crumbs { font-size: 14px; color: var(--text-3); margin-bottom: 8px; display: flex; align-items: center; gap: 4px; }
.entry h1 { font: 400 28px/36px var(--font-display); color: var(--text); margin: 0 0 12px; }
.entry .meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.entry .meta .pill { height: 28px; font-size: 13px; }
.entry .kv { display: grid; grid-template-columns: 160px 1fr; gap: 8px 16px; padding: 16px 0; border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); margin-bottom: 20px; }
.entry .kv dt { color: var(--text-3); margin: 0; }
.entry .kv dd { margin: 0; color: var(--text); }
.entry .body { font-size: 15px; line-height: 24px; color: var(--text-2); }
.entry .body p { margin: 0 0 14px; }
.entry .body ul { padding-left: 22px; margin: 0 0 14px; }
.entry .body h2, .entry .body h3 { font: 500 18px/26px var(--font-display); color: var(--text); margin: 20px 0 8px; }
.entry h2.sec { font: 500 16px/24px var(--font-display); color: var(--text); margin: 28px 0 8px; }
.entry .sources { list-style: none; padding: 0; margin: 0; }
.entry .sources li { padding: 10px 0; border-bottom: 1px solid var(--hairline); display: flex; gap: 12px; align-items: flex-start; }
.entry .sources li .ms { font-size: 18px; color: var(--text-3); margin-top: 2px; }
.entry .sources li small { display: block; color: var(--text-3); }
.entry .related { list-style: none; padding: 0; margin: 0; }
.entry .related li { padding: 8px 0; border-bottom: 1px solid var(--hairline); display: flex; gap: 12px; }
.entry .related li span { color: var(--text-3); flex: none; width: 110px; }
.entry .undo-wrap { margin-top: 24px; }
.entry .undo-wrap .undone { text-decoration: underline dashed; text-underline-offset: 3px; color: var(--text-3); cursor: help; }

/* ---------- About page ---------- */
.prose { max-width: 760px; font-size: 15px; line-height: 24px; color: var(--text-2); }
.prose h1 { font: 400 28px/36px var(--font-display); color: var(--text); margin: 0 0 16px; }
.prose h2 { font: 500 18px/26px var(--font-display); color: var(--text); margin: 28px 0 8px; }
.prose p { margin: 0 0 14px; }
.prose ul { padding-left: 22px; }
.prose table { border-collapse: collapse; width: 100%; font-size: 14px; }
.prose th, .prose td { text-align: left; padding: 8px; border-bottom: 1px solid var(--hairline); vertical-align: top; }

/* ---------- Footer ---------- */
.foot { margin-left: var(--rail-w); padding: 24px 24px 32px; border-top: 1px solid var(--hairline); font-size: 12px; line-height: 18px; color: var(--text-3); background: var(--surface); }
body.expanded .foot { margin-left: 0; }
.foot p { margin: 0 0 8px; max-width: 900px; }
.foot .links { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #202124; color: #fff; padding: 12px 20px; border-radius: 4px; box-shadow: var(--shadow-2); font-size: 14px; z-index: 60; }
html[data-theme="dark"] .toast { background: #e3e3e3; color: #202124; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .tb-action { width: 60px; }
  .tb-action span.lbl { display: none; }
  .search { margin: 0 12px 0 0; }
  .brand { margin-right: 16px; }
}
@media (max-width: 900px) {
  :root { --rail-w: 0px; }
  .rail { display: none; }
  .account .who { display: none; }
  .brand span.wm { display: none; }
  .search { flex: 1; }
  .tile { flex: 0 0 50%; }
  .tiles { flex-wrap: wrap; }
  .tile-actions { width: 100%; justify-content: flex-end; padding: 4px 8px; }
  .datepicker { flex-direction: column; width: calc(100vw - 32px); }
  .datepicker .presets { width: 100%; border-right: 0; border-bottom: 1px solid var(--hairline); }
  .main { padding: 12px; }
  .foot { padding: 16px 12px; }
}
@media (max-width: 600px) {
  .tb-action { display: none; }
  .tb-action.keep { display: flex; }
  .page-head h1.title { font-size: 24px; }
  .range-label { display: none; }
  .overview { padding: 16px; }
}
@media print {
  .topbar, .rail, .overview, .suggest, .toolbar, .grid-foot { display: none; }
  .main { margin: 0; }
}
