/*
 * Same look as the Apartment Management System: teal Material colours,
 * a faintly tinted page with white outlined cards, a light side panel
 * with rounded menu items, and rounded inputs and buttons.
 */
:root {
    --bg: #f3f6f5;
    --surface: #ffffff;
    --surface-2: #f3f7f6;
    --border: #d3dcd9;
    --text: #171d1b;
    --muted: #56615e;
    --brand: #00695c;
    --brand-dark: #004d40;
    --on-brand: #ffffff;
    --link: #00695c;
    --selected: #cce8e2;
    --on-selected: #05201c;
    --avatar: #9ef2e4;
    --on-avatar: #00201c;
    --focus: rgba(0, 105, 92, .22);
    --good: #14803c;
    --good-bg: #e3f5e9;
    --warn: #a15c00;
    --warn-bg: #fdf0d8;
    --bad: #b3261e;
    --bad-bg: #fde8e6;
    --info-bg: #dcf0ec;
    --input-bg: #ffffff;
    --input-border: #bec9c5;
    --badge-bg: #e6ecea;
    --badge-text: #3f4946;
    --radius: 14px;
    --radius-sm: 10px;
    color-scheme: light;
}

/* Dark mode: switched on with the sun/moon button beside the user's name. */
html[data-theme="dark"] {
    --bg: #0e1513;
    --surface: #1a2120;
    --surface-2: #242b2a;
    --border: #3a4442;
    --text: #dde4e1;
    --muted: #a9b4b0;
    --brand: #82d5c8;
    --brand-dark: #9ef2e4;
    --on-brand: #003731;
    --link: #82d5c8;
    --selected: #334b47;
    --on-selected: #cce8e2;
    --avatar: #005048;
    --on-avatar: #9ef2e4;
    --focus: rgba(130, 213, 200, .28);
    --good: #6fdc8c;
    --good-bg: #12331f;
    --warn: #f5c04a;
    --warn-bg: #3a2c0c;
    --bad: #ffb4ab;
    --bad-bg: #4a1a17;
    --info-bg: #1f3531;
    --input-bg: #1a2120;
    --input-border: #56615e;
    --badge-bg: #2f3836;
    --badge-text: #c3cdc9;
    color-scheme: dark;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 Roboto, "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; font-weight: 600; margin: 0; }
h1 small { font-size: .9rem; font-weight: 500; }
h2 { font-size: 1.05rem; font-weight: 600; margin: 0 0 .75rem; }
small, .muted { color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.neg { color: var(--bad); }
.pos { color: var(--good); }
.nowrap { white-space: nowrap; }

/* Layout */
.shell { display: flex; min-height: 100vh; }

/* Side panel: brand at the top, menu, signed-in user at the bottom */
.sidebar {
    width: 264px; flex: none; display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh;
    background: var(--surface); border-right: 1px solid var(--border);
}
.sidebar .brand { display: flex; align-items: center; gap: .75rem; padding: 1.25rem 1.1rem 1rem; }
.sidebar .brand img { max-width: 56px; max-height: 44px; border-radius: 8px; flex: none; }
.sidebar .brand strong { display: block; font-size: .95rem; font-weight: 700; line-height: 1.25; }
.sidebar .brand small { display: block; font-size: .8rem; }
.brand-mark { display: grid; place-items: center; flex: none; background: var(--brand); color: var(--on-brand); }
.brand-mark svg { width: 58%; height: 58%; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.sidebar nav { flex: 1; overflow-y: auto; padding: 0 .65rem .65rem; }
.sidebar nav a {
    display: flex; align-items: center; gap: .85rem; margin: 4px 0; padding: .65rem .75rem;
    border-radius: var(--radius-sm); color: var(--text); font-weight: 500;
}
.sidebar nav a svg { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sidebar nav a:hover { background: var(--surface-2); text-decoration: none; }
.sidebar nav a.active { background: var(--selected); color: var(--on-selected); font-weight: 600; }

.user-tile { display: flex; align-items: center; gap: .35rem; border-top: 1px solid var(--border); padding: .6rem .7rem .6rem 1.1rem; }
.user-tile.active { background: var(--selected); }
.user-tile .who { display: flex; align-items: center; gap: .75rem; flex: 1; min-width: 0; color: var(--text); }
.user-tile .who:hover { text-decoration: none; }
.user-tile .who span { min-width: 0; }
.user-tile strong, .user-tile small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-tile strong { font-size: .9rem; font-weight: 600; }
.user-tile small { font-size: .78rem; }
.avatar { width: 40px; height: 40px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--avatar); color: var(--on-avatar); font-weight: 600; }
.user-tile form { display: flex; }
.icon-btn, .theme-toggle {
    width: 36px; height: 36px; flex: none; display: grid; place-items: center; padding: 0;
    background: none; border: 0; border-radius: 50%; color: var(--muted); cursor: pointer;
}
.icon-btn:hover, .theme-toggle:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg, .theme-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .sun, html[data-theme="dark"] .theme-toggle .moon { display: none; }
html[data-theme="dark"] .theme-toggle .sun { display: block; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content { padding: 1.4rem 1.75rem 3rem; max-width: 1400px; width: 100%; }

/* Tabs for menu entries that group several pages */
.tabs { display: flex; flex-wrap: wrap; gap: .25rem; border-bottom: 1px solid var(--border); padding: .6rem 1.75rem 0; }
.tabs a { padding: .6rem .95rem; color: var(--muted); font-weight: 600; font-size: .92rem; border-bottom: 3px solid transparent; border-radius: 8px 8px 0 0; margin-bottom: -1px; }
.tabs a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.tabs a.active { color: var(--link); border-bottom-color: var(--link); }

.page-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* Cards and grids */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.15rem 1.25rem; margin-bottom: 1.1rem; }
.card.flush { padding: 0; overflow-x: auto; }
.card.flush > h2 { padding: 1rem 1.25rem 0; }
.grid { display: grid; gap: 1.1rem; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .9rem; margin-bottom: 1.1rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .95rem 1.1rem; }
.stat .label { color: var(--muted); font-size: .82rem; }
.stat .value { font-size: 1.4rem; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td { padding: .6rem .85rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .78rem; font-weight: 600; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
tfoot td { font-weight: 600; background: var(--surface-2); border-top: 1px solid var(--border); border-bottom: 0; }
td.empty { text-align: center; color: var(--muted); padding: 1.6rem; }
.detail th { width: 38%; background: none; font-size: .92rem; font-weight: 500; }
.detail tr:last-child th, .detail tr:last-child td { border-bottom: 0; }
.detail tr:hover { background: none; }
tr.total th, tr.total td { font-weight: 700; border-top: 2px solid var(--border); color: var(--text); }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .95rem 1rem; }
.field label { display: block; font-size: .84rem; font-weight: 600; margin-bottom: .3rem; }
.field.wide { grid-column: 1 / -1; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=search], select, textarea {
    width: 100%; padding: .6rem .75rem; border: 1px solid var(--input-border); border-radius: var(--radius-sm); font: inherit; background: var(--input-bg); color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--focus); }
input[readonly] { background: var(--surface-2); }
input[type=checkbox] { accent-color: var(--brand); width: 1rem; height: 1rem; }
textarea { min-height: 76px; resize: vertical; }
.check { display: flex; align-items: center; gap: .5rem; font-weight: 500; font-size: .92rem; }
.error { color: var(--bad); font-size: .84rem; margin: .25rem 0 0; }
fieldset { border: 0; padding: 0; margin: 0 0 1.4rem; }
legend { font-weight: 600; font-size: 1.02rem; padding: 0; margin-bottom: .7rem; }
.filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: end; margin-bottom: 1rem; }
.filters .field { min-width: 140px; }
.filters input, .filters select { width: auto; min-width: 140px; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: .5rem 1.15rem;
    border-radius: var(--radius-sm); border: 1px solid var(--brand); background: var(--brand); color: var(--on-brand);
    font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--brand-dark); border-color: var(--brand-dark); text-decoration: none; }
.btn.secondary { background: transparent; color: var(--link); border-color: var(--input-border); }
.btn.secondary:hover { background: var(--info-bg); border-color: var(--input-border); }
.btn.danger { background: transparent; color: var(--bad); border-color: var(--input-border); }
.btn.danger:hover { background: var(--bad-bg); border-color: var(--bad); }
.btn.small { min-height: 30px; padding: .15rem .7rem; font-size: .82rem; font-weight: 500; border-radius: 8px; }
.linklike { background: none; border: 0; padding: 0; color: var(--link); font: inherit; cursor: pointer; }
.linklike:hover { text-decoration: underline; }
.inline { display: inline; }

/* Badges and alerts */
.badge { display: inline-block; padding: .1rem .65rem; border-radius: 999px; font-size: .76rem; font-weight: 600; background: var(--badge-bg); color: var(--badge-text); white-space: nowrap; }
.badge.issued, .badge.paid, .badge.accepted { background: var(--good-bg); color: var(--good); }
.badge.reissued, .badge.partial, .badge.sent, .badge.quoted { background: var(--info-bg); color: var(--link); }
.badge.refunded, .badge.unpaid, .badge.expired { background: var(--warn-bg); color: var(--warn); }
.badge.void, .badge.cancelled, .badge.rejected, .badge.inactive { background: var(--bad-bg); color: var(--bad); }
.alert { padding: .75rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; }
.alert.ok { background: var(--good-bg); color: var(--good); }
.alert.err { background: var(--bad-bg); color: var(--bad); }
.alert ul { margin: 0; padding-left: 1.1rem; }
.note { background: var(--info-bg); border-radius: var(--radius-sm); padding: .7rem .95rem; margin-bottom: 1rem; font-size: .92rem; }

/* Pagination */
.pagination { display: flex; justify-content: space-between; align-items: center; padding: .7rem .9rem; gap: 1rem; flex-wrap: wrap; border-top: 1px solid var(--border); }
.pagination .pages { display: flex; gap: .3rem; }

/* Agency logo and name across the top of the dashboard and reports */
.agency-banner { display: flex; align-items: center; gap: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .95rem 1.25rem; margin-bottom: 1.1rem; }
.agency-banner img { max-height: 72px; max-width: 200px; flex: none; }
.agency-banner strong { display: block; font-size: 1.25rem; line-height: 1.3; }

/* Small bar chart on the dashboard */
.bars { display: flex; align-items: flex-end; gap: .7rem; height: 150px; padding-top: .5rem; }
.bars .bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; font-size: .75rem; color: var(--muted); }
.bars .bar i { display: block; width: 100%; max-width: 46px; background: var(--brand); border-radius: 6px 6px 0 0; min-height: 2px; }
.bars .bar b { font-weight: 600; color: var(--text); font-size: .74rem; }

/* Login: teal brand panel beside the sign-in form */
.login { min-height: 100vh; display: flex; }
.login-brand {
    flex: 1; display: grid; place-items: center; padding: 3.5rem; color: #fff;
    background: linear-gradient(135deg, #00796b, #004d40);
}
.login-brand > div { max-width: 460px; }
.login-brand .logo { display: block; max-width: 200px; max-height: 96px; border-radius: 12px; background: #fff; padding: 6px; }
.login-brand .brand-mark { background: rgba(255, 255, 255, .16); color: #fff; }
.login-brand h1 { font-size: 2.2rem; line-height: 1.2; margin: 1.75rem 0 .75rem; }
.login-brand p { font-size: 1.05rem; line-height: 1.4; margin: 0 0 2.25rem; color: rgba(255, 255, 255, .85); }
.login-brand ul { list-style: none; margin: 0; padding: 0; }
.login-brand li { display: flex; align-items: center; gap: .9rem; margin-bottom: 1rem; }
.login-brand li span { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 10px; background: rgba(255, 255, 255, .14); }
.login-brand li svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.login-form { flex: 1; display: grid; place-items: center; padding: 1.5rem; position: relative; }
.login-form .theme-toggle { position: absolute; top: 1rem; right: 1rem; }
.login-form form { width: 100%; max-width: 380px; }
.login-form h2 { font-size: 1.5rem; margin-bottom: .2rem; }
.login-form .field { margin-top: 1rem; }
.login-form .btn { width: 100%; min-height: 48px; margin-top: 1.25rem; }
.login-form .mobile-brand { display: none; align-items: center; gap: .75rem; margin-bottom: 1.5rem; font-weight: 700; }
.login-form .mobile-brand img { max-height: 44px; max-width: 120px; }
.login.plain { display: grid; place-items: center; padding: 1rem; }
.login.plain .card { width: 100%; max-width: 420px; }

@media (max-width: 900px) {
    .shell { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: static; border-right: 0; border-bottom: 1px solid var(--border); }
    .sidebar .brand { padding: .8rem 1rem .5rem; }
    .sidebar nav { display: flex; flex-wrap: wrap; gap: .2rem; padding: 0 .6rem .5rem; overflow: visible; }
    .sidebar nav a { margin: 0; padding: .4rem .65rem; gap: .45rem; font-size: .9rem; }
    .sidebar nav a svg { width: 18px; height: 18px; }
    .user-tile { padding: .4rem .7rem .4rem 1rem; }
    .avatar { width: 32px; height: 32px; }
    .content { padding: 1rem; }
    .tabs { padding: .4rem .6rem 0; }
    .login-brand { display: none; }
    .login-form .mobile-brand { display: flex; }
}

@media print {
    .sidebar, .tabs, .no-print, .filters, .pagination { display: none !important; }
    /* Paper is always light, whatever the screen is set to. */
    html[data-theme="dark"] {
        --bg: #fff; --surface: #fff; --surface-2: #f3f7f6; --border: #d3dcd9; --text: #171d1b; --muted: #56615e; --link: #00695c;
        --good: #14803c; --good-bg: #e3f5e9; --warn: #a15c00; --warn-bg: #fdf0d8; --bad: #b3261e; --bad-bg: #fde8e6; --info-bg: #dcf0ec;
        --badge-bg: #e6ecea; --badge-text: #3f4946; color-scheme: light;
    }
    body { background: #fff; font-size: 12px; }
    .content { padding: 0; max-width: none; }
    .card, .stat { border-color: #999; border-radius: 6px; break-inside: avoid; }
    .agency-banner { border: 0; border-bottom: 2px solid #333; border-radius: 0; padding: 0 0 .6rem; }
    a { color: inherit; }
}

/* Flights table on the ticket form */
.segments td { padding: .35rem .3rem; vertical-align: middle; }
.segments select, .segments input { min-width: 120px; }
.segments input[type=datetime-local] { min-width: 185px; }
