:root {
    --bd-bg: #f8f9fa;
    --bd-surface: #ffffff;
    --bd-border: #dadce0;
    --bd-border-soft: #e8eaed;
    --bd-text: #202124;
    --bd-muted: #5f6368;
    --bd-accent: #1a73e8;
    --bd-accent-soft: #e8f0fe;
    --bd-lunch: #f9ab00;
    --bd-dinner: #8ab4f8;
    --bd-waiting: #e37400;
    --bd-ok: #188038;
    --bd-danger: #d93025;
    --bd-radius: 8px;
    --bd-shadow: 0 1px 2px rgba(60, 64, 67, 0.12), 0 1px 3px rgba(60, 64, 67, 0.08);
}

* { box-sizing: border-box; }

.bd-body {
    margin: 0;
    color: var(--bd-text);
    background: var(--bd-bg);
    font-family: "Source Sans 3", "Segoe UI", sans-serif;
    font-size: 13px;
    line-height: 1.4;
    min-height: 100vh;
}

.bd-shell {
    width: 90%;
    max-width: none;
    margin: 0 auto;
    padding-left: 12px;
    padding-right: 12px;
}

.bd-main-shell { padding-top: 12px; padding-bottom: 24px; }

/* Header */
.bd-header {
    background: var(--bd-surface);
    border-bottom: 1px solid var(--bd-border);
    position: sticky;
    top: 0;
    z-index: 40;
}
.bd-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 8px;
    padding-bottom: 8px;
}
.bd-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.bd-logo {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    object-fit: cover;
}
.bd-logo-fallback {
    display: grid;
    place-items: center;
    background: var(--bd-accent);
    color: #fff;
    font-weight: 700;
}
.bd-brand-name {
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.bd-brand-meta {
    display: flex;
    gap: 10px;
    color: var(--bd-muted);
    font-size: 12px;
}
.bd-clock { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--bd-text); }
.bd-header-actions { display: flex; align-items: center; gap: 6px; }
.bd-user-label { color: var(--bd-muted); font-size: 12px; }
.bd-icon-btn {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: var(--bd-muted);
    text-decoration: none;
}
.bd-icon-btn:hover { background: var(--bd-border-soft); color: var(--bd-text); }

.bd-nav-bar { border-top: 1px solid var(--bd-border-soft); }
.bd-nav-inner { display: flex; gap: 2px; overflow-x: auto; }
.bd-nav {
    padding: 10px 12px;
    color: var(--bd-muted);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    font-weight: 500;
}
.bd-nav:hover { color: var(--bd-text); }
.bd-nav.active {
    color: var(--bd-accent);
    border-bottom-color: var(--bd-accent);
}

/* Buttons / inputs */
.bd-btn {
    appearance: none;
    border: 1px solid var(--bd-border);
    background: var(--bd-surface);
    color: var(--bd-text);
    border-radius: 4px;
    padding: 6px 10px;
    font: inherit;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.bd-btn:hover { background: #f1f3f4; }
.bd-btn-accent {
    background: var(--bd-accent);
    border-color: var(--bd-accent);
    color: #fff;
}
.bd-btn-accent:hover { filter: brightness(1.05); background: var(--bd-accent); }
.bd-btn-ghost { background: transparent; }
.bd-btn-xs { padding: 2px 6px; font-size: 11px; }

.bd-input,
.bd-select {
    width: 100%;
    border: 1px solid var(--bd-border);
    border-radius: 4px;
    background: #fff;
    color: var(--bd-text);
    padding: 7px 9px;
    font: inherit;
    min-height: 34px;
}
.bd-input:focus,
.bd-select:focus {
    outline: none;
    border-color: var(--bd-accent);
    box-shadow: 0 0 0 2px var(--bd-accent-soft);
}
.bd-date-hidden { position: absolute; opacity: 0; pointer-events: none; width: 0; height: 0; }

/* Layout */
.bd-dash-layout {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
}

.bd-sidebar {
    position: sticky;
    top: 88px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.bd-sidebar-block {
    background: var(--bd-surface);
    border: 1px solid var(--bd-border);
    border-radius: var(--bd-radius);
    padding: 12px;
    box-shadow: var(--bd-shadow);
}
.bd-sidebar-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--bd-muted);
    margin-bottom: 8px;
}
.bd-selected-date {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 8px;
}
.bd-date-nav {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 6px;
}
.bd-meta-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.bd-meta-line {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 3px 0;
}
.bd-muted { color: var(--bd-muted); }
.bd-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    background: #f1f3f4;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}
.bd-pill.ready { background: #e6f4ea; color: var(--bd-ok); }
.bd-pill.error { background: #fce8e6; color: var(--bd-danger); }
.bd-pill.pending,
.bd-pill.paused { background: #fef7e0; color: #b06000; }
.bd-pill.none { background: #f1f3f4; color: var(--bd-muted); }

/* Mini calendar */
.bd-mini-cal { user-select: none; }
.bd-cal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
    font-weight: 600;
}
.bd-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    text-align: center;
}
.bd-cal-dow {
    font-size: 10px;
    color: var(--bd-muted);
    padding: 4px 0;
    font-weight: 600;
}
.bd-cal-day {
    border: 0;
    background: transparent;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    margin: 0 auto;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
    color: var(--bd-text);
}
.bd-cal-day:hover { background: #f1f3f4; }
.bd-cal-day.other { color: #bdc1c6; }
.bd-cal-day.today { box-shadow: inset 0 0 0 1px var(--bd-accent); color: var(--bd-accent); font-weight: 700; }
.bd-cal-day.selected { background: var(--bd-accent); color: #fff; font-weight: 700; }
.bd-cal-day.selected.today { box-shadow: none; }

.bd-main { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.bd-page-title { margin: 0; font-size: 18px; font-weight: 600; }
.bd-toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.bd-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.bd-source {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--bd-border);
    background: #f1f3f4;
    color: var(--bd-muted);
}
.bd-source-system {
    background: #e8f0fe;
    border-color: #aecbfa;
    color: #174ea6;
}
.bd-source-manual {
    background: #e6f4ea;
    border-color: #a8dab5;
    color: #137333;
}
.bd-source-imported {
    background: #fef7e0;
    border-color: #fdd663;
    color: #895900;
}
.bd-modal-foot {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.bd-modal-foot-spacer { flex: 1; min-width: 8px; }
.bd-modal-panel-wide { max-width: 720px; width: min(720px, 94vw); }
.bd-conv-thread {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: min(60vh, 520px);
    overflow: auto;
    padding: 4px 2px;
}
.bd-conv-msg {
    border: 1px solid var(--bd-border);
    border-radius: 8px;
    padding: 8px 10px;
    background: #f8f9fa;
}
.bd-conv-user {
    background: #e8f0fe;
    border-color: #aecbfa;
    align-self: flex-end;
    max-width: 92%;
}
.bd-conv-bot {
    background: #fff;
    align-self: flex-start;
    max-width: 92%;
}
.bd-conv-role {
    font-size: 11px;
    font-weight: 600;
    color: var(--bd-muted);
    text-transform: capitalize;
    margin-bottom: 4px;
}
.bd-conv-text {
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 13px;
    line-height: 1.45;
}
.bd-page-sub { margin: 2px 0 0; color: var(--bd-muted); font-size: 12px; }

.bd-filters {
    display: grid;
    grid-template-columns: 1.6fr repeat(4, 1fr);
    gap: 6px;
    background: var(--bd-surface);
    border: 1px solid var(--bd-border);
    border-radius: var(--bd-radius);
    padding: 8px;
    box-shadow: var(--bd-shadow);
}
.bd-input-search { grid-column: 1 / -1; }

.bd-summary-grid {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 6px;
}
.bd-stat {
    background: var(--bd-surface);
    border: 1px solid var(--bd-border);
    border-radius: var(--bd-radius);
    padding: 8px 10px;
    box-shadow: var(--bd-shadow);
}
.bd-stat-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--bd-muted);
    font-weight: 600;
}
.bd-stat-value {
    font-size: 20px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    margin-top: 2px;
}

.bd-sections { display: flex; flex-direction: column; gap: 10px; }
.bd-panel {
    background: var(--bd-surface);
    border: 1px solid var(--bd-border);
    border-radius: var(--bd-radius);
    overflow: hidden;
    box-shadow: var(--bd-shadow);
}
.bd-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid var(--bd-border-soft);
    background: #fafafa;
}
.bd-section-head h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
}
.bd-section-head.lunch { border-left: 3px solid var(--bd-lunch); }
.bd-section-head.dinner { border-left: 3px solid var(--bd-dinner); }
.bd-section-head.waiting { border-left: 3px solid var(--bd-waiting); }
.bd-count {
    background: #f1f3f4;
    color: var(--bd-muted);
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 700;
}
.bd-section-body { min-height: 64px; }
.bd-empty {
    text-align: center;
    color: var(--bd-muted);
    padding: 18px 8px;
}

.bd-table-wrap {
    width: 100%;
    overflow-x: auto;
}
.bd-table {
    width: 100%;
    min-width: 1280px;
    border-collapse: collapse;
    font-size: 12px;
}
.bd-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f8f9fa;
    color: var(--bd-muted);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-weight: 700;
    text-align: left;
    padding: 7px 8px;
    border-bottom: 1px solid var(--bd-border);
    white-space: nowrap;
}
.bd-table tbody td {
    padding: 5px 8px;
    border-bottom: 1px solid var(--bd-border-soft);
    vertical-align: middle;
    background: #fff;
}
.bd-table tbody tr:hover td { background: #f8fbff; }
.bd-table tbody tr.bd-row-available td {
    color: var(--bd-muted);
    background: #fafafa;
}
.bd-table tbody tr.bd-row-available td .bd-available-label {
    color: var(--bd-ok);
    font-weight: 600;
}
.bd-table tbody tr.is-flash td {
    animation: bdPulse 0.9s ease;
}
.bd-col-notes {
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--bd-muted);
}
.bd-check {
    width: 16px;
    height: 16px;
    accent-color: var(--bd-accent);
    cursor: pointer;
}
.bd-check:disabled { cursor: not-allowed; opacity: 0.45; }
.bd-bool-yes { color: var(--bd-ok); font-weight: 600; }
.bd-bool-no { color: var(--bd-muted); }
.bd-link { color: var(--bd-accent); text-decoration: none; }
.bd-link:hover { text-decoration: underline; }
.bd-actions { display: flex; flex-wrap: wrap; gap: 4px; }

.bd-status {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 2px 8px;
    border-radius: 999px;
    background: #f1f3f4;
    color: var(--bd-muted);
    white-space: nowrap;
}
.bd-status.confirmed { background: #e6f4ea; color: var(--bd-ok); }
.bd-status.arrived { background: #e8f0fe; color: var(--bd-accent); }
.bd-status.finished { background: #f1f3f4; color: #5f6368; }
.bd-status.waiting { background: #fef7e0; color: #b06000; }
.bd-status.available { background: #e6f4ea; color: var(--bd-ok); }
.bd-status.cancelled,
.bd-status.no_show { background: #fce8e6; color: var(--bd-danger); }

.bd-row-clickable { cursor: pointer; }
.bd-row-clickable:hover td { background: #f8fbff !important; }

.bd-modal {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.bd-modal.hidden { display: none; }
.bd-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(32, 33, 36, 0.45);
}
.bd-modal-panel {
    position: relative;
    width: min(720px, 100%);
    max-height: min(90vh, 900px);
    overflow: auto;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 28px rgba(60, 64, 67, 0.28);
    border: 1px solid var(--bd-border);
}
.bd-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--bd-border-soft);
}
.bd-modal-head h3 { margin: 0; font-size: 16px; }
.bd-modal-body { padding: 14px 16px; }
.bd-modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 12px;
}
.bd-modal-grid label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--bd-muted);
}
.bd-modal-grid .bd-span-2 { grid-column: 1 / -1; }
.bd-check-label {
    flex-direction: row !important;
    align-items: center;
    gap: 8px !important;
    text-transform: none !important;
    font-size: 13px !important;
    color: var(--bd-text) !important;
    font-weight: 500 !important;
    margin-top: 18px;
}
.bd-modal-foot {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--bd-border-soft);
}

.bd-messages { padding-top: 10px; }
.bd-alert {
    border-radius: 6px;
    padding: 8px 12px;
    margin-bottom: 6px;
    border: 1px solid var(--bd-border);
    background: #fff;
}
.bd-alert-success { background: #e6f4ea; border-color: #ceead6; }
.bd-alert-error { background: #fce8e6; border-color: #f6aea9; }
.bd-alert-info { background: var(--bd-accent-soft); border-color: #d2e3fc; }

.bd-toast {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 60;
}
.bd-toast.hidden { display: none; }
.bd-toast-inner {
    background: #323232;
    color: #fff;
    padding: 10px 14px;
    border-radius: 6px;
    box-shadow: var(--bd-shadow);
    max-width: 320px;
}

/* Login / secondary pages keep compact card look */
.bd-login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: var(--bd-bg);
}
.bd-login-panel,
.bd-card-panel {
    background: var(--bd-surface);
    border: 1px solid var(--bd-border);
    border-radius: var(--bd-radius);
    box-shadow: var(--bd-shadow);
    padding: 20px;
    width: min(420px, 92vw);
}

@keyframes bdPulse {
    0%, 100% { box-shadow: inset 0 0 0 0 rgba(26, 115, 232, 0); }
    40% { box-shadow: inset 0 0 0 2px rgba(26, 115, 232, 0.35); }
}

@media (max-width: 1200px) {
    .bd-summary-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .bd-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
    .bd-dash-layout { grid-template-columns: 1fr; }
    .bd-sidebar { position: static; }
    .bd-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .bd-filters { grid-template-columns: 1fr 1fr; }
    .bd-user-label { display: none; }
    .bd-modal-grid { grid-template-columns: 1fr; }
}
