/* eTaklif — общий вид веб-страниц.
   Те же цвета и та же логика, что в приложениях: тёплый фон, белые
   карточки, глубокий бирюзовый для действий, кремовая бумага с золотом
   для самой таклифномы. Текст крупный: сайтом пользуются и родители. */

@font-face {
  font-family: "Cormorant";
  src: url("/assets/cormorant.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

:root {
  --bg: #F7F3EC;
  --card: #FFFFFF;
  --hairline: #DDD8CF;
  --field: #F0ECE5;
  --linen: #EEE7DB;
  --linen-deep: #E2D9C9;
  --text: #1C1B18;
  --muted: #6A6253;
  --accent: #006B67;
  --accent-strong: #00524F;
  --accent-soft: #E2F3F0;
  --ok: #147A4B;
  --ok-soft: #E5F4EA;
  --warn: #7A4F00;
  --warn-soft: #FFF0CC;
  --danger: #B3261E;
  --danger-soft: #FDE8E6;
  --brand: #B33226;
  --brand-deep: #7D1F1F;
  --paper: #FFF8E8;
  --gold: #8A651F;
  --gold-light: #E8D48B;
  --ink: #2A2620;

  --r-s: 10px;
  --r-m: 14px;
  --r-l: 18px;
  --r-xl: 24px;
  --shadow: 0 1px 2px rgba(40, 30, 10, .06), 0 6px 24px rgba(40, 30, 10, .06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Cormorant", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 17px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
img, svg { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------- раскладка ---------- */

.container { width: min(1120px, 100% - 32px); margin: 0 auto; }
.container.narrow { width: min(720px, 100% - 32px); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack.tight { gap: 8px; }
.stack.loose { gap: 28px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.row.top { align-items: flex-start; }
.row.between { justify-content: space-between; }
.row.nowrap { flex-wrap: nowrap; }
.grow { flex: 1 1 0; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 860px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- шапка ---------- */

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(247, 243, 236, .92);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--hairline);
}
.topbar .container { display: flex; align-items: center; gap: 16px; min-height: 64px; }
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 700; font-size: 20px; letter-spacing: -.01em; }
.logo svg { width: 34px; height: 34px; border-radius: 9px; flex: none; }
.topnav { display: flex; gap: 4px; margin-left: 8px; }
.topnav a { padding: 8px 12px; border-radius: 999px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 15px; }
.topnav a:hover, .topnav a[aria-current="page"] { color: var(--text); background: var(--linen); }
@media (max-width: 760px) { .topnav { display: none; } }

.lang { display: inline-flex; background: var(--linen); border-radius: 999px; padding: 3px; gap: 2px; }
.lang button {
  border: 0; background: transparent; color: var(--muted); font: 600 13px/1 var(--font);
  padding: 8px 10px; border-radius: 999px; cursor: pointer;
}
.lang button[aria-pressed="true"] { background: var(--card); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }

/* ---------- текст ---------- */

h1, h2, h3, h4, p { margin: 0; }
.hero { font-size: clamp(34px, 5.2vw, 56px); line-height: 1.06; letter-spacing: -.025em; font-weight: 800; }
.title { font-size: clamp(26px, 3.2vw, 34px); line-height: 1.15; letter-spacing: -.02em; font-weight: 750; }
.section { font-size: 21px; line-height: 1.25; font-weight: 700; letter-spacing: -.01em; }
.lead { font-size: clamp(18px, 2vw, 21px); line-height: 1.5; color: var(--muted); }
.note { font-size: 15px; color: var(--muted); }
.caption { font-size: 13.5px; color: var(--muted); }
.tiny { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.strong { font-weight: 650; }
.center { text-align: center; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }

/* ---------- карточки ---------- */

.card {
  background: var(--card); border: 1px solid var(--hairline); border-radius: var(--r-l);
  padding: 20px; box-shadow: var(--shadow);
}
.card.flat { box-shadow: none; }
.card.soft { background: var(--linen); border-color: var(--linen-deep); box-shadow: none; }
.card.accent { background: var(--accent-soft); border-color: #BFE3DE; box-shadow: none; }
.card.warn { background: var(--warn-soft); border-color: #F0D58A; box-shadow: none; }
.card.danger { background: var(--danger-soft); border-color: #F3C2BD; box-shadow: none; }
.card.clickable { cursor: pointer; transition: transform .12s ease, box-shadow .12s ease; text-align: left; font: inherit; color: inherit; width: 100%; }
.card.clickable:hover { transform: translateY(-1px); box-shadow: 0 2px 4px rgba(40, 30, 10, .08), 0 10px 30px rgba(40, 30, 10, .09); }

/* Лист приглашения: кремовая бумага, золотая двойная рамка. */
.paper {
  background: linear-gradient(180deg, #FFFAEE, var(--paper));
  border: 1px solid var(--gold-light); border-radius: 6px;
  padding: 28px 24px; position: relative; text-align: center; color: var(--ink);
  box-shadow: 0 1px 2px rgba(60, 40, 0, .1), 0 14px 40px rgba(60, 40, 0, .12);
  font-family: var(--serif);
}
.paper::before {
  content: ""; position: absolute; inset: 9px; border: 1.5px solid var(--gold);
  outline: 1px solid var(--gold-light); outline-offset: 3px; pointer-events: none; border-radius: 2px;
}
.paper > * { position: relative; }
.paper .paper-kicker { font: 600 12px/1.2 var(--font); letter-spacing: .16em; text-transform: uppercase; color: var(--gold); }
.paper .paper-title { font-size: clamp(28px, 4vw, 40px); line-height: 1.1; margin: 10px 0 8px; }
.paper .paper-rule { width: 64px; height: 1.5px; background: var(--gold); margin: 10px auto; border: 0; }
.paper .paper-line { font-size: 19px; line-height: 1.4; }
.paper .paper-small { font-size: 16px; color: #6B6558; }

/* ---------- кнопки ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 20px; border-radius: var(--r-m);
  border: 1px solid transparent; font: 650 16.5px/1.2 var(--font); cursor: pointer; text-decoration: none;
  transition: background .12s ease, border-color .12s ease, transform .06s ease; color: inherit;
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: default; pointer-events: none; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-strong); }
.btn.secondary { background: var(--card); border-color: var(--hairline); color: var(--text); }
.btn.secondary:hover { border-color: #C7C0B2; background: #FCFBF8; }
.btn.quiet { background: transparent; color: var(--accent); padding-inline: 12px; }
.btn.quiet:hover { background: var(--accent-soft); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger.quiet { background: transparent; color: var(--danger); }
.btn.danger.quiet:hover { background: var(--danger-soft); }
.btn.small { min-height: 38px; padding: 6px 14px; font-size: 15px; border-radius: var(--r-s); }
.btn.big { min-height: 56px; padding: 14px 28px; font-size: 18px; border-radius: var(--r-l); }
.btn.block { display: flex; width: 100%; }
.btn svg { width: 20px; height: 20px; flex: none; }

/* ---------- поля ---------- */

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field > .label { font-size: 14.5px; font-weight: 650; color: var(--muted); }
.input {
  width: 100%; min-height: 48px; padding: 11px 14px; border-radius: var(--r-m);
  border: 1px solid var(--hairline); background: var(--card); color: var(--text); font: 17px/1.3 var(--font);
}
textarea.input { min-height: 120px; resize: vertical; line-height: 1.45; }
.input::placeholder { color: #A39C8E; }
.input:focus { outline: 3px solid rgba(0, 107, 103, .25); border-color: var(--accent); }
.input.invalid { border-color: var(--danger); }
.input.big { min-height: 58px; font-size: 22px; letter-spacing: .02em; }
.hint { font-size: 13.5px; color: var(--muted); }
.error-text { font-size: 14.5px; color: var(--danger); font-weight: 600; }

.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 15.5px; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }

.seg { display: inline-flex; flex-wrap: wrap; background: var(--field); border-radius: var(--r-m); padding: 4px; gap: 4px; }
.seg button {
  border: 0; background: transparent; color: var(--muted); font: 650 15px/1.2 var(--font);
  min-height: 40px; padding: 8px 14px; border-radius: 10px; cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--card); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .1); }

/* Выбор вида тоя — плитки. */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.tile {
  display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 10px 14px;
  background: var(--card); border: 1.5px solid var(--hairline); border-radius: var(--r-m);
  font: 650 16px/1.25 var(--font); color: var(--text); cursor: pointer; text-align: left;
}
.tile:hover { border-color: #C7C0B2; }
.tile[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }

/* ---------- вкладки ---------- */

.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--hairline); scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  border: 0; background: transparent; padding: 12px 16px; font: 650 16px/1.2 var(--font); color: var(--muted);
  cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; border-radius: 8px 8px 0 0;
}
.tab:hover { color: var(--text); background: rgba(0, 0, 0, .03); }
.tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.tab .count { margin-left: 6px; font-size: 13px; background: var(--linen); color: var(--muted); padding: 2px 8px; border-radius: 999px; }

/* ---------- метки, числа ---------- */

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  font-size: 13.5px; font-weight: 650; background: var(--linen); color: var(--muted); white-space: nowrap;
}
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.danger { background: var(--danger-soft); color: var(--danger); }
.chip.accent { background: var(--accent-soft); color: var(--accent); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--card); border: 1px solid var(--hairline); border-radius: var(--r-l); padding: 16px 18px; }
.stat .stat-value { font-size: 32px; line-height: 1.1; font-weight: 800; letter-spacing: -.02em; }
.stat .stat-label { font-size: 14px; color: var(--muted); margin-top: 4px; }
.stat.accent { background: var(--accent-soft); border-color: #BFE3DE; }
.stat.accent .stat-value { color: var(--accent-strong); }
.stat.warn { background: var(--warn-soft); border-color: #F0D58A; }
.stat.danger { background: var(--danger-soft); border-color: #F3C2BD; }
.stat.danger .stat-value { color: var(--danger); }

.meter { height: 10px; border-radius: 999px; background: var(--field); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 999px; background: var(--accent); transition: width .25s ease; }
.meter.warn > span { background: #C98A00; }
.meter.over > span { background: var(--danger); }

/* ---------- таблицы ---------- */

.table-wrap { overflow-x: auto; border: 1px solid var(--hairline); border-radius: var(--r-l); background: var(--card); }
.table { width: 100%; border-collapse: collapse; font-size: 16px; }
.table th {
  text-align: left; font-size: 12.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--hairline); background: #FBF9F5; white-space: nowrap;
}
.table td { padding: 11px 14px; border-bottom: 1px solid #EFEAE1; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #FCFBF8; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .actions { text-align: right; white-space: nowrap; }
.table input.cell {
  width: 100%; border: 1px solid transparent; background: transparent; font: inherit; color: inherit;
  padding: 6px 8px; border-radius: 8px; min-width: 60px;
}
.table input.cell:hover { border-color: var(--hairline); }
.table input.cell:focus { outline: 0; border-color: var(--accent); background: #fff; }
.table tr.dup td { background: #FFF7E0; }
.table tr.group td { background: var(--linen); font-weight: 700; font-size: 14.5px; color: var(--muted); padding-block: 8px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px;
  border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--field); color: var(--text); }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }
.icon-btn svg { width: 20px; height: 20px; }

/* ---------- пусто, диалог, всплывашка ---------- */

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .empty-title { font-size: 20px; font-weight: 700; color: var(--text); margin-bottom: 6px; }

.dialog {
  border: 0; border-radius: var(--r-xl); padding: 24px; width: min(520px, calc(100vw - 32px));
  background: var(--card); color: var(--text); box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}
.dialog.wide { width: min(760px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(28, 27, 24, .45); }
.dialog-text { font-size: 19px; font-weight: 650; line-height: 1.35; margin-bottom: 14px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; flex-wrap: wrap; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--text); color: #fff; padding: 12px 18px; border-radius: 999px; font-size: 15.5px; font-weight: 600;
  transition: opacity .18s ease, transform .18s ease; z-index: 100; max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast[data-kind="error"] { background: var(--danger); }
.toast[data-kind="ok"] { background: var(--ok); }

.spinner {
  width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--linen-deep); border-top-color: var(--accent);
  animation: spin .8s linear infinite; display: inline-block; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Список дел. */
.todo { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid #EFEAE1; }
.todo:last-child { border-bottom: 0; }
.todo input[type="checkbox"] { width: 24px; height: 24px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.todo.done .todo-title { text-decoration: line-through; color: var(--muted); }
.todo-title { font-weight: 650; }
.todo-when { font-size: 14px; color: var(--muted); }
.todo.late .todo-when { color: var(--warn); font-weight: 650; }

.footer { border-top: 1px solid var(--hairline); margin-top: 56px; padding: 28px 0 40px; color: var(--muted); font-size: 14.5px; }
.footer a { color: var(--muted); }

/* ---------- печать ---------- */

.print-only { display: none; }
@media print {
  body { background: #fff; font-size: 12pt; }
  .no-print, .topbar, .tabs, .toast, .footer { display: none !important; }
  .print-only { display: block; }
  .card, .table-wrap, .stat { box-shadow: none; border-color: #999; }
  .table th { background: #fff; }
  .container { width: 100%; }
  a { color: inherit; text-decoration: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation-duration: .01ms !important; }
}

/* Запасной вид окна там, где браузер не знает <dialog> (см. core.js). */
dialog:not([open]) { display: none; }
.dialog-fallback[open] {
  display: block; position: fixed; left: 16px; right: 16px; top: 8vh; margin: 0 auto; z-index: 1000;
  max-height: 84vh; overflow: auto; box-shadow: 0 0 0 100vmax rgba(31, 27, 22, .45), var(--shadow, 0 8px 30px rgba(0,0,0,.2));
}
