:root {
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --success: #22c55e;
    --success-hover: #16a34a;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --purple: #9333ea;
    --purple-hover: #7e22ce;
    --bg-gray: #f3f4f6;
    --border: #d1d5db;
    --border-thick: #9ca3af;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --search-bg: #fef08a;
    --search-border: #eab308;
    --hour-bg: #dbeafe;
    --hour-border: #3b82f6;
    --half-hour-bg: #f8fafc;
    --current-bg: #fee2e2;
    --current-border: #ef4444;
    --dock-1-bg: #e0f2fe;
    --dock-1-border: #0ea5e9;
    --dock-2-bg: #dcfce7;
    --dock-2-border: #22c55e;
    --dock-3-bg: #fef3c7;
    --dock-3-border: #f59e0b;
    --dock-4-bg: #fce7f3;
    --dock-4-border: #ec4899;
    --dock-5-bg: #e0e7ff;
    --dock-5-border: #6366f1;
    --dock-6-bg: #fae8ff;
    --dock-6-border: #a855f7;
    --dock-7-bg: #ccfbf1;
    --dock-7-border: #14b8a6;
    --dock-8-bg: #fed7aa;
    --dock-8-border: #f97316;
    --cell-hover: #fef9c3;
    --cell-has-val: #d1fae5;
    --cell-match: #fef08a;
    --highlight-bg: #f5f3ff;
    --highlight-border: #a855f7;
    --highlight-glow: rgba(147, 51, 234, 0.4);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, sans-serif;
    background-color: var(--bg-gray);
    color: var(--text-main);
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.mobile-header {
    display: none;
    background: white;
    padding: 12px 16px;
    border-bottom: 2px solid var(--border);
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

.mobile-header h1 {
    font-size: 18px;
    font-weight: bold;
}

.mobile-menu-btn {
    background: none;
    border: none;
    font-size: 24px;
    padding: 4px 8px;
    cursor: pointer;
    color: var(--text-main);
}

.sidebar {
    width: 320px;
    background: white;
    border-right: 2px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 10;
    transition: transform 0.3s ease;
}

.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    position: relative;
}

.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}

.mobile-overlay.active {
    display: block;
}

.flex {
    display: flex;
}

.flex-col {
    display: flex;
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.items-start {
    align-items: flex-start;
}

.items-end {
    align-items: flex-end;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.justify-end {
    justify-content: flex-end;
}

.gap-2 {
    gap: 8px;
}

.gap-3 {
    gap: 12px;
}

.gap-4 {
    gap: 16px;
}

.p-4 {
    padding: 16px;
}

.mb-2 {
    margin-bottom: 8px;
}

.mb-3 {
    margin-bottom: 12px;
}

.mb-4 {
    margin-bottom: 16px;
}

.mt-1 {
    margin-top: 4px;
}

.mt-2 {
    margin-top: 8px;
}

.mt-4 {
    margin-top: 16px;
}

.w-full {
    width: 100%;
}

.flex-1 {
    flex: 1;
    min-width: 0;
}

.text-sm {
    font-size: 14px;
}

.text-xs {
    font-size: 12px;
}

.text-lg {
    font-size: 18px;
}

.text-xl {
    font-size: 20px;
}

.font-bold {
    font-weight: bold;
}

.font-medium {
    font-weight: 500;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-muted);
}

.relative {
    position: relative;
}

.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    padding: 24px;
    margin-bottom: 24px;
    border: 2px solid var(--border);
}

input[type="text"], input[type="number"], input[type="date"], select, textarea {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 16px;
    outline: none;
    font-family: Arial, sans-serif;
    transition: border-color 0.2s, box-shadow 0.2s;
    min-height: 44px;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.2);
}

textarea {
    resize: vertical;
    min-height: 120px;
}

button {
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.2s;
    min-height: 44px;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59,130,246,0.3);
}

.btn-success {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.btn-success:hover {
    background: var(--success-hover);
    border-color: var(--success-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(34,197,94,0.3);
}

.btn-danger {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

.btn-danger:hover {
    background: var(--danger-hover);
    border-color: var(--danger-hover);
}

.btn-purple {
    background: var(--purple);
    color: white;
    border-color: var(--purple);
}

.btn-purple:hover {
    background: var(--purple-hover);
    border-color: var(--purple-hover);
}

.btn-gray {
    background: #e5e7eb;
    color: #374151;
    border-color: #d1d5db;
}

.btn-gray:hover {
    background: #d1d5db;
    border-color: #9ca3af;
}

.btn-black {
    background: #111827;
    color: white;
    border-color: #111827;
}

.btn-black:hover {
    background: #374151;
}

.sidebar-section {
    border-bottom: 2px solid var(--border);
    padding: 16px;
}

.dashboard-datetime {
    background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 50%, #fef3c7 100%);
    border: 2px solid #bfdbfe;
    border-radius: 12px;
    padding: 18px 14px;
    text-align: center;
    margin-bottom: 12px;
    box-shadow: 0 4px 12px rgba(59,130,246,0.1);
}

.dashboard-time {
    font-size: 36px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 1px;
    color: #0f172a;
}

.dashboard-date {
    margin-top: 8px;
    font-size: 16px;
    font-weight: 700;
    color: #334155;
    line-height: 1.25;
    text-transform: capitalize;
}

#btn-toggle-cal {
    width: 100%;
    padding: 14px 16px;
    font-size: 15px;
    font-weight: 700;
    border-radius: 10px;
    transition: all 0.2s;
    border: 2px solid transparent;
}

#btn-toggle-cal:active {
    transform: scale(0.98);
}

#btn-toggle-cal.mode-calendar {
    background: var(--purple);
    color: white;
    border-color: var(--purple);
}

#btn-toggle-cal.mode-calendar:hover {
    background: var(--purple-hover);
}

#btn-toggle-cal.mode-zones {
    background: #0ea5e9;
    color: white;
    border-color: #0ea5e9;
}

#btn-toggle-cal.mode-zones:hover {
    background: #0284c7;
}

.appointment-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    scroll-behavior: smooth;
}

.appointment-item {
    background: #f9fafb;
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.appointment-item:hover {
    background: #f3f4f6;
    transform: translateX(4px);
    border-color: var(--primary);
}

.appointment-item.assigned {
    background: #fef2f2;
    border-color: #fecaca;
}

.appointment-item.search-match {
    background: var(--search-bg);
    border-color: var(--search-border);
    box-shadow: 0 0 8px rgba(234, 179, 8, 0.4);
}

.appointment-item.is-highlighted {
    background: var(--highlight-bg);
    border-color: var(--highlight-border);
    transform: translateX(4px);
    box-shadow: 0 4px 12px var(--highlight-glow);
}

mark {
    background-color: #fef08a;
    padding: 0;
    color: inherit;
}

.assigned-badge {
    background: linear-gradient(90deg, #F06292 0%, #D81B60 100%);
    color: white;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: bold;
    white-space: nowrap;
    border: 1px solid rgba(255,255,255,0.3);
    box-shadow: 0 2px 6px rgba(216,27,96,0.3);
}

.zone-search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.zone-search-wrap {
    position: relative;
    flex: 1;
}

.zone-search-wrap .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    pointer-events: none;
}

.zone-search-wrap input {
    padding-left: 38px;
    background: #f8fafc;
    border: 2px solid #cbd5e1;
}

.zone-search-wrap input:focus {
    background: white;
    border-color: var(--primary);
}

.zone-search-stats {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    min-width: 60px;
    text-align: right;
}

.zone-search-stats.has-results {
    color: #92400e;
    font-weight: bold;
}

.zone-search-clear {
    background: #e5e7eb;
    color: #374151;
    border: 2px solid #d1d5db;
    border-radius: 6px;
    padding: 0 12px;
    font-size: 18px;
    min-height: 42px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.zone-search-clear.visible {
    display: flex;
}

.zone-search-clear:hover {
    background: #d1d5db;
}

.calendar-toolbar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
    align-items: center;
}

.calendar-toolbar button {
    min-height: 40px;
    padding: 8px 14px;
    font-size: 14px;
}

.table-container {
    overflow-x: auto;
    margin-top: 16px;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
    border: 3px solid var(--border);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
    border: 3px solid var(--border);
}

th, td {
    border: 2px solid var(--border-thick);
    padding: 10px 12px;
    text-align: left;
    font-size: 14px;
    vertical-align: top;
}

th {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    position: sticky;
    top: 0;
    z-index: 2;
    font-weight: 700;
    border: 3px solid var(--border-thick);
    padding: 14px 12px;
}

.time-col {
    width: 90px;
    text-align: center;
    font-weight: 800;
    font-size: 15px;
    border: 2px solid var(--hour-border);
}

.hour-start td {
    border-top: 3px solid var(--hour-border);
    background: linear-gradient(90deg, var(--hour-bg) 0%, #eff6ff 100%) !important;
}

.hour-start .time-col {
    background: linear-gradient(180deg, var(--hour-border) 0%, #2563eb 100%) !important;
    color: white;
    font-weight: 900;
    border: 3px solid #1d4ed8;
}

tbody tr:not(.hour-start) td {
    background: var(--half-hour-bg);
}

.current-time-slot td {
    background: var(--current-bg) !important;
    border-left: 4px solid var(--current-border);
}

.current-time-slot .time-col {
    background: linear-gradient(180deg, #fecaca 0%, #fca5a5 100%) !important;
    border-left: 6px solid var(--current-border);
    font-weight: 900;
    color: #991b1b;
}

th.dock-col-0, td.dock-col-0 {
    background: linear-gradient(180deg, var(--dock-1-bg) 0%, rgba(14,165,233,0.1) 100%) !important;
    border-left: 4px solid var(--dock-1-border);
}

th.dock-col-1, td.dock-col-1 {
    background: linear-gradient(180deg, var(--dock-2-bg) 0%, rgba(34,197,94,0.1) 100%) !important;
    border-left: 4px solid var(--dock-2-border);
}

th.dock-col-2, td.dock-col-2 {
    background: linear-gradient(180deg, var(--dock-3-bg) 0%, rgba(245,158,11,0.1) 100%) !important;
    border-left: 4px solid var(--dock-3-border);
}

th.dock-col-3, td.dock-col-3 {
    background: linear-gradient(180deg, var(--dock-4-bg) 0%, rgba(236,72,153,0.1) 100%) !important;
    border-left: 4px solid var(--dock-4-border);
}

th.dock-col-4, td.dock-col-4 {
    background: linear-gradient(180deg, var(--dock-5-bg) 0%, rgba(99,102,241,0.1) 100%) !important;
    border-left: 4px solid var(--dock-5-border);
}

th.dock-col-5, td.dock-col-5 {
    background: linear-gradient(180deg, var(--dock-6-bg) 0%, rgba(168,85,247,0.1) 100%) !important;
    border-left: 4px solid var(--dock-6-border);
}

th.dock-col-6, td.dock-col-6 {
    background: linear-gradient(180deg, var(--dock-7-bg) 0%, rgba(20,184,166,0.1) 100%) !important;
    border-left: 4px solid var(--dock-7-border);
}

th.dock-col-7, td.dock-col-7 {
    background: linear-gradient(180deg, var(--dock-8-bg) 0%, rgba(249,115,22,0.1) 100%) !important;
    border-left: 4px solid var(--dock-8-border);
}

th.dock-col-0 {
    background: linear-gradient(135deg, var(--dock-1-border) 0%, #0284c7 100%) !important;
    color: white;
}

th.dock-col-1 {
    background: linear-gradient(135deg, var(--dock-2-border) 0%, #15803d 100%) !important;
    color: white;
}

th.dock-col-2 {
    background: linear-gradient(135deg, var(--dock-3-border) 0%, #d97706 100%) !important;
    color: white;
}

th.dock-col-3 {
    background: linear-gradient(135deg, var(--dock-4-border) 0%, #be185d 100%) !important;
    color: white;
}

th.dock-col-4 {
    background: linear-gradient(135deg, var(--dock-5-border) 0%, #4f46e5 100%) !important;
    color: white;
}

th.dock-col-5 {
    background: linear-gradient(135deg, var(--dock-6-border) 0%, #9333ea 100%) !important;
    color: white;
}

th.dock-col-6 {
    background: linear-gradient(135deg, var(--dock-7-border) 0%, #0d9488 100%) !important;
    color: white;
}

th.dock-col-7 {
    background: linear-gradient(135deg, var(--dock-8-border) 0%, #ea580c 100%) !important;
    color: white;
}

.cal-cell {
    position: relative;
    padding: 0;
    min-height: 54px;
    vertical-align: top;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid rgba(156,163,175,0.5);
}

.cal-cell:hover {
    background: var(--cell-hover) !important;
    /* transform: scale(1.02); REMOVED TO FIX MOUSE POINTER/FOCUS ISSUE */
    /* z-index: 5; REMOVED/NOT NEEDED IF NO SCALE */
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.cal-cell-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px;
    padding-right: 38px;
    align-items: flex-start;
}

.cal-field-group {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    border-radius: 6px;
    background: rgba(255,255,255,0.95);
    border: 2px solid rgba(209,213,219,0.5);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.cal-expand-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, var(--primary) 0%, #2563eb 100%);
    color: white;
    border: 2px solid white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 900;
    line-height: 1;
    z-index: 10;
    transition: all 0.2s;
    padding: 0;
    box-shadow: 0 3px 8px rgba(59,130,246,0.4);
}

.cal-expand-btn:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: scale(1.15) rotate(90deg);
    box-shadow: 0 5px 15px rgba(59,130,246,0.5);
}

.cal-expand-btn:active {
    transform: scale(1.05) rotate(90deg);
}

.cal-field-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    white-space: nowrap;
}

.cal-field-input {
    flex: 1;
    min-width: 110px;
    border: 2px solid var(--border);
    border-radius: 4px;
    padding: 5px 8px;
    font-size: 13px;
    background: white;
    color: var(--text-main);
}

.cal-field-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59,130,246,0.3);
}

.cal-cell.has-val {
    background: linear-gradient(135deg, var(--cell-has-val) 0%, #a7f3d0 100%) !important;
    border-color: var(--success);
}

.cal-cell.has-val .cal-field-group {
    background: rgba(255,255,255,0.98);
    border: 2px solid var(--success);
    box-shadow: 0 2px 6px rgba(34,197,94,0.2);
}

.cal-cell.has-val .cal-field-label {
    color: #047857;
}

.cal-cell.match-search {
    background: var(--cell-match) !important;
    outline: 3px solid var(--search-border);
    animation: pulse-search 2s infinite;
}

.cal-cell.match-search .cal-field-group {
    border: 2px solid var(--search-border);
    background: white;
}

.cal-cell.match-search .cal-field-label {
    color: #92400e;
}

.cal-cell.is-highlighted {
    outline: 4px solid var(--highlight-border) !important;
    outline-offset: -2px;
    z-index: 6 !important;
    box-shadow: 0 6px 20px var(--highlight-glow);
    /* transform: scale(1.03); REMOVED TO FIX MOUSE POINTER/FOCUS ISSUE */
    animation: pulse-highlight 1.5s infinite;
}

.zone-col {
    flex: 1;
    min-width: 150px;
    display: flex;
    flex-direction: column;
}

.zone-header {
    background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 100%);
    padding: 12px 14px;
    border-radius: 8px;
    font-weight: 800;
    text-align: left;
    margin-bottom: 10px;
    font-size: 15px;
    border: 2px solid #9ca3af;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.zone-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    border-radius: 8px;
    padding: 10px 14px;
    min-height: 48px;
    transition: all 0.15s;
    border: 2px solid transparent;
}

.zone-row.is-free {
    background: linear-gradient(90deg, var(--success) 0%, var(--success-hover) 100%);
    color: white;
    border-color: #15803d;
}

.zone-row.is-occupied {
    background: linear-gradient(90deg, #F06292 0%, #D81B60 100%);
    color: white;
    cursor: pointer;
    user-select: none;
    border-color: #be185d;
    box-shadow: 0 2px 8px rgba(216,27,96,0.3);
}

.zone-row.is-occupied:active, .zone-row.is-occupied.holding {
    transform: scale(0.98);
    opacity: 0.9;
}

.zone-row.match-search {
    animation: pulse-border 1.5s infinite;
    z-index: 1;
    position: relative;
}

@keyframes pulse-border {
    0%, 100% {
        box-shadow: 0 0 0 4px #eab308;
    }
    50% {
        box-shadow: 0 0 0 2px #eab308;
    }
}

.zone-row.no-match {
    opacity: 1;
}

.zone-num {
    width: 40px;
    font-size: 22px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 800;
    text-align: left;
    flex-shrink: 0;
    line-height: 1;
}

.zone-num.match-search {
    color: #fef08a;
}

.zone-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.zone-occ-text {
    flex: 1;
    font-weight: bold;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}

.search-term-highlight {
    background: linear-gradient(120deg, #fbbf24 0%, #f59e0b 100%);
    color: #7c2d12;
    font-weight: 800;
    border-radius: 3px;
    padding: 0 3px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    text-decoration: none;
}

.zone-row input[type="text"] {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid rgba(255,255,255,0.6);
    border-radius: 6px;
    min-width: 0;
    font-size: 14px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
    color: #1f2937;
    background: white;
}

.zone-row input[type="text"]:focus {
    box-shadow: 0 0 0 3px rgba(255,255,255,0.5), inset 0 1px 3px rgba(0,0,0,0.1);
    outline: none;
    border-color: var(--primary);
}

.btn-paste {
    flex-shrink: 0;
    background: white;
    color: var(--success);
    border: 2px solid rgba(255,255,255,0.8);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
    line-height: 1.2;
    min-height: 36px;
}

.btn-paste:hover {
    background: #f3f4f6;
    color: #166534;
    border-color: var(--success);
}

.btn-paste:active {
    transform: scale(0.95);
}

.btn-paste.flash-ok {
    background: var(--success-hover);
    color: white;
    border-color: var(--success-hover);
    animation: flash-success 0.6s ease;
}

.btn-paste.flash-err {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
    animation: flash-error 0.6s ease;
}

@keyframes flash-success {
    0%, 100% {
        background: var(--success-hover);
        transform: scale(1);
    }
    50% {
        background: var(--success);
        transform: scale(1.05);
    }
}

@keyframes flash-error {
    0%, 100% {
        background: var(--danger);
        transform: scale(1);
    }
    50% {
        background: #b91c1c;
        transform: scale(1.05);
    }
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 150;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin: 20px;
    border: 3px solid var(--border);
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.modal-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid var(--border);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 20px;
    background: #f3f4f6;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    border-top: 3px solid var(--border);
}

.cell-modal-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
    padding: 14px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    background: linear-gradient(135deg, #fafbfc 0%, #f8fafc 100%);
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.cell-modal-field label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cell-modal-field input {
    font-size: 15px;
    padding: 12px 14px;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: white;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
}

.cell-modal-field input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

.cell-modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 3px solid var(--primary);
}

.cell-time-display {
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    padding: 10px 14px;
    border-radius: 8px;
    font-weight: 700;
    color: #0369a1;
    border: 2px solid #0ea5e9;
}

.sync-tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 20px;
}

.sync-tab {
    flex: 1;
    padding: 12px;
    text-align: center;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-muted);
}

.sync-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.sync-tab-content {
    display: none;
}

.sync-tab-content.active {
    display: block;
}

.sync-section {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.sync-section h3 {
    margin-bottom: 12px;
    font-size: 16px;
    color: #1f2937;
}

.qr-container {
    display: flex;
    justify-content: center;
    padding: 20px;
    background: white;
    border-radius: 10px;
    border: 2px solid var(--border);
    margin: 20px 0;
}

.qr-placeholder {
    width: 200px;
    height: 200px;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 14px;
    text-align: center;
    padding: 20px;
    border-radius: 10px;
    border: 2px dashed var(--border);
}

.data-display {
    background: white;
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    font-family: monospace;
    font-size: 12px;
    max-height: 200px;
    overflow-y: auto;
    word-break: break-all;
    margin: 10px 0;
}

.sync-info {
    background: #eff6ff;
    border: 2px solid #bfdbfe;
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 16px;
    color: #1e40af;
    font-size: 14px;
}

.sync-info.warning {
    background: #fef3c7;
    border-color: #fbbf24;
    color: #92400e;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
}

.history-table th, .history-table td {
    padding: 12px 16px;
    border-bottom: 2px solid var(--border);
    border-top: none;
    border-left: none;
    border-right: none;
}

.history-table tr:hover {
    background: #f9fafb;
}

.badge {
    padding: 5px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    border: 1px solid transparent;
}

.badge-red {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fecaca;
}

.badge-green {
    background: #dcfce7;
    color: #166534;
    border-color: #bbf7d0;
}

.badge-blue {
    background: #dbeafe;
    color: #1e40af;
    border-color: #93c5fd;
}

.badge-purple {
    background: #f3e8ff;
    color: #7e22ce;
    border-color: #e9d5ff;
}

@keyframes pulse-search {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

@keyframes pulse-highlight {
    0%, 100% {
        outline-color: var(--highlight-border);
    }
    50% {
        outline-color: var(--highlight-glow);
    }
}

.quick-form {
    background: linear-gradient(135deg, #f9fafb 0%, #f1f5f9 100%);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-top: 16px;
    display: none;
    animation: slideDown 0.2s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.quick-form.active {
    display: block;
}

.quick-form-title {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 14px;
    color: var(--text-main);
}

.quick-form-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    margin-bottom: 14px;
}

.quick-form-meta-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.quick-form-meta-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

.quick-form-meta-group input, .quick-form-meta-group select {
    padding: 10px 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    background: white;
    color: var(--text-main);
    outline: none;
    min-height: 44px;
}

.quick-form-meta-group input:focus, .quick-form-meta-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.2);
}

.quick-form-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    margin-bottom: 14px;
}

.quick-form-field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 170px;
    flex: 1 1 180px;
}

.quick-form-field-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

.quick-form-field-input {
    width: 100%;
    min-width: 0;
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    color: var(--text-main);
    background: white;
    outline: none;
    min-height: 44px;
}

.quick-form-field-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

.quick-form-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.quick-form-actions button {
    min-height: 44px;
    padding: 10px 20px;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.options-toggle-btn {
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 700;
    background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
    color: white;
    border: 2px solid #111827;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s;
    min-height: 48px;
}

.options-toggle-btn:hover {
    background: linear-gradient(135deg, #4b5563 0%, #374151 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.options-toggle-btn .toggle-icon {
    font-size: 18px;
    transition: transform 0.3s ease;
}

.options-toggle-btn.open .toggle-icon {
    transform: rotate(180deg);
}

.options-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    padding: 0;
}

.options-panel.open {
    max-height: 300px;
    padding: 12px 0 0 0;
}

.options-panel .option-btn {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 600;
    background: #f9fafb;
    color: #374151;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.15s;
    margin-bottom: 8px;
    text-align: left;
    min-height: 44px;
}

.options-panel .option-btn:last-child {
    margin-bottom: 0;
}

.options-panel .option-btn:hover {
    background: #e5e7eb;
    border-color: #d1d5db;
    transform: translateX(4px);
}

.options-panel .option-btn .opt-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 14px;
    flex-shrink: 0;
}

.options-panel .option-btn .opt-icon.blue {
    background: #dbeafe;
    color: #2563eb;
}

.options-panel .option-btn .opt-icon.green {
    background: #dcfce7;
    color: #16a34a;
}

.options-panel .option-btn .opt-icon.purple {
    background: #f3e8ff;
    color: #9333ea;
}

.options-panel .option-btn .opt-icon.red {
    background: #fee2e2;
    color: #dc2626;
}

.settings-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.settings-box {
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    background: #f9fafb;
    margin-bottom: 16px;
}

.settings-box.bg-blue {
    background-color: #eff6ff;
    border-color: #bfdbfe;
}

.settings-box.bg-green {
    background-color: #f0fdf4;
    border-color: #a7f3d0;
}

.settings-box.bg-purple {
    background-color: #f5f3ff;
    border-color: #ddd6fe;
}

.settings-box.bg-yellow {
    background-color: #fefce8;
    border-color: #fde68a;
}

/* Help-Box */

.help-box {
    background-color: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 0;
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.5;
    color: #4b5563;
    overflow: hidden;
}

.help-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    user-select: none;
    border-bottom: 2px solid #e2e8f0;
}

.help-title:hover {
    background-color: #f1f5f9;
}

.help-toggle {
    background: none;
    border: 2px solid #cbd5e1;
    border-radius: 50%;
    color: #64748b;
    font-size: 16px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
}

.help-toggle:hover {
    background: #e2e8f0;
}

.help-content {
    padding: 0 16px 16px 16px;
    border-top: 2px solid #e2e8f0;
    display: none;
}

.help-detail {
    margin-top: 12px;
}

.help-detail:first-child {
    margin-top: 0;
}

/* Редактируемые блоки помощи */

.help-edit-actions {
    margin-top: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.help-edit-btn {
    font-size: 13px;
    padding: 6px 12px;
    min-height: 32px;
}

.help-edit-hint {
    font-size: 11px;
}

.help-editable {
    border-radius: 6px;
    padding: 4px 6px;
    outline: 2px dashed #9ca3af;
    background: #f9fafb;
}

/* History-Preview */

.history-settings-preview {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 2px solid #22c55e;
    border-radius: 8px;
    padding: 12px;
    margin-top: 12px;
}

.history-settings-preview h4 {
    font-size: 13px;
    font-weight: 700;
    color: #166534;
    margin-bottom: 8px;
}

.history-settings-preview ul {
    list-style: none;
    font-size: 12px;
    color: #15803d;
}

.history-settings-preview li {
    padding: 4px 0;
    border-bottom: 1px dashed #bbf7d0;
}

.history-settings-preview li:last-child {
    border-bottom: none;
}

/* Medienabfragen */

@media (max-width: 1023px) {
    body {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
        overflow-y: auto;
    }

    .mobile-header {
        display: flex;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 300px;
        transform: translateX(-100%);
        z-index: 100;
        box-shadow: 4px 0 16px rgba(0,0,0,0.15);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        padding: 70px 16px 20px 16px;
        width: 100%;
        overflow-y: visible;
    }

    .card {
        padding: 16px;
        margin-bottom: 16px;
    }

    #cal-search {
        width: 100% !important;
    }

    #zones-section .flex.gap-4 {
        flex-direction: column;
        gap: 20px;
    }

    .zone-col {
        min-width: 100%;
    }

    #hidden-zones {
        width: 100% !important;
    }

    .modal-content {
        width: 95%;
        max-height: 85vh;
    }

    .settings-grid-3 {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .quick-form-fields {
        flex-direction: column;
    }

    .quick-form-fields > * {
        width: 100%;
    }

    .quick-form-meta-row {
        flex-direction: column;
    }

    .quick-form-meta-row > * {
        width: 100%;
    }

    #zones-section .flex.justify-between {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }

    .btn-paste {
        min-height: 36px;
        padding: 8px 12px;
    }

    .appointment-item {
        padding: 14px;
    }

    .calendar-toolbar {
        width: 100%;
    }

    .sync-tabs {
        flex-direction: column;
    }

    .sync-tab {
        text-align: left;
        border-bottom: none;
        border-left: 3px solid transparent;
    }

    .sync-tab.active {
        border-left-color: var(--primary);
        border-bottom-color: transparent;
    }

    .qr-container {
        padding: 10px;
    }

    .qr-placeholder {
        width: 150px;
        height: 150px;
    }

    .zone-search-bar {
        flex-wrap: wrap;
    }
}

@media (max-width: 767px) {
    .main-content {
        padding: 70px 12px 16px 12px;
    }

    .card {
        padding: 14px;
        border-radius: 10px;
    }

    h2.text-xl {
        font-size: 18px;
    }

    .text-sm {
        font-size: 13px;
    }

    .quick-form-field-group {
        min-width: 100%;
    }

    .quick-form-field-input {
        width: 100%;
    }

    .cal-field-group {
        flex-direction: column;
        align-items: stretch;
    }

    .cal-field-input {
        width: 100%;
    }

    .zone-row {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        padding: 10px 12px;
    }

    .zone-num {
        width: 100%;
        text-align: left;
        font-size: 20px;
        border-bottom: 2px solid rgba(255,255,255,0.3);
        padding-bottom: 6px;
    }

    .zone-occ-text {
        text-align: left;
        font-size: 15px;
    }

    .zone-controls {
        flex-wrap: wrap;
        width: 100%;
    }

    .cal-cell {
        min-height: 64px;
    }

    th, td {
        padding: 8px;
        font-size: 12px;
    }

    .time-col {
        width: 60px;
    }

    .help-title {
        padding: 14px;
    }

    .help-content {
        padding: 0 14px 14px 14px;
    }

    button {
        padding: 12px 16px;
        font-size: 15px;
    }

    .sidebar {
        width: 280px;
    }

    .dashboard-time {
        font-size: 30px;
    }

    .dashboard-date {
        font-size: 14px;
    }

    .calendar-toolbar button {
        flex: 1 1 calc(50% - 8px);
    }
}

@media (max-width: 480px) {
    .mobile-header h1 {
        font-size: 16px;
    }

    .main-content {
        padding: 60px 10px 14px 10px;
    }

    .card {
        padding: 12px;
    }

    .modal-content {
        margin: 10px;
        width: 95%;
    }

    .modal-header, .modal-body, .modal-footer {
        padding: 16px;
    }

    #visible-zones {
        flex-direction: column;
        gap: 20px;
    }

    .history-table th, .history-table td {
        padding: 10px;
        font-size: 12px;
    }

    .qr-placeholder {
        width: 120px;
        height: 120px;
        font-size: 12px;
    }

    .dashboard-time {
        font-size: 26px;
    }

    .dashboard-date {
        font-size: 13px;
    }

    .calendar-toolbar button {
        flex: 1 1 100%;
    }
}