:root {
    --ink: #171717;
    --muted: #737373;
    --line: #e5e5e5;
    --paper: #fafafa;
    --card: #ffffff;
    --fill: #171717;
    --fill-text: #fafafa;
    --hover: #f5f5f5;
    --active: #eeeeee;
    --warn: #404040;
    --warn-bg: #f5f5f5;
    --danger: #171717;
    --danger-bg: #f2afaf;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    color: var(--ink);
    background: var(--paper);
    font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

a { color: var(--ink); }

.app {
    display: grid;
    grid-template-columns: 15.5rem 1fr;
    min-height: 100vh;
}

.side {
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    background: var(--card);
    border-right: 1px solid var(--line);
    padding: 1rem 0.75rem 0.85rem;
}

.brand {
    display: block;
    padding: 0.25rem 0.6rem 0.9rem;
    color: var(--ink);
    text-decoration: none;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.brand-logo {
    display: block;
    max-width: 100%;
    max-height: 2.4rem;
    margin-bottom: 0.45rem;
    object-fit: contain;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-height: 0;
    overflow: auto;
}

.nav a {
    display: block;
    padding: 0.4rem 0.6rem;
    color: var(--ink);
    text-decoration: none;
    border-radius: 8px;
}

.nav a:hover { background: var(--hover); }
.nav a.on { background: var(--active); font-weight: 600; }

.nav-group { margin: 0; }
.nav-group summary {
    list-style: none;
    cursor: pointer;
    padding: 0.4rem 0.6rem;
    border-radius: 8px;
}
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary:hover { background: var(--hover); }
.nav-group[open] summary { font-weight: 600; background: var(--active); }
.nav-sub a { padding-left: 1.15rem; font-size: 0.88rem; }

.chapter { padding: 0.2rem 0 1.3rem; scroll-margin-top: 1rem; }
.chapter + .chapter { border-top: 1px solid var(--line); padding-top: 1.2rem; }
.live-block { margin-top: 1.2rem; padding-top: 0.8rem; border-top: 1px dashed var(--line); }
.live-block h2 { margin-top: 0; font-size: 1.1rem; }

.side-foot {
    flex-shrink: 0;
    margin-top: auto;
    padding-top: 0.8rem;
    border-top: 1px solid var(--line);
}

.system-switch { position: relative; margin: 0 0 0.85rem; }

button.system-current,
.system-current.is-only {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 0.45rem;
    width: 100%;
    margin: 0;
    padding: 0.55rem 0.65rem;
    background: var(--active);
    color: inherit;
    border: 1px solid var(--line);
    border-radius: 10px;
    text-align: left;
    cursor: pointer;
}

.system-current.is-only { cursor: default; }

button.system-current:hover,
button.system-current[aria-expanded="true"] {
    background: var(--card);
    border-color: #d4d4d4;
}

.system-copy strong {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.system-copy span {
    display: block;
    color: var(--muted);
    font-size: 0.75rem;
    line-height: 1.3;
}

.system-caret {
    width: 0.4rem;
    height: 0.4rem;
    margin-top: -0.2rem;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg);
}

button.system-current[aria-expanded="true"] .system-caret {
    margin-top: 0.15rem;
    transform: rotate(225deg);
}

.system-menu {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 0.35rem);
    z-index: 6;
    max-height: min(24rem, calc(100dvh - 8rem));
    overflow: auto;
    padding: 0.3rem;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.system-menu button {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0.45rem 0.55rem;
    background: transparent;
    color: inherit;
    border: 0;
    border-radius: 7px;
    text-align: left;
    cursor: pointer;
}

.system-menu button strong { display: block; font-size: 0.84rem; font-weight: 600; }
.system-menu button span {
    display: block;
    color: var(--muted);
    font-size: 0.72rem;
    line-height: 1.35;
}

.system-menu button:hover { background: var(--hover); }
.system-menu button.on {
    background: var(--active);
    box-shadow: inset 0 0 0 1px var(--ink);
}
.system-menu button.on span { color: var(--ink); font-weight: 600; }

.account-wrap { position: relative; margin-top: 0.45rem; }

button.account {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    margin: 0;
    padding: 0.45rem;
    background: transparent;
    color: inherit;
    border: 0;
    border-radius: 8px;
    text-align: left;
    cursor: pointer;
}

button.account:hover, button.account[aria-expanded="true"] { background: var(--hover); }

.avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    background: var(--active);
    color: var(--ink);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
}

.account strong { display: block; font-size: 0.88rem; font-weight: 600; }
.account .who span { display: block; color: var(--muted); font-size: 0.75rem; line-height: 1.3; }

.account-menu {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(100% + 0.35rem);
    z-index: 5;
    padding: 0.3rem;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.account-menu a {
    display: block;
    padding: 0.42rem 0.55rem;
    border-radius: 7px;
    color: var(--ink);
    font-size: 0.88rem;
    text-decoration: none;
}

.account-menu a:hover { background: var(--hover); }
.account-menu a.on { background: var(--active); font-weight: 600; }

.menu-sep {
    height: 1px;
    margin: 0.25rem 0.35rem;
    background: var(--line);
}

main { padding: 1.75rem 2rem 3rem; max-width: 76rem; }

.gate {
    max-width: 24rem;
    margin: 12vh auto;
    padding: 1.5rem;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
}

main.gate.verify {
    max-width: 36rem;
    margin: 8vh auto 3rem;
    padding: 0;
    background: transparent;
    border: 0;
}

.verify-card h1 { margin: 0 0 0.6rem; font-size: 1.45rem; }
.verify-card.ok { border-color: #1f7a3a; }
.verify-card.ok h1 { color: #1f7a3a; }
.verify-card.bad { border-color: #a33; }
.verify-card.bad h1 { color: #a33; }
.verify-card ul { margin: 0.6rem 0 0; padding-left: 1.1rem; }
.verify-card .banner { margin-top: 0.9rem; }
.verify-foot { margin: 0.8rem 0 0; color: var(--muted); font-size: 0.85rem; }

main.gate.register {
    max-width: 22.5rem;
    margin: 8vh auto 3rem;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
}

main.gate.register h1 {
    font-size: 2.15rem;
    font-weight: 500;
    letter-spacing: -0.02em;
    line-height: 1.15;
    margin: 0 0 0.7rem;
}

main.gate.register .lead {
    margin: 0 0 1rem;
    font-size: 1.05rem;
    line-height: 1.45;
}

main.gate.register .note {
    margin: 0 0 1.1rem;
    padding: 0.7rem 0.85rem;
    background: #d9edf7;
    color: #31708f;
    border: 1px solid #bce8f1;
    border-radius: 4px;
    font-size: 0.92rem;
}

main.gate.register .banner.bad {
    margin: 0 0 1rem;
    background: #f2dede;
    color: #a94442;
    border: 1px solid #ebccd1;
    border-radius: 4px;
}

main.gate.register label {
    margin: 0.85rem 0 0.3rem;
    color: var(--ink);
    font-size: 0.95rem;
    font-weight: 700;
}

main.gate.register .help {
    margin: 0.3rem 0 0;
    color: #737373;
    font-size: 0.92rem;
}

main.gate.register button[type="submit"] {
    display: block;
    width: 100%;
    margin-top: 0.85rem;
    padding: 0.7rem 1rem;
    background: #5cb85c;
    border-color: #4cae4c;
    border-radius: 4px;
    font-size: 1.05rem;
    font-weight: 500;
    justify-content: center;
}

main.gate.register button[type="submit"]:hover { background: #449d44; border-color: #398439; }

main.gate.register .terms {
    margin: 0.85rem 0 0;
    color: #737373;
    font-size: 0.82rem;
    line-height: 1.4;
}

main.gate.register label.check.terms {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin: 1rem 0 0.5rem;
    font-weight: 400;
}

main.gate.register label.check.terms input {
    margin-top: 0.2rem;
}

main.gate.register .terms a { color: #337ab7; }

.brreg-field {
    position: relative;
}

.brreg-results {
    position: absolute;
    z-index: 20;
    left: 0;
    right: 0;
    top: calc(100% + 0.25rem);
    margin: 0;
    padding: 0.25rem;
    border: 1px solid #d0d7e2;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
    max-height: 14rem;
    overflow: auto;
}

.brreg-results[hidden] { display: none; }

.brreg-status {
    margin: 0;
    padding: 0.55rem 0.7rem;
    color: #667085;
    font-size: 0.85rem;
}

button.brreg-result {
    display: block;
    width: 100%;
    margin: 0;
    text-align: left;
    background: transparent;
    border: 0;
    border-radius: 6px;
    padding: 0.55rem 0.7rem;
    color: inherit;
    font: inherit;
    font-weight: 400;
    line-height: 1.35;
    cursor: pointer;
}

button.brreg-result:hover,
button.brreg-result.is-active,
button.brreg-result[aria-selected="true"] {
    background: #eef4ff;
}

button.brreg-result strong {
    display: block;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--ink);
}

button.brreg-result span {
    display: block;
    color: #667085;
    font-size: 0.8rem;
    margin-top: 0.12rem;
}

#company_meta:empty { display: none; }
#company_meta:not(:empty) {
    margin: 0.45rem 0 0;
    padding: 0.45rem 0.6rem;
    border-radius: 6px;
    background: #f4f7fb;
    color: #344054;
    font-size: 0.85rem;
    line-height: 1.35;
}

main.gate.register code {
    font-size: 0.95em;
}

h1 { font-weight: 600; font-size: 1.5rem; letter-spacing: -0.03em; margin: 0 0 0.5rem; }
h2 { font-weight: 600; font-size: 1.05rem; letter-spacing: -0.02em; }

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin: 0 0 0.5rem;
}

.page-head h1 { margin: 0; }

.head-menu { position: relative; flex: none; }

button.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.15rem;
    height: 2.15rem;
    margin: 0;
    padding: 0;
    background: var(--card);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 8px;
}

button.icon-btn .ico { width: 1.05rem; height: 1.05rem; }

button.icon-btn:hover,
button.icon-btn[aria-expanded="true"] {
    background: var(--hover);
    color: var(--ink);
}

.head-popover {
    position: absolute;
    right: 0;
    top: calc(100% + 0.35rem);
    z-index: 6;
    width: 18.5rem;
    padding: 0.85rem 0.9rem 0.95rem;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.head-popover-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--ink);
}

.head-popover label { margin-top: 0.75rem; }

.head-popover .hint { margin: 0.35rem 0 0; }

.head-popover button { margin-top: 0.75rem; }

.lede { color: var(--muted); margin-top: 0; }

.dash {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(16rem, 0.85fr);
    gap: 0.9rem;
    margin: 1.25rem 0 1.6rem;
    align-items: stretch;
}

.dash-side {
    display: grid;
    gap: 0.9rem;
    align-content: start;
}

.dash-media {
    margin-top: 0;
    align-items: start;
}
.dash-media-main {
    display: grid;
    gap: 0.9rem;
    align-content: start;
}
.dash-calendar-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.55rem;
}
.dash-calendar-list li {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: baseline;
    padding: 0.45rem 0;
    border-bottom: 1px solid var(--line);
}
.dash-calendar-list li:last-child { border-bottom: 0; }
.dash-calendar-list strong { display: block; font-size: 0.95rem; }
.dash-calendar-meta {
    display: grid;
    gap: 0.15rem;
    text-align: right;
    font-size: 0.88rem;
    white-space: nowrap;
}
.dash-calendar-list .status-overdue time,
.dash-calendar-list .status-due time { color: var(--danger); font-weight: 600; }
.dash-calendar-list .status-done time { color: var(--ok, #1b7a3d); }

.dash-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 1.1rem 1.2rem 1.15rem;
}

.dash-card h2 {
    margin: 0 0 0.85rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.dash-card .facts { margin: 0; }

.dash-more { margin: 0.95rem 0 0; font-size: 0.92rem; }

.dash-actions {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.dash-actions form { margin: 0; }

.dash-actions button,
.dash-actions .button {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.45rem;
    width: 100%;
    margin: 0;
    text-align: center;
}

.dash-kicker {
    margin: 0 0 0.75rem;
    font-weight: 600;
}

.dash-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.dash-links a { line-height: 1.4; }

.video-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.video-item {
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--paper);
}

.video-item summary {
    cursor: pointer;
    padding: 0.6rem 0.75rem;
    font-weight: 600;
    list-style: none;
}

.video-item summary::-webkit-details-marker { display: none; }

.video-item summary::before {
    content: "";
    display: inline-block;
    width: 0.4rem;
    height: 0.4rem;
    margin-right: 0.55rem;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(-45deg) translateY(-0.1rem);
}

.video-item[open] summary::before {
    transform: rotate(45deg) translateY(-0.1rem);
}

.video-item video {
    display: block;
    width: 100%;
    max-height: 24rem;
    background: #111;
    border-radius: 0 0 10px 10px;
}

.logo-list {
    display: flex;
    gap: 1.1rem;
    align-items: center;
}

.logo-list img {
    display: block;
    width: auto;
    max-height: 30px;
    max-width: 100%;
    object-fit: contain;
    object-position: center;
}

.dash-users .stat {
    margin: 0;
    font-size: 2.75rem;
    font-weight: 600;
    letter-spacing: -0.04em;
    line-height: 1;
}

.dash-users .stat-label {
    margin: 0.35rem 0 0;
    color: var(--muted);
}

.facts {
    display: grid;
    grid-template-columns: 10rem 1fr;
    gap: 0.35rem 1rem;
    margin: 1.2rem 0;
}

.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 1rem 1.1rem;
    margin: 1rem 0;
}

.banner {
    background: var(--warn-bg);
    color: var(--warn);
    border: 1px solid var(--line);
    padding: 0.75rem 0.9rem;
    border-radius: 8px;
}

.banner.bad { background: var(--danger-bg); color: var(--danger); }
.paywall-dialog,
.member-dialog {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 1.2rem 1.3rem 1.3rem;
    max-width: 28rem;
    background: white;
    color: var(--ink);
}
.paywall-dialog::backdrop,
.member-dialog::backdrop { background: rgba(0, 0, 0, 0.35); }
.paywall-dialog h2,
.member-dialog h2 { margin: 0 0 0.4rem; font-size: 1.25rem; }
.paywall-dialog p,
.member-dialog p { margin: 0.4rem 0; }
.paywall-dialog button,
.member-dialog button { margin-top: 0.7rem; margin-right: 0.4rem; }
.member-dialog { max-width: 28rem; }
.member-dialog label { margin-top: 0.7rem; }
.member-dialog [hidden] { display: none; }
.paywall-dialog ul { margin: 0.2rem 0 0.15rem; padding-left: 1.15rem; }
.paywall-dialog li { margin: 0.15rem 0; }
.pay-alert { display: block; align-items: center; justify-content: space-between; gap: 0.8rem; flex-wrap: wrap; }
.pay-alert form { display: inline; }
.pay-alert button { margin: 0; }
details.invoice-archive { margin: 1.6rem 0 0.4rem; }
details.invoice-archive summary { cursor: pointer; font-weight: 600; }
.ok { color: var(--muted); }

label { display: block; margin: 0.85rem 0 0.25rem; font-size: 0.85rem; color: var(--muted); }
label.check { display: flex; align-items: center; gap: 0.45rem; margin-top: 1rem; color: inherit; font-size: 0.95rem; }
label.check input { width: auto; }
input, select, textarea, button { font: inherit; color: inherit; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], input[type="file"], select, textarea {
    width: 100%;
    padding: 0.5rem 0.6rem;
    border: 1px solid #d4d4d4;
    background: white;
    border-radius: 8px;
}
textarea { min-height: 18rem; }
textarea.compact { min-height: 5.5rem; }
.hint { color: var(--muted); font-size: 0.85rem; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.logo-preview { max-width: 16rem; max-height: 5rem; object-fit: contain; }
.place-row, .goal-row {
    display: grid;
    gap: 0.45rem;
    margin: 0.7rem 0;
    padding-bottom: 0.7rem;
    border-bottom: 1px solid var(--line);
    align-items: end;
}
.place-row { grid-template-columns: 1fr 1.4fr auto; }
.goal-row { grid-template-columns: 1.3fr 1fr 0.9fr 0.85fr 1fr auto; }
.place-row button, .goal-row button, td.actions button { margin-top: 0; }
td.actions { white-space: nowrap; }
td.actions form { display: inline; }
td.actions a { margin-right: 0.45rem; }
td.actions button, td.actions .button { margin-top: 0; padding: 0.35rem 0.7rem; }
table.checks { font-size: 0.88rem; }
table.checks select, table.checks input { margin: 0; }
table.checks td, table.checks th { vertical-align: top; }
.risk-scroll { overflow-x: auto; margin-top: 0.8rem; }
table.risk { min-width: 58rem; }
table.risk th { text-align: center; font-size: 0.75rem; line-height: 1.25; }
table.risk th span { display: block; font-weight: 400; color: var(--muted); }
table.risk th.hazard, table.risk td.hazard { text-align: left; min-width: 16rem; }
table.risk th.group { background: var(--paper); }
table.risk td.mark, table.risk td.product { text-align: center; vertical-align: middle; }
table.risk td.mark input { width: auto; }
table.risk input.priority { width: 3.4rem; margin: 0 auto; text-align: center; }
table.risk .risk-remove { margin: 0; white-space: nowrap; }
table.plan { min-width: 64rem; }
table.plan th { font-size: 0.78rem; }
table.plan textarea.compact { min-height: 4.2rem; }
table.plan input.plan-number { width: 3.2rem; text-align: center; }
table.plan input.plan-priority { width: 4.5rem; text-align: center; }
table.plan .plan-remove { margin: 0; white-space: nowrap; }
tr.theme-row td { background: var(--paper); font-weight: 600; }
button, .button {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.9rem;
    background: var(--fill);
    color: var(--fill-text);
    border: 1px solid var(--fill);
    border-radius: 8px;
    padding: 0.45rem 0.85rem;
    text-decoration: none;
    cursor: pointer;
}
button .ico, .button .ico { width: 1.05em; height: 1.05em; flex: none; }
button:hover, .button:hover { background: #000; }
button.account {
    display: grid;
    width: 100%;
    margin: 0;
    padding: 0.45rem;
    background: transparent;
    color: inherit;
    border: 0;
    text-align: left;
}
button.account:hover, button.account[aria-expanded="true"] { background: var(--hover); }
.button.ghost, button.ghost {
    background: transparent;
    color: var(--ink);
    border: 1px solid #d4d4d4;
}
.button.ghost:hover, button.ghost:hover { background: var(--hover); }
.row { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }

.prose h2, .editor h2 { margin-top: 1.4rem; font-size: 1.35rem; font-weight: 600; }
.prose h3, .editor h3 { margin-top: 1.15rem; font-size: 1.15rem; font-weight: 600; }
.prose h4, .editor h4 { margin-top: 1rem; font-size: 1.02rem; font-weight: 600; }
.prose h5 { margin: 0.85rem 0 0.25rem; font-size: 0.95rem; font-weight: 600; }
.prose p { margin: 0.45rem 0; }
.prose ul, .prose ol { margin: 0.4rem 0 0.8rem; padding-left: 1.2rem; }
.prose li { margin: 0.15rem 0; }
.prose a { text-decoration: underline; text-underline-offset: 0.12em; }
.prose table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
.prose td, .prose th { border: 1px solid var(--line); padding: 0.3rem 0.45rem; vertical-align: top; }
.editor {
    min-height: 18rem;
    background: white;
    border: 1px solid #d4d4d4;
    border-radius: 8px;
    padding: 0.8rem 1rem;
}
.editor table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
.editor td, .editor th {
    border: 1px solid var(--line);
    padding: 0.3rem 0.45rem;
    vertical-align: top;
    min-width: 3rem;
}
.editor th { font-weight: 600; background: var(--paper); }
.editor-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.2rem;
    margin-top: 0.6rem;
    padding: 0.35rem;
    background: white;
    border: 1px solid #d4d4d4;
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
}
.editor-bar + .editor { border-top-left-radius: 0; border-top-right-radius: 0; }
.editor-bar button.icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.9rem;
    height: 1.9rem;
    margin: 0;
    padding: 0;
    background: transparent;
    color: var(--ink);
    border: 1px solid transparent;
    border-radius: 6px;
    line-height: 0;
}
.editor-bar button.icon svg { width: 1.05rem; height: 1.05rem; display: block; }
.editor-bar select {
    width: auto;
    margin: 0;
    padding: 0.22rem 0.4rem;
    border-radius: 6px;
    font-size: 0.82rem;
    background: transparent;
}
.editor-bar select:disabled { opacity: 0.35; }
.editor-bar button:hover { background: var(--hover); color: var(--ink); }
.editor-bar button.is-on { background: var(--active); }
.editor-bar button:disabled { opacity: 0.35; }
.editor-bar button:disabled:hover { background: transparent; }
.editor-bar .bar-gap {
    width: 1px;
    align-self: stretch;
    margin: 0.15rem 0.25rem;
    background: var(--line);
}
.editor-pop {
    display: flex;
    flex-basis: 100%;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.15rem 0.1rem;
}
.editor-pop[hidden] { display: none; }
.editor-pop span, .editor-pop label { margin: 0; font-size: 0.82rem; color: var(--muted); }
.editor-pop label.check { display: flex; align-items: center; gap: 0.3rem; }
.editor-pop input[type="number"] { width: 4.2rem; margin: 0; padding: 0.25rem 0.4rem; }
.editor-pop input[type="text"] { flex: 1; min-width: 10rem; margin: 0; padding: 0.25rem 0.45rem; }
.editor-pop button {
    margin: 0;
    padding: 0.18rem 0.55rem;
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
}
.editor-pop button:hover { background: var(--hover); color: var(--ink); }

.split {
    display: grid;
    grid-template-columns: 16rem 1fr;
    gap: 1.5rem;
}

.sections a {
    display: block;
    padding: 0.2rem 0;
    text-decoration: none;
}
.sections a.on { font-weight: 600; }
.sections h2 { font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 1.2rem 0 0.3rem; }

table.plain { width: 100%; border-collapse: collapse; }
table.plain td, table.plain th { text-align: left; padding: 0.4rem 0.3rem; border-bottom: 1px solid var(--line); font-weight: 400; }
table.plain td.actions { white-space: nowrap; }
table.plain td.actions form { display: inline; }
table.plain td.actions .button, table.plain td.actions button { margin: 0 0.35rem 0 0; padding: 0.15rem 0.5rem; }
table.plain td.actions a.button:not(.ghost),
table.plain td.actions button:not(.ghost) { padding: 0.45rem 0.8rem; font-weight: 600; }

.kurs-section { margin: 1.5rem 0 2rem; }
.kurs-section h2 {
    margin: 0 0 0.85rem;
    font-size: 1.05rem;
    font-weight: 600;
}
.kurs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
    gap: 0.9rem;
}
.kurs-card {
    display: flex;
    flex-direction: column;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
}
.kurs-card-media {
    display: block;
    background: var(--paper);
    aspect-ratio: 16 / 10;
    overflow: hidden;
}
.kurs-card-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.kurs-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    padding: 0.95rem 1rem 1.05rem;
    flex: 1;
}
.kurs-card-body h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.35;
}
.kurs-card-body h3 a {
    color: inherit;
    text-decoration: none;
}
.kurs-card-body h3 a:hover { text-decoration: underline; }
.kurs-card-body p {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.45;
    flex: 1;
}
.kurs-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.7rem;
    flex-wrap: wrap;
    margin-top: 0.25rem;
}
.kurs-card-foot .button { margin-top: 0; }
.kurs-price {
    font-weight: 600;
    white-space: nowrap;
}
.kurs-card.is-compact {
    flex-direction: row;
    align-items: stretch;
}
.kurs-card.is-compact .kurs-card-media {
    width: 8.5rem;
    flex: none;
    aspect-ratio: auto;
}
.kurs-card.is-compact .kurs-card-body { padding: 0.85rem 1rem; }

.dash-kurs .kurs-card { margin: 0; }
.dash-kurs .dash-more { margin-top: 0.85rem; }

.calendar-add { margin: 1.25rem 0 1.75rem; }
.calendar-month { margin: 0 0 1.5rem; }
.calendar-month h2 { margin: 0 0 0.55rem; font-size: 1.05rem; }
.calendar-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.55rem; }
.calendar-item {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.65rem 1rem;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface, #fff);
}
.calendar-item-main { display: grid; gap: 0.15rem; }
.calendar-item-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.55rem; }
.calendar-remind { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.92rem; cursor: pointer; }
.calendar-status { font-size: 0.9rem; }
.calendar-item.status-overdue .calendar-status,
.calendar-item.status-due .calendar-status { color: var(--danger); font-weight: 600; }
.calendar-item.status-done .calendar-status { color: var(--ok, #1b7a3d); }

.report-form textarea { min-height: 7rem; }
.attach-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
    gap: 0.75rem;
    margin: 0.75rem 0 1.25rem;
}
.attach-item {
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: var(--surface, #fff);
}
.attach-item img {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
}
.attach-delete {
    padding: 0.35rem 0.5rem 0.55rem;
}
.attach-delete button { width: 100%; }

@media (max-width: 800px) {
    .app { grid-template-columns: 1fr; }
    .side {
        position: static;
        height: auto;
        overflow: visible;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }
    .split { grid-template-columns: 1fr; }
    .pair, .place-row, .goal-row { grid-template-columns: 1fr; }
    .dash, .dash-media { grid-template-columns: 1fr; }
    .facts { grid-template-columns: 1fr; gap: 0.1rem; }
    .facts dt { margin-top: 0.55rem; }
    .facts dt:first-child { margin-top: 0; }
    main { padding: 1rem; }
    .kurs-card.is-compact { flex-direction: column; }
    .kurs-card.is-compact .kurs-card-media {
        width: 100%;
        aspect-ratio: 16 / 10;
    }
}
