/* KOVKA 3 — premium dark, dense, warm champagne accent. */
:root {
  --bg: #0d0d0e;
  --surface: #161618;
  --surface-2: #1d1d20;
  --surface-3: #26262a;
  --line: #2c2c31;
  --text: #f4f2ef;
  --muted: #9c978f;
  --muted-2: #767169;
  --accent: #e7cfa7;
  --accent-soft: rgba(231, 207, 167, 0.14);
  --accent-text: #17130c;
  --danger: #d98b86;
  --danger-soft: rgba(217, 139, 134, 0.14);
  --success: #93c09a;
  --radius: 18px;
  --radius-sm: 12px;
  --tap: 48px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body, #root { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
p { margin: 0 0 8px; }
ul { margin: 0; padding-left: 20px; }

.app { min-height: 100%; display: flex; flex-direction: column; }
.app-body { flex: 1; padding-bottom: calc(76px + var(--safe-bottom)); }
.app-body.no-nav { padding-bottom: 24px; }

.screen { max-width: 720px; margin: 0 auto; padding: 8px 16px 24px; }
.screen-body { display: flex; flex-direction: column; gap: 14px; }
.screen-head { display: flex; align-items: flex-start; gap: 10px; padding: 12px 0 14px; }
.screen-head-text { flex: 1; min-width: 0; }
.screen-title { font-size: 28px; line-height: 1.15; }
.page-title { font-size: 22px; line-height: 1.2; }
.eyebrow { font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted-2); }
.head-actions { display: flex; align-items: center; gap: 6px; }

.brand { display: flex; align-items: center; justify-content: space-between; padding: 14px 0 6px; }
.brand-mark { font-size: 20px; letter-spacing: 0.32em; font-weight: 600; }
.brand-sub { font-size: 10px; letter-spacing: 0.3em; color: var(--muted-2); text-transform: uppercase; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.strong { font-weight: 650; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.row-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.col { display: flex; flex-direction: column; gap: 10px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.spacer { flex: 1; }
.nowrap { white-space: nowrap; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  display: block;
  width: 100%;
  text-align: left;
}
.card-button { cursor: pointer; }
.card-button:active { background: var(--surface-2); }
.card.tight { padding: 10px 12px; }
.card.flat { background: var(--surface-2); border-color: transparent; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 16px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--surface-2); cursor: pointer; font-weight: 600; font-size: 15px;
}
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-primary { background: var(--accent); color: var(--accent-text); border-color: transparent; min-height: 54px; }
.btn-secondary { background: var(--surface-2); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.btn-lg { min-height: 54px; font-size: 16px; }
.btn-sm { min-height: 40px; padding: 0 12px; font-size: 14px; border-radius: 12px; }
.btn-full { width: 100%; }

.icon-btn {
  min-width: var(--tap); min-height: var(--tap); display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: none; border-radius: 12px; cursor: pointer; color: var(--text);
}
.icon-btn:active { background: var(--surface-2); }
.icon { flex: none; }

.hero { position: relative; overflow: hidden; padding: 20px; background: linear-gradient(145deg, #1b1b1e 0%, #121214 60%); }
.hero h2 { font-size: 26px; line-height: 1.2; max-width: 16ch; }
.hero p { color: var(--muted); margin: 10px 0 18px; max-width: 34ch; }

.stat { display: flex; gap: 10px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.stat-icon { width: 40px; height: 40px; border-radius: 12px; background: var(--surface-3); display: inline-flex; align-items: center; justify-content: center; color: var(--accent); }
.stat-label { font-size: 12px; color: var(--muted); }
.stat-value { font-size: 20px; font-weight: 650; }
.stat-hint { font-size: 12px; color: var(--muted-2); }

.progress { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 999px; }

.banner {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  border-radius: 14px; padding: 12px 14px; min-height: var(--tap);
  border: 1px solid transparent; cursor: pointer; font-size: 14px;
}
.banner-warning { background: rgba(231, 207, 167, 0.1); border-color: rgba(231, 207, 167, 0.25); color: #eadcc3; }
.banner-info { background: var(--surface-2); border-color: var(--line); color: var(--text); }
.banner-danger { background: var(--danger-soft); border-color: rgba(217, 139, 134, 0.3); color: #f0c9c6; }
.banner-success { background: rgba(147, 192, 154, 0.12); border-color: rgba(147, 192, 154, 0.3); color: #cfe6d3; }
.banner-text { flex: 1; }
.banner-action { font-weight: 650; }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(13, 13, 14, 0.94); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); padding-bottom: var(--safe-bottom);
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: 62px; background: transparent; border: none; color: var(--muted); font-size: 12px; cursor: pointer;
}
.nav-item.active { color: var(--accent); }
.nav-item span { line-height: 1; }

.list { display: flex; flex-direction: column; gap: 8px; }
.list-row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 10px 12px; min-height: var(--tap); cursor: pointer;
}
.list-row:active { background: var(--surface-2); }
.list-row .grow { flex: 1; min-width: 0; }
.list-title { font-size: 16px; font-weight: 600; }
.list-sub { font-size: 13px; color: var(--muted); }

.section-title { font-size: 18px; font-weight: 650; margin-top: 6px; }

.input {
  width: 100%; min-height: var(--tap); padding: 10px 12px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text); font-size: 16px;
}
.input:focus-visible, .btn:focus-visible, .icon-btn:focus-visible, .nav-item:focus-visible, .list-row:focus-visible, .card-button:focus-visible, .segment:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
textarea.input { min-height: 88px; resize: vertical; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: right 18px center, right 13px center; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 13px; color: var(--muted); }
.field-hint { font-size: 12px; color: var(--muted-2); }
.field-error { font-size: 13px; color: var(--danger); }

.num-row { display: flex; align-items: center; gap: 8px; }
.num-btn { min-width: 44px; min-height: var(--tap); border-radius: 12px; background: var(--surface-3); border: none; font-size: 22px; cursor: pointer; }
.num-input { text-align: center; font-size: 18px; font-weight: 600; }
.duration-row { display: flex; align-items: center; gap: 8px; }
.duration-row .input { width: 78px; text-align: center; }

.segmented { display: flex; gap: 4px; background: var(--surface-2); border-radius: 14px; padding: 4px; }
.segment { flex: 1; min-height: 44px; border-radius: 11px; border: none; background: transparent; color: var(--muted); font-weight: 600; cursor: pointer; font-size: 14px; }
.segment.active { background: var(--surface-3); color: var(--text); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); white-space: nowrap; cursor: pointer; font-size: 14px; }
.chip.active { background: var(--accent-soft); border-color: rgba(231, 207, 167, 0.4); color: var(--accent); }

.sheet-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); display: flex; align-items: flex-end; justify-content: center; z-index: 60; padding: 0; }
.sheet { background: var(--surface); border-radius: 22px 22px 0 0; width: 100%; max-width: 720px; max-height: 88vh; display: flex; flex-direction: column; border: 1px solid var(--line); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { font-size: 18px; }
.sheet-body { padding: 16px; padding-bottom: calc(20px + var(--safe-bottom)); overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.dialog { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; margin: auto 16px; padding: 20px; max-width: 460px; width: 100%; align-self: center; }
.dialog h2 { font-size: 19px; margin-bottom: 8px; }
.dialog-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }

.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 50; background: var(--surface-3); border: 1px solid var(--line); border-radius: 14px; padding: 6px; min-width: 210px; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45); }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 0 10px; background: transparent; border: none; border-radius: 10px; text-align: left; cursor: pointer; font-size: 15px; }
.menu-item:active { background: var(--surface-2); }
.menu-item.danger { color: var(--danger); }
.menu-item:disabled { opacity: 0.45; }

.occ-card { padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.occ-head { display: flex; gap: 12px; align-items: flex-start; }
.occ-index { width: 26px; height: 26px; border-radius: 9px; background: var(--surface-3); color: var(--muted); font-size: 13px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.occ-name { font-size: 17px; font-weight: 620; line-height: 1.25; overflow-wrap: anywhere; }
.occ-sub { font-size: 13px; color: var(--muted); }
.occ-thumb { width: 56px; height: 56px; border-radius: 12px; object-fit: cover; flex: none; background: var(--surface-3); }
.set-row { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 2px 0; border-top: 1px solid var(--line); }
.set-row:first-of-type { border-top: none; }
.set-mark { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--line); display: inline-flex; align-items: center; justify-content: center; color: var(--muted-2); flex: none; }
.set-mark.done { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.set-main { flex: 1; font-size: 15px; min-width: 0; }
.set-next { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.set-meta { font-size: 12px; color: var(--muted-2); }

.status-pill { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.status-pill.completed { color: var(--success); border-color: rgba(147, 192, 154, 0.4); }
.status-pill.active { color: var(--accent); border-color: rgba(231, 207, 167, 0.4); }
.status-pill.skipped { color: var(--muted-2); }

.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.day-cell { display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 64px; padding: 8px 2px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); cursor: pointer; }
.day-cell.selected { background: var(--accent-soft); border-color: rgba(231, 207, 167, 0.45); }
.day-cell.today .day-num { color: var(--accent); }
.day-dow { font-size: 11px; color: var(--muted-2); text-transform: uppercase; }
.day-num { font-size: 17px; font-weight: 620; }
.day-dots { display: flex; gap: 3px; min-height: 6px; }
.dot { width: 5px; height: 5px; border-radius: 50%; background: var(--muted-2); }
.dot.done { background: var(--success); }
.dot.plan { background: var(--accent); }

.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }

.bar-row { display: flex; align-items: center; gap: 10px; }
.bar-label { width: 84px; font-size: 14px; color: var(--muted); }
.bar-track { flex: 1; height: 10px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); }
.bar-value { width: 28px; text-align: right; font-variant-numeric: tabular-nums; }

.media { border-radius: 12px; object-fit: cover; }
.media-placeholder { border-radius: 12px; background: var(--surface-3); }
.media-strip { display: flex; gap: 8px; overflow-x: auto; }
.media-strip .media, .media-strip .media-placeholder { width: 96px; height: 96px; flex: none; }

.empty { text-align: center; padding: 28px 12px; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.empty h3 { font-size: 18px; }
.loading { display: flex; align-items: center; gap: 10px; padding: 20px 0; justify-content: center; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: spin 0.8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-box { display: flex; gap: 12px; align-items: flex-start; background: var(--danger-soft); border: 1px solid rgba(217, 139, 134, 0.3); border-radius: var(--radius); padding: 14px; color: #f2d3d0; }

.toasts { position: fixed; left: 0; right: 0; top: calc(10px + env(safe-area-inset-top, 0px)); bottom: auto; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 80; pointer-events: none; padding: 0 16px; }
.toast { background: var(--surface-3); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; max-width: 520px; font-size: 14px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5); }
.toast-error { border-color: rgba(217, 139, 134, 0.45); color: #f2d3d0; }
.toast-success { border-color: rgba(147, 192, 154, 0.4); }

.sticky-actions {
  position: sticky; bottom: calc(76px + var(--safe-bottom)); z-index: 20;
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px 0 6px; margin-top: 4px;
  background: linear-gradient(180deg, rgba(13, 13, 14, 0) 0%, rgba(13, 13, 14, 0.92) 26%, var(--bg) 100%);
}
.add-row { display: flex; gap: 6px; }
.add-row .btn { flex: 1 1 0; min-width: 0; padding: 0 8px; gap: 6px; }
.add-row .btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.occ-open { background: none; border: none; text-align: left; padding: 0; cursor: pointer; min-width: 0; }
.occ-sub .status-pill { margin-right: 6px; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.onboarding { max-width: 520px; margin: 0 auto; padding: 32px 20px; display: flex; flex-direction: column; gap: 16px; min-height: 100vh; justify-content: center; }

@media (min-width: 760px) {
  .app-body { padding-bottom: 32px; }
  .toasts { top: 16px; }
  .bottom-nav { position: sticky; border-radius: 18px; margin: 0 auto 16px; max-width: 720px; border: 1px solid var(--line); }
  .toasts { bottom: 24px; }
  .sticky-actions { bottom: 16px; }
}

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