/* Визуальная система по мотивам designbookmark.com (светлый вариант): мягкий серый фон, панели без рамок
   с лёгкой тенью, крупные скругления, «таблетки», тёмная главная кнопка. Не чисто белый и не чисто чёрный —
   чтобы глаза не уставали. Оранжевый AQUAGIZER — точечный акцент. */
:root {
  --bg: #eef0f3;
  --panel: #fafbfc;
  --inset: #f2f3f6;
  --field: #ffffff;
  --raised: #ffffff;
  --pill: rgba(116, 116, 128, 0.08);
  --pill-hover: rgba(116, 116, 128, 0.16);
  --line: rgba(20, 24, 33, 0.07);
  --text: #23262d;
  --muted: rgba(60, 62, 70, 0.66);
  --faint: rgba(60, 62, 70, 0.45);
  --accent: #e8680c;
  --accent-soft: rgba(232, 104, 12, 0.1);
  --ok: #1f9d55;
  --bad: #d64545;
  --warn: #c98a00;
  --r-panel: 20px;
  --r-field: 8px;
  --shadow-panel: 0 1px 2px rgba(20, 24, 33, .04), 0 4px 18px rgba(20, 24, 33, .04);
  --shadow-raised: 0 1px 2px rgba(20, 24, 33, .08), 0 4px 14px rgba(20, 24, 33, .06), inset 0 1px 0 rgba(255,255,255,.9);
  --ease: cubic-bezier(.22, 1, .36, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 Inter, "Inter Fallback", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; }
a { color: var(--text); text-decoration: none; }
a:hover { color: var(--accent); }
h1 { font-size: 28px; font-weight: 500; letter-spacing: -0.49px; line-height: 1.2; margin: 0 0 6px; }
h2 { font-size: 17px; font-weight: 500; letter-spacing: -0.2px; margin: 0; }
h3 { font-size: 13px; font-weight: 500; color: var(--muted); margin: 20px 0 10px; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }

/* ---------- шапка: плавающая панель ---------- */
.top { position: sticky; top: 0; z-index: 10; padding-top: 12px;
  background: linear-gradient(var(--bg) 70%, rgba(238, 240, 243, 0)); }
.top-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; min-height: 56px;
  background: rgba(250, 251, 252, 0.85); backdrop-filter: saturate(160%) blur(18px); -webkit-backdrop-filter: saturate(160%) blur(18px);
  border-radius: var(--r-panel); padding: 8px 10px 8px 18px; max-width: 1148px; box-shadow: var(--shadow-panel); }
.brand { font-weight: 600; letter-spacing: .04em; font-size: 15px; color: var(--text); display: flex; align-items: center; gap: 8px; }
.brand::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 8px rgba(232, 104, 12, .55); }
.brand span { color: var(--muted); font-weight: 500; letter-spacing: 0; }
.brand:hover { color: var(--text); }

/* меню-«таблетки» со скользящей подсветкой (см. motion.js) */
.nav { position: relative; display: flex; gap: 2px; flex-wrap: wrap; flex: 1; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { position: relative; z-index: 1; height: 30px; display: inline-flex; align-items: center; padding: 0 12px;
  border-radius: 999px; font-size: 13px; letter-spacing: -0.039px; color: var(--muted); transition: color .2s; white-space: nowrap; }
.nav a:hover { color: var(--text); }
.nav a.on { color: var(--text); font-weight: 500; }
.nav-pill { position: absolute; z-index: 0; top: 0; left: 0; height: 30px; border-radius: 999px; background: var(--raised);
  box-shadow: var(--shadow-raised); pointer-events: none; opacity: 0;
  transition: transform .45s var(--spring), width .45s var(--spring), opacity .2s; }
.nav-pill::after { content: ""; position: absolute; left: 50%; bottom: -5px; width: 4px; height: 4px; margin-left: -2px;
  border-radius: 50%; background: var(--accent); }
.no-js .nav a.on { background: var(--raised); box-shadow: var(--shadow-raised); }
.who { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.who span { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who form { margin: 0; }

main.wrap { padding-top: 20px; padding-bottom: 40px; }
.foot { color: var(--faint); font-size: 12px; padding-bottom: 32px; }

/* ---------- переключатель периода (segmented control) ---------- */
.period { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
.seg { position: relative; display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: rgba(116, 116, 128, .1); }
.seg-item { position: relative; z-index: 1; height: 30px; display: inline-flex; align-items: center; padding: 0 14px;
  border: 0; background: none; border-radius: 999px; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer;
  white-space: nowrap; transition: color .2s; }
.seg-item:hover { color: var(--text); }
.seg-item.on { color: var(--text); font-weight: 500; }
.seg .nav-pill { top: 3px; }
.seg .nav-pill::after { display: none; }
.no-js .seg-item.on { background: var(--raised); box-shadow: var(--shadow-raised); }
.period-custom { display: none; align-items: center; gap: 8px; }
.period-custom.open { display: inline-flex; animation: pop .35s var(--spring); }
.period-custom input { height: 32px; }
.period-range { font-size: 12px; }

/* ---------- плитки с цифрами ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 12px; }
.tile { position: relative; overflow: hidden; background: var(--panel); border-radius: var(--r-panel); padding: 20px;
  box-shadow: var(--shadow-panel); }
.tile.accent { background: radial-gradient(120% 140% at 0% 0%, rgba(232, 104, 12, .13), rgba(232, 104, 12, 0) 60%), var(--panel); }
.tile.accent::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(232, 104, 12, .28); }
.tile-label { color: var(--muted); font-size: 13px; }
.tile-value { font-size: 30px; font-weight: 500; letter-spacing: -0.8px; margin: 6px 0 4px; font-variant-numeric: tabular-nums; }
.tile-note { color: var(--muted); font-size: 12px; }

/* ---------- панели ---------- */
.panel { background: var(--panel); border-radius: var(--r-panel); padding: 20px; margin-bottom: 12px; box-shadow: var(--shadow-panel); }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-head a { color: var(--muted); font-size: 13px; }
.panel-head a:hover { color: var(--accent); }
.panel.soon { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.grid2 > .panel { margin-bottom: 0; min-width: 0; overflow-x: auto; }
@media (max-width: 1000px) { .grid2 { grid-template-columns: 1fr; } dl.props { grid-template-columns: 170px 1fr; } }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }

/* ---------- таблицы ---------- */
.table-wrap { overflow-x: auto; margin: 0 -8px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
th { text-align: left; color: var(--faint); font-weight: 500; font-size: 12px; padding: 8px; white-space: nowrap; }
td { padding: 10px 8px; border-top: 1px solid var(--line); vertical-align: top; }
tbody tr { transition: background .15s; }
tbody tr:hover td { background: var(--inset); }
tbody tr:hover td:first-child { border-radius: 10px 0 0 10px; }
tbody tr:hover td:last-child { border-radius: 0 10px 10px 0; }
tr.dim td { opacity: .5; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.plus { color: var(--ok); }
.neg { color: var(--bad); }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* ---------- бейджи и чипы ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 999px;
  font-size: 12px; font-weight: 500; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { background: rgba(31, 157, 85, .1); color: var(--ok); }
.badge.off { background: rgba(214, 69, 69, .1); color: var(--bad); }
.badge.warn { background: var(--accent-soft); color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { height: 28px; display: inline-flex; align-items: center; padding: 0 12px; border-radius: 999px; font-size: 13px;
  background: var(--pill); color: var(--faint); }
.chip.on { background: var(--raised); color: var(--text); box-shadow: var(--shadow-raised); }
.chip.on::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-right: 8px; }

/* ---------- формы и кнопки ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 14px; padding: 12px;
  background: var(--inset); border-radius: 14px; }
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.filters label.inline-check { flex-direction: row; align-items: center; gap: 8px; height: 36px; color: var(--text); font-size: 13px; }
.summary { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 0 14px; color: var(--muted); font-size: 13px; }
.summary span { background: var(--inset); border-radius: 999px; padding: 6px 12px; }
.summary b { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }

input, select { background: var(--field); color: var(--text); border: 0; border-radius: var(--r-field); height: 36px;
  padding: 0 12px; font: inherit; font-size: 14px; min-width: 0;
  box-shadow: inset 0 0 0 1px rgba(20, 24, 33, .1), 0 1px 2px rgba(20, 24, 33, .04);
  transition: box-shadow .2s var(--ease); color-scheme: light; }
input:focus, select:focus { outline: none; box-shadow: inset 0 0 0 1px rgba(232, 104, 12, .7), 0 0 0 4px rgba(232, 104, 12, .14); }
input[type=checkbox] { height: auto; box-shadow: none; accent-color: var(--accent); }

.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px;
  padding: 0 16px; border: 0; border-radius: 999px; font: inherit; font-size: 13px; font-weight: 500; letter-spacing: -0.039px;
  cursor: pointer; background: #2a2d34; color: #fff; white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 1px 2px rgba(20, 24, 33, .2);
  transition: transform .25s var(--spring), background .2s, opacity .2s; }
.btn:hover { color: #fff; background: #3a3e47; }
.btn:active { transform: scale(.96); }
.btn.ghost { background: var(--raised); color: var(--text); box-shadow: var(--shadow-raised); }
.btn.ghost:hover { background: #f5f6f8; color: var(--text); }
.btn.danger { background: rgba(214, 69, 69, .1); color: var(--bad); box-shadow: none; }
.btn.danger:hover { background: rgba(214, 69, 69, .17); color: var(--bad); }
.btn.sm { height: 28px; padding: 0 12px; font-size: 12px; }
button.link { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; padding: 0; }
button.link:hover { color: var(--accent); }

/* состояние «загрузка → готово» (см. motion.js) */
.btn .spin, .btn .tick { display: none; }
.btn.is-loading .spin { display: inline-block; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
.btn.is-done .tick { display: inline-block; color: var(--ok); animation: pop .45s var(--spring); }
.btn.is-loading .lbl, .btn.is-done .lbl { opacity: .7; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop { from { transform: scale(.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- вход ---------- */
.auth { max-width: 400px; margin: 56px auto; background: var(--panel); border-radius: 24px; padding: 28px; box-shadow: var(--shadow-panel); }
.form { display: flex; flex-direction: column; gap: 14px; margin: 20px 0; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.form label.check { flex-direction: row; align-items: flex-start; gap: 10px; font-size: 12px; }
.form label.check input { margin-top: 2px; }
.form .btn { height: 40px; font-size: 14px; }
.alert { background: rgba(214, 69, 69, .08); color: #b23434; padding: 10px 14px; border-radius: 12px; font-size: 14px; }
.notice { background: var(--accent-soft); box-shadow: inset 0 0 0 1px rgba(232, 104, 12, .28); padding: 14px 16px;
  border-radius: 14px; word-break: break-all; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.notice code { background: rgba(255, 255, 255, .8); padding: 4px 8px; border-radius: 6px; font-size: 12px; }

/* индикатор надёжности пароля */
.strength { height: 4px; border-radius: 99px; background: var(--pill-hover); overflow: hidden; margin-top: -6px; }
.strength i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--bad);
  transition: width .4s var(--spring), background .3s; }
.strength-label { font-size: 12px; color: var(--muted); min-height: 16px; margin-top: -8px; }

dl.props { display: grid; grid-template-columns: 200px 1fr; gap: 10px 16px; margin: 0; font-size: 14px; }
dl.props dt { color: var(--muted); }
dl.props dd { margin: 0; }

/* ---------- ведомость ---------- */
.statement h1 { font-size: 22px; }
.statement h3 { color: var(--text); font-size: 14px; margin-top: 24px; }
.statement dl.props { margin: 14px 0 6px; }
tr.subtotal td { font-weight: 500; background: var(--inset); }
.grand { text-align: right; font-size: 16px; margin: 18px 0 8px; }
@media print {
  body { background: #fff; }
  .top, .foot, .no-print, .filters { display: none !important; }
  main.wrap { padding: 0; max-width: none; }
  .panel { box-shadow: none; background: #fff; padding: 0; }
  .reveal { opacity: 1 !important; transform: none !important; }
  tbody tr:hover td { background: none; }
  tr.subtotal td { background: #f2f2f2; }
  td, th { font-size: 11px; padding: 5px 6px; }
}

/* ---------- появление при загрузке ---------- */
.reveal { opacity: 0; transform: translateY(10px) scale(.99); }
.reveal.in { opacity: 1; transform: none; transition: opacity .5s var(--ease), transform .6s var(--ease); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}

@media (max-width: 760px) {
  .top-row { gap: 8px; padding: 10px; }
  .nav { order: 3; flex-basis: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .seg::-webkit-scrollbar { display: none; }
  .who span { max-width: 140px; }
  dl.props { grid-template-columns: 1fr; gap: 2px; }
  dl.props dd { margin-bottom: 10px; }
  .grid2 { grid-template-columns: 1fr; }
  .tile-value { font-size: 26px; }
}
