.owner-body { background: #F8FAFC; }

.owner-layout { display: flex; min-height: 100vh; }

.owner-sidebar {
    width: 220px;
    background: var(--header-bg);
    color: var(--navy);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    padding: 24px 18px;
    flex-shrink: 0;
}
.owner-logo { font-family: 'Inter', -apple-system, sans-serif; font-size: 1.3rem; font-weight: 700; margin-bottom: 30px; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; color: var(--navy); }
.owner-sidebar nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.owner-sidebar nav a {
    color: var(--navy);
    padding: 10px 12px;
    border-radius: 8px;
    font-weight: 600;
}
.owner-sidebar nav a:hover { background: var(--line); color: var(--navy); }
.owner-sidebar nav a.active { background: var(--chili); color: #fff; }
.owner-sidebar-footer {
    font-size: 0.82rem;
    color: var(--ink-soft);
    padding-top: 14px;
    margin-bottom: 22px;
    border-top: 1px solid var(--line);
}
.owner-sidebar-footer a { display: block; margin-top: 6px; color: var(--navy); font-weight: 600; }
.owner-sidebar-footer .staff-tag { color: var(--ink-soft); }

.owner-main { flex: 1; padding: 32px 40px; max-width: 1180px; }

.owner-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.btn-primary, .btn-secondary {
    display: inline-block;
    padding: 10px 18px;
    border-radius: 8px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.92rem;
}
.btn-primary { background: var(--chili); color: #fff; }
.btn-primary:hover { background: var(--chili-dark); }
.btn-secondary { background: #F8FAFC; color: var(--ink); border: 1px solid var(--line); }
.btn-secondary:hover { background: var(--line); }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 30px;
}
.stat-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.stat-value { font-family: 'Inter', -apple-system, sans-serif; font-size: 1.8rem; font-weight: 700; }
.stat-label { color: var(--ink-soft); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.03em; }

/* The stat cards are <a> tags now (each links to the page that explains its
   own number — today's reservations, the upcoming list, Tables), so they
   need the usual anchor resets plus a hover cue that they're clickable,
   since a plain stat tile doesn't otherwise look like a link. */
.stat-card-link {
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.stat-card-link:hover {
    border-color: var(--chili);
    box-shadow: 0 4px 14px rgba(0,0,0,0.08);
    transform: translateY(-1px);
}

.owner-panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px 24px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

/* Wraps a wide table (e.g. the 10-column leads table on master/leads.php)
   so it scrolls horizontally within its own box on a narrow screen instead
   of forcing the whole page wider. */
.table-scroll { overflow-x: auto; }
.owner-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.owner-table th {
    text-align: left;
    padding: 10px 8px;
    border-bottom: 2px solid var(--line);
    color: var(--ink-soft);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.owner-table td {
    padding: 10px 8px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}
.owner-table tr:last-child td { border-bottom: none; }

.hours-table td, .hours-table th { text-align: center; }
.hours-table td:first-child, .hours-table th:first-child { text-align: left; font-weight: 600; }
.hours-table input[type=time] { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; }
.hours-table input[type=checkbox] { width: 18px; height: 18px; }

.owner-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.owner-actions a, .link-action {
    color: var(--sage);
    font-weight: 600;
    font-size: 0.85rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    text-decoration: none;
}
.link-danger {
    color: var(--chili);
    font-weight: 600;
    font-size: 0.85rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    text-decoration: none;
}

.text-guest-trigger {
    color: var(--sage);
    font-weight: 600;
    font-size: 0.85rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    text-decoration: none;
    font-family: inherit;
}
.text-guest-trigger:hover { text-decoration: underline; }

body.modal-open { overflow: hidden; }

.text-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(20, 20, 20, 0.5);
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}
.text-modal-overlay.open { display: flex; }

.text-modal {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.25);
    width: 100%;
    max-width: 420px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}
/* Wider variant for the Reservation/Waitlist "View" modals — enough fields
   (contact info, party size, date/time, table, status, notes) that the
   text modal's 420px would cram everything into one narrow column. */
.text-modal-wide { max-width: 600px; }
.detail-modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
@media (max-width: 560px) {
    .detail-modal-grid { grid-template-columns: 1fr; }
}
.text-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--line);
}
.text-modal-header h3 { margin: 0; font-size: 1.05rem; }
.text-modal-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    color: var(--ink-soft);
    padding: 4px;
}
.text-modal-close:hover { color: var(--ink); }
.text-modal-form { padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 14px; }
.text-modal-label { display: block; font-weight: 500; font-size: 0.9rem; }
.text-modal-form select,
.text-modal-form textarea {
    width: 100%;
    margin-top: 6px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.92rem;
    resize: vertical;
}
.text-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 4px;
}

.template-list { list-style: none; padding: 0; margin: 0 0 8px; }
.template-list-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}
.template-list-item:last-child { border-bottom: none; }
.template-list-item p { margin: 4px 0 0; font-size: 0.88rem; }

.admin-form label {
    display: block;
    margin-bottom: 14px;
    font-weight: 500;
    font-size: 0.9rem;
}
.admin-form input[type=text],
.admin-form input[type=password],
.admin-form input[type=number],
.admin-form input[type=tel],
.admin-form input[type=email],
.admin-form textarea,
.admin-form select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-top: 5px;
    font-family: inherit;
    font-size: 0.92rem;
}
/* master/site_theme.php's 3-option colour-scheme picker. */
.theme-picker { display: flex; flex-direction: column; gap: 12px; max-width: 560px; }
.theme-option {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.theme-option:hover { border-color: var(--chili); }
.theme-option-selected { border-color: var(--chili); box-shadow: 0 0 0 1px var(--chili); }
.theme-option input[type="radio"] { width: auto; margin: 0; flex-shrink: 0; }
.theme-option-label { display: flex; flex-direction: column; gap: 2px; }
.theme-option-label .muted { font-size: 0.85rem; }
.theme-swatch {
    flex-shrink: 0;
    width: 52px;
    height: 40px;
    border-radius: 8px;
    border: 1px solid var(--line);
    position: relative;
    overflow: hidden;
}
.theme-swatch-accent {
    position: absolute;
    bottom: 6px;
    left: 6px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
}
/* Brand: white card, orange accent dot — matches the site's actual default palette. */
.theme-swatch-brand { background: #FFFFFF; }
.theme-swatch-brand .theme-swatch-accent { background: #F97316; }
/* Dark: the actual dark-mode surface colour, same orange accent (dark mode doesn't touch --chili). */
.theme-swatch-dark { background: #12151C; border-color: #2E3444; }
.theme-swatch-dark .theme-swatch-accent { background: #F97316; }
/* Light: same white card as Brand, blue accent dot instead of orange. */
.theme-swatch-light { background: #FFFFFF; }
.theme-swatch-light .theme-swatch-accent { background: #2563EB; }

.accent-color-field { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.accent-color-field input[type="color"] {
    width: 44px;
    height: 38px;
    padding: 2px;
    border: 1px solid var(--line);
    border-radius: 8px;
    cursor: pointer;
    background: var(--card);
}
.accent-color-field input[type="text"] {
    width: 110px;
    font-family: 'SFMono-Regular', Consolas, monospace;
    text-transform: uppercase;
}
.checkbox-label { display: flex; align-items: center; gap: 8px; }
.checkbox-label input { width: auto; margin-top: 0; }
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    margin-bottom: 14px;
}
.checkbox-group .checkbox-label { margin-bottom: 0; font-weight: 400; }
.form-row { display: flex; gap: 14px; }
.form-row label { flex: 1; }
.inline-form { margin-bottom: 4px; }

.cell-input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 0.88rem;
}
.cell-input-sm { max-width: 100px; }

.filter-bar { display: flex; gap: 10px; margin-bottom: 20px; align-items: center; flex-wrap: wrap; }
.filter-bar input, .filter-bar select {
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-family: inherit;
}

/* Login / register */
.login-box {
    max-width: 360px;
    margin: 60px auto;
    background: var(--card);
    border: 1px solid var(--line);
    padding: 32px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
}
.register-box { max-width: 440px; }
.login-box h1 { margin-bottom: 20px; font-size: 1.5rem; }
.login-box label { display: block; text-align: left; margin-bottom: 14px; font-weight: 500; font-size: 0.9rem; }
.login-box input, .login-box textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-top: 5px;
    font-family: inherit;
}
.login-box button {
    width: 100%;
    padding: 11px;
    background: var(--chili);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
}
.login-box button:hover { background: var(--chili-dark); }
.login-box code {
    background: #F1F5F9;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85rem;
}

/* Master panel — a faint slate tint on the sidebar (vs. the owner
   dashboard's plain white) so it's visually obvious you're in the
   platform-wide panel, not a single restaurant's dashboard. Subtle on
   its own; the bright orange "Master" badge next to the logo is the real
   tell. */
.master-sidebar { background: #F8FAFC; }
.master-sidebar nav a:hover { background: var(--line); color: var(--navy); }
.master-sidebar nav a.active { background: var(--chili); color: #fff; }
.master-sidebar .owner-sidebar-footer { border-top-color: var(--line); }

.master-badge {
    display: inline-block;
    background: var(--chili);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 3px 9px;
    border-radius: 999px;
    margin-left: 8px;
    vertical-align: middle;
}

/* Shown at the top of the owner dashboard's main column while a master is
   impersonating a restaurant, so it's never mistaken for that restaurant's
   own session. */
.impersonation-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    background: var(--danger-bg);
    color: var(--danger-dark);
    border: 1px solid var(--danger);
    border-radius: 10px;
    padding: 12px 18px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}
.impersonation-banner a {
    background: var(--chili);
    color: #fff;
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    text-decoration: none;
    white-space: nowrap;
}
.impersonation-banner a:hover { background: var(--chili-dark); }

.danger-zone {
    border: 1px solid var(--danger);
    border-radius: var(--radius);
    padding: 20px 22px;
}
.danger-zone h2 { color: var(--danger-dark); }

.caution-zone {
    border: 1px solid #C9A227;
    border-radius: var(--radius);
    padding: 20px 22px;
}
.caution-zone h2 { color: #8A6D00; }
