:root {
    --ink: #102332;
    --muted: #64748b;
    --line: #e5edf2;
    --canvas: #f4f8fa;
    --panel: #ffffff;
    --cyan: #00aeca;
    --cyan-dark: #007f96;
    --cyan-soft: #e7f9fc;
    --green: #10b981;
    --amber: #f59e0b;
    --red: #ef4444;
    --orange: #f97316;
    --slate: #64748b;
    --shadow: 0 12px 32px rgba(20, 52, 69, .07);
}

* { box-sizing: border-box; }

html { color-scheme: light; }

body {
    margin: 0;
    background: var(--canvas);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }

.topbar {
    align-items: center;
    background: rgba(255, 255, 255, .96);
    border-bottom: 1px solid var(--line);
    display: flex;
    height: 72px;
    justify-content: space-between;
    padding: 0 max(24px, calc((100vw - 1380px) / 2));
    position: sticky;
    top: 0;
    z-index: 20;
}

.sr-only {
    border: 0;
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    white-space: nowrap;
    width: 1px;
}

.topbar-lead { align-items: center; display: flex; gap: 18px; min-width: 0; }
.brand { align-items: center; color: var(--ink); display: inline-flex; flex: none; gap: 11px; text-decoration: none; }
.brand img { border-radius: 9px; height: 42px; object-fit: cover; object-position: left center; width: 42px; }
.brand-copy { display: grid; line-height: 1.05; }
.brand-copy strong { font-size: 17px; letter-spacing: .08em; }
.brand-copy small { color: var(--muted); font-size: 11px; font-weight: 600; margin-top: 5px; text-transform: uppercase; }

.topbar-actions { align-items: center; display: flex; gap: 18px; }
.user-name { font-size: 13px; font-weight: 650; }
.admin-link, .logout-button {
    background: none;
    border: 0;
    color: var(--muted);
    cursor: pointer;
    font-size: 13px;
    font-weight: 650;
    padding: 8px 0;
    text-decoration: none;
}
.admin-link:hover, .logout-button:hover { color: var(--cyan-dark); }

.page-shell { margin: 0 auto; max-width: 1428px; padding: 34px 24px 42px; }

.eyebrow { color: var(--cyan-dark); font-size: 10px; font-weight: 800; letter-spacing: .14em; margin: 0 0 8px; text-transform: uppercase; }

/* Hotel context: the page's primary identity, held in the topbar so it stays
   visible on every section rather than only on the dashboard. */
.topbar-context {
    align-items: center;
    border-left: 1px solid var(--line);
    display: flex;
    gap: 9px;
    min-width: 0;
    padding-left: 18px;
}
.hotel-name {
    color: var(--ink);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -.01em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.hotel-switcher { display: flex; min-width: 0; }
.hotel-switcher select {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--ink);
    cursor: pointer;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -.01em;
    max-width: 330px;
    padding: 6px 4px 6px 8px;
    text-overflow: ellipsis;
}
.hotel-switcher select:hover { background: var(--canvas); }
.hotel-switcher select:focus-visible { border-color: var(--cyan); outline: none; }

/* Sits among the footer's small print, so it is scaled to that idiom -- a shade
   heavier than the meta text beside it, since a degraded state must still read. */
.integration-line {
    align-items: center;
    display: inline-flex;
    font-size: 10px;
    font-weight: 700;
    gap: 7px;
}
.state-dot { background: var(--green); border: 3px solid rgba(16, 185, 129, .22); border-radius: 50%; flex: none; height: 10px; width: 10px; }
.integration-line.warning { color: #a4670a; }
.integration-line.warning .state-dot { background: var(--amber); border-color: rgba(245, 158, 11, .22); }

.metric-grid { display: grid; gap: 16px; grid-template-columns: repeat(4, 1fr); margin: 0 0 18px; }
.metric-card, .panel { background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); }
.metric-card { border-radius: 15px; min-height: 168px; padding: 21px; position: relative; }
.metric-card p { color: var(--muted); font-size: 12px; font-weight: 700; margin: 18px 0 5px; }
.metric-card > strong { display: block; font-size: 29px; letter-spacing: -.04em; }
.metric-card > span { color: var(--muted); display: block; font-size: 11px; margin-top: 5px; }
.metric-icon { align-items: center; border-radius: 10px; display: flex; font-size: 18px; font-weight: 800; height: 36px; justify-content: center; width: 36px; }
.metric-icon.mapping, .metric-icon.lines { background: var(--cyan-soft); color: var(--cyan-dark); }
.metric-icon.accepted { background: #eafaf4; color: #07835d; }
.metric-icon.attention { background: #fff4e8; color: var(--orange); }
.progress-track { background: #eaf0f3; border-radius: 99px; bottom: 15px; height: 4px; left: 21px; overflow: hidden; position: absolute; right: 21px; }
.progress-track i { background: linear-gradient(90deg, var(--cyan), #52d4e5); display: block; height: 100%; }
.metric-card.has-issues { border-color: #fed7aa; }

.dashboard-grid { display: grid; gap: 18px; margin-bottom: 18px; }
.primary-grid { grid-template-columns: minmax(0, 1.65fr) minmax(310px, .7fr); }
.attention-grid { grid-template-columns: 1fr; }
.panel { border-radius: 16px; padding: 24px; }
.panel-heading { align-items: flex-start; display: flex; gap: 20px; justify-content: space-between; }
.panel-heading h2 { font-size: 18px; letter-spacing: -.02em; margin: 0; }

.legend { align-items: center; color: var(--muted); display: flex; font-size: 10px; gap: 13px; }
.legend span { align-items: center; display: flex; gap: 5px; }
.legend i { border-radius: 2px; height: 7px; width: 7px; }
.legend i.accepted { background: var(--green); }
.legend i.pending { background: var(--amber); }
.legend i.problem { background: var(--red); }

.batch-chart { align-items: stretch; display: grid; gap: 15px; grid-template-columns: repeat(6, minmax(52px, 1fr)); height: 216px; margin-top: 22px; }
.chart-period { display: grid; grid-template-rows: 1fr auto; min-width: 0; }
.bar-area { align-items: end; border-bottom: 1px solid var(--line); display: flex; gap: 3px; justify-content: center; min-height: 170px; padding: 20px 5px 0; }
.bar { border-radius: 5px 5px 1px 1px; min-height: 18px; min-width: 8px; position: relative; width: 18%; }
.bar span { color: white; font-size: 9px; font-weight: 800; left: 50%; position: absolute; top: 5px; transform: translateX(-50%); }
.bar.accepted { background: var(--green); }
.bar.pending { background: var(--amber); }
.bar.rejected { background: var(--red); }
.bar.failed { background: var(--orange); }
.bar.blocked { background: var(--slate); }
.axis-label { color: var(--muted); font-size: 9px; font-weight: 650; margin-top: 10px; text-align: center; white-space: nowrap; }

.donut-layout { align-items: center; display: flex; gap: 28px; justify-content: center; min-height: 225px; padding-top: 14px; }
.donut { align-items: center; border-radius: 50%; display: flex; height: 138px; justify-content: center; width: 138px; }
.donut > div { align-items: center; background: white; border-radius: 50%; display: flex; flex-direction: column; height: 86px; justify-content: center; width: 86px; }
.donut strong { font-size: 26px; line-height: 1; }
.donut span { color: var(--muted); font-size: 10px; margin-top: 5px; text-transform: uppercase; }
.status-legend { min-width: 122px; }
.status-legend > div { align-items: center; border-bottom: 1px solid #f0f4f6; display: flex; font-size: 11px; justify-content: space-between; padding: 7px 0; }
.status-legend span { align-items: center; color: var(--muted); display: flex; gap: 7px; }
.status-legend i { border-radius: 50%; height: 7px; width: 7px; }

.count-pill { align-items: center; background: #fff1e7; border-radius: 99px; color: var(--orange); display: flex; font-size: 11px; font-weight: 800; height: 25px; justify-content: center; min-width: 25px; padding: 0 8px; }
.count-pill.danger { background: #fff0f0; color: var(--red); }
.attention-list { display: grid; gap: 9px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-top: 19px; }
.attention-item { align-items: flex-start; background: #f8fafb; border-radius: 10px; display: flex; gap: 11px; padding: 11px; }
.attention-item > i { background: var(--slate); border-radius: 50%; flex: 0 0 auto; height: 8px; margin-top: 5px; width: 8px; }
.attention-item.danger > i { background: var(--red); }
.attention-item.warning > i { background: var(--amber); }
.attention-item.info > i { background: var(--cyan); }
.attention-item strong { display: block; font-size: 11px; }
.attention-item p { color: var(--muted); font-size: 9px; line-height: 1.45; margin: 3px 0 0; }
.healthy-state { align-items: center; display: flex; flex-direction: column; justify-content: center; min-height: 210px; text-align: center; }
.healthy-state span { align-items: center; background: #e9faf4; border-radius: 50%; color: var(--green); display: flex; height: 44px; justify-content: center; margin-bottom: 12px; width: 44px; }
.healthy-state p { color: var(--muted); font-size: 11px; }

.recent-panel, .unmapped-panel { margin-bottom: 18px; }
.freshness { display: grid; text-align: right; }
.freshness span { color: var(--muted); font-size: 9px; text-transform: uppercase; }
.freshness strong { font-size: 11px; margin-top: 4px; }
.table-scroll { margin: 18px -24px -24px; overflow-x: auto; }
table { border-collapse: collapse; min-width: 860px; width: 100%; }
th { background: #f8fafb; color: var(--muted); font-size: 9px; letter-spacing: .08em; padding: 10px 16px; text-align: left; text-transform: uppercase; }
td { border-top: 1px solid var(--line); font-size: 11px; padding: 13px 16px; }
td:first-child, th:first-child { padding-left: 24px; }
td:last-child, th:last-child { padding-right: 24px; }
td small { color: var(--muted); font-size: 8px; margin-left: 2px; text-transform: uppercase; }
td code { color: #46606f; font: 9px ui-monospace, SFMono-Regular, Menlo, monospace; }
.status-badge { border-radius: 99px; display: inline-block; font-size: 9px; font-weight: 750; padding: 5px 8px; }
.status-badge.accepted { background: #e9faf4; color: #087b58; }
.status-badge.pending { background: #fff7df; color: #9a6200; }
.status-badge.rejected { background: #fff0f0; color: #c52929; }
.status-badge.failed { background: #fff1e8; color: #bf4f12; }
.status-badge.blocked { background: #edf1f4; color: #475569; }

.unmapped-grid { display: grid; gap: 10px; grid-template-columns: repeat(3, 1fr); margin-top: 18px; }
.unmapped-grid > div { background: #f8fafb; border: 1px solid var(--line); border-radius: 10px; display: grid; gap: 5px; padding: 13px; }
.unmapped-grid code { color: var(--red); font-size: 13px; font-weight: 800; }
.unmapped-grid span { color: var(--muted); font-size: 9px; }
.unmapped-grid strong { font-size: 10px; }

.empty-state { align-items: center; color: var(--muted); display: flex; font-size: 12px; justify-content: center; min-height: 190px; text-align: center; }
footer { align-items: center; color: var(--muted); display: flex; flex-wrap: wrap; font-size: 9px; gap: 18px; justify-content: center; padding: 20px 0 0; }

/* Login */
.login-page { background: #eef5f7; min-height: 100vh; }
.login-shell { background: white; display: grid; grid-template-columns: 1.08fr .92fr; margin: 0 auto; min-height: 100vh; }
.login-story { background: linear-gradient(145deg, #082633, #075066); color: white; display: flex; flex-direction: column; justify-content: space-between; min-height: 100vh; overflow: hidden; padding: clamp(36px, 6vw, 80px); position: relative; }
.login-story::after { border: 1px solid rgba(255,255,255,.1); border-radius: 50%; content: ""; height: 580px; position: absolute; right: -310px; top: 12%; width: 580px; }
.login-brand { color: white; position: relative; z-index: 1; }
.login-story .eyebrow { color: #86e4ef; }
.login-story h1 { font-size: clamp(38px, 5vw, 67px); letter-spacing: -.055em; line-height: 1.03; margin: 0 0 22px; max-width: 700px; }
.login-story > div > p:last-child { color: #b9d7de; font-size: 15px; line-height: 1.7; max-width: 530px; }
.login-points { display: flex; flex-wrap: wrap; gap: 22px; position: relative; z-index: 1; }
.login-points span { align-items: center; color: #cde3e8; display: flex; font-size: 11px; gap: 7px; }
.login-points i { color: #62d7e4; font-style: normal; }
.login-card { align-self: center; justify-self: center; max-width: 450px; padding: 42px; width: 100%; }
.login-card h2 { font-size: 28px; letter-spacing: -.035em; margin: 0; }
.login-help, .support-copy { color: var(--muted); font-size: 12px; line-height: 1.6; }
.login-card form { display: grid; margin-top: 30px; }
.login-card label { font-size: 11px; font-weight: 750; margin: 0 0 7px; }
.login-card input { border: 1px solid #ccdbe2; border-radius: 10px; margin-bottom: 18px; outline: none; padding: 13px 14px; transition: border .15s, box-shadow .15s; width: 100%; }
.login-card input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(0,174,202,.12); }
.login-card button { background: var(--cyan-dark); border: 0; border-radius: 10px; color: white; cursor: pointer; font-weight: 750; margin-top: 4px; padding: 14px; }
.login-card button:hover { background: #006c80; }
.form-error { background: #fff0f0; border: 1px solid #ffd1d1; border-radius: 9px; color: #b52626; font-size: 11px; margin-top: 18px; padding: 11px 13px; }
.support-copy { margin-top: 23px; text-align: center; }

@media (max-width: 1050px) {
    .metric-grid { grid-template-columns: repeat(2, 1fr); }
    .primary-grid, .attention-grid { grid-template-columns: 1fr; }
    .status-panel { min-height: 310px; }
}

@media (max-width: 760px) {
    .topbar { height: 64px; padding: 0 16px; }
    .user-name { display: none; }
    .page-shell { padding: 20px 14px 32px; }
    .topbar-lead { gap: 12px; }
    .topbar-context { gap: 7px; padding-left: 12px; }
    .hotel-name, .hotel-switcher select { font-size: 13px; max-width: 190px; }
    .metric-grid { grid-template-columns: 1fr 1fr; }
    .metric-card { min-height: 158px; padding: 17px; }
    .metric-card > strong { font-size: 25px; }
    .progress-track { left: 17px; right: 17px; }
    .panel { padding: 19px; }
    .batch-chart { gap: 5px; overflow-x: auto; }
    .legend.compact { display: none; }
    .donut-layout { gap: 20px; }
    .unmapped-grid { grid-template-columns: 1fr; }
    .login-shell { grid-template-columns: 1fr; }
    .login-story { display: none; }
    .login-card { padding: 30px 24px; }
}

@media (max-width: 460px) {
    /* On a phone the hotel you are viewing matters more than the wordmark;
       the icon still carries the brand. */
    .brand-copy { display: none; }
    .topbar-actions { gap: 12px; }
    .metric-grid { grid-template-columns: 1fr; }
    .hotel-name, .hotel-switcher select { max-width: 150px; }
    .panel-heading { flex-direction: column; }
    .donut-layout { align-items: center; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

/* Section navigation */
.section-nav { background: var(--panel); border-bottom: 1px solid var(--line); display: flex; gap: 4px; overflow-x: auto; padding: 0 32px; }
.section-nav a { border-bottom: 2px solid transparent; color: var(--muted); display: block; font-size: 12px; font-weight: 600; padding: 14px 14px 12px; text-decoration: none; white-space: nowrap; }
.section-nav a:hover { color: var(--ink); }
.section-nav a.active { border-bottom-color: var(--cyan); color: var(--cyan-dark); }

/* Detail pages */
.back-link { color: var(--muted); display: inline-block; font-size: 12px; font-weight: 600; margin-bottom: 14px; text-decoration: none; }
.back-link:hover { color: var(--cyan-dark); }
.row-link { color: var(--cyan-dark); font-size: 11px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.row-link:hover { text-decoration: underline; }
.panel-foot { border-top: 1px solid var(--line); margin: 0 -24px -24px; padding: 14px 24px; text-align: right; }

.detail-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-top: 18px; }
.detail-grid div { background: #f8fafb; border-radius: 10px; padding: 12px 14px; }
.detail-grid small { color: var(--muted); display: block; font-size: 9px; letter-spacing: .07em; margin-bottom: 5px; text-transform: uppercase; }
.detail-grid strong { color: var(--ink); display: block; font-size: 14px; min-width: 0; overflow-wrap: anywhere; }
.detail-grid code { font: 10px ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }
.detail-grid > div { min-width: 0; }

/* Tables on list pages */
td.num, th.num { text-align: right; }
td.wrap { max-width: 260px; white-space: normal; }
td .muted { color: var(--muted); }
tr.statistical td { background: #fcfcfd; color: var(--muted); }
tfoot td { background: #f8fafb; border-top: 2px solid var(--line); font-weight: 750; }

/* Filters and pagination */
.filter-bar { display: flex; gap: 8px; margin-top: 16px; }
.filter-bar a { background: #f1f5f8; border-radius: 99px; color: var(--muted); font-size: 11px; font-weight: 650; padding: 6px 13px; text-decoration: none; }
.filter-bar a.active { background: var(--cyan-soft); color: var(--cyan-dark); }

.pagination { align-items: center; border-top: 1px solid var(--line); display: flex; gap: 14px; justify-content: flex-end; margin: 0 -24px -24px; padding: 14px 24px; }
.pagination a { color: var(--cyan-dark); font-size: 11px; font-weight: 700; text-decoration: none; }
.pagination a:hover { text-decoration: underline; }
.pagination .disabled { color: #b8c4cc; font-size: 11px; font-weight: 700; }
.pagination .page-of { color: var(--muted); font-size: 11px; }

.count-pill.danger { background: #fdecec; color: #b42318; }
.attention-item.info i { background: var(--cyan); }

@media (max-width: 760px) {
    .section-nav { padding: 0 16px; }
    .detail-grid { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
}

/* A table followed by a footer or pagination must not pull them over the edge */
.table-scroll:not(:last-child) { margin-bottom: 0; }
.panel-foot, .pagination { margin-top: 0; }
.panel > .panel-foot:last-child, .panel > .pagination:last-child { margin-bottom: -24px; }

/* Mapped / unmapped marks */
td.mark, th.mark { text-align: center; }
.mark-yes, .mark-no, .mark-pending {
    align-items: center; border-radius: 99px; display: inline-flex; font-size: 12px;
    font-weight: 800; height: 24px; justify-content: center; line-height: 1; width: 24px;
}
.mark-yes { background: #eafaf4; color: #07835d; }
.mark-no { background: #fdecec; color: #b42318; }
.mark-pending { background: #f1f5f8; color: #8b9aa5; }
