:root {
  --bg: #f4f1f8;
  --card: #ffffff;
  --text: #292331;
  --muted: #746d7b;
  --primary: #77598d;
  --primary-dark: #5f4474;
  --soft: #eee7f3;
  --border: #ded5e5;
  --danger: #a33b4b;
  --success: #307a55;
  --shadow: 0 8px 24px rgba(50, 35, 63, .08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.app-header { background: linear-gradient(135deg, #76578d, #9b79ae); color: white; padding: 20px max(18px, calc((100vw - 1050px)/2)); display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.app-header h1 { margin: 0; font-size: clamp(1.45rem, 4vw, 2rem); }
.app-header p { margin: 4px 0 0; opacity: .9; }
.header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.pill { background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.25); padding: 7px 10px; border-radius: 999px; font-size: .85rem; max-width: 230px; overflow: hidden; text-overflow: ellipsis; }
main { width: min(1050px, calc(100% - 28px)); margin: 22px auto 60px; }
.auth-wrap { min-height: 65vh; display: grid; place-items: center; }
.auth-card { width: min(460px, 100%); }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
h2, h3, h4 { margin-top: 0; }
label { display: grid; gap: 6px; font-weight: 650; margin-bottom: 13px; }
input, select, textarea { width: 100%; border: 1px solid var(--border); border-radius: 11px; padding: 11px 12px; color: var(--text); background: #fff; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(119,89,141,.16); border-color: var(--primary); }
button { border: 0; border-radius: 11px; padding: 10px 14px; font-weight: 750; }
.primary { background: var(--primary); color: #fff; }
.primary:hover { background: var(--primary-dark); }
.secondary { background: var(--soft); color: var(--primary-dark); }
.ghost { background: transparent; color: inherit; border: 1px solid currentColor; }
.danger { color: var(--danger); background: #fff1f3; }
.small { padding: 7px 10px; font-size: .86rem; }
.row { display: flex; align-items: center; flex-wrap: wrap; }
.gap { gap: 9px; }
.between { justify-content: space-between; }
.grid { display: grid; gap: 12px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tabs { display: flex; gap: 7px; overflow-x: auto; padding: 4px 0 13px; scrollbar-width: thin; position: sticky; top: 0; z-index: 4; background: var(--bg); }
.tab { white-space: nowrap; background: #e9e2ee; color: var(--text); }
.tab.active { background: var(--primary); color: white; }
.panel { display: none; }
.panel.active { display: block; }
.muted { color: var(--muted); }
.message { min-height: 1.4em; color: var(--danger); }
.info-box { background: #f7f3f9; border: 1px solid var(--border); padding: 12px; border-radius: 12px; margin-bottom: 12px; color: var(--muted); }
.stack { display: grid; gap: 10px; }
.item { border: 1px solid var(--border); border-radius: 13px; padding: 13px; background: #fff; }
.item-title { font-weight: 800; margin-bottom: 4px; }
.item-meta { color: var(--muted); font-size: .9rem; line-height: 1.5; }
.item-actions { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 9px; }
.set-row { display: grid; grid-template-columns: 62px 1fr 1fr auto; gap: 8px; align-items: end; padding: 10px 0; border-bottom: 1px dashed var(--border); }
.set-row.side { grid-template-columns: 62px 80px 1fr 1fr auto; }
.set-number { font-weight: 800; align-self: center; }
.set-row label { margin: 0; font-size: .82rem; }
.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.summary { border: 1px solid var(--border); background: #faf8fc; border-radius: 12px; padding: 12px; }
.summary strong { display: block; font-size: 1.25rem; margin-top: 4px; }
.future { opacity: .8; }
.pb-badge { display: inline-block; background: #f3e8b4; color: #64520c; padding: 4px 8px; border-radius: 999px; font-size: .78rem; font-weight: 800; }
.timer-display { font-variant-numeric: tabular-nums; text-align: center; font-size: clamp(3.2rem, 14vw, 6rem); font-weight: 800; letter-spacing: .02em; margin: 12px 0 18px; }
.timer-controls { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.timer-presets { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-top: 15px; }
.timer-status { text-align: center; color: var(--muted); min-height: 1.4em; }
.mode-switch { display: grid; grid-template-columns: 1fr 1fr; background: var(--soft); border-radius: 12px; padding: 4px; margin-bottom: 14px; }
.mode-switch button.active { background: white; color: var(--primary-dark); box-shadow: 0 2px 8px rgba(0,0,0,.08); }
dialog { border: 0; border-radius: 16px; padding: 20px; box-shadow: var(--shadow); max-width: min(420px, calc(100% - 30px)); }
dialog::backdrop { background: rgba(31,24,35,.45); }
@media (max-width: 680px) {
  .app-header { align-items: flex-start; flex-direction: column; }
  .header-actions { justify-content: flex-start; }
  .grid.two { grid-template-columns: 1fr; }
  .set-row, .set-row.side { grid-template-columns: 48px 1fr 1fr; }
  .set-row.side .side-select { grid-column: 2 / 4; }
  .set-row .remove-set { grid-column: 3; justify-self: end; }
  .summary-grid { grid-template-columns: 1fr; }
}
