:root {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --ink: #17202a;
    --muted: #637083;
    --line: #dfe5ec;
    --primary: #0f766e;
    --primary-strong: #115e59;
    --accent: #b45309;
    --soft: #eef8f6;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.5;
}

a {
    color: inherit;
    text-decoration: none;
}

.topbar {
    align-items: center;
    background: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 24px;
    justify-content: space-between;
    padding: 16px clamp(18px, 5vw, 64px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand {
    align-items: center;
    color: var(--primary-strong);
    display: inline-flex;
    font-size: 22px;
    font-weight: 800;
    gap: 8px;
}

.brand img {
    border-radius: 6px;
    display: block;
    height: 40px;
    object-fit: contain;
    width: 40px;
}

.brand-wrap {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.site-status {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 6px;
    color: #9a3412;
    font-size: 16px;
    font-weight: 900;
    padding: 7px 10px;
}

.nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.nav a {
    border-radius: 6px;
    color: var(--muted);
    font-weight: 700;
    padding: 8px 10px;
}

.nav a.active,
.nav a:hover {
    background: var(--soft);
    color: var(--primary-strong);
}

main {
    min-height: calc(100vh - 132px);
}

.hero,
.page-head,
.workflow,
.split,
.dashboard-grid,
.stat-grid,
.restaurant-dashboard,
.location-layout,
.spaces-layout,
.tables-layout,
.events-layout,
.booking-panel,
.restaurant-list,
.auth-wrap {
    margin: 0 auto;
    max-width: 1160px;
    padding: clamp(28px, 5vw, 64px) clamp(18px, 4vw, 32px);
}

.hero {
    display: grid;
    gap: 28px;
    grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
    min-height: 520px;
    place-items: center;
}

.eyebrow {
    color: var(--accent);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0;
    margin: 0 0 10px;
    text-transform: uppercase;
}

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

h1 {
    font-size: clamp(34px, 5vw, 58px);
    line-height: 1.05;
    margin-bottom: 18px;
}

h2 {
    font-size: 22px;
}

.lead,
.page-head p {
    color: var(--muted);
    font-size: 18px;
    max-width: 760px;
}

.dashboard-head {
    align-items: flex-end;
    display: flex;
    gap: 20px;
    justify-content: space-between;
}

.head-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.restaurant-home-head {
    justify-content: flex-start;
}

.restaurant-home-head .head-actions {
    margin-top: 18px;
}

.actions,
.zones {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.button {
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    font-weight: 800;
    justify-content: center;
    min-height: 42px;
    padding: 10px 14px;
}

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

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

.button.secondary {
    background: #fff;
    border-color: var(--line);
    color: var(--primary-strong);
}

.button.danger {
    background: #fff1f2;
    border-color: #fecdd3;
    color: #9f1239;
}

.button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.hero-panel,
.panel,
.restaurant-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 16px 40px rgba(23, 32, 42, 0.07);
}

.hero-panel {
    display: grid;
    gap: 14px;
    padding: 20px;
    width: 100%;
}

.hero-map {
    min-height: 360px;
    overflow: hidden;
    padding: 0;
    position: relative;
    width: 100%;
}

.map-canvas {
    background:
        linear-gradient(90deg, rgba(15, 118, 110, 0.08) 1px, transparent 1px),
        linear-gradient(0deg, rgba(15, 118, 110, 0.08) 1px, transparent 1px),
        radial-gradient(circle at 28% 28%, rgba(15, 118, 110, 0.16), transparent 28%),
        radial-gradient(circle at 76% 42%, rgba(180, 83, 9, 0.14), transparent 24%),
        #f8fafc;
    background-size: 44px 44px, 44px 44px, auto, auto, auto;
    height: 100%;
    min-height: 360px;
    position: relative;
}

.map-canvas::before,
.map-canvas::after {
    background: rgba(99, 112, 131, 0.18);
    border-radius: 999px;
    content: "";
    position: absolute;
}

.map-canvas::before {
    height: 34px;
    left: -10%;
    top: 46%;
    transform: rotate(-16deg);
    width: 120%;
}

.map-canvas::after {
    height: 28px;
    left: 18%;
    top: 12%;
    transform: rotate(36deg);
    width: 86%;
}

.map-pin {
    background: var(--primary);
    border: 4px solid #fff;
    border-radius: 50% 50% 50% 0;
    box-shadow: 0 10px 24px rgba(23, 32, 42, 0.18);
    height: 30px;
    left: 58%;
    position: absolute;
    top: 34%;
    transform: rotate(-45deg);
    width: 30px;
    z-index: 1;
}

.map-pin.secondary {
    background: var(--accent);
    left: 30%;
    top: 58%;
    transform: rotate(-45deg) scale(0.82);
}

.map-pin.tertiary {
    background: #4338ca;
    left: 76%;
    top: 66%;
    transform: rotate(-45deg) scale(0.72);
}

.map-search-card {
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid var(--line);
    border-radius: 8px;
    bottom: 16px;
    box-shadow: 0 16px 38px rgba(23, 32, 42, 0.12);
    display: grid;
    gap: 8px;
    left: 16px;
    padding: 14px;
    position: absolute;
    right: 16px;
    z-index: 2;
}

.map-search-card span,
.map-search-card small {
    color: var(--muted);
}

.map-search-card small {
    min-height: 18px;
}

.metric {
    border-left: 4px solid var(--primary);
    padding: 8px 0 8px 14px;
}

.metric strong {
    display: block;
    font-size: 30px;
}

.metric span,
.list span,
.restaurant-card p {
    color: var(--muted);
}

.workflow,
.split,
.dashboard-grid,
.restaurant-list {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding-top: 0;
}

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

.workflow article,
.panel {
    padding: 20px;
}

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

.form {
    display: grid;
    gap: 14px;
}

.form label {
    color: var(--muted);
    display: grid;
    font-size: 14px;
    font-weight: 700;
    gap: 6px;
}

input,
select,
textarea {
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--ink);
    font: inherit;
    min-height: 42px;
    padding: 10px 12px;
    width: 100%;
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    outline: 3px solid rgba(15, 118, 110, 0.12);
}

.compact {
    gap: 10px;
}

.form-hint {
    color: var(--muted);
    font-size: 13px;
    margin: -6px 0 0;
}

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

.list li,
.restaurant-card {
    align-items: center;
    display: flex;
    gap: 14px;
    justify-content: space-between;
}

.list li {
    border-bottom: 1px solid var(--line);
    padding-bottom: 10px;
}

.zones span {
    background: var(--soft);
    border-radius: 6px;
    color: var(--primary-strong);
    font-weight: 800;
    padding: 8px 10px;
}

.table-map {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(3, minmax(64px, 1fr));
    margin-top: 18px;
}

.table-map button {
    aspect-ratio: 1;
    background: #fff8ed;
    border: 1px solid #f1d8b5;
    border-radius: 50%;
    color: #7c3f05;
    font: inherit;
    font-weight: 800;
}

.booking {
    grid-template-columns: repeat(5, minmax(130px, 1fr));
}

.restaurant-list {
    grid-template-columns: 1fr;
}

.notice {
    border-radius: 8px;
    font-weight: 800;
    margin: 0 auto 22px;
    max-width: 1096px;
    padding: 14px 18px;
}

.notice.success {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.notice.error {
    background: #fff1f2;
    border: 1px solid #fecdd3;
    color: #9f1239;
}

.restaurant-card {
    padding: 18px 20px;
}

.event-grid {
    grid-template-columns: 0.9fr 1.1fr 1fr;
}

.stat-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    padding-top: 0;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
}

.stat-card span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.stat-card strong {
    display: block;
    font-size: 34px;
    line-height: 1;
    margin: 10px 0 6px;
}

.stat-card p {
    color: var(--muted);
    margin-bottom: 0;
}

.restaurant-dashboard {
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
    padding-top: 0;
}

.location-layout {
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(300px, 0.42fr) minmax(0, 0.58fr);
    padding-top: 0;
}

.location-form {
    align-self: start;
}

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

.map-panel {
    min-width: 0;
}

.restaurant-map {
    border: 1px solid var(--line);
    border-radius: 8px;
    height: 520px;
    margin-top: 16px;
    overflow: hidden;
    width: 100%;
}

.spaces-layout {
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(300px, 0.4fr) minmax(0, 0.6fr);
    padding-top: 0;
}

.space-form {
    align-self: start;
}

.spaces-list {
    display: grid;
    gap: 14px;
}

.space-card {
    display: grid;
    gap: 10px;
}

.space-card-head {
    align-items: flex-start;
    display: flex;
    gap: 14px;
    justify-content: space-between;
}

.card-actions {
    align-items: center;
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.status-pill {
    background: #fff1f2;
    border-radius: 999px;
    color: #9f1239;
    flex: 0 0 auto;
    font-size: 13px;
    font-weight: 900;
    padding: 6px 10px;
}

.status-pill.active {
    background: #ecfdf5;
    color: #047857;
}

.space-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.space-meta span {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--muted);
    display: inline-flex;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.2;
    min-height: 30px;
    padding: 6px 9px;
}

.space-description {
    color: var(--muted);
    margin-bottom: 0;
}

.events-layout {
    align-items: start;
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(300px, 0.42fr) minmax(0, 0.58fr);
    padding-top: 0;
}

.calendar-tools,
.calendar-wrap {
    margin: 0 auto;
    max-width: 1160px;
    padding: 0 clamp(18px, 4vw, 32px) clamp(18px, 4vw, 32px);
}

.calendar-tools {
    align-items: stretch;
    display: grid;
    gap: 14px;
    grid-template-columns: minmax(300px, 1fr) minmax(240px, 0.45fr);
}

.calendar-action-form {
    display: grid;
    gap: 12px;
}

.legend-panel {
    align-content: start;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.legend {
    border-radius: 999px;
    font-size: 13px;
    font-weight: 900;
    padding: 7px 10px;
}

.legend.open,
.calendar-cell.open {
    background: #ecfdf5;
    color: #047857;
}

.legend.closed,
.calendar-cell.closed {
    background: #f1f5f9;
    color: #64748b;
}

.legend.reserved,
.calendar-cell.reserved {
    background: #fff1f2;
    color: #be123c;
}

.legend.event,
.calendar-cell.event {
    background: #eef2ff;
    color: #4338ca;
}

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

.calendar-grid {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    grid-template-columns: minmax(240px, 280px) repeat(var(--calendar-days), minmax(92px, 1fr));
    min-width: 1480px;
    overflow: hidden;
}

.calendar-head,
.calendar-table-label,
.calendar-cell,
.zone-row {
    border-bottom: 1px solid var(--line);
    border-right: 1px solid var(--line);
    min-height: 44px;
    padding: 9px 10px;
}

.calendar-head {
    background: #f8fafc;
    color: var(--ink);
    font-weight: 900;
    position: sticky;
    top: 0;
    z-index: 2;
}

.calendar-head small {
    color: var(--muted);
    display: block;
    font-size: 12px;
}

.table-col {
    left: 0;
    position: sticky;
    z-index: 3;
}

.zone-row {
    background: var(--soft);
    color: var(--primary-strong);
    font-weight: 900;
}

.calendar-table-label {
    align-items: center;
    background: #fff;
    display: flex;
    gap: 8px;
    font-weight: 800;
    left: 0;
    position: sticky;
    z-index: 1;
}

.calendar-table-label input[type="checkbox"] {
    flex: 0 0 16px;
    height: 16px;
    margin: 0;
    min-height: 16px;
    padding: 0;
    width: 16px;
}

.calendar-cell {
    align-items: center;
    display: flex;
    font-size: 12px;
    font-weight: 900;
    justify-content: center;
    text-transform: uppercase;
}

.event-form {
    align-self: start;
}

.events-list {
    display: grid;
    align-content: start;
    align-self: start;
    gap: 12px;
}

.event-card {
    display: grid;
    gap: 8px;
}

.event-table-picker {
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 10px;
    padding: 12px;
}

.event-table-group {
    display: grid;
    gap: 8px;
}

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

.event-table-options label {
    align-items: center;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--ink);
    display: inline-flex;
    flex-direction: row;
    font-size: 13px;
    gap: 6px;
    justify-content: flex-start;
    padding: 8px 10px;
}

.event-table-options input[type="checkbox"] {
    flex: 0 0 16px;
    height: 16px;
    margin: 0;
    width: 16px;
}

.event-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.event-meta span {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--muted);
    display: inline-flex;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.2;
    min-height: 30px;
    padding: 6px 9px;
}

.tables-layout {
    align-items: start;
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(0, calc(100% - 438px)) 420px;
    padding-top: 0;
}

.table-editor {
    display: grid;
    gap: 14px;
    min-width: 0;
    overflow: hidden;
    position: relative;
    z-index: 2;
}

.table-edit-list {
    display: grid;
    gap: 10px;
}

.table-edit-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 10px;
    min-width: 0;
    padding: 12px;
}

.table-edit-title {
    align-items: center;
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.table-edit-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(4, minmax(76px, 1fr));
}

.table-edit-grid label {
    color: var(--muted);
    display: grid;
    font-size: 13px;
    font-weight: 800;
    gap: 5px;
}

.table-preview-panel {
    min-width: 0;
    position: sticky;
    top: 86px;
    z-index: 1;
}

.layout-preview {
    background:
        linear-gradient(90deg, rgba(223, 229, 236, 0.8) 1px, transparent 1px),
        linear-gradient(0deg, rgba(223, 229, 236, 0.8) 1px, transparent 1px),
        #f8fafc;
    background-size: 10% 10%;
    border: 1px solid var(--line);
    border-radius: 8px;
    height: 520px;
    margin: 14px 0 10px;
    overflow: hidden;
    position: relative;
}

.layout-table {
    align-items: center;
    background: #fff8ed;
    border: 2px solid #f1d8b5;
    border-radius: 50%;
    color: #7c3f05;
    display: grid;
    height: 54px;
    justify-items: center;
    line-height: 1;
    padding: 7px;
    position: absolute;
    transform: translate(-50%, -50%);
    touch-action: none;
    user-select: none;
    width: 54px;
}

.layout-table.shape-square {
    border-radius: 8px;
}

.layout-table.shape-rectangle {
    border-radius: 8px;
    height: 48px;
    transform: translate(-50%, -50%) rotate(var(--table-rotation, 0deg));
    width: 86px;
}

.layout-table.dragging {
    box-shadow: 0 10px 28px rgba(23, 32, 42, 0.18);
    cursor: grabbing;
    z-index: 5;
}

.layout-table.blocked {
    border-color: #ef4444;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.16);
}

.layout-table.active {
    background: #ecfdf5;
    border-color: #86efac;
    color: #047857;
}

.layout-table.inactive {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #64748b;
}

.layout-table span {
    font-size: 12px;
    font-weight: 800;
}

.wide-panel {
    grid-row: span 2;
}

.panel-title {
    align-items: flex-start;
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    justify-content: space-between;
}

.panel-title .button {
    flex: 0 0 auto;
}

.empty-state {
    background: #f8fafc;
    border: 1px dashed var(--line);
    border-radius: 8px;
    color: var(--muted);
    padding: 18px;
}

.empty-state strong {
    color: var(--ink);
    display: block;
    margin-bottom: 6px;
}

.empty-state p {
    margin-bottom: 0;
}

.compact-empty {
    padding: 14px;
}

.quick-actions,
.checklist {
    display: grid;
    gap: 10px;
}

.quick-action {
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 2px;
    padding: 12px;
}

.quick-action:hover {
    border-color: var(--primary);
    background: var(--soft);
}

.quick-action span {
    color: var(--muted);
}

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

.checklist li {
    align-items: center;
    color: var(--muted);
    display: flex;
    gap: 10px;
}

.checklist span {
    align-items: center;
    background: #fff1f2;
    border-radius: 50%;
    color: #9f1239;
    display: inline-flex;
    flex: 0 0 24px;
    font-weight: 900;
    height: 24px;
    justify-content: center;
    width: 24px;
}

.checklist li.done {
    color: var(--ink);
}

.checklist li.done span {
    background: #ecfdf5;
    color: #047857;
}

.auth-wrap {
    padding-top: 0;
}

.auth-form {
    margin: 0 auto;
    max-width: 460px;
}

.muted-link {
    color: var(--muted);
    font-weight: 700;
    text-align: center;
}

.muted-link:hover {
    color: var(--primary-strong);
}

.footer {
    border-top: 1px solid var(--line);
    color: var(--muted);
    padding: 20px clamp(18px, 5vw, 64px);
}

@media (max-width: 860px) {
    .hero,
    .split,
    .dashboard-grid,
    .stat-grid,
    .restaurant-dashboard,
    .location-layout,
    .spaces-layout,
    .tables-layout,
    .events-layout,
    .workflow,
    .event-grid {
        grid-template-columns: 1fr;
    }

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

    .dashboard-head {
        align-items: flex-start;
        flex-direction: column;
    }

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

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

    .restaurant-map {
        height: 380px;
    }

    .table-preview-panel {
        position: static;
    }

    .table-edit-grid {
        grid-template-columns: 1fr;
    }

    .layout-preview {
        height: 420px;
    }

    .topbar,
    .restaurant-card {
        align-items: flex-start;
        flex-direction: column;
    }

    .site-status {
        font-size: 14px;
    }

    h1 {
        font-size: 36px;
    }
}

@media (max-width: 1120px) {
    .tables-layout {
        grid-template-columns: 1fr;
    }

    .table-preview-panel {
        position: static;
    }
}
