:root {
    color-scheme: light;
    --bg: #f4f7f4;
    --surface: #ffffff;
    --surface-soft: #f8faf8;
    --ink: #202621;
    --muted: #667268;
    --line: #dfe5df;
    --line-strong: #cad6cc;
    --green: #14884f;
    --green-dark: #0f6b3f;
    --green-soft: #e9f5ee;
    --green-pale: #f2f8f4;
    --danger: #cf3f3a;
    --danger-soft: #fff0ef;
    --shadow: 0 18px 40px rgba(32, 38, 33, 0.08);
    --sidebar-width: 264px;
    --topbar-height: 74px;
    --editor-width: clamp(398px, 29vw, 430px);
    --page-gutter: clamp(22px, 2.1vw, 30px);
    --content-gap: 20px;
    --panel-padding: 16px;
    --editor-gutter: 20px;
    --control-height: 42px;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

body {
    margin: 0;
    min-width: 320px;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

.app-frame {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
    border-right: 1px solid var(--line);
    background: var(--surface);
    padding: 20px 14px 18px;
}

.brand-row,
.brand,
.global-topbar,
.global-actions,
.module-toolbar,
.module-actions,
.panel-heading,
.form-actions,
.row-actions,
.bom-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-row,
.global-topbar,
.module-toolbar,
.panel-heading {
    justify-content: space-between;
}

.brand-row {
    padding: 0 6px 28px;
}

.brand-mark {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 7px;
    background: var(--green);
    color: #fff;
    font-weight: 900;
}

.brand strong {
    font-size: 1.25rem;
}

.nav-groups {
    display: grid;
    gap: 24px;
    padding-bottom: 20px;
}

.nav-group {
    display: grid;
    gap: 11px;
}

.nav-label {
    margin: 0 6px;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: 0;
}

.nav-list {
    display: grid;
    gap: 8px;
}

.nav-button {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 46px;
    border: 1px solid transparent;
    border-radius: 7px;
    background: transparent;
    color: #536058;
    padding: 0 10px;
    text-align: left;
    font-weight: 760;
}

.nav-button:hover,
.nav-button.is-active {
    border-color: #d4e5d9;
    background: var(--green-soft);
    color: var(--green-dark);
}

.nav-icon {
    display: grid;
    width: 24px;
    height: 24px;
    place-items: center;
    border-radius: 6px;
    color: #5d6a62;
}

.nav-icon svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.nav-button:hover .nav-icon,
.nav-button.is-active .nav-icon {
    color: var(--green);
}

.sidebar-footer {
    margin-top: auto;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 14px;
    color: var(--muted);
    font-size: 0.82rem;
}

.sidebar-footer strong,
.sidebar-footer span {
    color: var(--ink);
}

.sidebar-footer p {
    margin: 10px 0 14px;
}

.db-status {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #d8ebdf;
    border-radius: 7px;
    background: var(--green-pale);
    padding: 10px;
}

.db-status span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--green);
}

.main-shell {
    min-width: 0;
}

.global-topbar {
    gap: 18px;
    height: var(--topbar-height);
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.92);
    padding: 0 var(--page-gutter);
}

.global-search {
    position: relative;
    flex: 1;
    max-width: 620px;
}

.global-search input,
.search-box input,
input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line-strong);
    border-radius: 7px;
    background: var(--surface);
    color: var(--ink);
    padding: 10px 12px;
}

.global-search input {
    min-height: var(--control-height);
    padding-left: 42px;
    padding-right: 86px;
}

.search-leading,
.search-shortcut {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

.search-leading {
    left: 15px;
    display: grid;
    width: 18px;
    height: 18px;
    place-items: center;
    color: #526058;
}

.search-leading svg,
.sidebar-menu svg,
.primary-button svg,
.language-icon svg,
.topbar-icon svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.search-shortcut {
    right: 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface-soft);
    color: var(--muted);
    padding: 4px 7px;
    font-size: 0.72rem;
    font-weight: 800;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--green);
    outline: 3px solid rgba(20, 136, 79, 0.12);
}

.primary-button,
.ghost-button,
.danger-button,
.action-button,
.icon-button,
.admin-button,
.profile-button {
    min-height: 38px;
    border: 1px solid transparent;
    border-radius: 7px;
    padding: 0 14px;
    font-weight: 800;
}

.primary-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--green);
    color: #fff;
    box-shadow: 0 8px 18px rgba(20, 136, 79, 0.18);
}

.primary-button:hover {
    background: var(--green-dark);
}

.global-actions {
    flex: 0 0 auto;
    justify-content: flex-end;
}

.quick-add {
    min-width: 142px;
    min-height: 40px;
    padding: 0 16px;
}

.quick-add svg {
    width: 17px;
    height: 17px;
}

.quick-add .chevron-icon {
    width: 15px;
    height: 15px;
    margin-left: 2px;
}

.language-switcher {
    position: relative;
    display: inline-flex;
    align-items: center;
    min-width: 92px;
}

.language-icon {
    position: absolute;
    left: 12px;
    display: grid;
    width: 18px;
    height: 18px;
    place-items: center;
    color: #526058;
    pointer-events: none;
}

.language-switcher select {
    min-height: 40px;
    appearance: none;
    border-color: var(--line);
    background: var(--surface);
    padding: 0 30px 0 38px;
    color: var(--ink);
    font-size: 0.84rem;
    font-weight: 850;
}

.language-switcher::after {
    position: absolute;
    right: 12px;
    width: 7px;
    height: 7px;
    border-right: 1.8px solid #526058;
    border-bottom: 1.8px solid #526058;
    content: "";
    transform: translateY(-18%) rotate(45deg);
    pointer-events: none;
}

.ghost-button {
    border-color: var(--line);
    background: var(--surface);
    color: var(--ink);
}

.danger-button {
    background: var(--danger-soft);
    color: #b3332f;
}

.action-button {
    display: inline-grid;
    width: 30px;
    min-width: 30px;
    min-height: 30px;
    place-items: center;
    padding: 0;
    border-color: var(--line);
    background: var(--surface);
    color: #4d5a52;
    font-size: 0.75rem;
    font-weight: 900;
}


.delete-action {
    border-color: #f4dada;
    background: var(--danger-soft);
    color: var(--danger);
}

.icon-button,
.admin-button {
    display: inline-grid;
    min-width: 38px;
    place-items: center;
    border-color: var(--line);
    background: var(--surface);
    color: #526058;
    padding: 0 10px;
}

.admin-button {
    border-radius: 999px;
    background: #eef2ee;
}

.topbar-icon {
    position: relative;
    width: 40px;
    min-width: 40px;
    min-height: 40px;
    padding: 0;
}

.topbar-icon svg {
    width: 19px;
    height: 19px;
}

.notification-badge {
    position: absolute;
    top: -7px;
    right: -5px;
    display: grid;
    min-width: 18px;
    height: 18px;
    place-items: center;
    border: 2px solid var(--surface);
    border-radius: 999px;
    background: var(--green);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 900;
}

.profile-button {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    border-color: transparent;
    background: transparent;
    color: var(--ink);
    padding: 0 2px 0 6px;
}

.profile-avatar {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border: 1px solid #dfe8e1;
    border-radius: 999px;
    background: #eef3ef;
    color: #526058;
    font-size: 0.84rem;
    font-weight: 900;
}

.profile-name {
    font-size: 0.88rem;
    font-weight: 800;
}

.profile-button svg {
    width: 15px;
    height: 15px;
    color: #526058;
}

.workspace-board {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--editor-width);
    min-height: calc(100vh - var(--topbar-height));
}

.records-column {
    display: grid;
    align-content: start;
    gap: var(--content-gap);
    min-width: 0;
    padding: var(--page-gutter);
}

.records-column > * {
    min-width: 0;
}

.editor-panel {
    position: sticky;
    top: var(--topbar-height);
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: calc(100vh - var(--topbar-height));
    overflow: hidden;
    border-left: 1px solid var(--line);
    background: var(--surface);
    box-shadow: -18px 0 35px rgba(32, 38, 33, 0.05);
}

.section-kicker {
    margin: 0 0 6px;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

h1,
h2 {
    margin: 0;
    line-height: 1.1;
}

h1 {
    font-size: 2rem;
    letter-spacing: 0;
}

h2 {
    font-size: 1.05rem;
}

.module-toolbar {
    gap: 18px;
    min-height: 58px;
    margin-bottom: 0;
}

.module-heading {
    display: flex;
    align-items: flex-start;
    gap: 13px;
    min-width: 0;
}

.module-heading-icon {
    display: none;
}

.module-subtitle {
    display: none;
}

.module-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.module-action-button {
    width: 40px;
    min-width: 40px;
    min-height: 40px;
    padding: 0;
}


.filter-strip {
    display: grid;
    grid-template-columns: minmax(230px, 0.95fr) minmax(280px, 1.55fr) max-content;
    gap: 10px;
    margin-bottom: 0;
}

.search-box,
.filter-control {
    position: relative;
}

.search-box input {
    min-height: var(--control-height);
    padding-left: 42px;
}

.filter-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    display: grid;
    width: 18px;
    height: 18px;
    place-items: center;
    color: #526058;
    transform: translateY(-50%);
    pointer-events: none;
}

.filter-search-icon svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.filter-selects {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
    gap: 10px;
}

.filter-control select {
    min-height: var(--control-height);
    appearance: none;
    padding-right: 34px;
    color: var(--ink);
    font-weight: 760;
}

.filter-control::after {
    position: absolute;
    top: 50%;
    right: 13px;
    width: 7px;
    height: 7px;
    border-right: 1.8px solid #526058;
    border-bottom: 1.8px solid #526058;
    content: "";
    transform: translateY(-64%) rotate(45deg);
    pointer-events: none;
}

.clear-filters {
    min-height: var(--control-height);
    padding: 0 18px;
}

.panel,
.metric-card {
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.table-panel {
    padding: var(--panel-padding);
}

.panel-heading {
    min-height: 34px;
    margin-bottom: 15px;
}

.panel-heading p,
.editor-header p,
.status-line,
.empty-state {
    color: var(--muted);
}

.panel-heading p,
.editor-header p {
    margin: 6px 0 0;
    font-size: 0.88rem;
}

.count-pill,
.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    border-radius: 999px;
    padding: 0 10px;
    background: var(--green-soft);
    color: var(--green-dark);
    font-size: 0.78rem;
    font-weight: 850;
}

.status-pill[data-status="active"] {
    background: #d2eedd;
    color: var(--green-dark);
}

.status-pill[data-status="lead"] {
    background: var(--green-soft);
    color: var(--green-dark);
    border: 1px solid #c2dece;
}

.status-pill[data-status="paused"] {
    background: #fff0d0;
    color: #b87820;
}

.status-pill[data-status="lost"] {
    background: var(--danger-soft);
    color: var(--danger);
}

.status-pill[data-status="hidden"] {
    background: #f0f0f0;
    color: var(--muted);
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 7px;
}

table {
    width: 100%;
    min-width: 620px;
    border-collapse: separate;
    border-spacing: 0;
}

.planner-load-table {
    min-width: 0;
    table-layout: fixed;
}

.planner-load-table th,
.planner-load-table td {
    padding: 8px 10px;
}

.planner-load-table th:nth-child(1),
.planner-load-table td:nth-child(1) {
    width: 17%;
}

.planner-load-table th:nth-child(2),
.planner-load-table td:nth-child(2) {
    width: 34%;
}

.planner-load-table th:nth-child(3),
.planner-load-table td:nth-child(3),
.planner-load-table th:nth-child(4),
.planner-load-table td:nth-child(4),
.planner-load-table th:nth-child(5),
.planner-load-table td:nth-child(5) {
    width: 16.33%;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 8px 12px;
    text-align: left;
    vertical-align: middle;
}

th {
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: uppercase;
}

td {
    height: 44px;
    font-size: 0.84rem;
}

tbody tr:last-child td {
    border-bottom: 0;
}

tbody .record-row {
    cursor: pointer;
}

tbody .record-row:focus {
    outline: none;
}

tbody .record-row td {
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

tbody tr:hover td {
    background: #fbfdfb;
}

tbody .record-row.is-selected td,
tbody .record-row.is-selected:hover td {
    background: rgba(20, 136, 79, 0.075);
    box-shadow:
        inset 0 1px rgba(20, 136, 79, 0.36),
        inset 0 -1px rgba(20, 136, 79, 0.36);
}

tbody .record-row.is-selected td:first-child {
    box-shadow:
        inset 1px 0 rgba(20, 136, 79, 0.36),
        inset 0 1px rgba(20, 136, 79, 0.36),
        inset 0 -1px rgba(20, 136, 79, 0.36);
}

tbody .record-row.is-selected td:last-child {
    box-shadow:
        inset -1px 0 rgba(20, 136, 79, 0.36),
        inset 0 1px rgba(20, 136, 79, 0.36),
        inset 0 -1px rgba(20, 136, 79, 0.36);
}

tbody .record-row.is-selected td:first-child:last-child {
    box-shadow:
        inset 1px 0 rgba(20, 136, 79, 0.36),
        inset -1px 0 rgba(20, 136, 79, 0.36),
        inset 0 1px rgba(20, 136, 79, 0.36),
        inset 0 -1px rgba(20, 136, 79, 0.36);
}

tbody .record-row:focus-visible td {
    outline: 2px solid rgba(20, 136, 79, 0.38);
    outline-offset: -2px;
}

.th-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.sort-mark {
    position: relative;
    width: 8px;
    height: 12px;
    opacity: 0.65;
}

.sort-mark::before,
.sort-mark::after {
    position: absolute;
    left: 1px;
    width: 5px;
    height: 5px;
    border-left: 1.5px solid currentColor;
    border-top: 1.5px solid currentColor;
    content: "";
}

.sort-mark::before {
    top: 1px;
    transform: rotate(45deg);
}

.sort-mark::after {
    bottom: 1px;
    transform: rotate(225deg);
}

.index-col {
    width: 38px;
    color: var(--muted);
    text-align: center;
}

.row-index {
    font-size: 0.78rem;
    font-weight: 800;
}

.actions-col {
    width: 48px;
    text-align: right;
}

.row-title {
    display: block;
    max-width: 190px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 850;
}

.row-subtle {
    display: block;
    max-width: 180px;
    margin-top: 3px;
    overflow: hidden;
    color: var(--muted);
    font-size: 0.78rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.row-actions {
    gap: 6px;
    justify-content: flex-end;
}

.table-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 15px;
    color: var(--muted);
    font-size: 0.84rem;
}

.table-footer select {
    width: 64px;
    padding: 8px;
}

.pager {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.pager button {
    min-width: 34px;
    min-height: 34px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--surface);
    color: var(--ink);
    font-weight: 800;
}

.pager button.is-active {
    border-color: var(--green);
    background: var(--green);
    color: #fff;
}

.compact-button {
    min-height: 34px;
    padding: 0 12px;
    font-size: 0.82rem;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-top: 0;
}

.metric-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 100px;
    padding: 20px;
}

.metric-label {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
}

.metric-value {
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1;
    color: var(--ink);
}

.editor-header {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 12px;
    padding: 22px var(--editor-gutter) 15px;
}

.editor-close {
    width: 38px;
    min-width: 38px;
    min-height: 38px;
    padding: 0;
}

.editor-close svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.editor-tabs {
    flex: 0 0 auto;
    display: flex;
    gap: 26px;
    border-bottom: 1px solid var(--line);
    border-top: 1px solid #eef2ee;
    margin: 0;
    padding: 0 var(--editor-gutter);
}

.editor-tabs button {
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: #48534b;
    padding: 14px 0 12px;
    font-size: 0.84rem;
    font-weight: 800;
}

.editor-tabs button.is-active {
    border-color: var(--green);
    color: var(--green-dark);
}

form {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.form-scroll {
    display: block;
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 18px var(--editor-gutter);
}

.form-scroll > * + * {
    margin-top: 13px;
}

form > .static-stack {
    flex: 1 1 auto;
    overflow: auto;
    padding: 18px var(--editor-gutter);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 12px;
}

.field,
.checkbox-field {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 850;
}

.field-label {
    display: inline-flex;
    gap: 3px;
    align-items: center;
}

.required-mark {
    color: var(--danger);
}

.field.is-full {
    grid-column: 1 / -1;
}

.checkbox-field {
    grid-template-columns: auto 1fr;
    align-items: center;
    min-height: 38px;
    color: var(--ink);
}

.checkbox-field input {
    accent-color: var(--green);
}

.editor-panel input,
.editor-panel select,
.editor-panel textarea {
    min-height: 38px;
    padding: 9px 11px;
}

textarea {
    min-height: 88px;
    resize: vertical;
}

.form-actions {
    flex: 0 0 auto;
    justify-content: space-between;
    border-top: 1px solid var(--line);
    margin: 0;
    background: rgba(255, 255, 255, 0.96);
    padding: 16px var(--editor-gutter);
}

.form-danger-slot,
.form-save-slot {
    display: flex;
    align-items: center;
    gap: 10px;
}

.editor-delete {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.editor-delete svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.static-stack {
    display: grid;
    gap: 12px;
}

.static-card {
    display: grid;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--surface-soft);
    padding: 15px;
}

.static-card-accent {
    border-color: #cce5d5;
    background: var(--green-pale);
}

.static-card strong {
    font-size: 1rem;
}

.static-card p {
    margin: 0;
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.5;
}

.backup-download-button {
    justify-self: start;
}

.static-label {
    color: var(--green-dark);
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: uppercase;
}

.quick-link-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.settings-list {
    display: grid;
    gap: 10px;
    margin: 0;
}

.settings-list div {
    border-top: 1px solid var(--line);
    padding-top: 10px;
}

.settings-list dt {
    color: var(--ink);
    font-weight: 850;
}

.settings-list dd {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 0.85rem;
    line-height: 1.45;
}

.bom-block {
    display: grid;
    gap: 10px;
    border-top: 1px solid var(--line);
    padding-top: 14px;
}

.bom-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.bom-heading strong {
    font-size: 0.9rem;
}

.bom-list {
    display: grid;
    gap: 8px;
}

.bom-row {
    align-items: end;
    flex-wrap: wrap;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--surface-soft);
    padding: 10px;
}

.bom-row .field {
    flex: 1 1 130px;
}

.bom-row .field:first-child {
    flex-basis: 100%;
}

.bom-row .icon-button {
    width: auto;
    padding: 0 10px;
}

.planner-hint {
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.35;
    text-align: right;
}

.planner-assignment-list,
.planner-timeline-list {
    display: grid;
    gap: 8px;
}

.planner-assignment-row {
    display: grid;
    grid-template-columns: minmax(180px, 1.4fr) minmax(140px, 1fr) minmax(140px, 1fr);
    gap: 10px;
    align-items: end;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--surface-soft);
    padding: 10px;
}

.planner-assignment-meta {
    display: grid;
    gap: 4px;
    align-self: center;
    min-width: 0;
}

.planner-assignment-meta strong {
    color: var(--ink);
    font-size: 0.9rem;
    overflow-wrap: anywhere;
}

.planner-assignment-meta span {
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.35;
}

.planner-timeline-block {
    gap: 14px;
}

.planner-progress-grid {
    display: grid;
    grid-template-columns: minmax(120px, 1.3fr) repeat(3, minmax(70px, 0.8fr));
    gap: 8px;
    align-items: center;
    padding: 9px 10px;
}

.planner-timeline-section {
    display: grid;
    gap: 8px;
}

.planner-timeline-section-title {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 850;
    text-transform: uppercase;
}

.planner-timeline-row {
    display: grid;
    grid-template-columns: minmax(110px, 0.28fr) minmax(180px, 1fr);
    gap: 10px;
    align-items: center;
}

.planner-timeline-label {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.planner-timeline-label strong {
    color: var(--ink);
    font-size: 0.82rem;
    overflow-wrap: anywhere;
}

.planner-timeline-label span {
    color: var(--muted);
    font-size: 0.72rem;
}

.planner-timeline-track {
    position: relative;
    min-height: 34px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background:
        repeating-linear-gradient(
            to right,
            rgba(36, 48, 41, 0.06) 0,
            rgba(36, 48, 41, 0.06) 1px,
            transparent 1px,
            transparent 12.5%
        ),
        #fff;
    overflow: hidden;
}

.planner-timeline-segment {
    position: absolute;
    top: 5px;
    bottom: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    border-radius: 5px;
    padding: 0 5px;
    color: #ffffff;
    font-size: 0.68rem;
    font-weight: 850;
    line-height: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.planner-timeline-segment[data-type="personnel"] {
    background: #2f7d62;
}

.planner-timeline-segment[data-type="machine"] {
    background: #5067a8;
}

.supply-history-block {
    gap: 12px;
}

.supply-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 8px;
}

.supply-summary-card {
    display: grid;
    gap: 5px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--surface-soft);
    padding: 10px;
}

.supply-summary-card span {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 850;
    text-transform: uppercase;
}

.supply-summary-card strong {
    min-width: 0;
    color: var(--ink);
    font-size: 0.94rem;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.supply-history-list {
    display: grid;
    gap: 0;
    border: 1px solid var(--line);
    border-radius: 7px;
    overflow: hidden;
}

.supply-history-grid {
    display: grid;
    grid-template-columns: 0.9fr 1.25fr 0.8fr 0.95fr;
    gap: 8px;
    align-items: center;
    padding: 9px 10px;
}

.supply-history-head {
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 900;
    text-transform: uppercase;
}

.supply-history-row {
    border-top: 1px solid var(--line);
    color: var(--ink);
    font-size: 0.76rem;
}

.supply-history-grid span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.supply-empty {
    margin: 0;
    color: var(--muted);
    font-size: 0.84rem;
    line-height: 1.45;
}

.cost-note {
    margin: 0;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.45;
}

.currency-dashboard-panel {
    display: grid;
    gap: 12px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 14px;
    padding-bottom: 14px;
}

.currency-status-strip {
    display: grid;
    gap: 3px;
    border: 1px solid #cce5d5;
    border-radius: 7px;
    background: var(--green-pale);
    padding: 11px 12px;
}

.currency-status-strip[data-status="missing"] {
    border-color: #f0d0cd;
    background: var(--danger-soft);
}

.currency-status-strip strong {
    font-size: 0.9rem;
}

.currency-status-strip span {
    color: var(--muted);
    font-size: 0.82rem;
}

.currency-rate-list {
    display: grid;
    border: 1px solid var(--line);
    border-radius: 7px;
    overflow: hidden;
}

.currency-rate-row {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.85fr) minmax(0, 0.8fr);
    gap: 8px;
    align-items: center;
    border-top: 1px solid var(--line);
    padding: 9px 10px;
    font-size: 0.78rem;
}

.currency-rate-row:first-child {
    border-top: 0;
}

.currency-rate-row span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.currency-rate-head {
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 900;
    text-transform: uppercase;
}

.empty-state {
    margin: 16px 0 0;
}

.status-line {
    min-height: 24px;
    margin: 0;
}

.status-line:empty {
    display: none;
}

@media (max-width: 1320px) {
    .module-toolbar {
        display: grid;
        grid-template-columns: 1fr;
        gap: 14px;
        min-height: 0;
    }

    .module-actions {
        justify-content: flex-start;
    }

    .filter-strip {
        grid-template-columns: minmax(0, 1fr) max-content;
    }

    .filter-strip .search-box {
        grid-column: 1 / -1;
    }
}

@media (max-width: 1180px) {
    .workspace-board {
        grid-template-columns: 1fr;
    }

    .editor-panel {
        position: static;
        height: auto;
        overflow: visible;
        border-left: 0;
        border-top: 1px solid var(--line);
    }

    form,
    .form-scroll,
    form > .static-stack {
        overflow: visible;
    }
}

@media (max-width: 900px) {
    :root {
        --page-gutter: 20px;
        --content-gap: 18px;
    }

    .app-frame {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .sidebar-footer {
        display: none;
    }

    .nav-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .global-topbar,
    .module-toolbar,
    .global-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .global-topbar {
        height: auto;
        padding: 14px var(--page-gutter);
    }

    .module-toolbar {
        min-height: 0;
    }

    .filter-strip,
    .metric-grid,
    .form-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    :root {
        --page-gutter: 16px;
        --content-gap: 18px;
        --panel-padding: 16px;
        --editor-gutter: 16px;
    }

    h1 {
        font-size: 1.75rem;
    }

    .module-toolbar {
        gap: 14px;
    }

    .module-heading {
        gap: 12px;
    }

    .supply-summary-grid {
        grid-template-columns: 1fr;
    }

    .planner-assignment-row,
    .planner-progress-grid,
    .planner-timeline-row {
        grid-template-columns: 1fr;
    }

    .planner-hint {
        text-align: left;
    }

    .currency-rate-row {
        grid-template-columns: 1fr;
    }

    .metric-card {
        min-height: 130px;
        padding: 18px 16px;
    }

    .global-actions {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 92px 40px 40px 48px;
        width: 100%;
    }

    .quick-add {
        min-width: 0;
    }

    .global-actions .icon-button,
    .global-actions .language-switcher,
    .global-actions .profile-button {
        min-width: 0;
        width: 100%;
    }

    .global-actions .profile-button {
        justify-content: center;
        padding: 0;
    }

    .global-actions .profile-name,
    .global-actions .profile-button svg {
        display: none;
    }

    .nav-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .nav-group:first-child .nav-list,
    .nav-group:last-child .nav-list {
        grid-template-columns: 1fr;
    }

    .nav-button {
        min-height: 42px;
        gap: 8px;
        font-size: 0.88rem;
    }

    .panel-heading,
    .bom-row {
        align-items: stretch;
        flex-direction: column;
    }
}

/* ── Sidebar collapse ─────────────────────────────── */
.app--sidebar-collapsed {
    --sidebar-width: 64px;
}

.app--sidebar-collapsed .sidebar {
    padding: 20px 8px 18px;
    overflow: visible;
}

.app--sidebar-collapsed .brand {
    display: none;
}

.app--sidebar-collapsed .brand-row {
    justify-content: center;
    padding-bottom: 24px;
}

.app--sidebar-collapsed .nav-text,
.app--sidebar-collapsed .nav-label,
.app--sidebar-collapsed .sidebar-footer {
    display: none;
}

.app--sidebar-collapsed .nav-button {
    justify-content: center;
    padding: 0;
    min-height: 42px;
}

.app--sidebar-collapsed .nav-icon {
    width: 26px;
    height: 26px;
}

/* ── Dropdown panel ───────────────────────────────── */
.dropdown-panel {
    position: fixed;
    z-index: 200;
    min-width: 210px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 8px 28px rgba(32, 38, 33, 0.14);
    padding: 6px;
}

.dropdown-header {
    padding: 6px 10px 4px;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dropdown-separator {
    height: 1px;
    margin: 4px 6px;
    background: var(--line);
}

.dropdown-item {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 34px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--ink);
    padding: 0 10px;
    text-align: left;
    font: inherit;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
}

.dropdown-item:hover {
    background: var(--green-soft);
    color: var(--green-dark);
}

.dropdown-item[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
}

.dropdown-item[disabled]:hover {
    background: transparent;
    color: var(--ink);
}

.dropdown-muted {
    padding: 8px 10px;
    color: var(--muted);
    font-size: 0.84rem;
    line-height: 1.5;
}

/* ── Contacts tab placeholder ─────────────────────── */
.contacts-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 140px;
    padding: 28px 24px;
    text-align: center;
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.55;
}

/* ── Pager disabled state ─────────────────────────── */
.pager button[disabled] {
    opacity: 0.38;
    cursor: not-allowed;
}

/* ── Filter button active state ───────────────────── */
.module-action-button.is-active {
    border-color: var(--green);
    background: var(--green-soft);
    color: var(--green-dark);
}

/* ── Login overlay ────────────────────────────────── */
body.is-authenticating .app-frame {
    display: none;
}

.login-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: linear-gradient(180deg, #f5f7f4 0%, #eef2ef 100%);
    z-index: 9999;
    overflow: auto;
}

.login-overlay[hidden] {
    display: none;
}

.login-stage {
    display: flex;
    gap: 48px;
    align-items: stretch;
    width: 100%;
    max-width: 880px;
}

.welcome-panel {
    flex: 1 1 360px;
    max-width: 440px;
    align-self: center;
    color: var(--ink);
}

.welcome-title {
    margin: 10px 0 14px;
    font-size: 1.7rem;
    line-height: 1.2;
    letter-spacing: -0.01em;
    color: var(--ink);
}

.welcome-lead {
    margin: 0 0 22px;
    font-size: 1rem;
    line-height: 1.55;
    color: var(--muted);
}

.welcome-points {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 10px;
}

.welcome-points li {
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid #e3e8e4;
    border-radius: 10px;
    color: var(--ink);
    font-size: 0.92rem;
    line-height: 1.5;
}

.welcome-points li strong {
    color: var(--green);
    margin-right: 4px;
}

.login-card {
    flex: 1 1 360px;
    background: var(--surface);
    border: 1px solid #e3e8e4;
    border-radius: 14px;
    padding: 28px 28px 24px;
    width: 100%;
    max-width: 380px;
    align-self: center;
    box-shadow: 0 12px 36px rgba(15, 30, 22, 0.08);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

@media (max-width: 880px) {
    .login-stage {
        flex-direction: column;
        align-items: center;
        gap: 24px;
        max-width: 440px;
    }
    .welcome-panel {
        align-self: stretch;
        max-width: none;
    }
    .welcome-title { font-size: 1.4rem; }
}

.login-brand {
    font-weight: 700;
    font-size: 0.78rem;
    letter-spacing: 0.18em;
    color: var(--green);
    text-transform: uppercase;
}

.login-title {
    margin: 0;
    font-size: 1.25rem;
    color: var(--ink);
}

.login-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--muted);
}

.login-field input {
    padding: 10px 12px;
    border: 1px solid #d8ddda;
    border-radius: 8px;
    font: inherit;
    color: var(--ink);
    background: #fbfcfb;
}

.login-field input:focus {
    outline: none;
    border-color: var(--green);
    background: var(--surface);
    box-shadow: 0 0 0 3px var(--green-soft);
}

.login-submit {
    padding: 10px 14px;
    background: var(--green);
    color: #fff;
    border: 0;
    border-radius: 8px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    margin-top: 4px;
}

.login-submit:hover { filter: brightness(1.05); }
.login-submit[disabled] { opacity: 0.6; cursor: progress; }

.login-error {
    margin-top: 4px;
    padding: 8px 12px;
    background: #fff1f0;
    border: 1px solid #f5c2c0;
    color: #9a221a;
    border-radius: 8px;
    font-size: 0.85rem;
}

.login-error[hidden] { display: none; }

/* ── Modal overlay (change password etc.) ─────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 30, 22, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 10000;
}

.modal-overlay[hidden] { display: none; }

.modal-card {
    background: var(--surface);
    border-radius: 14px;
    box-shadow: 0 24px 64px rgba(15, 30, 22, 0.24);
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 12px;
}

.modal-title {
    margin: 0;
    font-size: 1.05rem;
    color: var(--ink);
}

.modal-close {
    background: none;
    border: 0;
    font-size: 1.4rem;
    color: var(--muted);
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    border-radius: 6px;
}

.modal-close:hover { background: var(--surface-soft); color: var(--ink); }

.modal-body {
    padding: 6px 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.modal-hint {
    margin: 0;
    font-size: 0.78rem;
    color: var(--muted);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px 18px;
    border-top: 1px solid #e6ebe7;
    background: var(--surface-soft);
}

.modal-secondary {
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid #d8ddda;
    color: var(--ink);
    border-radius: 8px;
    font: inherit;
    cursor: pointer;
}

.modal-secondary:hover { background: var(--surface-soft); }

.modal-footer .login-submit {
    margin-top: 0;
}

/* ── Phones editor (customers/suppliers Contacts tab) ─ */
.phones-block {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.phones-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.phones-hint {
    margin: 0;
    color: var(--muted);
    font-size: 0.84rem;
}

.phones-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.phone-row {
    border: 1px solid #e3e8e4;
    border-radius: 10px;
    padding: 12px 14px;
    background: var(--surface);
}

.phone-row-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr auto;
    gap: 12px;
    align-items: end;
}

.phone-row-grid .field {
    margin: 0;
}

.phone-row-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #e3e8e4;
}

.phones-chip-caption {
    font-size: 0.78rem;
    color: var(--muted);
    margin-right: 6px;
}

.messenger-chip {
    background: var(--surface);
    border: 1px solid #d8ddda;
    color: var(--ink);
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.82rem;
    cursor: pointer;
    font: inherit;
    font-size: 0.82rem;
    transition: all 0.15s ease;
}

.messenger-chip:hover {
    border-color: var(--green);
    color: var(--green);
}

.messenger-chip.is-active {
    background: var(--green);
    color: #fff;
    border-color: var(--green);
}

.messenger-chip.is-active:hover {
    background: var(--green-dark, #0f6e40);
    color: #fff;
}

.phones-no-messengers {
    color: var(--muted);
    font-size: 0.82rem;
    font-style: italic;
}

@media (max-width: 600px) {
    .phone-row-grid {
        grid-template-columns: 1fr;
    }
}
