/* ConBIC 3.0 — same palette as 2.0: #F1EFE8 #185FA5 #378ADD #1D9E75 #D85A30 #B36F0B */
:root {
  --bg: #F1EFE8;
  --primary: #185FA5;
  --accent: #378ADD;
  --ok: #1D9E75;
  --warn: #D85A30;
  --amber: #B36F0B;
  --ink: #1f2430;
  --card: #ffffff;
  --line: #d9d4c7;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 16px/1.55 "Segoe UI", system-ui, sans-serif;
  min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--primary); }
h1, h2, h3 { color: var(--primary); line-height: 1.25; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }

header.site {
  background: var(--primary); color: #fff;
  display: flex; align-items: center; gap: 1rem; padding: .6rem 1.2rem;
}
header.site .logo { font-weight: 700; font-size: 1.15rem; color: #fff; text-decoration: none; }
header.site nav { margin-left: auto; display: flex; gap: .9rem; align-items: center; }
header.site a { color: #eaf2fb; text-decoration: none; }
header.site a:hover { text-decoration: underline; }
.lang-switch a.active { font-weight: 700; text-decoration: underline; }

main { flex: 1; width: 100%; margin: 0 auto; padding: 1.2rem; }
main.narrow { max-width: 720px; }
main.wide { max-width: none; }

/* R2a par.A1: left menu — persistent >= 1200 px, hamburger overlay below. */
.layout { flex: 1; display: flex; width: 100%; min-height: 0; }
.layout > main { min-width: 0; }
.sidenav { display: none; flex-direction: column; gap: .15rem; padding: 1rem .8rem;
  background: #f1f4f8; border-right: 1px solid #dfe5ec; min-width: 210px; }
.sidenav a { color: #24303f; text-decoration: none; padding: .5rem .7rem;
  border-radius: 8px; }
.sidenav a:hover { background: #e4eaf2; }
.sidenav a.active { background: var(--primary); color: #fff; }
.sidenav a.soon { color: #7a828c; }
.sidenav a.soon .muted { font-size: .8rem; }
.menu-toggle-box { position: absolute; left: -9999px; }
.menu-toggle { display: none; color: #fff; font-size: 1.3rem; cursor: pointer;
  margin-right: .6rem; user-select: none; }
@media (min-width: 1200px) {
  .sidenav { display: flex; }
}
@media (max-width: 1199.98px) {
  .menu-toggle { display: inline-block; }
  .menu-toggle-box:checked ~ .layout .sidenav { display: flex; position: fixed;
    top: 0; left: 0; bottom: 0; z-index: 40; box-shadow: 2px 0 12px rgba(0,0,0,.2);
    padding-top: 3.2rem; }
}

footer.site {
  border-top: 1px solid var(--line); padding: .7rem 1.2rem;
  font-size: .85rem; color: #5a5f6b; background: var(--bg);
}

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 1rem 1.2rem; margin-bottom: 1rem;
}
.notice { border-left: 4px solid var(--ok); padding: .6rem .9rem; background: #eaf6f1; border-radius: 6px; margin-bottom: 1rem; }
.error { border-left: 4px solid var(--warn); padding: .6rem .9rem; background: #fbeae3; border-radius: 6px; margin-bottom: 1rem; }
.draft-banner {
  background: var(--amber); color: #fff; text-align: center;
  padding: .35rem .8rem; font-size: .85rem;
}

form.stack label { display: block; margin: .7rem 0 .2rem; font-weight: 600; }
form.stack input[type=text], form.stack input[type=email],
form.stack input[type=password], form.stack select {
  width: 100%; padding: .55rem .7rem; border: 1px solid var(--line);
  border-radius: 6px; font-size: 1rem; background: #fff;
}
button, .btn {
  background: var(--primary); color: #fff; border: 0; border-radius: 6px;
  padding: .6rem 1.1rem; font-size: 1rem; cursor: pointer; text-decoration: none;
  display: inline-block; margin-top: .8rem;
}
button.secondary { background: var(--accent); }
button.danger { background: var(--warn); }

table.plain { border-collapse: collapse; width: 100%; font-size: .9rem; }
table.plain th, table.plain td { border-bottom: 1px solid var(--line); padding: .35rem .5rem; text-align: left; }
.table-scroll { overflow-x: auto; }

.badge { display: inline-block; border-radius: 999px; padding: .1rem .65rem; font-size: .85rem; color: #fff; }
.badge.ok { background: var(--ok); }
.badge.warn { background: var(--warn); }
.badge.amber { background: var(--amber); }
.badge.neutral { background: #7a8194; }

/* §7 shell grid: >=1600px three columns, 1200–1600 two, <900 one */
.shell { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 900px) { .shell { grid-template-columns: 280px 1fr; } .shell .col-chat { grid-column: 1 / -1; } }
@media (min-width: 1600px) { .shell { grid-template-columns: 320px 1fr 380px; } .shell .col-chat { grid-column: auto; } }

.pulse-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 900px) { .pulse-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1600px) { .pulse-grid { grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); } }

.chat-q { display: block; width: 100%; text-align: left; background: #fff; color: var(--primary);
  border: 1px solid var(--line); border-radius: 6px; padding: .5rem .8rem; margin: .3rem 0; cursor: pointer; }
.chat-q:hover { border-color: var(--accent); }
.chat-a { background: #f6f9fd; border-left: 3px solid var(--accent); padding: .6rem .9rem; border-radius: 6px; margin: .5rem 0; }

.legal main { max-width: 760px; }
.muted { color: #5a5f6b; font-size: .9rem; }

/* --- R1: Otsused cards, Lihtvaade, chips, search --- */
main.liht { max-width: 720px; }
.context-line { color: #5a5f6b; font-size: .95rem; margin-top: 0; }
.topbar-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 700px) { .topbar-grid { grid-template-columns: 1fr 1fr 1fr; } }
.topbar strong, .hero { font-size: 1.35rem; color: var(--primary); }
p.hero { margin: .4rem 0; }
.decision-card .card-q { font-weight: 600; }
.range-strip { position: relative; height: 10px; border-radius: 5px; margin: .6rem 0;
  background: linear-gradient(90deg, var(--ok) 0%, var(--amber) 60%, var(--warn) 100%); opacity: .85; }
.range-strip .zero-mark { position: absolute; left: 0; top: 12px; font-size: .75rem; color: #5a5f6b; }
.range-strip .range-fill { display: none; }
/* R1.1 par.3.2: number markers under the range strip (0 | expected | adverse) */
.range-markers { display: flex; justify-content: space-between; gap: .5rem;
  font-size: .75rem; color: #5a5f6b; margin: 0 0 .4rem; }
.range-markers .expected { text-align: center; }
.range-markers .adverse { text-align: right; }
.chip-row { display: flex; gap: .6rem; flex-wrap: wrap; }
button.chip { background: #fff; color: var(--primary); border: 1px solid var(--primary);
  border-radius: 999px; padding: .45rem 1rem; }
button.chip:hover { background: var(--primary); color: #fff; }
/* R1.1b par.2: the optional (1) row inside the contract form — radio chips */
label.chip.choice { display: inline-flex; align-items: center; gap: .35rem;
  background: #fff; color: var(--primary); border: 1px solid var(--primary);
  border-radius: 999px; padding: .45rem 1rem; cursor: pointer; }
label.chip.choice:has(input:checked) { background: var(--primary); color: #fff; }
button.linklike { background: none; border: none; color: var(--primary);
  text-decoration: underline; padding: 0; margin: 0; cursor: pointer; font-size: 1rem; }
.kiip1 { max-width: 560px; margin: 2rem auto; }
.liht-lause { font-size: 1.1rem; }
.liht-kysimus { font-size: 1.15rem; font-weight: 600; color: var(--primary); }
.bottom-line { border-top: 1px solid var(--line); padding-top: .6rem; }
.search-row { display: flex; gap: .5rem; align-items: center; }
.search-row input { flex: 1; }
.search-row button, .refresh-form button { margin-top: 0; }
.search-hits label.hit, form.hit { display: block; padding: .3rem 0; }
form.hit button { margin: 0 0 0 .5rem; padding: .2rem .7rem; }
.roleswitch form button { margin-top: .3rem; }
details summary { cursor: pointer; color: var(--primary); margin-top: .5rem; }
.limits { border-left: 4px solid var(--amber); }
.f2 { border-left: 4px solid var(--accent); }
.partner-row { border-top: 1px solid var(--line); padding-top: .6rem; }

/* R1 par.7.2: 390px — header wraps into three blocks; "ET / EN" stays on one
   line and never breaks mid-word. */
.lang-switch { white-space: nowrap; }
@media (max-width: 480px) {
  header.site { flex-wrap: wrap; row-gap: .3rem; }
  header.site nav { margin-left: 0; flex-wrap: wrap; row-gap: .3rem; width: 100%; }
}

/* R2a par.A2: Ülevaade blocks */
main.yv { max-width: 1080px; }
.yv-lause { font-size: 1.05rem; margin: .45rem 0; }
.yv-strip .badge { margin-right: .3rem; }
.inline-info { display: inline-block; }
.inline-info summary { cursor: pointer; color: #5a5f6b; list-style: none; display: inline; }
.inline-info[open] span { display: inline-block; margin-left: .4rem; font-size: .8rem; max-width: 480px; }
.yv-fan svg { width: 100%; height: 150px; }
.yv-fan-labels { display: flex; justify-content: space-between; gap: .6rem; font-size: .9rem; }
.yv-periods { display: grid; grid-template-columns: repeat(4, 1fr); gap: .6rem; margin: .8rem 0; }
.yv-period { border: 1px solid #e2e7ee; border-radius: 8px; padding: .5rem .6rem; font-size: .9rem; }
.yv-period-total { font-weight: 700; color: var(--primary); }
.yv-contrib .dot { display: inline-block; width: .6em; height: .6em; border-radius: 50%; margin-right: .35em; }
.yv-cal th { text-align: left; font-weight: 600; }
.yv-cal td { position: relative; }
.yv-cal td.tone-pressure { background: rgba(196, 90, 26, calc(0.08 + 0.25 * var(--heat, 0))); }
.yv-cal td.tone-favorable { background: rgba(63, 157, 99, calc(0.08 + 0.2 * var(--heat, 0))); }
.yv-cal-q td { font-size: .8rem; vertical-align: top; }
.yv-cycle svg { width: 100%; max-width: 420px; height: 90px; }
a.btn { display: inline-block; background: var(--primary); color: #fff; padding: .6rem 1.2rem;
  border-radius: 8px; text-decoration: none; }
@media (max-width: 719.98px) { .yv-periods { grid-template-columns: 1fr 1fr; } }

/* R2a par.B: Turg + Rollid */
.turg-chart { width: 100%; height: 200px; background: #fbfaf7; border: 1px solid #eee6d8; border-radius: 6px; }
.turg-legend { display: flex; flex-wrap: wrap; gap: .8rem; font-size: .85rem; margin-top: .3rem; }
.turg-legend .dot, .yv-contrib .dot { display: inline-block; width: .6em; height: .6em; border-radius: 50%; margin-right: .3em; }
details.turg-card summary, details.turg-2008 summary { cursor: pointer; padding: .35rem 0; }
.rollid-clock svg { width: 100%; max-width: 300px; height: auto; display: block; margin: 0 auto; }
.rollid-relay td.relay-cell { width: 14px; height: 14px; padding: 0; border: 1px solid #fff; }
.relay-cell.phase-recovery { background: #cfe6d9; }
.relay-cell.phase-expansion { background: #7fc39e; }
.relay-cell.phase-slowdown { background: #f0d9a8; }
.relay-cell.phase-contraction { background: #e5b39a; }
.relay-cell.phase-unknown, .relay-cell.unknown { background: #e8e8e8; }
.rollid-relay th { white-space: nowrap; }
.rollid-q { font-size: .6rem; color: #9aa3ad; font-weight: 400; }
tr.rollid-you { background: #f2f7fd; }
.relay-year { font-size: .65rem; color: #5a5f6b; }

/* R2a.1: account card in the left menu (p8) */
.sidenav-account { display: flex; flex-direction: column; gap: .1rem;
  border: 1px solid #dfe5ec; border-radius: 8px; background: #fff;
  padding: .55rem .7rem; margin-bottom: .6rem; }
.sidenav-account-name { font-weight: 700; color: var(--primary); }
/* R2a.1 p5: stacked bars (lower panel of the cost basket) */
.yv-bars { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem;
  align-items: end; margin: .5rem 0 .3rem; }
.yv-bar { text-align: center; font-size: .85rem; }
.yv-bar-stack { display: flex; flex-direction: column-reverse; height: 150px;
  justify-content: flex-start; border-bottom: 2px solid #d9d4c7; }
.yv-bar-seg { position: relative; min-height: 2px; }
.yv-bar-seg span { font-size: .7rem; color: #fff; position: absolute;
  left: 50%; top: 50%; transform: translate(-50%, -50%); white-space: nowrap; }
.yv-bar-total { font-weight: 700; color: var(--primary); margin-bottom: .2rem; }
.yv-anchor { border-left: 3px solid var(--accent); padding-left: .6rem; }
/* R2a.1 p7: relay v2 — colour = role state, darkness = volume level */
.relay-cell.state-näljane { background: rgba(133, 183, 235, var(--rheat, .6)); }
.relay-cell.state-täituv { background: rgba(29, 158, 117, var(--rheat, .6)); }
.relay-cell.state-tipus { background: rgba(216, 90, 48, var(--rheat, .6)); }
.relay-cell.state-jahtuv { background: rgba(179, 111, 11, var(--rheat, .6)); }
.relay-cell.state-unknown, .relay-cell.unknown { background: #e8e8e8; }
.dot.st1 { background: #85B7EB; }
.dot.st2 { background: #1D9E75; }
.dot.st3 { background: #D85A30; }
.dot.st4 { background: #B36F0B; }
.relay-yearcell { border-left: 2px solid #fff; opacity: .8; }
.relay-divider { border-left: 2px dashed #9aa3ad; background: #fff; width: 4px; }
.relay-forecast { background: repeating-linear-gradient(45deg, #f2f2f2 0 4px, #e2e7ee 4px 8px); text-align: center; font-size: .7rem; color: #9aa3ad; }
.rollid-phase-strip td { height: 5px; padding: 0; opacity: .55; }
.relay-info summary { display: block; width: 100%; height: 100%; min-height: 12px; cursor: pointer; list-style: none; }
.relay-info[open] span { position: absolute; background: #fff; border: 1px solid #d9d4c7; border-radius: 6px; padding: .2rem .4rem; z-index: 30; font-size: .75rem; }
.relay-info { position: static; }
.tsykkel svg { width: 100%; max-width: 460px; height: auto; }
.tsykkel-legend { margin: .2rem 0; }

/* R3 §F tester bar + §E plan ribbon */
.tester-bar { background: #4a2a6b; color: #fff; padding: .35rem 1.2rem;
  display: flex; align-items: center; gap: 1rem; font-size: .85rem; flex-wrap: wrap; }
.tester-bar form { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; margin: 0; }
.tester-bar .tester-mark { font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.tester-bar select { font-size: .85rem; padding: .1rem .3rem; }
.tester-bar button { margin: 0; padding: .15rem .6rem; font-size: .85rem; }
.tester-bar a { color: #e8ddf5; }
.plan-ribbon { background: #B36F0B; color: #fff; padding: .4rem 1.2rem;
  font-size: .9rem; text-align: center; }
