/* Plachta - zakladni styly (Faze 0) */

:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --border: #e3e6ec;
    --text: #1c2230;
    --text-muted: #6b7488;

    --sidebar-bg: #171d2b;
    --sidebar-text: #a9b2c5;
    --sidebar-text-active: #ffffff;
    --sidebar-active: #2a3450;

    --accent: #2f5fd8;
    --accent-hover: #2751bb;

    --success: #1f7a4d;
    --success-bg: #e6f4ec;
    --warning: #9a6212;
    --warning-bg: #fdf3e2;
    --danger: #b3261e;
    --danger-bg: #fdecea;

    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 12px rgba(16, 24, 40, .05);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

h1 {
    font-size: 1.5rem;
    margin: 0 0 .25rem;
    letter-spacing: -.01em;
}

h2 {
    font-size: 1.05rem;
    margin: 0 0 1rem;
}

code {
    font-family: "Cascadia Mono", Consolas, "SF Mono", monospace;
    font-size: .87em;
    background: #eef0f4;
    border-radius: 4px;
    padding: .1em .38em;
}

.muted {
    color: var(--text-muted);
}

/* ---------------------------------------------------------------- layout */

.app {
    display: grid;
    grid-template-columns: 145px 1fr;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    padding: 1.25rem 0;
}

.brand {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: .55rem;
    padding: 0 .75rem 1.5rem;
    width: 0;
    min-width: 100%;
}

.brand-logo {
    display: block;
    width: 100%;
    height: auto;
    background: #fff;
    border-radius: 8px;
    padding: .4rem .5rem;
}

.brand-text {
    color: #fff;
    font-weight: 600;
    font-size: 1.05rem;
}

.sidebar-toggle.btn {
    display: none;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 .75rem;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.nav-item {
    display: block;
    padding: .5rem .75rem;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: .93rem;
    white-space: nowrap;
    transition: background .12s, color .12s;
}

.nav-item:hover {
    background: rgba(255, 255, 255, .06);
    color: #fff;
}

.nav-item.is-active {
    background: var(--sidebar-active);
    color: var(--sidebar-text-active);
    font-weight: 500;
}

.sidebar-foot {
    padding: 1rem 1.25rem 0;
    border-top: 1px solid rgba(255, 255, 255, .08);
    margin-top: auto;
    flex-shrink: 0;
    width: 0;
    min-width: 100%;
}

.user-name {
    display: block;
    color: #fff;
    font-size: .9rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-decoration: none;
}

a.user-name:hover {
    text-decoration: underline;
}

.user-role {
    font-size: .8rem;
    margin-bottom: .6rem;
}

.sidebar-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .4rem;
}

.sidebar-actions form {
    margin: 0;
}

.sidebar-actions .btn {
    line-height: normal;
}

.main {
    padding: 1.75rem 2rem 3rem;
    max-width: 1200px;
    min-width: 0;
    min-height: 0;
    height: 100%;
    overflow-y: auto;
}

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-head p {
    margin: 0;
}

/* ----------------------------------------------------------------- cards */

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: .875rem;
    margin-bottom: 1.5rem;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    box-shadow: var(--shadow);
}

.card-value {
    font-size: 1.65rem;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -.02em;
}

.card-label {
    font-size: .9rem;
    margin-top: .1rem;
}

.card-hint {
    font-size: .8rem;
    margin-top: .3rem;
}

.help-topics {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.help-topic {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    padding: .75rem .9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: inherit;
    background: var(--bg);
}

.help-topic:hover {
    border-color: var(--accent);
}

.help-notes {
    margin: 0;
    padding-left: 1.2rem;
}

.help-notes li {
    margin-bottom: .45rem;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.4rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.25rem;
}

.panel-subhead {
    margin: 1.25rem 0 .75rem;
    font-size: 1rem;
    font-weight: 600;
}

/* ---------------------------------------------------------------- tables */

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: .92rem;
}

.table th {
    text-align: left;
    font-weight: 600;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    padding: .5rem .6rem;
}

.table td {
    padding: .55rem .6rem;
    border-bottom: 1px solid #f0f2f5;
}

.table tr:last-child td {
    border-bottom: none;
}

.table-wrap {
    overflow-x: auto;
    max-width: 100%;
    min-width: 0;
}

.util-bar {
    display: block;
    height: 6px;
    margin-top: .35rem;
    background: #eef0f4;
    border-radius: 3px;
    overflow: hidden;
}

.util-bar > span {
    display: block;
    height: 100%;
    width: var(--util, 0%);
    background: var(--accent);
}

.report-period-label {
    margin: .75rem 0 0;
}

.report-routes summary {
    cursor: pointer;
}

.report-routes ol {
    margin: .4rem 0 0;
    padding-left: 1.2rem;
}

/* ------------------------------------------------------- tags a odznaky */

.tag {
    display: inline-block;
    padding: .12rem .5rem;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 500;
}

.tag-write {
    background: var(--success-bg);
    color: var(--success);
}

.tag-read {
    background: #eaf0fd;
    color: var(--accent);
}

.tag-none {
    background: #f0f1f4;
    color: var(--text-muted);
}

.badge {
    flex-shrink: 0;
    background: #eaf0fd;
    color: var(--accent);
    border-radius: 999px;
    padding: .25rem .7rem;
    font-size: .8rem;
    font-weight: 500;
}

.badge-muted {
    background: #f0f1f4;
    color: var(--text-muted);
}

/* --------------------------------------------------------------- tlacitka */

.btn {
    display: inline-block;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: .5rem 1rem;
    font-size: .92rem;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background .12s, border-color .12s;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-ghost {
    background: transparent;
    border-color: rgba(255, 255, 255, .18);
    color: var(--sidebar-text);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, .08);
    color: #fff;
}

/* Ghost tlacitko pro svetle plochy - btn-ghost je ladeny na tmavy sidebar. */
.btn-outline {
    background: #fff;
    border-color: var(--border);
    color: var(--text);
}

.btn-outline:hover {
    background: #f7f8fa;
    border-color: #ccd2dd;
}

.btn-danger {
    background: #fff;
    border-color: #e7bcb8;
    color: var(--danger);
}

.btn-danger:hover {
    background: var(--danger-bg);
}

.btn-sm {
    padding: .3rem .7rem;
    font-size: .85rem;
}

.btn-user-active {
    display: inline-grid;
    justify-items: center;
    align-items: center;
}

.btn-user-active-sizer,
.btn-user-active-label {
    grid-area: 1 / 1;
    white-space: nowrap;
}

.btn-user-active-sizer {
    visibility: hidden;
}

.btn-block {
    display: block;
    width: 100%;
}

/* -------------------------------------------------------------- formulare */

.form {
    display: flex;
    flex-direction: column;
    gap: .9rem;
}

.panel > .form .panel-subhead,
.panel > .form .form-actions {
    margin: 0;
}

.field {
    display: block;
}

.field-label {
    display: block;
    font-size: .85rem;
    font-weight: 500;
    margin-bottom: .3rem;
}

.field input {
    width: 100%;
    padding: .55rem .7rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: .95rem;
    background: #fff;
    color: var(--text);
}

.field input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(47, 95, 216, .15);
}

.field input[readonly] {
    background: var(--surface, #fff);
    color: var(--text);
}

.field input[type="checkbox"] {
    width: auto;
    padding: 0;
    border: none;
    box-shadow: none;
}

/* --------------------------------------------------------------- hlasky */

.alert {
    border-radius: var(--radius-sm);
    padding: .6rem .85rem;
    font-size: .9rem;
    margin-bottom: 1rem;
}

.alert-error {
    background: var(--danger-bg);
    color: var(--danger);
}

.alert-info {
    background: #eaf0fd;
    color: var(--accent);
}

.alert-success {
    background: var(--success-bg);
    color: var(--success);
}

.alert-warning {
    background: var(--warning-bg);
    color: var(--warning);
}

/* ------------------------------------------------------------ prihlaseni */

.login-page {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 2rem 1rem;
    background: var(--bg);
}

/* Podkres: fotka rozmazana, desaturovana a prekryta svetlym zavojem,
   aby neprebila logo ani formular. Chybove stranky zustavaji bez fotky. */
.login-page-photo {
    position: relative;
    isolation: isolate;
    overflow: hidden;
}

.login-page-photo::before {
    content: "";
    position: fixed;
    inset: -16px -16px 0 -16px;
    background: url("../img/truck.jpg") 70% 70% / cover no-repeat;
    filter: blur(5px) saturate(.55) brightness(1.08);
    z-index: -2;
}

.login-page-photo::after {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(245, 246, 248, .68);
    z-index: -1;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
}

.login-page-photo .login-card {
    box-shadow: 0 12px 40px rgba(16, 24, 40, .12), 0 2px 8px rgba(16, 24, 40, .06);
}

.login-card-wide {
    max-width: 780px;
}

.login-head {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-logo {
    display: block;
    width: 100%;
    max-width: 280px;
    height: auto;
    margin: 0 auto 1rem;
}

.login-head h1 {
    margin-bottom: .1rem;
}

.login-head p {
    margin: 0;
    font-size: .9rem;
}

.login-hint {
    margin: 1.25rem 0 0;
    font-size: .82rem;
    text-align: center;
}

.login-trust {
    margin: .25rem 0 1.1rem;
}

.trace {
    background: #f7f8fa;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .8rem;
    font-size: .78rem;
    overflow-x: auto;
    max-height: 340px;
}

/* ----------------------------------------------- podnavigace a zalozky */

.subnav {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
}

.subnav-item {
    padding: .45rem .8rem;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    text-decoration: none;
    font-size: .92rem;
    margin-bottom: -1px;
}

.subnav-item:hover {
    color: var(--text);
}

.subnav-item.is-active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    font-weight: 500;
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-bottom: 1rem;
}

.tab {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .35rem .75rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    color: var(--text-muted);
    text-decoration: none;
    font-size: .88rem;
}

.tab:hover {
    color: var(--text);
}

.tab.is-active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.tab-count {
    font-size: .78rem;
    opacity: .75;
}

/* ------------------------------------------------------ formulare v panelu */

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.panel-head h2 {
    margin-bottom: 0;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: .9rem 1.1rem;
}

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

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .9rem 1.1rem;
}

@media (max-width: 960px) {
    .grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 520px) {
    .grid-4 {
        grid-template-columns: 1fr;
    }
}

.grid-5 {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: .9rem 1.1rem;
}

@media (max-width: 1100px) {
    .grid-5 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .grid-5 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 520px) {
    .grid-5 {
        grid-template-columns: 1fr;
    }
}

.inline-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: .75rem;
}

.inline-form .field {
    margin: 0;
}

.field-grow {
    flex: 1 1 220px;
}

.field-narrow {
    flex: 0 0 150px;
}

.field select,
.search-form input,
.table input[type="text"],
.table input[type="email"],
.table input[type="time"],
.table input[type="number"],
.queue-form input,
.queue-form select {
    width: 100%;
    padding: .45rem .6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: .92rem;
    background: #fff;
    color: var(--text);
}

.field select:focus,
.table input[type="text"]:focus,
.table input[type="email"]:focus,
.table input[type="time"]:focus,
.table input[type="number"]:focus,
.queue-form input:focus,
.queue-form select:focus,
.search-form input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(47, 95, 216, .15);
}

.field-error {
    display: block;
    color: var(--danger);
    font-size: .82rem;
    margin-top: .25rem;
}

.form-actions {
    margin-top: 1.1rem;
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
}

.conflict-dialog {
    border: 0;
    border-radius: var(--radius);
    padding: 1.25rem 1.4rem;
    max-width: 32rem;
    color: var(--text);
    box-shadow: 0 16px 40px rgba(23, 29, 43, .28);
}

.conflict-dialog::backdrop {
    background: rgba(23, 29, 43, .45);
}

.conflict-dialog h3 {
    margin: 0 0 .6rem;
}

.conflict-list {
    margin: .6rem 0 0;
    padding-left: 1.1rem;
}

.conflict-list li + li {
    margin-top: .2rem;
}

.setting-row {
    display: flex;
    align-items: flex-start;
    gap: .7rem;
    cursor: pointer;
    max-width: 42rem;
}

.setting-row input[type="checkbox"] {
    margin-top: .2rem;
    flex-shrink: 0;
}

.setting-row strong {
    display: block;
}

.setting-help {
    display: block;
    margin-top: .25rem;
    font-size: .9rem;
    line-height: 1.4;
}

.settings-form .panel-subhead:first-of-type {
    margin-top: 0;
}

.settings-form .setting-row {
    margin-bottom: 1rem;
    max-width: none;
}

.settings-form .setting-row .field-label {
    margin-bottom: .2rem;
}

.settings-form .setting-row .muted.small {
    margin: 0;
}

.settings-form .field-narrow {
    max-width: 8rem;
}

.settings-form .field-narrow + .muted.small {
    margin-top: .35rem;
    margin-bottom: 0;
}

.settings-form .field-smtp {
    max-width: 22rem;
}

.field-weeks {
    flex: 0 0 7rem;
}

.cron-url {
    overflow-wrap: anywhere;
}

.export-status {
    white-space: pre-wrap;
    max-width: 22rem;
}

.row-forms {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    align-items: flex-end;
}

.search-form {
    display: flex;
    gap: .5rem;
}

.search-form input {
    min-width: 240px;
}

.checkbox {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: .85rem;
    color: var(--text-muted);
    margin-right: .5rem;
}

.shortcut-form {
    align-items: flex-end;
}

.shortcut-roles {
    border: 0;
    margin: 0;
    padding: 0;
    min-width: 12rem;
}

.shortcut-roles .field-label {
    margin-bottom: .2rem;
}

.shortcut-preview {
    display: inline-block;
    padding: .2rem .6rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: .85rem;
}

.plan-color-preview {
    display: inline-block;
    box-sizing: border-box;
    padding: 2px 8px;
    border-radius: 3px;
    line-height: 1.25;
    white-space: nowrap;
}

.plan-color-preview-cell {
    width: 1%;
    white-space: nowrap;
    min-width: 6.5rem;
}

.plan-color-font-size {
    width: 3.25rem;
    max-width: 3.25rem;
}

.input-narrow {
    max-width: 110px;
}

/* -------------------------------------------------------- fronta zkratek */

.queue-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .8rem 1rem;
    margin-bottom: .6rem;
}

.queue-head {
    display: flex;
    align-items: center;
    gap: .6rem;
    flex-wrap: wrap;
    margin-bottom: .6rem;
}

.queue-token {
    font-size: 1rem;
    font-weight: 600;
    background: #eef0f4;
}

.queue-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    align-items: center;
}

.queue-form {
    display: flex;
    gap: .4rem;
    align-items: center;
}

/* ------------------------------------------------------------- drobnosti */

.card-link {
    display: block;
    color: inherit;
    text-decoration: none;
    transition: border-color .12s, transform .12s;
}

.card-link:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning);
    text-decoration: none;
}

.table .num {
    text-align: right;
}

.table th.col-narrow,
.table td.col-narrow {
    width: 1%;
    white-space: nowrap;
}

.table.audit-table {
    min-width: 52rem;
}

.table.audit-table td.audit-change {
    max-width: 22rem;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
}

.table .col-actions {
    width: 1%;
    white-space: nowrap;
    text-align: right;
}

.table td.vacation-actions {
    vertical-align: middle;
    text-align: right;
}

.vacation-actions-row {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: .4rem;
}

.group-name-input { width: 100%; }

.table input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.table input[type="number"]::-webkit-outer-spin-button,
.table input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.table input.plan-color-font-size {
    appearance: auto;
    -moz-appearance: auto;
    width: 3.25rem;
    max-width: 3.25rem;
    padding-left: .35rem;
    padding-right: .2rem;
}

.table input.plan-color-font-size::-webkit-outer-spin-button,
.table input.plan-color-font-size::-webkit-inner-spin-button {
    -webkit-appearance: auto;
    appearance: auto;
    display: block;
    margin: 0;
}

.table td.group-count,
.table td.group-actions { vertical-align: middle; }

.group-actions-row {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
}

.color-choices {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem;
    border: 0;
    margin: 0;
    padding: 0;
    min-width: 11.5rem;
}

.color-choices legend {
    width: 100%;
    margin-bottom: .15rem;
}

.color-choice {
    position: relative;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .18);
    cursor: pointer;
}

.color-choice input {
    position: absolute;
    opacity: 0;
    inset: 0;
    margin: 0;
    cursor: pointer;
}

.color-choice:has(input:checked) {
    outline: 2px solid var(--text);
    outline-offset: 2px;
}

.color-choice:has(input:focus-visible) {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.color-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    vertical-align: middle;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .18);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.small {
    font-size: .84rem;
}

.empty {
    color: var(--text-muted);
    background: #f7f8fa;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem;
    margin: 0;
}

.pager {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-top: 1rem;
}

/* ----------------------------------------------------------- typy vozidel */

.kind-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem;
}

.kind-chip {
    display: inline-block;
    padding: .15rem .45rem;
    font-size: .78rem;
    line-height: 1.25;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #f8f9fb;
    white-space: nowrap;
}

.kind-field {
    border: 0;
    margin: 0;
    padding: 0;
    min-width: 0;
}

.kind-field .muted.small {
    margin: 0 0 .15rem;
}

.kind-picker {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: .35rem;
}

.kind-filter {
    margin: .75rem 0 .35rem;
}

.kind-option {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .4rem .75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    cursor: pointer;
    font-size: .88rem;
    line-height: 1.25;
}

.kind-option input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
}

.kind-option:has(input:checked) {
    border-color: var(--accent);
    background: #f2f6ff;
}

.kind-option:has(input:focus-visible) {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.kind-option:has(input:disabled) {
    cursor: default;
    opacity: .65;
}

.table th.col-lp,
.table td.col-lp {
    font-size: .85rem;
    white-space: nowrap;
}

.table input[type="date"] {
    padding: .35rem .5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: .9rem;
}

.field textarea {
    width: 100%;
    padding: .45rem .6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: .92rem;
    resize: vertical;
}

.field textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(47, 95, 216, .15);
}

.notice {
    padding: .7rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.25rem;
}

.notice-warning {
    background: var(--warning-bg);
    color: var(--warning);
}

/* --------------------------------------------------------------- mobilni */

@media (max-width: 800px) {
    .app {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    .sidebar {
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
        gap: .5rem;
        padding: .75rem 1rem;
        height: auto;
        overflow: visible;
    }

    .brand {
        padding: 0;
        max-width: 200px;
        width: auto;
        min-width: 0;
    }

    .nav {
        flex-direction: row;
        flex-wrap: wrap;
        padding: 0;
        flex: 1 1 100%;
        overflow: visible;
        min-height: 0;
    }

    .sidebar-foot {
        display: flex;
        align-items: center;
        gap: 1rem;
        border-top: none;
        margin: 0;
        padding: 0;
        width: auto;
        min-width: 0;
    }

    .user-role {
        margin-bottom: 0;
    }

    .sidebar-actions {
        flex-direction: row;
        align-items: center;
    }

    .main {
        padding: 1.25rem 1rem 2rem;
        height: auto;
        min-height: 0;
        overflow-y: auto;
    }

    body.app-plan .brand {
        flex-direction: row;
        align-items: center;
        max-width: none;
        flex: 1 1 auto;
        gap: .75rem;
    }

    body.app-plan .brand-logo {
        width: auto;
        max-width: 140px;
        max-height: 36px;
        padding: .2rem .35rem;
    }

    body.app-plan .brand-text {
        display: none;
    }

    body.app-plan .sidebar-toggle {
        display: inline-block;
        margin-left: auto;
    }

    body.app-plan .nav,
    body.app-plan .sidebar-foot {
        display: none;
    }

    body.app-plan.is-nav-open .nav,
    body.app-plan.is-nav-open .sidebar-foot {
        display: flex;
        flex: 1 1 100%;
    }

    body.app-plan .plan-toolbar-week,
    body.app-plan .plan-toolbar-filters,
    body.app-plan .plan-toolbar-actions {
        width: 100%;
    }

    body.app-plan .plan-week-picker {
        flex: 1 1 auto;
        min-width: 0;
    }

    body.app-plan .plan-week-trigger,
    body.app-plan .plan-week-list {
        width: 100%;
    }

    body.app-plan .plan-search {
        width: 100%;
        min-width: 0;
        flex: 1 1 100%;
    }

    body.app-plan {
        --plan-driver-w: 160px;
    }

    body.app-plan .plan-col-driver {
        width: var(--plan-driver-w);
    }

    body.app-plan .plan-th-driver-legend {
        display: none;
    }

    body.app-plan .plan-grid {
        width: max(100%, 780px);
    }

    body.app-plan .plan-cell-inner {
        min-height: 56px;
    }

    body.app-plan .plan-modal-box {
        width: calc(100% - 1rem);
        max-width: none;
        max-height: calc(100dvh - 1rem);
        padding: 1rem;
        border-radius: 8px;
    }
}

/* ----------------------------------------------------------- naseptavac */

.suggest-cell {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: .45rem;
    max-width: 42rem;
}

.suggest-slot {
    display: flex;
    align-items: center;
    gap: .55rem;
}

.suggest-slot-main {
    display: flex;
    align-items: center;
    gap: .55rem;
    flex: 1 1 auto;
    min-width: 0;
}

.suggest-slot-num {
    flex: 0 0 1.4rem;
    color: var(--text-muted);
    font-size: .85rem;
    text-align: right;
}

.job-alert {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    flex: 0 0 auto;
    margin: 0;
    cursor: pointer;
}

.job-alert input {
    margin: 0;
}

.job-alert .plan-chip-alert {
    pointer-events: none;
}

.job-alert input:not(:checked) + .plan-chip-alert {
    opacity: .35;
}

.job-preload {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    flex: 0 0 auto;
    margin: 0;
    cursor: pointer;
}

.job-preload input {
    margin: 0;
}

.job-preload .plan-chip-preload {
    pointer-events: none;
}

.job-preload input:not(:checked) + .plan-chip-preload {
    opacity: .35;
}

.job-order {
    display: flex;
    flex-direction: column;
    flex: 0 0 1.7rem;
    width: 1.7rem;
    gap: 0;
}

.job-order[hidden] {
    visibility: hidden;
    display: flex;
    pointer-events: none;
}

.job-order-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.7rem;
    height: 1.15rem;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
}

.job-order-btn svg {
    width: 14px;
    height: 14px;
    display: block;
}

.job-order-btn:hover:not([hidden]) {
    color: var(--text);
}

.job-order-btn[hidden] {
    visibility: hidden;
    display: flex;
    pointer-events: none;
}

.suggest-field {
    position: relative;
    flex: 1 1 auto;
    font-family: "Cascadia Mono", Consolas, "SF Mono", monospace;
    font-size: 1rem;
}

.suggest-ghost,
.suggest-input {
    display: block;
    width: 100%;
    padding: .55rem .7rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font: inherit;
    letter-spacing: inherit;
}

.suggest-ghost {
    position: absolute;
    inset: 0;
    color: transparent;
    pointer-events: none;
    white-space: pre;
    overflow: hidden;
    background: #fff;
}

.suggest-ghost .is-rest {
    color: #b0b7c6;
}

.suggest-input {
    position: relative;
    background: transparent;
    color: var(--text);
}

.suggest-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(47, 95, 216, .15);
}

.suggest-menu {
    position: absolute;
    z-index: 20;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    padding: .25rem;
    max-height: 16rem;
    overflow: auto;
}

.suggest-option {
    display: flex;
    align-items: center;
    gap: .6rem;
    width: 100%;
    padding: .35rem .55rem;
    border: 0;
    background: transparent;
    font: inherit;
    text-align: left;
    cursor: pointer;
    border-radius: 4px;
}

.suggest-option.is-active,
.suggest-option:hover {
    background: #eef3ff;
}

.suggest-kind {
    color: var(--text-muted);
    font-size: .78rem;
    margin-left: auto;
}

.suggest-n {
    color: var(--text-muted);
    font-size: .78rem;
    font-variant-numeric: tabular-nums;
}

.suggest-preview {
    margin-top: 1rem;
}

.suggest-tokens {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    margin-bottom: .4rem;
}

.suggest-token {
    font-family: "Cascadia Mono", Consolas, "SF Mono", monospace;
    padding: .15rem .45rem;
    border-radius: 4px;
    background: var(--success-bg);
    color: var(--success);
}

.suggest-token.is-unknown {
    background: var(--warning-bg);
    color: var(--warning);
}

kbd {
    font-family: inherit;
    font-size: .82em;
    border: 1px solid var(--border);
    border-bottom-width: 2px;
    border-radius: 4px;
    padding: .05em .4em;
    background: #fff;
}

/* ---------------------------------------------------------- planovaci plachta */

body.app-plan {
    height: 100vh;
    overflow: hidden;
}

body.app-plan.app {
    height: 100vh;
    min-height: 0;
}

body.app-plan {
    --job-bg: #bbf7d0;
    --job-text: #14532d;
    --job-unconfirmed-bg: #fdf3e2;
    --job-unconfirmed-text: #000000;
    --job-border: transparent;
    --job-font-size: 11px;
    --job-font-weight: 400;
    --job-unconfirmed-border: transparent;
    --job-unconfirmed-font-size: 11px;
    --job-unconfirmed-font-weight: 400;
    --job-invoiced-bg: #fee2e2;
    --job-invoiced-text: #b91c1c;
    --job-invoiced-border: #dc2626;
    --job-invoiced-font-size: 11px;
    --job-invoiced-font-weight: 400;
    --dov-bg: #bfdbfe;
    --dov-text: #1e3a8a;
    --dov-border: transparent;
    --dov-font-size: 11px;
    --dov-font-weight: 700;
    --volno-bg: #e5e7eb;
    --volno-text: #4b5563;
    --volno-border: transparent;
    --volno-font-size: 11px;
    --volno-font-weight: 700;
    --w-bg: #f3f4f6;
    --w-text: #9ca3af;
    --nem-bg: #fecaca;
    --nem-text: #991b1b;
    --nem-border: transparent;
    --nem-font-size: 11px;
    --nem-font-weight: 700;
    --konec-bg: #d4d4d8;
    --konec-text: #3f3f46;
    --konec-border: transparent;
    --konec-font-size: 11px;
    --konec-font-weight: 700;
    --pending-swatch-bg: #fee2e2;
    --pending-badge-text: #b91c1c;
    --pending-border: #ef4444;
    --pending-font-size: 11px;
    --pending-font-weight: 700;
    --block-bg: #e5e7eb;
    --weekend-header-bg: #e5e7eb;
    --holiday-header-bg: #fecaca;
    --holiday-header-text: #991b1b;
    --sticky-bg: #f9fafb;
    --plan-driver-w: 260px;
}

body.app-plan .main {
    max-width: none;
    padding: 0;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.plan-page {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
    overflow: hidden;
}

.plan-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .6rem 1rem;
    padding: .7rem 1rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    position: relative;
    z-index: 20;
}

.plan-toolbar-week {
    position: relative;
    z-index: 30;
    overflow: visible;
}

.plan-toolbar-week,
.plan-toolbar-filters,
.plan-toolbar-actions {
    display: flex;
    align-items: center;
    gap: .45rem;
    flex-wrap: wrap;
}

.plan-week-picker {
    position: relative;
    flex: 0 0 auto;
}

.plan-week-trigger {
    width: calc(32ch + 2.6rem);
    min-width: 0;
    box-sizing: border-box;
    padding: .35rem 1.6rem .35rem .55rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    font-family: inherit;
    font-size: inherit;
    text-align: left;
    cursor: pointer;
    position: relative;
}

.plan-week-trigger::after {
    content: '';
    position: absolute;
    right: .55rem;
    top: 50%;
    width: 0;
    height: 0;
    margin-top: -2px;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid var(--muted, #6b7280);
}

.plan-week-trigger:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(47, 95, 216, .15);
}

.plan-week-list {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    z-index: 50;
    width: calc(32ch + 2.6rem);
    max-height: 8.5rem;
    margin: 0;
    padding: .2rem 0;
    list-style: none;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    box-shadow: 0 4px 14px rgba(15, 23, 42, .12);
}

.plan-week-option {
    padding: .35rem .55rem;
    font-size: inherit;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.plan-week-option:hover {
    background: #f3f4f6;
}

.plan-week-option.is-selected {
    background: rgba(47, 95, 216, .12);
    font-weight: 600;
}

.plan-search {
    width: 150px;
    padding: .35rem .55rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.plan-filter-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .15rem;
}

.plan-check {
    display: flex;
    align-items: center;
    gap: .35rem;
    font-size: .85rem;
    white-space: nowrap;
    cursor: pointer;
}

.plan-check:has(input:disabled) {
    opacity: .55;
    cursor: not-allowed;
    color: var(--text-muted);
}

.plan-check[hidden],
.plan-legend-item[hidden] {
    display: none !important;
}

.plan-check-block {
    margin: .75rem 0 1rem;
}

.plan-stats {
    margin-right: .4rem;
}

.plan-grid-wrap {
    flex: 1;
    overflow: auto;
    min-height: 0;
    background: #fff;
}

.plan-loading {
    padding: 2rem;
}

.plan-grid {
    border-collapse: collapse;
    table-layout: fixed;
    width: max(100%, 1100px);
}

.plan-col-driver,
.plan-th-driver {
    width: var(--plan-driver-w, 260px);
}

.plan-grid thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: var(--sticky-bg);
    border: 1px solid var(--border);
    padding: 6px 4px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    vertical-align: middle;
}

.plan-th-driver {
    left: 0;
    z-index: 4;
    box-shadow: 2px 0 4px rgba(0, 0, 0, .06);
    text-align: left;
    padding-left: 8px;
    padding-right: 6px;
}

.plan-th-driver-title {
    display: block;
    text-align: center;
    font-weight: 600;
}

.plan-th-driver-legend {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    font-weight: 400;
    line-height: 1.2;
    color: var(--text-muted);
    white-space: normal;
}

.plan-th-day.is-weekend {
    background: var(--weekend-header-bg);
}

.plan-th-day.is-holiday {
    background: var(--holiday-header-bg);
}

.plan-th-day.is-weekend.is-holiday {
    background: #fca5a5;
}

.plan-day-name {
    display: block;
    color: var(--accent);
}

.plan-th-day.is-holiday .plan-day-name,
.plan-th-day.is-weekend .plan-day-name {
    color: var(--text);
}

.plan-th-day.is-holiday .plan-day-name {
    color: var(--holiday-header-text);
}

.plan-day-date {
    display: block;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 400;
}

.plan-day-holiday {
    display: block;
    font-size: 9px;
    color: var(--holiday-header-text);
    font-weight: 500;
    margin-top: 2px;
}

.plan-grid tbody td {
    border: 1px solid #c5cad3;
    vertical-align: top;
    padding: 0;
}

.plan-grid tbody tr.plan-group-start > td {
    border-top: 2px solid #000;
}

.plan-grid tbody td.plan-td-driver {
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--sticky-bg);
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    vertical-align: middle;
    box-shadow: 2px 0 4px rgba(0, 0, 0, .06);
    transform-origin: center left;
    transition: transform .12s ease-out, box-shadow .12s ease-out;
}

.plan-grid tbody tr.is-inactive > td.plan-td-driver {
    opacity: .7;
}

.plan-grid tbody tr.is-focus-row > td.plan-td-driver {
    z-index: 5;
    outline: 1px solid rgba(255, 255, 255, .85);
    outline-offset: -1px;
    transform: translateY(-6px) scale(1.02);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .4),
        inset 4px 0 0 #fff,
        0 7px 0 rgba(28, 34, 48, .22),
        0 9px 8px rgba(0, 0, 0, .22);
}

.plan-grid tbody tr.is-focus-row > td.plan-td-driver::after {
    display: none;
}

@media (prefers-reduced-motion: reduce) {
    .plan-grid tbody td.plan-td-driver {
        transition: none;
    }

    .plan-grid tbody tr.is-focus-row > td.plan-td-driver {
        transform: none;
    }
}

.plan-driver-head {
    display: flex;
    align-items: baseline;
    gap: .45em;
    min-width: 0;
}

.plan-driver-inactive {
    font-weight: 700;
    flex-shrink: 0;
}

.plan-driver-types {
    font-weight: 600;
    font-size: 11px;
    opacity: .85;
    overflow: hidden;
    text-overflow: ellipsis;
}

.plan-driver-vehicle {
    font-size: 12px;
    font-weight: 400;
    line-height: 1.3;
    opacity: .85;
    margin-top: 1px;
    color: inherit;
    white-space: normal;
}

.plan-driver-unit {
    display: inline-block;
    vertical-align: top;
    max-width: 100%;
}

.plan-driver-unit-head {
    display: block;
    white-space: nowrap;
}

.plan-driver-specs {
    display: block;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.25;
    opacity: .9;
    white-space: normal;
    margin-top: 1px;
}

.plan-td-driver .plan-driver-vehicle a,
.plan-td-driver .plan-driver-vehicle a:link,
.plan-td-driver .plan-driver-vehicle a:visited,
.plan-td-driver .plan-driver-vehicle a:hover,
.plan-td-driver .plan-driver-vehicle a:active {
    color: inherit;
    text-decoration: none;
}

.plan-td-driver .plan-driver-vehicle a:hover {
    text-decoration: underline;
}

.plan-cell {
    cursor: pointer;
    position: relative;
}

.plan-cell:hover {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
    z-index: 1;
}

.plan-grid tbody tr.is-focus-row > td:not(.is-focus-cell)::after,
.plan-th-day.is-focus-col::after,
.plan-cell.is-focus-col:not(.is-focus-cell)::after,
.plan-cell.is-focus-cell::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(47, 95, 216, .08);
    pointer-events: none;
    z-index: 2;
}

.plan-cell.is-focus-cell::after {
    background: rgba(47, 95, 216, .14);
}

.plan-cell-inner {
    padding: 3px 4px;
    min-height: 48px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.plan-chip {
    display: flex;
    align-items: flex-start;
    gap: 3px;
    font-size: var(--job-font-size);
    font-weight: var(--job-font-weight);
    line-height: 1.25;
    padding: 2px 4px;
    border-radius: 3px;
    word-break: break-word;
    background: var(--job-bg);
    color: var(--job-text);
    box-shadow: inset 0 0 0 2px var(--job-border);
}

.plan-chip-spacer {
    min-height: 1.25em;
    padding: 2px 4px;
    font-size: var(--job-font-size);
    line-height: 1.25;
    visibility: hidden;
    pointer-events: none;
}

.plan-chip-text {
    flex: 1;
    min-width: 0;
}

.plan-chip.is-preload {
    justify-content: flex-end;
}

.plan-chip.is-preload .plan-chip-text {
    font-style: italic;
    text-align: right;
}

.plan-chip-badges {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
    margin-left: auto;
}

.plan-chip-unconfirmed,
.plan-chip-alert,
.plan-chip-preload,
.plan-legend-unconfirmed,
.plan-legend-preload {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    background: #dc2626;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    flex-shrink: 0;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
}

.plan-chip-preload,
.plan-legend-preload {
    width: 16px;
    background: #6b7280;
    font-size: 11px;
}

.plan-legend-unconfirmed,
.plan-legend-preload {
    margin-left: 0;
}

.plan-chip.is-unconfirmed {
    background: var(--job-unconfirmed-bg);
    color: var(--job-unconfirmed-text);
    font-size: var(--job-unconfirmed-font-size);
    font-weight: var(--job-unconfirmed-font-weight);
    box-shadow: inset 0 0 0 2px var(--job-unconfirmed-border);
}

.plan-chip.is-invoiced {
    background: var(--job-invoiced-bg);
    color: var(--job-invoiced-text);
    font-size: var(--job-invoiced-font-size);
    font-weight: var(--job-invoiced-font-weight);
    box-shadow: inset 0 0 0 2px var(--job-invoiced-border);
}

.plan-chip.is-status-dov {
    background: var(--dov-bg);
    color: var(--dov-text);
    font-size: var(--dov-font-size);
    font-weight: var(--dov-font-weight);
    box-shadow: inset 0 0 0 2px var(--dov-border);
}

.plan-chip.is-status-volno {
    background: var(--volno-bg);
    color: var(--volno-text);
    font-size: var(--volno-font-size);
    font-weight: var(--volno-font-weight);
    box-shadow: inset 0 0 0 2px var(--volno-border);
}

.plan-chip.is-status-w { background: var(--w-bg); color: var(--w-text); font-weight: 600; }
.plan-chip.is-status-nem {
    background: var(--nem-bg);
    color: var(--nem-text);
    font-size: var(--nem-font-size);
    font-weight: var(--nem-font-weight);
    box-shadow: inset 0 0 0 2px var(--nem-border);
}

.plan-chip.is-status-konec {
    background: var(--konec-bg);
    color: var(--konec-text);
    font-size: var(--konec-font-size);
    font-weight: var(--konec-font-weight);
    box-shadow: inset 0 0 0 2px var(--konec-border);
}

.plan-cell-note {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    line-height: 1.2;
    color: inherit;
    font-weight: 400;
    padding: 2px 4px;
    border-radius: 3px;
    word-break: break-word;
}

.plan-cell-note-text {
    flex: 1;
    min-width: 0;
}

.plan-cell.is-empty { background: #fafafa; }
.plan-cell.is-holiday-col { background: var(--holiday-header-bg); }
.plan-cell.is-status-dov {
    background: var(--dov-bg);
}

.plan-cell.is-status-volno {
    background: var(--volno-bg);
}
.plan-cell.is-status-w { background: var(--w-bg); }
.plan-cell.is-status-w .plan-chip {
    background: var(--w-bg);
    color: var(--text);
}
.plan-cell.is-status-nem {
    background: var(--nem-bg);
}
.plan-cell.is-status-konec {
    background: var(--konec-bg);
}
.plan-cell.is-blocked { background: var(--block-bg); }

.plan-cell.is-pending {
    box-shadow: inset 0 0 0 2px var(--pending-border);
}

.plan-cell.is-editing {
    box-shadow: inset 0 0 0 2px #7c3aed;
    cursor: not-allowed;
}

.plan-pending-badge,
.plan-editing-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    line-height: 1;
}

.plan-pending-badge {
    color: var(--pending-badge-text);
    font-size: var(--pending-font-size);
    font-weight: var(--pending-font-weight);
}

.plan-editing-badge {
    font-size: 10px;
    font-weight: 700;
    max-width: 70%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    background: #7c3aed;
    color: #fff;
    border-radius: 3px;
    padding: 1px 4px;
    right: auto;
    left: 2px;
    top: auto;
    bottom: 2px;
}

.plan-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 16px;
    padding: 6px 16px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    font-size: 12px;
    flex-shrink: 0;
}

.plan-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.plan-swatch {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid var(--border);
}

.plan-swatch-job {
    background: var(--job-bg);
    box-shadow: inset 0 0 0 2px var(--job-border);
}

.plan-swatch-unconfirmed {
    background: var(--job-unconfirmed-bg);
    box-shadow: inset 0 0 0 2px var(--job-unconfirmed-border);
}

.plan-swatch-invoice {
    background: var(--job-invoiced-bg);
    box-shadow: inset 0 0 0 2px var(--job-invoiced-border);
}

.plan-swatch-pending {
    background: var(--pending-swatch-bg);
    box-shadow: inset 0 0 0 2px var(--pending-border);
}
.plan-swatch-block { background: var(--block-bg); }

.job-menu {
    position: fixed;
    z-index: 80;
    min-width: 11rem;
    padding: .25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(23, 29, 43, .18);
}

.job-menu[hidden] {
    display: none;
}

.job-menu button[hidden] { display: none; }

.job-menu button {
    display: flex;
    align-items: center;
    gap: .45rem;
    width: 100%;
    text-align: left;
    border: 0;
    background: transparent;
    color: var(--text);
    padding: .4rem .6rem;
    border-radius: 4px;
    cursor: pointer;
}

.job-menu button svg {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
}

.job-menu button:hover:not(:disabled) { background: #f7f8fa; }

.job-menu button:disabled {
    color: var(--text-muted);
    cursor: default;
}

.plan-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

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

.plan-modal-box {
    background: var(--surface);
    border-radius: 10px;
    padding: 24px;
    max-width: 480px;
    width: 90%;
    max-height: 90vh;
    overflow: auto;
    position: relative;
    box-shadow: var(--shadow);
}

.plan-modal-box h3 {
    margin: 0 0 .5rem;
    font-size: 1.05rem;
}

.plan-status-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: .75rem 0;
}

.btn-status {
    box-sizing: border-box;
    min-width: 5.6em;
    min-height: 32px;
    padding: 6px 12px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: #fff;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
}

.btn-status:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.plan-history {
    margin-top: .5rem;
}

.plan-history h4 {
    margin: 0 0 .35rem;
    font-size: .85rem;
}

.plan-history-list {
    margin: 0;
    padding-left: 1.1rem;
    font-size: .8rem;
    line-height: 1.35;
    max-height: calc(1.35em * 5);
    overflow-y: auto;
}

@media print {
    @page {
        size: A3 landscape;
        margin: 8mm;
    }

    body.app-plan {
        height: auto;
        overflow: visible;
    }

    body.app-plan .sidebar,
    body.app-plan .plan-toolbar-filters,
    body.app-plan .plan-toolbar-actions,
    body.app-plan .plan-modal,
    body.app-plan .alert {
        display: none !important;
    }

    body.app-plan.app {
        display: block;
        height: auto;
    }

    body.app-plan .main {
        overflow: visible;
        display: block;
    }

    .plan-page {
        overflow: visible;
        display: block;
    }

    .plan-grid-wrap {
        overflow: visible;
    }

    .plan-grid {
        width: 100%;
    }

    .plan-cell {
        cursor: default;
    }

    .plan-grid tbody tr.is-focus-row > td::after,
    .plan-th-day.is-focus-col::after,
    .plan-cell.is-focus-col::after,
    .plan-cell.is-focus-cell::after {
        display: none;
    }

    .plan-grid tbody tr.is-focus-row > td.plan-td-driver {
        outline: none;
        box-shadow: none;
        transform: none;
        animation: none;
    }
}
