@font-face {
  font-family: "Oranienbaum";
  src: url("fonts/oranienbaum-cyrillic-400-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
  font-display: swap;
}
@font-face {
  font-family: "Oranienbaum";
  src: url("fonts/oranienbaum-cyrillic-ext-400-normal.woff2") format("woff2");
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+20BD, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
  font-display: swap;
}
@font-face {
  font-family: "Oranienbaum";
  src: url("fonts/oranienbaum-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2212;
  font-display: swap;
}
@font-face {
  font-family: "Golos Text";
  font-weight: 400;
  src: url("fonts/golos-text-cyrillic-400-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
  font-display: swap;
}
@font-face {
  font-family: "Golos Text";
  font-weight: 400;
  src: url("fonts/golos-text-cyrillic-ext-400-normal.woff2") format("woff2");
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+20BD, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
  font-display: swap;
}
@font-face {
  font-family: "Golos Text";
  font-weight: 400;
  src: url("fonts/golos-text-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2212;
  font-display: swap;
}
@font-face {
  font-family: "Golos Text";
  font-weight: 600;
  src: url("fonts/golos-text-cyrillic-600-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
  font-display: swap;
}
@font-face {
  font-family: "Golos Text";
  font-weight: 600;
  src: url("fonts/golos-text-latin-600-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2212;
  font-display: swap;
}

/* Night desk under a lamp, with the calendar as a lit ledger sheet. */
:root {
  --desk: #1c140e;
  --desk-line: #43342a;
  --on-desk: #f1e6d2;
  --on-desk-soft: #bba88f;
  --gold: #e3b15b;
  --lamp-glow: rgba(227, 177, 91, 0.18);
  --negative: #f08a70;
  --paper: #efe3cb;
  --paper-rule: #d8c8aa;
  --ink: #2b2016;
  --ink-soft: #66543d;
  --ink-off: #a8977c;
  --heat: 0;
  --stamp: #a8331f;
  --display: "Oranienbaum", Georgia, serif;
  --text: "Golos Text", system-ui, -apple-system, sans-serif;
}

:root[data-theme="light"] {
  --desk: #e4d6bb;
  --desk-line: #bfab89;
  --on-desk: #2b2016;
  --on-desk-soft: #5e4d38;
  --gold: #7a500f;
  --lamp-glow: rgba(255, 244, 214, 0.7);
  --negative: #a8331f;
  --paper: #fbf6e9;
  --paper-rule: #e5d9c1;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--desk);
  color: var(--on-desk);
  font: 400 16px/1.45 var(--text);
  overflow-wrap: anywhere;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.sheet :focus-visible { outline-color: var(--stamp); }
h1, h2, p, ul, dl, dd { margin: 0; padding: 0; }
ul { list-style: none; }
[hidden] { display: none !important; }

.app {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 12px 16px calc(32px + env(safe-area-inset-bottom));
}
.emoji { width: 22px; height: 22px; flex: none; display: block; }
.soft { color: var(--on-desk-soft); font-size: 14px; }
.number { font-variant-numeric: tabular-nums; white-space: nowrap; }

.chats {
  display: flex;
  gap: 6px;
  margin: 0 -16px 12px;
  padding: 0 16px;
  overflow-x: auto;
  scrollbar-width: none;
}
.chats::-webkit-scrollbar { display: none; }
.chat {
  flex: none;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 18px;
  color: var(--on-desk-soft);
}
.chat.active { background: var(--gold); color: var(--desk); font-weight: 600; }

.sheet {
  padding: 8px 10px 6px;
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 6px 56px var(--lamp-glow);
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px 2px;
}
.sheet-title { font: 400 25px/1.1 var(--display); }
.sheet-title::first-letter { text-transform: uppercase; }
.sheet-arrows { display: flex; }
.icon-button {
  width: 44px;
  height: 44px;
  border-radius: 22px;
  font: 400 28px/1 var(--display);
}
.icon-button:disabled { color: var(--ink-off); opacity: 0.45; }

.month { touch-action: pan-y; }
.weekdays, .days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.weekdays {
  padding-bottom: 5px;
  border-bottom: 3px double var(--stamp);
  color: var(--ink-soft);
  font-size: 12px;
  text-align: center;
}
.day, .day-blank { height: 44px; }
.day {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  background: rgba(201, 138, 36, var(--heat));
  transition: background-color 120ms ease-out;
}
.day-number { font: 400 19px/1.1 var(--display); font-variant-numeric: lining-nums; }
.day.off { color: var(--ink-off); }
.day.today .day-number { padding: 0 3px; border-bottom: 2px solid var(--stamp); }
.day.in-range { box-shadow: inset 0 2px var(--ink), inset 0 -2px var(--ink); }
.day.start, .day.end { background: var(--ink); color: var(--paper); box-shadow: none; }
.day.start { border-top-left-radius: 8px; border-bottom-left-radius: 8px; }
.day.end { border-top-right-radius: 8px; border-bottom-right-radius: 8px; }
.day.today.start .day-number, .day.today.end .day-number { border-bottom-color: var(--paper); }

.quick { display: flex; gap: 18px; padding: 6px 4px 0; }
.quick-button {
  min-height: 40px;
  font-size: 14px;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
}
.quick-button.active { border-bottom-color: var(--stamp); font-weight: 600; }

.report { transition: opacity 120ms ease-out; }
.report.updating { opacity: 0.55; }
.hero { padding: 24px 0 18px; }
.hero h1 { font: 400 16px/1.3 var(--text); color: var(--on-desk-soft); }
.hero-sum {
  margin: 2px 0;
  font: 400 clamp(42px, 13vw, 54px)/1.1 var(--display);
  color: var(--gold);
  font-variant-numeric: lining-nums;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 50px;
  border-top: 1px solid var(--desk-line);
}
.row dt { display: flex; align-items: center; gap: 10px; }
.row dd { font: 400 21px/1.2 var(--display); font-variant-numeric: lining-nums; text-align: right; }
.row.negative dd { color: var(--negative); }
.row.earned dd { color: var(--gold); }

.block { padding-top: 26px; }
.block h2 { margin-bottom: 6px; font: 400 21px/1.2 var(--display); }
.chat-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 46px;
  align-items: center;
  border-top: 1px solid var(--desk-line);
  text-align: left;
}
.operation {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--desk-line);
}
.plain-button {
  width: 100%;
  min-height: 46px;
  margin-top: 16px;
  border: 1px solid var(--desk-line);
  border-radius: 4px;
}
.failure { padding: 28px 0; }
.blocking {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 26vh 12px 0;
  text-align: center;
  font-size: 17px;
}
.blocking .emoji { width: 44px; height: 44px; }
.notice { padding: 24px 16px; }

.skeleton { background: var(--desk-line); border-radius: 3px; animation: breathe 1.3s ease-in-out infinite; }
.skeleton-hero { height: 90px; margin: 26px 0 18px; }
.skeleton-row { height: 44px; margin-bottom: 8px; }
@keyframes breathe { 50% { opacity: 0.55; } }

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