:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1d2330;
  --muted: #646c7a;
  --line: #d9dde3;
  --chip: #e6e8ec;
  --chip-off: #f7f8fa;
  --accent: #1a73e8;
  --accent-ink: #ffffff;
  --error: #c5221f;
  --sel: #e8f0fe;
  --folder: #5f6368;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15181d; --card: #1e2229; --text: #e7e9ee; --muted: #9aa2b1;
    --line: #333944; --chip: #2f3540; --chip-off: #1e2229; --accent: #8ab4f8; --accent-ink: #0b1a33; --error: #f28b82; --sel: #263650; --folder: #aab1bd;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.top {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 20px; background: var(--card); border-bottom: 1px solid var(--line);
}
.left { display: flex; align-items: center; gap: 14px; }
.brand { font-weight: 600; font-size: 16px; color: var(--text); text-decoration: none; }
.home { display: inline-flex; align-items: center; gap: 6px; }
.banner { background: var(--sel); border: 1px solid var(--accent); border-radius: 8px; padding: 8px 12px; font-size: 14px; margin-bottom: 8px; }
.logo { color: var(--accent); margin-right: 4px; }
.who { display: flex; gap: 12px; align-items: center; color: var(--muted); font-size: 14px; }
main { max-width: 1040px; margin: 28px auto; padding: 0 16px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.narrow { max-width: 760px; width: 100%; justify-self: center; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
h1 { font-size: 20px; margin: 0 0 12px; }
h2 { font-size: 17px; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, Consolas, monospace; overflow-wrap: anywhere; }
.label { display: block; font-weight: 600; margin: 18px 0 6px; }
.row { display: flex; gap: 8px; }
input[type=text] {
  flex: 1; min-width: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); color: var(--text); font: inherit;
}
input[type=text]:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.btn {
  display: inline-block; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font: inherit; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn:disabled { opacity: .6; cursor: default; }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; padding: 0; }
.fields { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 4px;
  background: var(--chip); border: 1px solid transparent; color: var(--text); font: inherit; font-size: 14px; cursor: pointer;
}
.chip .x { font-weight: 700; }
.chip.off { background: var(--chip-off); border-color: var(--line); color: var(--muted); text-decoration: line-through; }
.chip.off .x { display: none; }
.actions { margin-top: 20px; }
.error { color: var(--error); margin: 12px 0 0; }
.progress-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.bar { height: 6px; background: var(--chip); border-radius: 3px; overflow: hidden; margin: 16px 0 10px; }
.bar-fill { height: 100%; width: 30%; background: var(--accent); border-radius: 3px; animation: slide 1.4s ease-in-out infinite; }
.bar.done .bar-fill { width: 100%; animation: none; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(340%); } }
.stats { margin: 0; }
#doneBox { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
@media (max-width: 520px) { .row { flex-direction: column; } .card { padding: 18px; } }

/* steps */
.steps { display: flex; gap: 18px; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.steps .on { color: var(--accent); font-weight: 600; }
.steps .done { color: var(--text); }

/* picker */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 8px -24px 0; padding: 0 24px; overflow-x: auto; }
.tab { background: none; border: 0; border-bottom: 3px solid transparent; padding: 12px 14px 10px; font: inherit; font-size: 15px; color: var(--text); cursor: pointer; white-space: nowrap; }
.tab.on { border-bottom-color: var(--accent); color: var(--accent); font-weight: 600; }
.search { display: flex; gap: 8px; margin: 16px 0 10px; }
.search input { flex: 1; min-width: 0; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); font: inherit; }
.search .btn { display: inline-flex; align-items: center; padding: 0 22px; }
.crumbbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 36px; flex-wrap: wrap; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 14px; }
.crumb.current { font-weight: 600; }
.sep { color: var(--muted); }
.btn.small { padding: 5px 12px; font-size: 13px; }
.btn.picked { background: var(--sel); border-color: var(--accent); color: var(--accent); }
.section-label { font-size: 14px; margin: 12px 0 8px; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(190px, 100%), 1fr)); gap: 12px; max-height: 52vh; overflow-y: auto; padding: 2px; }
.grid .empty { grid-column: 1 / -1; padding: 24px 0; text-align: center; }
.tile { position: relative; min-width: 0; display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 8px 0 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); cursor: pointer; user-select: none; }
.tile:hover { border-color: var(--muted); }
.tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.tile.on { border-color: var(--accent); background: var(--sel); box-shadow: inset 0 0 0 1px var(--accent); }
.ficon { flex: none; width: 24px; height: 24px; color: var(--folder); }
.ficon svg { width: 24px; height: 24px; display: block; }
.tile.on .ficon { color: var(--accent); }
.fname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.check { position: absolute; top: -7px; left: -7px; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 700; display: none; align-items: center; justify-content: center; }
.tile.on .check { display: flex; }
.open { flex: none; width: 30px; height: 30px; border-radius: 50%; border: 0; background: none; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; }
.open:hover { background: var(--chip); color: var(--text); }
.paste { margin-top: 18px; }
.paste label { display: block; margin-bottom: 4px; }
.footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 20px -24px -24px; padding: 14px 24px; border-top: 1px solid var(--line); background: var(--bg); border-radius: 0 0 var(--radius) var(--radius); }
.tray { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-width: 0; }
.tray .count { margin-right: 4px; }

/* confirm */
.confirm-list { list-style: none; margin: 16px 0 4px; padding: 0; border: 1px solid var(--line); border-radius: 8px; }
.confirm-list li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; }
.confirm-list li + li { border-top: 1px solid var(--line); }
.ctext { flex: 1; min-width: 0; }
.cname { font-weight: 600; overflow-wrap: anywhere; }
.actions { display: flex; gap: 8px; }

@media (max-width: 520px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: none; }
  .top { padding: 10px 16px; }
  .who #whoEmail { max-width: 46vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tile { padding-left: 10px; gap: 8px; }
  .footer { flex-direction: column; align-items: stretch; }
  .footer .btn { width: 100%; }
}
@media (max-width: 520px) {
  .tabs { margin: 8px -18px 0; padding: 0 18px; }
  .footer { margin: 20px -18px -18px; padding: 14px 18px; }
}
@media (max-width: 520px) { .left { gap: 8px; } .who { gap: 8px; } }

/* sign-in */
.signin { max-width: 460px; width: 100%; justify-self: center; }
.signin input[type=email], .signin input.code {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); color: var(--text); font: inherit;
}
.signin input.code { font-family: ui-monospace, Consolas, monospace; font-size: 24px; letter-spacing: 8px; text-align: center; }
.signin input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.signin .actions { margin-top: 16px; flex-wrap: wrap; }
