:root {
    --bg: #f4f4f0;
    --card: #ffffff;
    --accent: #2f6f6d;
    --text: #1b1b1b;
    --muted: #5b5b5b;
    --danger: #c04b3e;
    --border: #d9d9d0;
    --shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
    --shadow-soft: 0 6px 16px rgba(0, 0, 0, 0.06);
    --topbar-height: 96px;
    --tabs-height: 64px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, sans-serif;
    background: linear-gradient(180deg, #f9f7f2 0%, #f4f4f0 100%);
    color: var(--text);
    animation: fadeIn 0.4s ease-out;
    height: 100vh;
    overflow: hidden;
}

body.login {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--topbar-height);
    padding: 8px 16px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: var(--shadow-soft);
    gap: 16px;
}

.menu-bar {
    position: fixed;
    top: var(--topbar-height);
    left: 16px;
    right: 16px;
    background: rgba(255, 253, 247, 0.98);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
    transform: translateY(-120%);
    opacity: 0;
    transition: transform 0.25s ease, opacity 0.25s ease;
    z-index: 700;
    max-height: calc(100vh - 90px);
    overflow: auto;
    backdrop-filter: blur(6px);
}

.menu-overlay {
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(20, 20, 20, 0.22);
    backdrop-filter: blur(3px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 650;
}

.menu-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.menu-bar.open {
    transform: translateY(0);
    opacity: 1;
    animation: menuDrop 0.25s ease;
}

.menu-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    padding: 18px;
}

.menu-panel {
    background: #fffdf7;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 14px 12px;
    box-shadow: var(--shadow-soft);
}

.menu-panel h3 {
    margin: 0 0 10px;
    font-size: 0.9rem;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: #2c2b26;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    padding: 6px 8px;
    background: rgba(47, 111, 109, 0.08);
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.menu-panel h3::before {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #2f6f6d;
    box-shadow: 0 0 6px rgba(47, 111, 109, 0.45);
    flex: 0 0 auto;
}

.menu-panel .inline-actions {
    margin-top: 8px;
}

.menu-panel .list li {
    padding: 8px 10px;
    border-radius: 8px;
}

.menu-panel .list li:hover {
    background: rgba(47, 111, 109, 0.08);
}

.menu-panel input,
.menu-panel select,
.menu-panel button {
    width: 100%;
}

.menu-panel .list li {
    transition: background 0.15s ease, transform 0.15s ease;
}

.menu-panel .list li:hover {
    transform: translateX(2px);
}

.brand {
    font-weight: 700;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.brand-logo {
    width: auto;
    height: 56px;
    max-width: 160px;
    object-fit: contain;
    display: inline-block;
    filter: drop-shadow(0 10px 20px rgba(16, 44, 38, 0.45)) drop-shadow(0 2px 6px rgba(0, 0, 0, 0.2));
}

.nav a {
    margin-left: 12px;
    text-decoration: none;
    color: var(--accent);
    font-weight: 600;
}

.nav .btn {
    margin-left: 10px;
    background: #1f4e4c;
    color: #ffffff;
    box-shadow: var(--shadow-soft);
}

.topbar .nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    max-width: 65vw;
}

.nav .btn .icon {
    margin-right: 6px;
    width: 16px;
    height: 16px;
    display: inline-block;
    vertical-align: -2px;
    background-color: #ffffff;
    mask-size: contain;
    mask-repeat: no-repeat;
    mask-position: center;
    -webkit-mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
}

.icon-menu {
    mask-image: url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"black\"><rect x=\"3\" y=\"6\" width=\"18\" height=\"2\"/><rect x=\"3\" y=\"11\" width=\"18\" height=\"2\"/><rect x=\"3\" y=\"16\" width=\"18\" height=\"2\"/></svg>');
    -webkit-mask-image: url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"black\"><rect x=\"3\" y=\"6\" width=\"18\" height=\"2\"/><rect x=\"3\" y=\"11\" width=\"18\" height=\"2\"/><rect x=\"3\" y=\"16\" width=\"18\" height=\"2\"/></svg>');
}

.icon-star {
    mask-image: url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"black\"><path d=\"M12 3l2.8 5.7 6.2.9-4.5 4.4 1.1 6.2L12 17.9 6.4 20.2l1.1-6.2L3 9.6l6.2-.9z\"/></svg>');
    -webkit-mask-image: url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"black\"><path d=\"M12 3l2.8 5.7 6.2.9-4.5 4.4 1.1 6.2L12 17.9 6.4 20.2l1.1-6.2L3 9.6l6.2-.9z\"/></svg>');
}

.icon-power {
    mask-image: url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"black\"><path d=\"M11 2h2v10h-2z\"/><path d=\"M6.2 4.5l1.4 1.4A7 7 0 1 0 16.4 6l1.4-1.4A9 9 0 1 1 6.2 4.5z\"/></svg>');
    -webkit-mask-image: url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"black\"><path d=\"M11 2h2v10h-2z\"/><path d=\"M6.2 4.5l1.4 1.4A7 7 0 1 0 16.4 6l1.4-1.4A9 9 0 1 1 6.2 4.5z\"/></svg>');
}

.icon-map {
    mask-image: url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"black\"><path d=\"M9 3l6 2 6-2v16l-6 2-6-2-6 2V5z\"/><path d=\"M9 3v16\"/><path d=\"M15 5v16\"/></svg>');
    -webkit-mask-image: url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"black\"><path d=\"M9 3l6 2 6-2v16l-6 2-6-2-6 2V5z\"/><path d=\"M9 3v16\"/><path d=\"M15 5v16\"/></svg>');
}

.topbar .nav .btn {
    background: #1f4e4c;
    color: #ffffff;
}

.topbar .nav .btn:hover {
    background: #275c59;
}

.topbar .nav .btn.danger {
    background: #a3382e;
}

.topbar .nav .btn.danger:hover {
    background: #b44339;
}

.pill {
    display: inline-block;
    padding: 4px 10px;
    background: #e7f5f1;
    border-radius: 999px;
    font-size: 0.8rem;
    margin-right: 8px;
}

.map-layout {
    position: relative;
    height: calc(100vh - var(--topbar-height));
    box-sizing: border-box;
}

.map-panel {
    position: relative;
    height: 100%;
}

.map-full {
    height: 100%;
    width: 100%;
}

.map-legend {
    position: static;
    background: rgba(255, 253, 247, 0.95);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 12px;
    box-shadow: var(--shadow-soft);
    display: grid;
    gap: 8px;
    min-width: 0;
    width: 100%;
}

.map-stats {
    position: static;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    background: rgba(255, 253, 247, 0.95);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 10px 12px;
    box-shadow: var(--shadow-soft);
    min-width: 0;
    backdrop-filter: blur(6px);
}

.map-stats .stat {
    display: grid;
    gap: 4px;
    padding: 6px 8px;
    border-radius: 10px;
    background: rgba(47, 111, 109, 0.08);
}

.map-stats .stat.planned {
    background: rgba(43, 111, 214, 0.12);
}

.map-stats .stat.done {
    background: rgba(67, 160, 71, 0.12);
}

.map-stats .stat.overdue {
    background: rgba(209, 79, 66, 0.14);
}

.map-stats .stat-label {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #3a4b47;
}

.map-stats .stat-value {
    font-size: 0.92rem;
    font-weight: 700;
    color: #1f2e2a;
}

.left-tabs {
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    height: calc(100vh - var(--topbar-height));
    display: flex;
    z-index: 880;
    pointer-events: auto;
}

.left-tab-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 10px;
    background: rgba(255, 253, 247, 0.96);
    border-right: 1px solid var(--border);
    box-shadow: var(--shadow-soft);
    pointer-events: auto;
    margin-top: 72px;
}

.left-tab-btn {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    border: none;
    background: #f3f7f5;
    color: #2b3a36;
    padding: 10px 8px;
    border-radius: 10px;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 10px 24px rgba(16, 44, 38, 0.1);
}

.left-tab-btn:hover {
    transform: rotate(180deg);
}

.left-tab-btn.active {
    background: #2f6f6d;
    color: #fff;
    box-shadow: 0 12px 28px rgba(16, 44, 38, 0.18);
}

.left-tab-panels {
    width: 0;
    height: 100%;
    overflow: hidden;
    transition: width 0.25s ease;
    pointer-events: auto;
    position: relative;
}

.left-tabs.open .left-tab-panels {
    width: min(260px, 86vw);
}

.left-tab-panel {
    height: calc(100vh - var(--topbar-height));
    width: 100%;
    background: rgba(255, 253, 247, 0.98);
    border-right: 1px solid var(--border);
    box-shadow: 16px 0 36px rgba(16, 44, 38, 0.12);
    transform: translateX(-24px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.25s ease, opacity 0.25s ease;
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
}

.left-tab-panel.active {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

.left-tab-panel-inner {
    height: 100%;
    overflow: auto;
    padding: 14px;
    display: grid;
    gap: 12px;
    color: var(--text);
}

.right-tabs {
    position: fixed;
    top: var(--topbar-height);
    right: 0;
    height: calc(100vh - var(--topbar-height));
    display: flex;
    z-index: 900;
    pointer-events: auto;
}

.right-tabs .tab-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 10px;
    background: rgba(255, 253, 247, 0.96);
    border-left: 1px solid var(--border);
    box-shadow: var(--shadow-soft);
    pointer-events: auto;
}

.right-tabs .tab-btn {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    border: none;
    background: #f3f7f5;
    color: #2b3a36;
    padding: 10px 8px;
    border-radius: 10px;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 10px 24px rgba(16, 44, 38, 0.1);
}

.right-tabs .tab-btn.active {
    background: #2f6f6d;
    color: #fff;
    box-shadow: 0 12px 28px rgba(16, 44, 38, 0.18);
}

.right-tabs .tab-panels {
    width: 0;
    height: 100%;
    overflow: hidden;
    transition: width 0.25s ease;
    pointer-events: auto;
    position: relative;
}

.right-tabs.open .tab-panels {
    width: min(420px, 88vw);
}

.tab-panel {
    height: calc(100vh - var(--topbar-height));
    width: 100%;
    background: rgba(255, 253, 247, 0.98);
    border-left: 1px solid var(--border);
    box-shadow: -16px 0 36px rgba(16, 44, 38, 0.12);
    transform: translateX(24px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.25s ease, opacity 0.25s ease;
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    z-index: 1;
}

.tab-panel.active {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

.tab-panel-inner {
    height: 100%;
    overflow: auto;
    padding: 16px;
    display: grid;
    gap: 12px;
    color: var(--text);
}

@media (max-width: 768px) {
    body {
        height: 100dvh;
    }

    .map-layout {
        height: calc(100dvh - var(--topbar-height));
    }

    .map-panel {
        position: static;
    }

    .map-full {
        position: fixed;
        top: var(--topbar-height);
        left: 0;
        right: 0;
        bottom: var(--tabs-height);
        height: auto;
    }

    .map-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        min-width: 0;
    }

    .map-stats .stat-label {
        font-size: 0.6rem;
    }

    .map-stats .stat-value {
        font-size: 0.95rem;
    }

    .right-tabs .tab-btn {
        writing-mode: horizontal-tb;
        transform: none;
        padding: 8px 12px;
    }

    .right-tabs {
        right: auto;
        left: 0;
        bottom: 0;
        top: auto;
        width: 100%;
        height: auto;
        flex-direction: column-reverse;
        z-index: 950;
    }

    .right-tabs .tab-buttons {
        flex-direction: row;
        justify-content: space-around;
        border-left: none;
        border-top: 1px solid var(--border);
        padding: 10px 12px;
        height: var(--tabs-height);
    }

    .map-legend {
        z-index: 920;
    }

    .map-stats {
        z-index: 920;
    }

    .left-tabs {
        top: var(--topbar-height);
        height: auto;
    }

    .left-tab-btn {
        writing-mode: horizontal-tb;
        transform: none;
        padding: 8px 12px;
    }

    .left-tab-buttons {
        margin-top: 56px;
    }

    .left-tab-panels {
        height: auto;
    }

    .left-tabs.open .left-tab-panels {
        width: min(80vw, 320px);
    }

    .left-tab-panel {
        height: auto;
        box-shadow: 12px 0 24px rgba(16, 44, 38, 0.12);
    }

    .right-tabs .tab-panels {
        width: 100%;
        height: 0;
        transition: height 0.25s ease;
    }

    .right-tabs.open .tab-panels {
        height: min(70vh, 520px);
    }

    .tab-panel {
        height: 100%;
        box-shadow: 0 -16px 36px rgba(16, 44, 38, 0.12);
    }
}

.legend-title {
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.legend-items {
    display: grid;
    gap: 6px;
    font-size: 0.8rem;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.legend-item .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.55rem;
    font-weight: 700;
    color: #fff;
}

.legend-item .dot.planned {
    background: #2b6fd6;
    box-shadow: 0 0 6px rgba(43, 111, 214, 0.45);
}

.legend-item .dot.done {
    background: #36a064;
    box-shadow: 0 0 6px rgba(54, 160, 100, 0.45);
}

.legend-item .dot.overdue {
    background: #d14f42;
    box-shadow: 0 0 6px rgba(209, 79, 66, 0.5);
}

.legend-actions {
    display: grid;
    gap: 6px;
}

.legend-actions .btn {
    width: 100%;
    text-align: center;
}


.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 18px;
    box-shadow: var(--shadow-soft);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    animation: liftIn 0.35s ease-out;
}

.side-panel .card {
    background: rgba(255, 253, 247, 0.96);
    backdrop-filter: blur(6px);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.card.small {
    max-width: 420px;
    margin: 80px auto;
}

h1, h2, h3 {
    margin-top: 0;
}

label {
    display: block;
    margin-top: 10px;
    font-weight: 600;
}

input, select, textarea {
    width: 100%;
    padding: 8px 10px;
    margin-top: 6px;
    border-radius: 6px;
    border: 1px solid var(--border);
    min-width: 0;
    font-family: inherit;
}

textarea {
    resize: vertical;
}

button {
    margin-top: 12px;
    padding: 10px 14px;
    border: none;
    background: var(--accent);
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
    box-shadow: var(--shadow-soft);
}

button.danger {
    background: var(--danger);
}

button:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

button:active {
    transform: translateY(0);
    opacity: 0.85;
}

.btn {
    display: inline-block;
    padding: 6px 10px;
    background: var(--accent);
    color: #fff;
    border-radius: 6px;
    text-decoration: none;
    margin-right: 6px;
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
    box-shadow: var(--shadow-soft);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn:active {
    transform: translateY(0);
    opacity: 0.85;
}

.alert {
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 16px;
}

.alert.success {
    background: #e7f5f1;
    border: 1px solid #b6e1d7;
}

.alert.error {
    background: #fcebea;
    border: 1px solid #f5c2c0;
}

.hint {
    color: var(--muted);
    font-size: 0.9rem;
}

.filters {
    display: grid;
    gap: 10px;
    align-items: end;
}

.popup {
    min-width: 420px;
    max-width: 520px;
}

.popup h3 {
    margin-top: 0;
}

.popup .drag-handle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    cursor: move;
    user-select: none;
}

.popup .drag-handle::before {
    content: '⋮⋮';
    font-size: 1rem;
    letter-spacing: 2px;
    color: var(--muted);
}

.tab-header {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}

.tab-btn {
    flex: 1;
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: #f8f7f2;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text);
}

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

.tab-btn:not(.active) {
    box-shadow: var(--shadow-soft);
}

button:disabled,
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
    background: #c9d4d1;
    color: #2b2b2b;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.inline-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.list {
    list-style: none;
    padding: 0;
    margin: 8px 0 0;
}

.list li {
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 6px;
    background: #faf9f4;
}

#recent-list li {
    cursor: pointer;
}

.list.scroll {
    max-height: calc(100vh - 320px);
    overflow: auto;
    padding-right: 4px;
}

.menu-panel {
    max-height: calc(100vh - 140px);
    overflow: auto;
}

.list.scroll::-webkit-scrollbar {
    width: 6px;
}

.list.scroll::-webkit-scrollbar-thumb {
    background: rgba(47, 111, 109, 0.4);
    border-radius: 999px;
}

.check-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 0.9rem;
}

.list li strong {
    display: block;
}

.location-list li {
    background: #fffdf7;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 12px;
    padding: 10px 12px;
    box-shadow: 0 10px 24px rgba(16, 44, 38, 0.08);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
    animation: listPop 0.24s ease;
}

.location-list li:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(16, 44, 38, 0.12);
    border-color: rgba(32, 96, 90, 0.3);
}

.location-list .badge {
    margin-top: 6px;
    background: rgba(47, 111, 109, 0.12);
    color: #25504a;
}

.list-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    font-size: 0.8rem;
    color: #3a4b47;
    margin-top: 6px;
}

.meta-name {
    font-weight: 600;
}

.meta-phone {
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(43, 111, 214, 0.12);
    color: #2b6fd6;
    font-weight: 600;
}

@keyframes listPop {
    0% {
        opacity: 0;
        transform: translateY(6px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.list .list-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.8);
}

.status-dot.planned {
    background: #2b6fd6;
}

.status-dot.done {
    background: #43a047;
}

.status-dot.overdue {
    background: #d14f42;
}

.badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 6px;
    background: #eef2f1;
    font-size: 0.75rem;
    margin-right: 6px;
}

.badge.planned {
    background: rgba(43, 111, 214, 0.15);
    color: #2b6fd6;
}

.badge.done {
    background: rgba(67, 160, 71, 0.15);
    color: #2d7a43;
}

.badge.overdue {
    background: rgba(209, 79, 66, 0.18);
    color: #b0392f;
}


.calendar-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.calendar-controls .btn {
    min-width: 36px;
    padding: 6px 10px;
}

.calendar-month {
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #22302c;
    text-align: center;
}

.calendar-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

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

.calendar-weekday {
    text-align: center;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #4b5d58;
}

.calendar-cell {
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    background: #fffdf8;
    padding: 8px 6px 6px;
    min-height: 56px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
    justify-content: flex-start;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.calendar-cell.is-empty {
    border: none;
    background: transparent;
    cursor: default;
}

.calendar-cell.has-events {
    border-color: rgba(47, 111, 109, 0.3);
    box-shadow: 0 8px 20px rgba(20, 45, 36, 0.12);
}

.calendar-cell.is-today {
    border-color: rgba(43, 111, 214, 0.55);
    background: rgba(43, 111, 214, 0.08);
}

.calendar-cell.is-selected {
    border-color: rgba(20, 85, 95, 0.8);
    box-shadow: 0 10px 24px rgba(14, 59, 52, 0.18);
    transform: translateY(-1px);
    background: rgba(32, 96, 90, 0.08);
}

.calendar-day-number {
    font-weight: 600;
    font-size: 0.85rem;
    color: #2a3a36;
}

.calendar-badges {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: center;
}

.cal-badge {
    min-width: 18px;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #fff;
}

.cal-badge.planned {
    background: #2b6fd6;
}

.cal-badge.done {
    background: #43a047;
}

.cal-badge.overdue {
    background: #d14f42;
}

.calendar-day-title {
    font-weight: 600;
    margin-bottom: 6px;
    color: #22302c;
}

.calendar-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    padding: 6px 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease;
    color: #2a3a36;
}

.calendar-item:hover {
    background: rgba(20, 45, 36, 0.12);
}

.calendar-empty {
    padding: 10px;
    border-radius: 10px;
    background: rgba(20, 45, 36, 0.08);
    color: var(--muted);
    text-align: center;
}

.search-input {
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: #fffefb;
    padding: 10px 12px;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
    color: #23322e;
}

.search-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.78rem;
    font-weight: 600;
    color: #2b3a36;
    padding: 4px 2px 6px;
    letter-spacing: 0.02em;
}

.search-results li {
    background: #ffffff;
    border: 1px solid rgba(43, 58, 54, 0.08);
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 12px 26px rgba(16, 44, 38, 0.1);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.search-results li:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(16, 44, 38, 0.12);
    border-color: rgba(32, 96, 90, 0.45);
}

.search-results .search-item {
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    padding: 10px 12px;
    cursor: pointer;
    color: #23322e;
    display: grid;
    gap: 6px;
}

.search-results mark {
    background: rgba(43, 111, 214, 0.18);
    color: inherit;
    padding: 0 3px;
    border-radius: 4px;
}

.tag-badge {
    background: rgba(47, 111, 109, 0.12);
    color: #25504a;
}

.search-section {
    display: grid;
    gap: 10px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 14px;
    border: 1px solid rgba(43, 58, 54, 0.08);
}

.search-section-title {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #2b3a36;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
}

.notes-field {
    width: 100%;
    min-height: 110px;
    resize: vertical;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: #fffefb;
    padding: 10px 12px;
    font-size: 0.9rem;
    line-height: 1.5;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

.stepper {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin: -6px -6px 10px;
    padding: 6px;
    position: sticky;
    top: 0;
    background: rgba(255, 253, 247, 0.98);
    z-index: 5;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 10px 20px rgba(16, 44, 38, 0.08);
}

.step-btn {
    border: 1px solid rgba(47, 111, 109, 0.18);
    background: #f5f7f5;
    color: #2b3a36;
    border-radius: 12px;
    padding: 8px 10px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.step-btn.active {
    background: #2f6f6d;
    color: #fff;
    box-shadow: 0 10px 20px rgba(16, 44, 38, 0.16);
}

.step-btn.done {
    background: rgba(54, 160, 100, 0.12);
    color: #1f4d3a;
}

.step-btn.done.active {
    background: #2f6f6d;
    color: #fff;
}

.step-status {
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(47, 111, 109, 0.12);
    color: #2b3a36;
}

.step-btn.active .step-status {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
}

.step-btn.disabled {
    background: #eef2f1;
    color: #93a09c;
    cursor: not-allowed;
    box-shadow: none;
}

.asset-main {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.asset-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.asset-quick {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
    align-items: center;
}

.asset-quick select {
    min-width: 140px;
    padding: 6px 10px;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: #fffefb;
    font-size: 0.8rem;
}

.badge.subtle {
    background: rgba(47, 111, 109, 0.08);
    color: #2b3a36;
}
.note-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 6px;
}

.note-tags label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid rgba(47, 111, 109, 0.18);
    background: rgba(47, 111, 109, 0.08);
    color: #25504a;
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.note-tags label:hover {
    transform: translateY(-1px);
    background: rgba(47, 111, 109, 0.16);
    box-shadow: 0 8px 16px rgba(16, 44, 38, 0.12);
}

.note-tags input[type="checkbox"] {
    accent-color: #2f6f6d;
}

.client-inline-actions {
    margin-top: 6px;
}

.client-inline-form {
    display: none;
    margin-top: 8px;
    padding: 10px;
    border-radius: 12px;
    border: 1px solid rgba(47, 111, 109, 0.18);
    background: rgba(47, 111, 109, 0.06);
    gap: 8px;
}

.client-inline-form.open {
    display: grid;
}

.client-inline-form label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #2b3a36;
}

.lightbox {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1200;
}

.lightbox.open {
    display: flex;
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 18, 16, 0.6);
    backdrop-filter: blur(2px);
}

.lightbox-content {
    position: relative;
    z-index: 1;
    max-width: min(92vw, 960px);
    max-height: min(88vh, 720px);
    background: rgba(255, 253, 247, 0.98);
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 30px 80px rgba(16, 44, 38, 0.35);
    padding: 16px;
    display: grid;
    place-items: center;
    animation: lightboxPop 0.2s ease;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 12px;
    object-fit: contain;
}

.lightbox-close {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    color: #2c3b37;
    font-size: 1.4rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(16, 44, 38, 0.18);
}

@keyframes lightboxPop {
    from {
        transform: scale(0.98);
        opacity: 0.4;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.map-full .leaflet-popup-content {
    margin: 0;
    padding: 12px 14px;
    min-width: 0;
    width: 100%;
    max-width: 92vw;
    max-height: var(--popup-max-height, 53vh);
    overflow: hidden;
    box-sizing: border-box;
}

.map-full .leaflet-popup-content-wrapper {
    width: min(92vw, 560px);
    max-height: calc(var(--popup-max-height, 53vh) + 24px);
    overflow: hidden;
    box-sizing: border-box;
}

.map-full .leaflet-popup-content-wrapper {
    border-radius: 12px;
    background: #fffdf7;
    color: var(--text);
    box-shadow: var(--shadow);
    transition: transform 0.22s ease, opacity 0.22s ease, box-shadow 0.22s ease;
    will-change: transform, opacity;
}

.map-full .leaflet-popup-tip {
    background: #fffdf7;
}

.leaflet-popup {
    opacity: 1;
}

.leaflet-popup.popup-open .leaflet-popup-content-wrapper {
    transform-origin: 50% 100%;
    animation: genieIn 0.36s cubic-bezier(0.2, 0.85, 0.2, 1);
}

.leaflet-popup.popup-closing .leaflet-popup-content-wrapper {
    transform-origin: 50% 100%;
    animation: genieOut 0.28s cubic-bezier(0.6, 0, 0.4, 1);
}

@keyframes genieIn {
    0% {
        opacity: 0;
        transform: translateY(16px) scaleX(1.05) scaleY(0.25);
    }
    55% {
        opacity: 1;
        transform: translateY(0) scaleX(0.98) scaleY(1.05);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scaleX(1) scaleY(1);
    }
}

@keyframes genieOut {
    0% {
        opacity: 1;
        transform: translateY(0) scaleX(1) scaleY(1);
    }
    100% {
        opacity: 0;
        transform: translateY(16px) scaleX(1.05) scaleY(0.2);
    }
}

.marker-icon {
    background: transparent;
    border: none;
    width: 24px;
    height: 24px;
    display: block;
}

.leaflet-marker-icon.marker-icon {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.marker-pin {
    display: block;
    width: 18px;
    height: 18px;
    background: #2f6f6d;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.45) inset;
    position: relative;
}

.marker-pin::after {
    content: '';
    width: 8px;
    height: 8px;
    background: #ffffff;
    border-radius: 50%;
    position: absolute;
    top: 5px;
    left: 5px;
}

.marker-pin.bounce {
    animation: markerBounce 0.8s ease;
}

.marker-pin.status-planned {
    box-shadow: 0 16px 40px rgba(47, 111, 109, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.45) inset;
}

.marker-pin.status-done {
    box-shadow: 0 16px 40px rgba(54, 148, 92, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.45) inset;
}

.marker-pin.status-overdue {
    box-shadow: 0 16px 40px rgba(192, 75, 62, 0.95), 0 0 0 1px rgba(255, 255, 255, 0.45) inset;
}

.cluster-marker {
    background: transparent;
    border: none;
}

.cluster-badge {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #4b9a95, #1f4e4c);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    box-shadow: 0 12px 26px rgba(16, 44, 38, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.7);
}

.marker-mini-tooltip {
    background: rgba(255, 253, 247, 0.98);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 12px 28px rgba(16, 44, 38, 0.14);
    padding: 8px 10px;
    opacity: 0;
    transform: translateY(6px) scale(0.98);
    transition: opacity 0.12s ease, transform 0.12s ease;
}

.marker-mini-tooltip .mini-tooltip {
    display: grid;
    gap: 4px;
    min-width: 140px;
}

.marker-mini-tooltip .mini-title {
    font-weight: 700;
    font-size: 0.85rem;
}

.marker-mini-tooltip .mini-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 0.72rem;
    color: #3a4b47;
}

.marker-mini-tooltip .mini-address {
    font-size: 0.75rem;
    color: #3f524d;
}

.marker-mini-tooltip .mini-tags {
    font-size: 0.7rem;
    color: #2f6f6d;
}

.marker-mini-tooltip .mini-status {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 999px;
    display: inline-flex;
    width: fit-content;
    background: rgba(47, 111, 109, 0.12);
    color: #2f6f6d;
}

.marker-mini-tooltip .mini-status.planned {
    background: rgba(43, 111, 214, 0.12);
    color: #2b6fd6;
}

.marker-mini-tooltip .mini-status.done {
    background: rgba(67, 160, 71, 0.12);
    color: #2d7a43;
}

.marker-mini-tooltip .mini-status.overdue {
    background: rgba(209, 79, 66, 0.18);
    color: #b0392f;
}

.marker-mini-tooltip.is-ready {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.label-icon {
    background: transparent;
    border: none;
}

.label-icon .marker-label {
    background: rgba(255, 253, 247, 0.92);
    border: 1px solid var(--border);
    border-left: 4px solid var(--status-color);
    color: var(--text);
    font-size: 0.75rem;
    padding: 2px 8px 2px 28px;
    border-radius: 8px;
    box-shadow: var(--shadow-soft);
    position: relative;
    opacity: 1;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transform: translate(-50%, -49px);
    white-space: nowrap;
    --status-color: #2b6fd6;
}

.label-icon .marker-label.has-thumb {
    transform: translate(-50%, -79px);
}

.label-icon .marker-label .label-thumb {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid rgba(0, 0, 0, 0.08);
}


.label-icon .marker-label .label-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--status-color);
    box-shadow: 0 0 6px var(--status-color);
    position: absolute;
    left: 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.55rem;
    color: #fff;
    font-weight: 700;
}

.label-icon .marker-label .label-text {
    background: rgba(255, 255, 255, 0.85);
    padding: 2px 6px;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    text-shadow: none;
    font-weight: 700;
}

.label-icon .marker-label.status-done .label-dot {
    background: #36a064 !important;
    box-shadow: 0 0 6px rgba(54, 160, 100, 0.45) !important;
}

.label-icon .marker-label.status-overdue .label-dot {
    background: #d14f42 !important;
    box-shadow: 0 0 6px rgba(209, 79, 66, 0.5) !important;
}

.label-icon .marker-label.status-planned .label-dot {
    background: #2b6fd6 !important;
    box-shadow: 0 0 6px rgba(43, 111, 214, 0.45) !important;
}

.label-icon .marker-label.status-done {
    --status-color: #36a064;
}

.label-icon .marker-label.status-overdue {
    --status-color: #d14f42;
}

.label-icon .marker-label.status-planned {
    --status-color: #2b6fd6;
}

.popup .inline-actions input {
    flex: 1 1 160px;
}

.popup .inline-actions button {
    flex: 1 1 140px;
}

.popup input[type="color"] {
    width: 46px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
}

.popup input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 4px;
}

.popup input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 6px;
}

.popup input[type="color"]::-moz-color-swatch {
    border: none;
    border-radius: 6px;
}

.popup {
    max-height: calc(var(--popup-max-height, 53vh) - 10px);
    overflow: auto;
    display: block;
}

.section {
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 10px;
    background: rgba(255, 253, 247, 0.96);
    overflow: hidden;
}

.section-toggle {
    display: none;
}

.section-toggle.active {
    color: var(--accent);
}

.section-content {
    max-height: 0;
    overflow: hidden;
    padding: 0 12px;
    transition: max-height 0.2s ease;
}

.section-content.active {
    max-height: 45vh;
    padding: 12px;
    overflow: auto;
}

.photo-block {
    display: grid;
    gap: 8px;
    margin-bottom: 10px;
}

.photo-preview {
    width: 100%;
    height: 160px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #f5f2ea;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-placeholder {
    color: #7b766f;
    font-size: 0.85rem;
}

.photo-input {
    display: none;
}

.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    display: grid;
    gap: 10px;
    z-index: 9999;
}

.toast {
    background: #fffdf7;
    border: 1px solid var(--border);
    padding: 10px 14px;
    border-radius: 10px;
    box-shadow: var(--shadow-soft);
    font-size: 0.9rem;
    min-width: 220px;
}

.toast.success {
    border-color: #b6e1d7;
    background: #e7f5f1;
}

.toast.error {
    border-color: #f5c2c0;
    background: #fcebea;
}

@media (max-width: 960px) and (min-width: 769px) {
    .map-full {
        height: 60vh;
    }
}

@media (max-width: 520px) {
    .popup {
        min-width: 260px;
        max-width: 100%;
    }

    .map-full .leaflet-popup-content {
        min-width: 260px;
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes liftIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes menuDrop {
    from { transform: translateY(-14px); }
    to { transform: translateY(0); }
}

@keyframes markerBounce {
    0% { transform: translateY(0); }
    30% { transform: translateY(-8px); }
    60% { transform: translateY(0); }
    85% { transform: translateY(-3px); }
    100% { transform: translateY(0); }
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th, table td {
    border-bottom: 1px solid var(--border);
    padding: 6px;
    text-align: left;
    vertical-align: top;
}

.menu-table th, .menu-table td {
    font-size: 0.85rem;
}

.menu-table td {
    max-width: 160px;
    word-break: break-word;
}

#upcoming-list li {
    cursor: pointer;
}

.drag-preview {
    background: rgba(20, 18, 12, 0.8);
    color: #f6f3ea;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 6px 8px;
    font-size: 0.72rem;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.drag-preview .coords {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.68rem;
}
