:root {
    --ink: #151512;
    --muted: #6b6f68;
    --paper: #fcfbf7;
    --panel: #ffffff;
    --line: #deddd5;
    --line-strong: #b9b7ac;
    --charcoal: #20201d;
    --coal: #11110f;
    --amber: #f2b84b;
    --orange: #e6772e;
    --teal: #1d8b7a;
    --blue: #4267c7;
    --red: #c64037;
    --green: #578f45;
    --shadow: 0 14px 38px rgba(27, 25, 18, .12);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #ece9df;
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    background:
        linear-gradient(rgba(24, 24, 20, .03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(24, 24, 20, .03) 1px, transparent 1px),
        #ece9df;
    background-size: 26px 26px;
}

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

button {
    color: inherit;
}

img {
    max-width: 100%;
}

.top-shell {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-height: 78px;
    padding: 10px 22px;
    color: #f7f4eb;
    background: rgba(18, 18, 16, .96);
    border-bottom: 1px solid rgba(255, 255, 255, .12);
    backdrop-filter: blur(14px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 220px;
    color: inherit;
    text-decoration: none;
}

.brand img {
    width: 58px;
    height: 58px;
    object-fit: contain;
}

.brand strong,
.brand small {
    display: block;
    line-height: 1.05;
}

.brand strong {
    font-size: 18px;
}

.brand small {
    margin-top: 3px;
    color: #c7c1b4;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0;
}

.main-tabs {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex: 1 1 auto;
    gap: 7px;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: thin;
}

.sync-pill {
    flex: 0 0 auto;
    min-width: 72px;
    padding: 7px 10px;
    color: #bdb6a9;
    background: #292923;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
    text-align: center;
}

.sync-pill[data-sync-status="live"] {
    color: #ddf5eb;
    background: #174f44;
    border-color: #2e8f7c;
}

.sync-pill[data-sync-status="saving"] {
    color: #3b2a03;
    background: #f2c867;
    border-color: #d7a835;
}

.sync-pill[data-sync-status="offline"] {
    color: white;
    background: var(--red);
    border-color: #9f3029;
}

.tab,
.icon-action,
.segmented button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-weight: 800;
    cursor: pointer;
    transition: border-color .16s ease, background .16s ease, color .16s ease, transform .16s ease;
}

.tab {
    flex: 0 0 auto;
    padding: 0 11px;
    color: #d8d2c5;
    background: transparent;
    white-space: nowrap;
}

.tab:hover,
.tab.active {
    color: white;
    background: #303029;
    border-color: rgba(255, 255, 255, .12);
}

.tab svg,
.icon-action svg,
.segmented svg {
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
}

.workspace {
    width: min(1580px, calc(100vw - 28px));
    margin: 18px auto 54px;
}

.status-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.status-strip article,
.tool-panel,
.inspector,
.map-surface,
.zone-list,
.zone-detail,
.move-form,
.move-history,
.stock-tools,
.todo-tools,
.table-wrap,
.summary-card,
.todo-panel,
.planning-panel,
.todo-stat {
    background: rgba(252, 251, 247, .96);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(25, 25, 20, .07);
}

.status-strip article {
    min-height: 74px;
    padding: 14px 16px;
}

.status-strip span,
.field-label,
.eyebrow {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
    line-height: 1.2;
    letter-spacing: 0;
    text-transform: uppercase;
}

.status-strip strong {
    display: block;
    margin-top: 7px;
    color: var(--coal);
    font-size: 24px;
    line-height: 1;
}

.view {
    display: none;
}

.view.is-active {
    display: block;
}

.section-head,
.section-subhead {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.section-head h1,
.section-subhead h2 {
    margin: 4px 0 0;
    font-size: 30px;
    line-height: 1.08;
    letter-spacing: 0;
}

.section-subhead h2 {
    font-size: 20px;
}

.head-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.icon-action {
    min-width: 42px;
    padding: 0 12px;
    color: var(--ink);
    background: white;
    border-color: var(--line-strong);
    text-decoration: none;
}

.icon-action:hover {
    border-color: var(--charcoal);
    transform: translateY(-1px);
}

.icon-action.primary {
    color: #161410;
    background: var(--amber);
    border-color: #d39b34;
}

.icon-action.danger {
    color: white;
    background: var(--red);
    border-color: #9f3029;
}

.icon-action input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.plan-layout {
    display: grid;
    grid-template-columns: 246px minmax(0, 1fr) 320px;
    gap: 12px;
    align-items: stretch;
}

.tool-panel,
.inspector {
    display: grid;
    align-content: start;
    gap: 16px;
    padding: 14px;
}

.tool-panel label,
.stock-tools label,
.todo-tools label,
.move-form label,
.inspector label {
    display: grid;
    gap: 7px;
}

input,
select,
textarea {
    width: 100%;
    min-height: 40px;
    padding: 9px 10px;
    color: var(--ink);
    background: white;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    outline: none;
}

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

input:focus,
select:focus,
textarea:focus {
    border-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(230, 119, 46, .16);
}

.segmented {
    display: grid;
    gap: 7px;
}

.segmented button {
    justify-content: flex-start;
    width: 100%;
    padding: 0 10px;
    color: #4f514b;
    background: #f4f1e8;
    border-color: #ddd8ca;
}

.segmented button.active {
    color: #17150f;
    background: #ffe1a4;
    border-color: #d39b34;
}

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

.swatch {
    min-height: 34px;
    border: 2px solid rgba(0, 0, 0, .18);
    border-radius: 8px;
    cursor: pointer;
}

.swatch.active {
    outline: 3px solid rgba(21, 21, 18, .22);
    outline-offset: 2px;
}

.color-picker {
    min-height: 38px;
    padding: 4px;
    cursor: pointer;
}

.legend {
    display: grid;
    gap: 7px;
}

.legend-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 28px;
    color: #555850;
    font-size: 13px;
    font-weight: 700;
}

.legend-dot {
    width: 13px;
    height: 13px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, .2);
}

.line-hint {
    display: none;
    padding: 10px;
    color: #563605;
    background: #fff2cf;
    border: 1px solid #e5c675;
    border-radius: 8px;
    font-size: 13px;
}

.line-hint.is-active {
    display: grid;
    gap: 3px;
}

.map-surface {
    padding: 12px;
    min-width: 0;
}

.site-map {
    position: relative;
    min-height: 380px;
    overflow: hidden;
    aspect-ratio: 16 / 10;
    background: #201f1a;
    border: 1px solid #c9c2b4;
    border-radius: 8px;
    touch-action: none;
}

.site-map.is-panning {
    cursor: grab;
}

.site-map.is-panning:active {
    cursor: grabbing;
}

.map-canvas {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(21, 21, 18, .08) 1px, transparent 1px),
        linear-gradient(rgba(21, 21, 18, .08) 1px, transparent 1px),
        radial-gradient(circle at 22% 36%, rgba(242, 184, 75, .24), transparent 22%),
        radial-gradient(circle at 72% 68%, rgba(29, 139, 122, .18), transparent 24%),
        #d7d1c2;
    background-position: center;
    background-size: 28px 28px, 28px 28px, auto, auto, cover;
    transform: translate(var(--map-pan-x, 0), var(--map-pan-y, 0)) scale(var(--map-zoom, 1));
    transform-origin: 0 0;
    will-change: transform;
}

.map-canvas.has-image {
    background-size: 100% 100%;
    background-repeat: no-repeat;
}

.map-zoom-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 20;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px;
    background: rgba(252, 251, 247, .92);
    border: 1px solid rgba(20, 19, 15, .16);
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(20, 19, 15, .16);
}

.map-zoom-controls button {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    background: white;
    border: 1px solid var(--line-strong);
    border-radius: 7px;
    cursor: pointer;
}

.map-zoom-controls button.active {
    background: var(--amber);
    border-color: #d39b34;
}

.map-zoom-controls svg {
    width: 16px;
    height: 16px;
}

#map-zoom-label {
    min-width: 48px;
    color: var(--ink);
    font-size: 12px;
    font-weight: 950;
    text-align: center;
}

.map-background-label {
    position: absolute;
    right: 14px;
    bottom: 12px;
    z-index: 1;
    padding: 5px 8px;
    color: rgba(20, 19, 15, .66);
    background: rgba(252, 251, 247, .72);
    border: 1px solid rgba(20, 19, 15, .12);
    border-radius: 8px;
    font-size: 12px;
    font-weight: 850;
}

.map-lines,
.map-layer {
    position: absolute;
    inset: 0;
}

.map-lines {
    z-index: 4;
    pointer-events: auto;
}

.map-line-hit {
    stroke: transparent;
    stroke-linecap: round;
    stroke-width: var(--map-line-hit-width, 4);
    vector-effect: non-scaling-stroke;
    cursor: grab;
    pointer-events: stroke;
}

.map-line-visual {
    stroke-linecap: round;
    stroke-width: var(--map-line-width, .85);
    vector-effect: non-scaling-stroke;
    pointer-events: none;
}

.map-line-visual.is-selected {
    stroke-width: var(--map-line-selected-width, 1.25);
    filter: drop-shadow(0 0 2px rgba(255, 255, 255, .95));
}

.map-layer {
    z-index: 5;
    pointer-events: none;
}

.map-zone {
    position: absolute;
    display: grid;
    align-content: start;
    gap: 4px;
    padding: 7px;
    color: #151512;
    background: color-mix(in srgb, var(--zone-color) 18%, transparent);
    border: 2px solid var(--zone-color);
    border-radius: 8px;
    cursor: grab;
    transform: rotate(var(--zone-angle, 0deg));
    transform-origin: center center;
    user-select: none;
    pointer-events: auto;
}

.map-zone:active {
    cursor: grabbing;
}

.map-zone.is-selected {
    box-shadow: 0 0 0 4px rgba(255, 255, 255, .88), 0 0 0 7px var(--zone-color);
}

.map-zone strong {
    width: fit-content;
    max-width: 100%;
    padding: 3px 6px;
    overflow: hidden;
    color: #11110f;
    background: rgba(255, 255, 255, .84);
    border-radius: 7px;
    font-size: 12px;
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.map-zone small {
    width: fit-content;
    padding: 2px 6px;
    color: white;
    background: rgba(17, 17, 15, .82);
    border-radius: 7px;
    font-size: 11px;
    font-weight: 800;
}

.map-point {
    position: absolute;
    display: grid;
    place-items: center;
    width: var(--map-point-size, 42px);
    height: var(--map-point-size, 42px);
    padding: 0;
    color: white;
    background: var(--point-color);
    border: var(--map-point-border, 2px) solid rgba(255, 255, 255, .92);
    border-radius: 50%;
    box-shadow: 0 7px 18px rgba(0, 0, 0, .28);
    cursor: grab;
    font-size: var(--map-point-font, 11px);
    font-weight: 950;
    line-height: 1;
    text-align: center;
    transform: translate(-50%, -50%);
    user-select: none;
    pointer-events: auto;
    text-rendering: geometricPrecision;
}

.map-point:active {
    cursor: grabbing;
}

.map-point.is-selected {
    box-shadow: 0 0 0 4px rgba(255, 255, 255, .9), 0 0 0 7px var(--point-color), 0 7px 18px rgba(0, 0, 0, .25);
}

.line-label {
    position: absolute;
    z-index: 6;
    padding: var(--map-label-pad-y, 3px) var(--map-label-pad-x, 6px);
    color: white;
    background: rgba(17, 17, 15, .86);
    border: 0;
    border-radius: 7px;
    cursor: pointer;
    font-size: var(--map-label-font, 11px);
    font-weight: 800;
    transform: translate(-50%, -50%);
    pointer-events: auto;
    text-rendering: geometricPrecision;
}

.line-label.is-selected {
    background: var(--red);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, .86);
}

.line-handle {
    position: absolute;
    z-index: 9;
    display: grid;
    place-items: center;
    width: var(--map-handle-size, 30px);
    height: var(--map-handle-size, 30px);
    color: white;
    background: var(--line-color);
    border: var(--map-point-border, 2px) solid rgba(255, 255, 255, .95);
    border-radius: 50%;
    box-shadow: 0 8px 18px rgba(0, 0, 0, .26);
    cursor: grab;
    font-size: var(--map-label-font, 11px);
    font-weight: 950;
    transform: translate(-50%, -50%);
    user-select: none;
    pointer-events: auto;
    text-rendering: geometricPrecision;
}

.line-handle:active {
    cursor: grabbing;
}

.pending-pin {
    position: absolute;
    z-index: 7;
    width: var(--map-pending-size, 18px);
    height: var(--map-pending-size, 18px);
    background: var(--amber);
    border: var(--map-point-border, 2px) solid var(--coal);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.inspector-empty {
    display: grid;
    gap: 12px;
}

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

.quick-card,
.zone-card,
.stand-card,
.move-row,
.summary-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: white;
}

.quick-card,
.zone-card,
.stand-card,
.move-row {
    padding: 10px;
}

.quick-card {
    display: grid;
    gap: 4px;
}

.quick-card strong,
.zone-card strong,
.move-row strong {
    color: var(--ink);
}

.quick-card span,
.zone-card span,
.move-row span,
.stand-card span,
.summary-card span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.inspector-form {
    display: grid;
    gap: 11px;
}

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

.delete-action {
    color: white;
    background: var(--red);
    border-color: #9f3029;
}

.zones-layout {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 12px;
}

.zone-list {
    display: grid;
    align-content: start;
    gap: 9px;
    min-width: 0;
    padding: 12px;
}

.zone-card {
    display: grid;
    gap: 7px;
    cursor: pointer;
}

.zone-card.active {
    border-color: var(--orange);
    box-shadow: inset 4px 0 0 var(--orange);
}

.zone-card header,
.stand-card header,
.summary-card header,
.move-row header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.zone-badge,
.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 8px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 850;
}

.zone-badge {
    color: white;
    background: var(--zone-color);
}

.status-badge {
    color: #40320a;
    background: #fff0c4;
}

.zone-detail {
    min-height: 680px;
    min-width: 0;
    padding: 12px;
}

.zone-meta-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr .8fr .8fr .55fr 1.4fr;
    gap: 8px;
    margin-bottom: 12px;
    padding: 10px;
    background: #f4f1e8;
    border: 1px solid #ddd6c7;
    border-radius: 8px;
}

.zone-meta-grid label,
.zone-inline-editor label,
.stand-edit-grid label,
.stand-card label,
.gallery-tools label,
.gallery-card label {
    display: grid;
    gap: 6px;
}

.zone-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(300px, .65fr);
    gap: 12px;
    align-items: start;
}

.zone-editor {
    display: grid;
    align-content: start;
    gap: 10px;
    min-width: 0;
}

.zone-editor-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.segmented.mini {
    display: inline-flex;
    gap: 6px;
}

.segmented.mini button {
    width: auto;
    min-height: 36px;
    padding: 0 10px;
}

.mini-color-tools {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.mini-color-tools .swatch {
    width: 30px;
    min-height: 30px;
    padding: 0;
}

.mini-color-tools .color-picker {
    width: 42px;
    min-height: 32px;
}

.zone-mini-map {
    position: relative;
    min-height: clamp(520px, 62vh, 760px);
    overflow: hidden;
    background:
        linear-gradient(90deg, rgba(21, 21, 18, .08) 1px, transparent 1px),
        linear-gradient(rgba(21, 21, 18, .08) 1px, transparent 1px),
        #d8d1c0;
    background-size: 24px 24px;
    border: 1px solid #c5bead;
    border-radius: 8px;
    touch-action: none;
}

.zone-mini-map.has-image {
    background: #d8d1c0;
}

.zone-map-background {
    position: absolute;
    z-index: 0;
    background-repeat: no-repeat;
    background-size: 100% 100%;
    opacity: .95;
    pointer-events: none;
}

.zone-focus-frame {
    position: absolute;
    z-index: 1;
    display: grid;
    align-content: start;
    padding: 7px;
    background: color-mix(in srgb, var(--zone-color) 12%, transparent);
    border: 2px solid var(--zone-color);
    border-radius: 8px;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, .62), inset 0 0 0 1px rgba(255, 255, 255, .4);
    transform: rotate(var(--zone-angle, 0deg));
    transform-origin: center center;
    pointer-events: none;
}

.zone-focus-frame span {
    width: fit-content;
    max-width: 100%;
    padding: 3px 7px;
    overflow: hidden;
    color: #11110f;
    background: rgba(255, 255, 255, .86);
    border-radius: 7px;
    font-size: 12px;
    font-weight: 900;
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.zone-mini-lines,
.zone-mini-layer {
    position: absolute;
    inset: 0;
}

.zone-mini-lines {
    z-index: 2;
    pointer-events: auto;
}

.zone-mini-layer {
    z-index: 3;
    pointer-events: none;
}

.zone-mini-line-hit {
    stroke: transparent;
    stroke-linecap: round;
    stroke-width: 5;
    vector-effect: non-scaling-stroke;
    cursor: grab;
    pointer-events: stroke;
}

.zone-mini-line {
    stroke-linecap: round;
    stroke-width: .9;
    vector-effect: non-scaling-stroke;
    pointer-events: none;
}

.zone-mini-line.is-selected {
    stroke-width: 1.35;
    filter: drop-shadow(0 0 2px rgba(255, 255, 255, .95));
}

.zone-mini-point {
    position: absolute;
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    padding: 0;
    color: white;
    background: var(--point-color);
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 5px 12px rgba(0, 0, 0, .2);
    cursor: grab;
    font-size: 9px;
    font-weight: 950;
    line-height: 1;
    transform: translate(-50%, -50%);
    pointer-events: auto;
    user-select: none;
}

.zone-mini-point.is-selected {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, .92), 0 0 0 5px var(--point-color);
}

.zone-mini-line-label {
    position: absolute;
    z-index: 4;
    padding: 2px 5px;
    color: white;
    background: rgba(17, 17, 15, .82);
    border: 0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 10px;
    font-weight: 850;
    transform: translate(-50%, -50%);
    pointer-events: auto;
}

.zone-mini-line-label.is-selected {
    background: var(--red);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, .9);
}

.zone-mini-handle,
.zone-pending-pin {
    position: absolute;
    z-index: 5;
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    color: white;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: auto;
}

.zone-mini-handle {
    background: var(--line-color);
    border: 2px solid rgba(255, 255, 255, .96);
    box-shadow: 0 5px 12px rgba(0, 0, 0, .2);
    cursor: grab;
    font-size: 9px;
    font-weight: 950;
}

.zone-pending-pin {
    background: var(--amber);
    border: 2px solid var(--coal);
    pointer-events: none;
}

.zone-inline-editor {
    display: grid;
    gap: 9px;
    padding: 10px;
    background: white;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.zone-inline-editor header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

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

.zone-inline-editor textarea {
    min-height: 72px;
}

.stand-list {
    display: grid;
    align-content: start;
    gap: 10px;
    max-height: calc(100vh - 230px);
    overflow: auto;
    padding-right: 2px;
}

.stand-card {
    display: grid;
    gap: 10px;
    min-width: 0;
}

.stand-actions {
    display: flex;
    gap: 6px;
}

.stand-actions .icon-action {
    width: 38px;
    min-width: 38px;
    padding: 0;
}

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

.stand-card textarea {
    min-height: 72px;
}

.gallery-panel {
    margin-top: 12px;
    padding: 14px;
    background: rgba(252, 251, 247, .96);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(25, 25, 20, .07);
}

.gallery-tools {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(120px, .35fr) minmax(170px, .55fr) auto;
    gap: 10px;
    align-items: end;
    margin-bottom: 12px;
}

.gallery-count {
    display: grid;
    min-width: 92px;
    min-height: 40px;
    align-content: center;
    padding: 6px 10px;
    color: var(--ink);
    background: #f3efe4;
    border: 1px solid #ddd6c7;
    border-radius: 8px;
}

.gallery-count strong,
.gallery-count span {
    line-height: 1;
}

.gallery-count strong {
    font-size: 18px;
}

.gallery-count span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 850;
    text-transform: uppercase;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 10px;
}

.gallery-card {
    display: grid;
    overflow: hidden;
    background: white;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.gallery-card img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    background: #d8d1c0;
    border-bottom: 1px solid var(--line);
}

.gallery-card-body {
    display: grid;
    gap: 8px;
    padding: 10px;
}

.gallery-card-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 34px;
    gap: 7px;
    align-items: center;
}

.gallery-card-grid {
    display: grid;
    grid-template-columns: .45fr minmax(0, 1fr);
    gap: 8px;
}

.gallery-card textarea {
    min-height: 74px;
}

.need-grid {
    display: grid;
    grid-template-columns: 1.1fr .55fr .55fr .75fr .75fr 34px;
    gap: 6px;
    align-items: center;
}

.need-grid input,
.need-grid select {
    min-height: 34px;
    padding: 7px 8px;
    font-size: 13px;
}

.stock-tools {
    display: flex;
    align-items: end;
    gap: 10px;
    padding: 12px;
    margin-bottom: 10px;
}

.stock-tools label {
    flex: 1 1 230px;
}

.table-wrap {
    overflow: auto;
}

.stock-table {
    width: 100%;
    min-width: 1040px;
    border-collapse: collapse;
}

.stock-table th,
.stock-table td {
    padding: 9px 8px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.stock-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    color: #f8f4ea;
    background: var(--charcoal);
    font-size: 12px;
}

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

.stock-table input,
.stock-table select {
    min-height: 34px;
    padding: 6px 7px;
    font-size: 13px;
}

.stock-table .num {
    width: 78px;
}

.stock-action-cell {
    width: 68px;
    text-align: center;
}

.stock-delete {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    color: #8f211c;
    background: #fff3f1;
    border: 1px solid #e1aaa5;
    border-radius: 8px;
    cursor: pointer;
}

.stock-delete:hover {
    color: white;
    background: var(--red);
    border-color: #9f3029;
}

.stock-delete svg {
    width: 16px;
    height: 16px;
}

.available-pill {
    display: inline-flex;
    justify-content: center;
    min-width: 46px;
    padding: 6px 8px;
    color: white;
    background: var(--green);
    border-radius: 7px;
    font-weight: 900;
}

.available-pill.low {
    background: var(--orange);
}

.available-pill.empty {
    background: var(--red);
}

.moves-layout {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 12px;
}

.move-form {
    display: grid;
    align-content: start;
    gap: 12px;
    padding: 14px;
}

.move-history {
    padding: 14px;
}

.section-subhead input {
    width: min(360px, 100%);
}

#move-list {
    display: grid;
    gap: 8px;
}

.move-row {
    display: grid;
    gap: 5px;
}

.move-row small {
    color: var(--muted);
    font-weight: 750;
}

.todo-tools {
    display: grid;
    grid-template-columns: minmax(240px, 1.4fr) minmax(180px, .8fr) minmax(150px, .7fr) minmax(160px, .7fr) 110px;
    gap: 10px;
    align-items: end;
    padding: 12px;
    margin-bottom: 10px;
}

.todo-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.todo-stat {
    min-height: 70px;
    padding: 12px 14px;
}

.todo-stat span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
    text-transform: uppercase;
}

.todo-stat strong {
    display: block;
    margin-top: 6px;
    color: var(--coal);
    font-size: 24px;
    line-height: 1;
}

.todo-layout {
    display: grid;
    grid-template-columns: minmax(340px, .72fr) minmax(0, 1.28fr);
    gap: 12px;
    align-items: start;
}

.todo-panel,
.planning-panel {
    min-width: 0;
    padding: 14px;
}

.todo-list,
.planning-column-list {
    display: grid;
    gap: 6px;
}

.planning-board {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(232px, 1fr);
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.planning-column {
    display: grid;
    align-content: start;
    gap: 7px;
    min-height: 430px;
    padding: 10px;
    background: #f4f1e8;
    border: 1px solid #ddd6c7;
    border-radius: 8px;
    transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}

.planning-column.drop-target {
    border-style: dashed;
}

.planning-column.drag-over,
.todo-list.drag-over {
    background: #fff8e5;
    border-color: var(--orange);
    box-shadow: inset 0 0 0 2px rgba(230, 119, 46, .28);
}

.planning-column > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 34px;
}

.planning-column > header strong {
    font-size: 14px;
    line-height: 1.15;
}

.planning-column > header span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 24px;
    color: white;
    background: var(--charcoal);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
}

.todo-card {
    display: grid;
    gap: 6px;
    padding: 8px 9px;
    background: white;
    border: 1px solid var(--line);
    border-left: 5px solid var(--todo-color, var(--orange));
    border-radius: 8px;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.todo-card[data-todo-draggable="true"] {
    cursor: grab;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}

.todo-card[data-todo-draggable="true"]:active {
    cursor: grabbing;
}

.todo-card[data-todo-draggable="true"] input,
.todo-card[data-todo-draggable="true"] textarea,
.todo-card[data-todo-draggable="true"] select {
    -webkit-user-select: text;
    user-select: text;
}

body.todo-dragging,
body.todo-dragging * {
    cursor: grabbing;
    -webkit-user-select: none;
    user-select: none;
}

.todo-card.dragging {
    opacity: .55;
    transform: scale(.985);
}

.todo-card header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.todo-card strong {
    display: block;
    margin-top: 2px;
    font-size: 14px;
    line-height: 1.22;
}

.todo-card-line {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.todo-card-line span {
    display: inline-flex;
    align-items: center;
    min-height: 21px;
    padding: 0 6px;
    color: #56584f;
    background: #f4f1e8;
    border: 1px solid #ddd6c7;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 850;
}

.todo-card-details {
    display: grid;
    gap: 8px;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    transition: max-height .18s ease, opacity .14s ease, padding-top .18s ease;
}

.todo-card:hover,
.todo-card:focus,
.todo-card:focus-within,
.todo-card.is-open {
    border-color: color-mix(in srgb, var(--todo-color, var(--orange)) 42%, var(--line));
    box-shadow: 0 8px 22px rgba(29, 24, 18, .11);
}

.todo-card:hover .todo-card-details,
.todo-card:focus .todo-card-details,
.todo-card:focus-within .todo-card-details,
.todo-card.is-open .todo-card-details {
    max-height: 360px;
    opacity: 1;
    padding-top: 3px;
    pointer-events: auto;
}

.todo-kind {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    padding: 0 6px;
    color: var(--ink);
    background: color-mix(in srgb, var(--todo-color, var(--orange)) 18%, white);
    border: 1px solid color-mix(in srgb, var(--todo-color, var(--orange)) 38%, var(--line));
    border-radius: 999px;
    font-size: 10px;
    font-weight: 900;
}

.todo-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.todo-meta span {
    display: inline-flex;
    align-items: center;
    min-height: 25px;
    padding: 0 7px;
    color: #4e514b;
    background: #f3efe4;
    border: 1px solid #ddd6c7;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 800;
}

.todo-date-field {
    display: grid;
    gap: 6px;
}

.todo-date-field input {
    min-height: 36px;
}

.todo-date-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.todo-date-buttons button {
    min-height: 30px;
    padding: 0 8px;
    color: #474942;
    background: #f4f1e8;
    border: 1px solid #d8d0bf;
    border-radius: 7px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 850;
}

.todo-date-buttons button.active {
    color: #161410;
    background: var(--amber);
    border-color: #d39b34;
}

.todo-actions {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
}

.todo-actions .icon-action {
    min-height: 36px;
    padding: 0 10px;
}

.todo-card.compact {
    gap: 5px;
    padding: 7px 8px;
    border-left-width: 4px;
}

.todo-card.compact strong {
    font-size: 12px;
}

.todo-card.compact .status-badge,
.todo-card.compact .todo-meta span {
    font-size: 11px;
}

.todo-card.compact .todo-card-line span {
    min-height: 19px;
    font-size: 10px;
}

.todo-card.compact .todo-actions .icon-action {
    flex: 1 1 auto;
    min-width: 0;
}

.empty-note.compact {
    padding: 10px;
    font-size: 12px;
}

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

.summary-card {
    display: grid;
    gap: 12px;
    padding: 14px;
    box-shadow: var(--shadow);
}

.summary-card h2 {
    margin: 0;
    font-size: 18px;
}

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

.metric {
    padding: 9px;
    background: #f3efe4;
    border-radius: 8px;
}

.metric strong {
    display: block;
    margin-bottom: 2px;
    font-size: 18px;
}

.material-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.material-list span {
    padding: 5px 7px;
    color: var(--ink);
    background: #f3efe4;
    border: 1px solid #ddd6c7;
    border-radius: 7px;
}

.empty-note {
    padding: 16px;
    color: var(--muted);
    background: #f4f1e8;
    border: 1px dashed var(--line-strong);
    border-radius: 8px;
    font-weight: 750;
}

.print-root {
    display: none;
}

.print-week {
    color: #171510;
    background: white;
    font-family: Inter, Arial, sans-serif;
}

.print-header,
.print-stats,
.print-day > header,
.print-unplanned > header,
.print-task header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.print-header {
    padding-bottom: 8px;
    margin-bottom: 8px;
    border-bottom: 2px solid #171510;
}

.print-header p {
    margin: 0 0 2px;
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
}

.print-header h1 {
    margin: 0;
    font-size: 24px;
    line-height: 1;
}

.print-period {
    display: grid;
    gap: 2px;
    text-align: right;
}

.print-period strong,
.print-period span {
    font-size: 12px;
}

.print-stats {
    justify-content: flex-start;
    margin-bottom: 8px;
}

.print-stats span,
.print-day > header span,
.print-unplanned > header span {
    padding: 3px 7px;
    border: 1px solid #cfc8b9;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 900;
}

.print-days {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 5px;
}

.print-day,
.print-unplanned {
    min-width: 0;
    padding: 6px;
    background: #f7f3ea;
    border: 1px solid #d8d0bf;
    border-radius: 6px;
}

.print-day > header,
.print-unplanned > header {
    min-height: 26px;
    margin-bottom: 5px;
}

.print-day > header strong,
.print-unplanned > header strong {
    font-size: 11px;
    line-height: 1.1;
}

.print-task {
    display: grid;
    gap: 3px;
    padding: 5px;
    margin-bottom: 4px;
    background: white;
    border: 1px solid #d8d0bf;
    border-left: 4px solid var(--todo-color, #e6772e);
    border-radius: 5px;
    break-inside: avoid;
}

.print-task strong {
    font-size: 10px;
    line-height: 1.15;
}

.print-task header span {
    font-size: 8px;
    font-weight: 900;
    text-transform: uppercase;
}

.print-task div {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
}

.print-task small {
    padding: 2px 4px;
    background: #f1ede2;
    border-radius: 4px;
    font-size: 8px;
    font-weight: 800;
}

.print-empty,
.print-note {
    margin: 0;
    color: #69665d;
    font-size: 10px;
    font-weight: 800;
}

.print-unplanned {
    margin-top: 8px;
}

.print-unplanned > div {
    columns: 4 170px;
    column-gap: 6px;
}

@media (hover: none) {
    .todo-card .todo-card-details {
        max-height: none;
        opacity: 1;
        padding-top: 3px;
        pointer-events: auto;
    }
}

@page {
    size: A4 landscape;
    margin: 9mm;
}

@media print {
    body.has-print-export {
        background: white;
    }

    body.has-print-export .top-shell,
    body.has-print-export .workspace {
        display: none !important;
    }

    body.has-print-export .print-root {
        display: block !important;
    }
}

@media (max-width: 1180px) {
    .top-shell {
        align-items: flex-start;
        flex-direction: column;
    }

    .brand {
        min-width: 0;
    }

    .main-tabs {
        width: 100%;
    }

    .plan-layout {
        grid-template-columns: 220px minmax(0, 1fr);
    }

    .inspector {
        grid-column: 1 / -1;
    }

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

    .todo-tools,
    .todo-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 820px) {
    .workspace {
        width: min(100% - 18px, 760px);
        margin-top: 10px;
    }

    .status-strip,
    .todo-stats,
    .summary-grid,
    .plan-layout,
    .zones-layout,
    .todo-layout,
    .zone-detail-grid,
    .zone-meta-grid,
    .stand-edit-grid,
    .gallery-tools,
    .gallery-card-grid,
    .moves-layout {
        grid-template-columns: 1fr;
    }

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

    .section-head {
        align-items: stretch;
        flex-direction: column;
    }

    .section-head h1 {
        font-size: 25px;
    }

    .head-actions,
    .stock-tools,
    .todo-tools {
        align-items: stretch;
        flex-direction: column;
    }

    .todo-tools {
        display: grid;
        grid-template-columns: 1fr;
    }

    .planning-board {
        grid-auto-flow: row;
        grid-auto-columns: auto;
        grid-template-columns: 1fr;
        overflow-x: visible;
    }

    .planning-column {
        min-height: 0;
    }

    .zone-mini-map {
        min-height: 500px;
    }

    .stand-list {
        max-height: none;
        overflow: visible;
        padding-right: 0;
    }

    .site-map {
        width: 100%;
        min-height: 430px;
        aspect-ratio: auto;
    }

    .map-surface {
        order: 1;
    }

    .tool-panel {
        order: 2;
    }

    .inspector {
        order: 3;
    }

    .main-tabs {
        gap: 5px;
    }

    .tab {
        min-width: 43px;
        padding: 0 10px;
    }

    .tab span {
        display: none;
    }
}

@media (max-width: 520px) {
    .top-shell {
        padding: 9px;
    }

    .brand img {
        width: 48px;
        height: 48px;
    }

    .inspector-grid,
    .zone-inline-grid,
    .need-grid,
    .metric-row,
    .todo-stats {
        grid-template-columns: 1fr;
    }

    .site-map {
        min-height: 360px;
    }

    .zone-mini-map {
        min-height: 420px;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
    }
}
