/*
 * Admin + client portal — "ledger" theme.
 * Warm paper surface, forest-green ink, amber as the single accent,
 * mono figures for anything that reads like a number or a code.
 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --green:   #0c501a;
    --green-d: #083810;
    --green-l: #e6f2ea;
    --amber:   #FFB400;
    --amber-l: #fff6dc;
    --navy:    #0a1628;
    --navy-2:  #111f36;
    --ink:     #0d1f12;
    --muted:   #5a6b60;
    --rule:    #dbe5dd;
    --rule-2:  #c6d6ca;
    --surf:    #f3f5f0;
    --paper:   #fbfbf8;
    --red:     #b3261e;
    --red-l:   #fbecea;
    --blue:    #24539c;
    --blue-l:  #ecf2fb;

    --f-body:    'Instrument Sans', system-ui, sans-serif;
    --f-display: 'Syne', var(--f-body);
    --f-mono:    'IBM Plex Mono', ui-monospace, monospace;

    --r:  10px;
    --r-s: 6px;
    --shadow: 0 1px 0 rgba(13,31,18,0.04), 0 10px 30px -18px rgba(13,31,18,0.28);
    --sb-w: 252px;
    --ease: cubic-bezier(.2,.7,.2,1);
}

html { -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--f-body);
    font-size: 15px;
    line-height: 1.45;
    color: var(--ink);
    min-height: 100vh;
    background-color: var(--surf);
    background-image: radial-gradient(rgba(12,80,26,0.07) 1px, transparent 1px);
    background-size: 22px 22px;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--green); }
::selection { background: var(--amber); color: var(--navy); }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

/* ── Login ── */
.login-wrap {
    min-height: 100vh; min-height: 100dvh;
    display: flex; align-items: center; justify-content: center; padding: 1.25rem;
    background:
        radial-gradient(60rem 40rem at 110% -10%, rgba(12,80,26,0.55), transparent 60%),
        radial-gradient(40rem 30rem at -10% 110%, rgba(255,180,0,0.14), transparent 60%),
        repeating-linear-gradient(0deg, rgba(255,255,255,0.025) 0 1px, transparent 1px 28px),
        var(--navy);
}
.login-card { background: var(--paper); border-radius: 14px; width: 100%; max-width: 400px; overflow: hidden; box-shadow: 0 30px 80px -30px rgba(0,0,0,0.6); animation: rise .5s var(--ease) both; }
.login-head { background: var(--green); padding: 2rem 2rem 1.7rem; position: relative; overflow: hidden; }
.login-head::after { content: ''; position: absolute; left: 2rem; bottom: 0; width: 46px; height: 4px; background: var(--amber); }
.login-head h1 { font-family: var(--f-display); font-size: 1.6rem; font-weight: 800; color: #fff; letter-spacing: -0.01em; }
.login-head p  { font-family: var(--f-mono); font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(255,255,255,0.65); margin-top: 6px; }
.login-body { padding: 1.8rem 2rem 2rem; }
.login-body label { display: block; font-size: 0.8rem; font-weight: 600; margin-bottom: 0.4rem; }
.login-body input[type=password], .login-body input[type=email], .login-body input[type=text] {
    width: 100%; padding: 0.75rem 0.95rem; border: 1.5px solid var(--rule-2); border-radius: var(--r-s);
    font: inherit; font-size: 1rem; margin-bottom: 1rem; background: #fff; transition: border-color .15s, box-shadow .15s;
}
.login-body input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 4px rgba(12,80,26,0.12); }
.login-body label.check-inline { display: flex; align-items: center; gap: 0.5rem; font-weight: 500; }
.login-body label.check-inline input { width: 18px; height: 18px; margin-bottom: 0; accent-color: var(--green); }
.btn-login { width: 100%; background: var(--green); color: #fff; border: none; padding: 0.9rem; border-radius: var(--r-s); font: inherit; font-weight: 700; font-size: 0.95rem; cursor: pointer; transition: background .15s, transform .15s; }
.btn-login:hover { background: var(--green-d); }
.btn-login:active { transform: translateY(1px); }
.login-error { background: var(--red-l); border: 1px solid #ebbcb7; color: #7a1a1a; font-size: 0.84rem; padding: 0.65rem 0.9rem; border-radius: var(--r-s); margin-bottom: 1rem; }

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

.sidebar {
    width: var(--sb-w);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    padding: 1.5rem 0 0;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    z-index: 60;
    color: #fff;
    background:
        linear-gradient(180deg, rgba(12,80,26,0.22), transparent 40%),
        repeating-linear-gradient(0deg, rgba(255,255,255,0.022) 0 1px, transparent 1px 32px),
        var(--navy);
    border-right: 1px solid rgba(255,255,255,0.04);
}

.sb-logo { padding: 0 1.4rem 1.3rem; margin-bottom: 0.6rem; position: relative; }
.sb-logo::after { content: ''; position: absolute; left: 1.4rem; right: 1.4rem; bottom: 0; height: 1px; background: linear-gradient(90deg, rgba(255,180,0,0.6), rgba(255,255,255,0.06) 40%); }
.sb-logo img { height: 34px; filter: brightness(0) invert(1); display: block; }
.sb-logo small { display: block; font-family: var(--f-mono); font-size: 0.62rem; color: var(--amber); letter-spacing: 0.18em; text-transform: uppercase; margin-top: 8px; opacity: 0.85; }

.sb-nav { flex: 1; padding: 0.3rem 0.75rem 1rem; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.15) transparent; }

.sb-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.8rem;
    border-radius: var(--r-s);
    color: rgba(255,255,255,0.62);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background .18s, color .18s, padding .18s;
    margin-bottom: 1px;
}
.sb-link i { width: 16px; text-align: center; font-size: 0.82rem; opacity: 0.8; }
.sb-link:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sb-link.active { background: linear-gradient(90deg, rgba(12,80,26,0.75), rgba(12,80,26,0.25)); color: #fff; }
.sb-link.active::before { content: ''; position: absolute; left: -0.75rem; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: var(--amber); }
.sb-link.active i { color: var(--amber); opacity: 1; }
.sb-link.sb-sub { padding-left: 2.55rem; font-size: 0.82rem; }
.sb-link.sb-sub::after { content: ''; position: absolute; left: 1.3rem; top: 0; height: 50%; width: 0.7rem; border-left: 1px solid rgba(255,255,255,0.18); border-bottom: 1px solid rgba(255,255,255,0.18); border-bottom-left-radius: 4px; }
.sb-sep { height: 1px; background: rgba(255,255,255,0.07); margin: 0.6rem 0.8rem; }
.sb-ext i:last-child { margin-left: auto; font-size: 0.6rem; width: auto; opacity: 0.45; }

.sb-footer { padding: 1rem 1.4rem calc(1rem + env(safe-area-inset-bottom)); border-top: 1px solid rgba(255,255,255,0.07); background: rgba(0,0,0,0.18); }
.sb-user { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 0.8rem; min-width: 0; }
.sb-avatar { width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; background: var(--amber); color: var(--navy); font-family: var(--f-display); font-weight: 800; font-size: 0.85rem; }
.sb-user div { min-width: 0; line-height: 1.3; }
.sb-user strong { display: block; font-size: 0.82rem; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user div span { display: block; font-family: var(--f-mono); font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.1em; color: rgba(255,255,255,0.5); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-footer a { font-size: 0.8rem; color: rgba(255,255,255,0.5); text-decoration: none; display: inline-flex; align-items: center; gap: 0.5rem; transition: color .15s; }
.sb-footer a:hover { color: var(--amber); }

/* Mobile top bar + drawer scrim (hidden on desktop) */
.m-topbar { display: none; }
.sb-scrim { display: none; }
.sb-close { display: none; }

/* ── Main ── */
.main { margin-left: var(--sb-w); flex: 1; min-width: 0; padding: 2.2rem clamp(1.2rem, 3vw, 2.75rem) 4rem; animation: rise .45s var(--ease) both; }

.page-header { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 1.8rem; flex-wrap: wrap; gap: 1rem; padding-bottom: 1.1rem; border-bottom: 1px solid var(--rule); position: relative; }
.page-header::after { content: ''; position: absolute; left: 0; bottom: -1px; width: 56px; height: 3px; background: var(--amber); border-radius: 2px; }
.page-header h1 { font-family: var(--f-display); font-size: clamp(1.4rem, 2.6vw, 1.85rem); font-weight: 800; letter-spacing: -0.015em; line-height: 1.1; }
.page-header > div:not(:first-child), .page-header > .action-btns { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ── Stats ── */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card, .db-tile, .pt-tile, .wt-tile {
    background: #fff; border: 1px solid var(--rule); border-radius: var(--r); padding: 1.1rem 1.25rem; box-shadow: var(--shadow); position: relative; overflow: hidden;
    animation: rise .5s var(--ease) both;
}
.stat-card::before, .db-tile::before, .pt-tile::before, .wt-tile::before { content: ''; position: absolute; left: 0; top: 0; width: 28px; height: 3px; background: var(--amber); }
.stats > :nth-child(2), .db-tiles > :nth-child(2), .pt-tiles > :nth-child(2), .wt-tiles > :nth-child(2) { animation-delay: .05s; }
.stats > :nth-child(3), .db-tiles > :nth-child(3), .pt-tiles > :nth-child(3), .wt-tiles > :nth-child(3) { animation-delay: .1s; }
.stats > :nth-child(4), .db-tiles > :nth-child(4), .pt-tiles > :nth-child(4), .wt-tiles > :nth-child(4) { animation-delay: .15s; }
.stat-card .stat-label { font-family: var(--f-mono); font-size: 0.66rem; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.45rem; }
.stat-card .stat-num   { font-family: var(--f-display); font-size: 2rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.stat-card.s-total    .stat-num { color: var(--ink); }
.stat-card.s-pending  .stat-num { color: #c27f00; }
.stat-card.s-pending::before { background: #c27f00; }
.stat-card.s-approved .stat-num { color: var(--green); }
.stat-card.s-approved::before { background: var(--green); }
.stat-card.s-declined .stat-num { color: var(--red); }
.stat-card.s-declined::before { background: var(--red); }

/* Tile labels across admin dashboards + portal (structure lives in the pages) */
.db-tile small, .pt-tile small, .wt-tile small { font-family: var(--f-mono); font-weight: 500 !important; letter-spacing: 0.12em !important; }
.db-tile strong, .pt-tile strong, .wt-tile strong { font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
/* Big figures stay on one line and shrink to the tile's width (Syne is wide: ~0.75em per digit) */
.db-tile, .pt-tile { container-type: inline-size; }
.db-tile strong, .pt-tile strong { white-space: nowrap; line-height: 1.15; }

/* ── Flash ── */
.flash { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.85rem 1.1rem; border-radius: var(--r-s); font-size: 0.9rem; margin-bottom: 1.5rem; border: 1px solid; border-left-width: 4px; animation: rise .4s var(--ease) both; }
.flash.success { background: var(--green-l); border-color: rgba(12,80,26,0.35); border-left-color: var(--green); color: var(--green-d); }
.flash.error   { background: var(--red-l); border-color: #ebbcb7; border-left-color: var(--red); color: #7a1a1a; }

/* ── Filter tabs ── */
.filter-tabs { display: flex; gap: 0.4rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.filter-tab {
    padding: 0.42rem 0.95rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--muted);
    background: #fff;
    border: 1px solid var(--rule);
    white-space: nowrap;
    transition: background .15s, color .15s, border-color .15s;
}
.filter-tab:hover { border-color: var(--green); color: var(--green); }
.filter-tab.active { background: var(--navy); color: #fff; border-color: var(--navy); box-shadow: inset 0 -2px 0 var(--amber); }

/* ── Table ── */
.table-wrap { background: #fff; border: 1px solid var(--rule); border-radius: var(--r); overflow-x: auto; box-shadow: var(--shadow); -webkit-overflow-scrolling: touch; }
.form-card .table-wrap { box-shadow: none; }

.bookings-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.bookings-table th { background: var(--paper); color: var(--muted); font-family: var(--f-mono); font-size: 0.64rem; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.bookings-table td { padding: 0.85rem 1rem; border-bottom: 1px solid var(--rule); vertical-align: middle; font-variant-numeric: tabular-nums; }
.bookings-table tbody tr:last-child td { border-bottom: none; }
.bookings-table tbody tr { transition: background .12s; }
.bookings-table tbody tr:hover td { background: #f7faf7; }
.bookings-table tfoot td { background: var(--paper); border-top: 1px solid var(--rule-2); border-bottom: none; font-weight: 600; }
.bookings-table td strong { font-weight: 600; }
/* Amounts and dates never wrap: right-aligned cells hold money, .nowrap marks dates and short codes */
.bookings-table td.num, .bookings-table td.db-num, .bookings-table td[style*="text-align:right"], .bookings-table .nowrap { white-space: nowrap; }
.bookings-table th.num, .bookings-table th[style*="text-align:right"] { text-align: right; }

.td-name strong { display: block; color: var(--ink); }
.td-name span   { font-size: 0.78rem; color: var(--muted); }

.action-btns { display: flex; gap: 0.4rem; flex-wrap: wrap; }

/* ── Buttons ── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
    padding: 0.42rem 0.8rem; border-radius: var(--r-s);
    font-family: inherit; font-size: 0.78rem; font-weight: 600; line-height: 1.2;
    border: 1px solid transparent; cursor: pointer; text-decoration: none; white-space: nowrap;
    transition: background .15s, border-color .15s, color .15s, transform .1s, box-shadow .15s;
}
.btn:hover { box-shadow: 0 2px 8px -4px rgba(13,31,18,0.35); }
.btn:active { transform: translateY(1px); }
.btn-view    { background: var(--blue-l); color: var(--blue); border-color: #d3e0f3; }
.btn-view:hover { border-color: var(--blue); }
.btn-approve { background: var(--green-l); color: var(--green); border-color: #cfe4d6; }
.btn-approve:hover { border-color: var(--green); }
.btn-decline, .btn-delete { background: var(--red-l); color: var(--red); border-color: #f2d2ce; }
.btn-decline:hover, .btn-delete:hover { border-color: var(--red); }
.btn-edit    { background: var(--amber-l); color: #8a5600; border-color: #f6e2a9; }
.btn-edit:hover { border-color: #c27f00; }

.btn-cancel, .btn-save {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
    padding: 0.6rem 1.25rem; border-radius: var(--r-s); font-family: inherit; font-size: 0.86rem; font-weight: 600;
    cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, transform .1s, border-color .15s;
}
.btn-cancel { background: #fff; color: var(--muted); border: 1px solid var(--rule-2); }
.btn-cancel:hover { border-color: var(--muted); color: var(--ink); }
.btn-save   { background: var(--green); color: #fff; border: 1px solid var(--green); box-shadow: inset 0 -2px 0 rgba(0,0,0,0.18); }
.btn-save:hover { background: var(--green-d); }
.btn-save:active, .btn-cancel:active { transform: translateY(1px); }

.empty-state { text-align: center; padding: 3.5rem 1.5rem; color: var(--muted); font-size: 0.9rem; }
.empty-state i { font-size: 2.2rem; display: block; margin-bottom: 0.9rem; color: var(--rule-2); }

/* ── Modal ── */
.modal-backdrop { display: none; position: fixed; inset: 0; background: rgba(10,22,40,0.55); backdrop-filter: blur(3px); z-index: 1000; align-items: center; justify-content: center; padding: 1rem; }
.modal-backdrop.open { display: flex; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 580px; max-height: 90vh; overflow-y: auto; box-shadow: 0 40px 80px -30px rgba(0,0,0,0.5); animation: rise .3s var(--ease) both; }
.modal-head { background: var(--navy); color: #fff; padding: 1.1rem 1.4rem; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 1; box-shadow: inset 0 -3px 0 var(--amber); }
.modal-head h2 { font-family: var(--f-display); font-size: 1.05rem; font-weight: 800; }
.modal-close { background: none; border: none; color: rgba(255,255,255,0.7); font-size: 1.2rem; cursor: pointer; width: 36px; height: 36px; border-radius: 50%; }
.modal-close:hover { color: #fff; background: rgba(255,255,255,0.1); }
.modal-body { padding: 1.4rem; }
.modal-body .dl { display: grid; grid-template-columns: 130px 1fr; gap: 0.55rem 1rem; font-size: 0.88rem; }
.modal-body .dl dt { color: var(--muted); font-weight: 600; }
.modal-body .dl dd { color: var(--ink); min-width: 0; overflow-wrap: anywhere; }
.modal-body .dl dd.meet-link a { color: var(--green); word-break: break-all; }

/* ── Forms ── */
.edit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.edit-field { display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; }
.edit-field.full { grid-column: 1 / -1; }
.edit-field label { font-size: 0.76rem; font-weight: 600; color: var(--muted); }
.edit-field input, .edit-field select, .edit-field textarea,
.form-card input[type=text], .form-card input[type=email], .form-card input[type=number], .form-card input[type=date],
.form-card input[type=search], .form-card input[type=url], .form-card input[type=password], .form-card input[type=tel],
.form-card input[type=month], .form-card input[type=time], .form-card select, .form-card textarea {
    padding: 0.58rem 0.8rem; border: 1.5px solid var(--rule-2); border-radius: var(--r-s);
    font-family: inherit; font-size: 0.88rem; color: var(--ink); background: #fff; max-width: 100%;
    transition: border-color .15s, box-shadow .15s;
}
.edit-field input:focus, .edit-field select:focus, .edit-field textarea:focus,
.form-card input:focus, .form-card select:focus, .form-card textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 4px rgba(12,80,26,0.1); }
.edit-field textarea { resize: vertical; min-height: 80px; }
.modal-foot { padding: 1rem 1.4rem; border-top: 1px solid var(--rule); display: flex; justify-content: flex-end; gap: 0.6rem; flex-wrap: wrap; background: var(--paper); position: sticky; bottom: 0; }

/* ── Inline forms in the actions column ── */
.inline-form { display: inline; }

/* ── Focus groups ── */
.fg-list { display: grid; gap: 1rem; }
.fg-card { background: #fff; border: 1px solid var(--rule); border-radius: var(--r); padding: 1.2rem 1.4rem; display: flex; gap: 1.2rem; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; box-shadow: var(--shadow); }
.fg-card.closed { opacity: 0.8; }
.fg-main { flex: 1; min-width: min(260px, 100%); }
.fg-main h3 { font-family: var(--f-display); font-size: 1.08rem; font-weight: 800; }
.fg-client { font-size: 0.8rem; color: var(--muted); margin-top: 2px; }
.fg-meta { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 0.8rem; font-size: 0.8rem; color: var(--muted); }
.fg-meta strong { color: var(--ink); }
.fg-link { display: flex; align-items: center; gap: 0.4rem; margin-top: 0.7rem; font-size: 0.78rem; }
.fg-link input { flex: 1; min-width: 0; max-width: 360px; padding: 0.35rem 0.6rem; border: 1px solid var(--rule); border-radius: var(--r-s); font-family: var(--f-mono); font-size: 0.72rem; color: var(--muted); background: var(--surf); }
.fg-side { display: flex; flex-direction: column; align-items: flex-end; gap: 0.7rem; }

.switch-form { display: flex; align-items: center; gap: 0.6rem; font-size: 0.8rem; font-weight: 600; }
.switch { position: relative; width: 44px; height: 24px; border: none; border-radius: 12px; background: #c9d6ce; cursor: pointer; transition: background 0.2s; flex-shrink: 0; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform 0.2s var(--ease); box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.switch.on { background: var(--green); }
.switch.on::after { transform: translateX(20px); }
.switch:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.switch-label.on { color: var(--green); }
.switch-label.off { color: var(--muted); }

.form-card { background: #fff; border: 1px solid var(--rule); border-radius: var(--r); padding: 1.4rem 1.5rem; margin-bottom: 1.4rem; box-shadow: var(--shadow); min-width: 0; }
.form-card h2 { font-family: var(--f-display); font-size: 1.05rem; font-weight: 800; margin-bottom: 0.35rem; letter-spacing: -0.005em; }
.form-card h3 { font-family: var(--f-display); font-weight: 800; }
.form-card .hint { font-size: 0.82rem; color: var(--muted); margin-bottom: 1rem; line-height: 1.55; }
.edit-field small { font-size: 0.73rem; color: var(--muted); }
.check-inline { display: flex; align-items: center; gap: 0.5rem; font-size: 0.86rem; font-weight: 600; }
.check-inline input { width: 17px; height: 17px; accent-color: var(--green); flex-shrink: 0; }

.q-card { border: 1px solid var(--rule); border-radius: var(--r-s); padding: 1rem; margin-bottom: 0.8rem; background: var(--paper); }
.q-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.7rem; }
.q-num { font-family: var(--f-mono); font-size: 0.68rem; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.q-tools { display: flex; gap: 0.3rem; }
.q-tools button { background: #fff; border: 1px solid var(--rule); border-radius: var(--r-s); width: 32px; height: 32px; cursor: pointer; color: var(--muted); }
.q-tools button:hover { color: var(--ink); border-color: var(--muted); }
.q-tools button.q-remove:hover { color: var(--red); border-color: var(--red); }
.q-options[hidden] { display: none; }
.btn-add { background: var(--green-l); color: var(--green); border: 1.5px dashed rgba(12,80,26,0.5); padding: 0.65rem 1rem; border-radius: var(--r-s); font-family: inherit; font-weight: 600; font-size: 0.84rem; cursor: pointer; width: 100%; transition: background .15s, border-color .15s; }
.btn-add:hover { border-color: var(--green); background: #dcecdf; }
.form-actions { display: flex; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap; }
.form-actions .right { display: flex; gap: 0.6rem; flex-wrap: wrap; }

.fit { display: inline-block; font-family: var(--f-mono); font-size: 0.68rem; font-weight: 500; padding: 3px 8px; border-radius: 4px; white-space: nowrap; }
.fit-high { background: var(--green-l); color: var(--green); }
.fit-mid  { background: var(--amber-l); color: #8a5600; }
.fit-low  { background: var(--red-l); color: var(--red); }
.fit-na   { background: var(--surf); color: var(--muted); }

.answers { list-style: none; display: grid; gap: 0.8rem; margin-top: 1rem; }
.answers li { border-left: 3px solid var(--rule); padding: 0.2rem 0 0.2rem 0.8rem; }
.answers li.yes { border-color: var(--green); }
.answers li.no  { border-color: var(--red); }
.answers .q { font-size: 0.78rem; font-weight: 600; color: var(--muted); }
.answers .a { font-size: 0.9rem; white-space: pre-wrap; margin-top: 2px; }
.answers .tag { font-family: var(--f-mono); font-size: 0.62rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.1em; margin-left: 0.4rem; }
.answers li.yes .tag { color: var(--green); }
.answers li.no .tag  { color: var(--red); }
.respond-box { margin-top: 1.2rem; border-top: 1px solid var(--rule); padding-top: 1rem; }
.respond-box textarea { width: 100%; min-height: 80px; padding: 0.58rem 0.8rem; border: 1.5px solid var(--rule-2); border-radius: var(--r-s); font-family: inherit; font-size: 0.88rem; resize: vertical; }
.respond-box .row { display: flex; gap: 0.5rem; margin-top: 0.6rem; flex-wrap: wrap; }
.back-link { font-family: var(--f-mono); font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); text-decoration: none; display: inline-flex; align-items: center; gap: 0.45rem; margin-bottom: 0.7rem; transition: color .15s, gap .15s; }
.back-link:hover { color: var(--green); gap: 0.65rem; }

/* Two-column detail blocks (invoice / quotation headers) */
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1rem; }

/* Portal status chips */
.pt-status { font-family: var(--f-mono); font-size: 0.64rem; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; padding: 3px 8px; border-radius: 4px; background: var(--surf); color: var(--muted); white-space: nowrap; }
.pt-status.paid, .pt-status.accepted, .pt-status.finalized { background: var(--green-l); color: var(--green); }
.pt-status.overdue, .pt-status.declined { background: var(--red-l); color: var(--red); }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

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

/* ════════════════════════════════════════
   Tablet / phone
   ════════════════════════════════════════ */
@media (max-width: 960px) {
    .shell { display: block; }

    .m-topbar {
        display: flex; align-items: center; gap: 0.75rem;
        position: sticky; top: 0; z-index: 50;
        height: 58px; padding: 0 0.75rem 0 0.5rem; padding-top: env(safe-area-inset-top);
        background: rgba(10,22,40,0.96); backdrop-filter: blur(10px);
        color: #fff; box-shadow: inset 0 -2px 0 var(--amber);
    }
    .m-burger, .sb-close {
        width: 44px; height: 44px; border: 0; border-radius: var(--r-s); background: transparent; color: #fff;
        font-size: 1.1rem; cursor: pointer; display: grid; place-items: center; flex-shrink: 0;
    }
    .m-burger:hover, .sb-close:hover { background: rgba(255,255,255,0.08); }
    .m-topbar img { height: 24px; filter: brightness(0) invert(1); }
    .m-title { margin-left: auto; font-family: var(--f-mono); font-size: 0.66rem; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(255,255,255,0.7); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45vw; }

    .sidebar {
        width: min(300px, 86vw);
        transform: translateX(-102%);
        transition: transform .28s var(--ease), box-shadow .28s;
        padding-top: calc(1.1rem + env(safe-area-inset-top));
    }
    .sb-logo { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
    .sb-close { display: grid; margin-right: -0.6rem; }
    .sb-link { padding: 0.78rem 0.85rem; font-size: 0.95rem; }
    .sb-link.sb-sub { font-size: 0.9rem; }
    body.nav-open { overflow: hidden; }
    body.nav-open .sidebar { transform: none; box-shadow: 20px 0 60px rgba(0,0,0,0.4); }
    .sb-scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(10,22,40,0.5); backdrop-filter: blur(2px); opacity: 0; pointer-events: none; transition: opacity .28s; }
    body.nav-open .sb-scrim { opacity: 1; pointer-events: auto; }

    .main { margin-left: 0; padding: 1.4rem 1rem 3rem; }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
    body { font-size: 14.5px; }
    .page-header { align-items: flex-start; margin-bottom: 1.3rem; }
    .page-header > div:not(:first-child), .page-header > .action-btns, .page-header > a, .page-header > form { width: 100%; }
    .page-header .btn-save, .page-header .btn-cancel { flex: 1 1 auto; }

    .form-card { padding: 1.1rem 1rem; border-radius: var(--r-s); }
    .edit-grid, .two-col { grid-template-columns: minmax(0, 1fr); }
    .edit-field.full { grid-column: 1; }
    .form-actions, .form-actions .right { width: 100%; }
    .form-actions .right > *, .form-actions > .btn-save, .form-actions > .btn-cancel { flex: 1 1 auto; }

    /* 16px inputs stop iOS from zooming on focus */
    .edit-field input, .edit-field select, .edit-field textarea, .form-card input, .form-card select, .form-card textarea, .respond-box textarea { font-size: 16px; }

    .filter-tabs { flex-wrap: nowrap; overflow-x: auto; margin-inline: -1rem; padding: 0 1rem 0.3rem; scrollbar-width: none; }
    .filter-tabs::-webkit-scrollbar { display: none; }

    .fg-side { align-items: stretch; width: 100%; }
    .modal-body .dl { grid-template-columns: minmax(0, 1fr); gap: 0.15rem; }
    .modal-body .dl dd { margin-bottom: 0.5rem; }

    /* Modals become bottom sheets */
    .modal-backdrop { padding: 0; align-items: flex-end; }
    .modal { max-width: none; border-radius: 16px 16px 0 0; max-height: 92dvh; animation-name: sheet; }

    /* Tables flagged by admin.js become stacked cards */
    .bookings-table.is-stack thead { display: none; }
    .bookings-table.is-stack, .bookings-table.is-stack tbody, .bookings-table.is-stack tfoot { display: block; }
    .bookings-table.is-stack tr { display: block; padding: 0.75rem 1rem; border-bottom: 1px solid var(--rule); }
    .bookings-table.is-stack tbody tr:last-child { border-bottom: none; }
    .bookings-table.is-stack tbody tr:hover td { background: none; }
    .bookings-table.is-stack td {
        display: block; position: relative; padding: 0.28rem 0 0.28rem min(40%, 9rem); border: 0; min-height: 1.6rem;
        text-align: left !important; overflow-wrap: anywhere; max-width: none !important; width: auto !important;
    }
    .bookings-table.is-stack td::before { content: attr(data-label); position: absolute; left: 0; top: 0.5rem; width: calc(min(40%, 9rem) - 0.75rem); font-family: var(--f-mono); font-size: 0.6rem; line-height: 1.3; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
    .bookings-table.is-stack td.no-label, .bookings-table.is-stack td.cell-actions { padding-left: 0; }
    .bookings-table.is-stack td.no-label::before { display: none; }
    .bookings-table.is-stack td:first-child:not(.no-label) { font-size: 0.98rem; }
    .bookings-table.is-stack td:first-child:not(.no-label)::before { top: 0.6rem; }
    .bookings-table.is-stack td.cell-empty { display: none; }
    .bookings-table.is-stack td.cell-actions { padding-top: 0.6rem; }
    .bookings-table.is-stack td.cell-actions::before { display: none; }
    .bookings-table.is-stack td.cell-actions .action-btns, .bookings-table.is-stack td.cell-actions { gap: 0.4rem; }
    .bookings-table.is-stack td.cell-actions .btn { padding: 0.55rem 0.85rem; font-size: 0.82rem; }
    .bookings-table.is-stack tfoot tr { background: var(--paper); }
    /* Breakdown lines under a row (over billing, VAT, totals): one compact "label … amount" line */
    .bookings-table.is-stack tr.is-subline { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: 0.45rem 1rem; border-bottom: 1px dashed var(--rule); }
    .bookings-table.is-stack tr.is-subline td { padding: 0; min-height: 0; }
    .bookings-table.is-stack tr.is-subline td::before { display: none; }
    .bookings-table.is-stack tr.is-subline td:empty, .bookings-table.is-stack tr.is-subline td.cell-empty { display: none; }
    .bookings-table.is-stack .empty-state { padding: 2.5rem 1rem; }

    /* Wide editable tables scroll sideways inside their card instead */
    .form-card > table:not(.is-stack), .form-card > div > table:not(.is-stack) { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .bookings-table:not(.is-stack) th, .bookings-table:not(.is-stack) td { padding: 0.65rem 0.7rem; }
    .table-wrap:has(> .bookings-table:not(.is-stack)) { background: linear-gradient(90deg, #fff 30%, transparent), linear-gradient(-90deg, rgba(13,31,18,0.08), transparent 18px) right / 18px 100% no-repeat, #fff; }
}

@media (max-width: 420px) {
    .stats { grid-template-columns: minmax(0, 1fr); }
    .stat-card .stat-num { font-size: 1.7rem; }
    .main { padding-inline: 0.8rem; }
}

@keyframes sheet { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Show/hide password button (admin.js wraps each password field) */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { width: 100%; padding-right: 2.6rem !important; }
.pw-toggle {
    position: absolute; top: 50%; right: 0.35rem; transform: translateY(-50%);
    width: 2rem; height: 2rem; display: grid; place-items: center;
    background: none; border: none; border-radius: var(--r-s); color: var(--muted); cursor: pointer;
}
.pw-toggle:hover { color: var(--ink); }
.pw-toggle:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }

/* Sign-in: confirmation notice and text-style buttons */
.login-status { background: var(--green-l, #e8f3eb); border: 1px solid #b9d9c1; color: #0c501a; font-size: 0.84rem; padding: 0.65rem 0.9rem; border-radius: var(--r-s); margin-bottom: 1rem; }
.link-button { background: none; border: none; padding: 0; font: inherit; font-size: 0.8rem; color: var(--green); text-decoration: underline; cursor: pointer; }
.sb-footer > a { margin-right: 1rem; }
.sb-footer a.active { color: var(--amber); }

/* ════════════════════════════════════════
   List pages (clients, hosting, invoices, timesheets, users)
   ════════════════════════════════════════ */

/* Summary band: the page's key figures, ruled like a ledger header */
.ledger { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 1.4rem; }
.ledger-cell { background: #fff; padding: 1rem 1.25rem 1.05rem; position: relative; min-width: 0; animation: rise .5s var(--ease) both; container-type: inline-size; }
.ledger-cell:nth-child(2) { animation-delay: .04s; }
.ledger-cell:nth-child(3) { animation-delay: .08s; }
.ledger-cell:nth-child(4) { animation-delay: .12s; }
.ledger-cell small { display: flex; align-items: center; gap: 0.45rem; font-family: var(--f-mono); font-size: 0.62rem; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.ledger-cell small::before { content: ''; width: 7px; height: 7px; border-radius: 2px; background: var(--rule-2); flex-shrink: 0; }
.ledger-cell strong { display: block; font-family: var(--f-display); font-size: min(1.55rem, 9cqi); font-weight: 800; line-height: 1.15; margin-top: 0.4rem; white-space: nowrap; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.ledger-cell span { display: block; font-size: 0.76rem; color: var(--muted); margin-top: 0.25rem; }
.ledger-cell.is-good small::before { background: var(--green); }
.ledger-cell.is-good strong { color: var(--green); }
.ledger-cell.is-warn small::before { background: var(--amber); }
.ledger-cell.is-warn strong { color: #9a6200; }
.ledger-cell.is-alert small::before { background: var(--red); }
.ledger-cell.is-alert strong { color: var(--red); }
.ledger-cell.is-quiet strong { color: var(--muted); }

/* Filter tabs + counts, with room for a note on the right */
.list-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; flex-wrap: wrap; margin-bottom: 1rem; }
.list-toolbar .filter-tabs { margin-bottom: 0; }
.list-toolbar .hint { font-size: 0.78rem; color: var(--muted); }
.filter-tab .count { display: inline-block; min-width: 1.4em; margin-left: 0.4rem; padding: 0 0.4em; border-radius: 999px; background: var(--surf); color: var(--muted); font-family: var(--f-mono); font-size: 0.66rem; font-weight: 500; text-align: center; }
.filter-tab.active .count { background: rgba(255,255,255,0.16); color: #fff; }
.filter-tab.is-alert:not(.active) { color: var(--red); }
.filter-tab.is-alert:not(.active) .count { background: var(--red-l); color: var(--red); }

/* Collapsible action panel (e.g. "Invoice timesheets"), closed until needed */
.drawer { background: #fff; border: 1px solid var(--rule); border-radius: var(--r); box-shadow: var(--shadow); margin-bottom: 1.4rem; overflow: hidden; }
.drawer > summary { list-style: none; display: flex; align-items: center; gap: 0.85rem; padding: 0.85rem 1.2rem; cursor: pointer; user-select: none; transition: background .15s; }
.drawer > summary::-webkit-details-marker { display: none; }
.drawer > summary:hover { background: var(--paper); }
.drawer-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--green-l); color: var(--green); flex-shrink: 0; }
.drawer-title { min-width: 0; flex: 1; }
.drawer-title strong { display: block; font-family: var(--f-display); font-size: 0.95rem; font-weight: 800; }
.drawer-title span { display: block; font-size: 0.78rem; color: var(--muted); }
.drawer > summary::after { content: '\f078'; font-family: 'Font Awesome 6 Free'; font-weight: 900; font-size: 0.72rem; color: var(--muted); transition: transform .2s var(--ease); }
.drawer[open] > summary { border-bottom: 1px solid var(--rule); }
.drawer[open] > summary::after { transform: rotate(180deg); }
.drawer-body { padding: 1.2rem; animation: rise .3s var(--ease) both; }
.drawer-body .form-actions { margin-top: 1rem; }

/* Status chips */
.chip { display: inline-flex; align-items: center; gap: 0.4rem; padding: 3px 9px 3px 8px; border-radius: 999px; background: var(--surf); color: var(--muted); font-family: var(--f-mono); font-size: 0.63rem; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; white-space: nowrap; line-height: 1.5; }
.chip::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.chip-green { background: var(--green-l); color: var(--green); }
.chip-blue  { background: var(--blue-l); color: var(--blue); }
.chip-amber { background: var(--amber-l); color: #8a5600; }
.chip-red   { background: var(--red-l); color: var(--red); }
.chip-solid { background: var(--green); color: #fff; }
.chip-plain::before { display: none; }
.chips { display: flex; gap: 0.3rem; flex-wrap: wrap; align-items: center; }

/* Rows */
.bookings-table tr[data-href] { cursor: pointer; }
.bookings-table tr.is-overdue td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.bookings-table tr.is-off td { color: var(--muted); }
.bookings-table tr.is-off .entity strong { color: var(--muted); }
.mono { font-family: var(--f-mono); font-size: 0.82rem; font-weight: 500; letter-spacing: 0.01em; }
.sub { display: block; font-size: 0.75rem; color: var(--muted); margin-top: 2px; font-weight: 400; }
.sub.is-alert { color: var(--red); font-weight: 600; }
.sub.is-good { color: var(--green); }
.amount { font-weight: 600; white-space: nowrap; }

/* A record's name with its code tile or avatar */
.entity { display: flex; align-items: center; gap: 0.8rem; min-width: 0; }
.entity > div { min-width: 0; }
.entity strong { display: block; color: var(--ink); font-weight: 600; }
.entity a { color: inherit; text-decoration: none; }
.entity a:hover { color: var(--green); }
.monogram { width: 40px; height: 40px; border-radius: 9px; flex-shrink: 0; display: grid; place-items: center; background: var(--green); color: #fff; font-family: var(--f-mono); font-size: 0.66rem; font-weight: 600; letter-spacing: 0.04em; box-shadow: inset 0 -3px 0 rgba(0,0,0,0.2); }
.monogram.is-off { background: var(--rule); color: var(--muted); box-shadow: none; }
.monogram-logo { width: 40px; height: 40px; border-radius: 9px; flex-shrink: 0; object-fit: contain; background: #fff; border: 1px solid var(--rule); }
.monogram-logo.is-off { filter: grayscale(1); opacity: 0.6; }
.avatar { width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; background: var(--navy); color: var(--amber); font-family: var(--f-display); font-size: 0.85rem; font-weight: 800; }
.avatar.is-off { background: var(--rule); color: var(--muted); }

/* Quiet secondary actions: icon only, named by aria-label/title */
.btn-icon { width: 32px; height: 32px; padding: 0; background: #fff; color: var(--muted); border-color: var(--rule); }
.btn-icon:hover { color: var(--ink); border-color: var(--muted); }
.btn-icon.is-danger:hover { color: var(--red); border-color: var(--red); background: var(--red-l); }
.action-btns { align-items: center; }
.bookings-table td.cell-actions-end .action-btns { justify-content: flex-end; flex-wrap: nowrap; }

/* Weekday / weekend split of a timesheet's hours */
.hours { display: flex; align-items: baseline; gap: 0.5rem; }
.hours-bar { display: flex; width: 120px; max-width: 100%; height: 6px; border-radius: 3px; background: var(--surf); overflow: hidden; margin-top: 0.4rem; }
.hours-bar i { display: block; height: 100%; }
.hours-bar .wd { background: var(--green); }
.hours-bar .we { background: var(--amber); }
.legend { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.74rem; color: var(--muted); }
.legend::before { content: ''; width: 8px; height: 8px; border-radius: 2px; background: var(--green); }
.legend.we::before { background: var(--amber); }

/* Sign-in history as a compact timeline */
.timeline { list-style: none; background: #fff; border: 1px solid var(--rule); border-radius: var(--r); box-shadow: var(--shadow); padding: 0.4rem 0; }
.timeline li { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr) auto; gap: 1rem; align-items: center; padding: 0.6rem 1.2rem; font-size: 0.84rem; border-bottom: 1px solid var(--rule); }
.timeline li:last-child { border-bottom: 0; }
.timeline time { font-family: var(--f-mono); font-size: 0.72rem; color: var(--muted); }
.timeline .who { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timeline .ip { font-family: var(--f-mono); font-size: 0.7rem; color: var(--muted); margin-left: 0.5rem; }
.section-title { font-family: var(--f-display); font-size: 1.05rem; font-weight: 800; margin: 2rem 0 0.8rem; display: flex; align-items: center; gap: 0.5rem; }
.section-title i { color: var(--green); font-size: 0.9rem; }

@media (max-width: 720px) {
    .ledger { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ledger-cell { padding: 0.85rem 1rem; }
    .list-toolbar { flex-direction: column; align-items: stretch; }
    .list-toolbar .row-hint { display: none; }
    .drawer > summary { padding: 0.8rem 1rem; }
    .drawer-body { padding: 1rem; }
    .bookings-table.is-stack td.cell-actions-end .action-btns { justify-content: flex-start; flex-wrap: wrap; }
    .bookings-table.is-stack .entity { padding-top: 0.1rem; }
    .bookings-table.is-stack tr.is-overdue { box-shadow: inset 3px 0 0 var(--red); }
    .bookings-table.is-stack tr.is-overdue td:first-child { box-shadow: none; }
    .timeline li { grid-template-columns: minmax(0, 1fr) auto; gap: 0.2rem 0.8rem; padding: 0.7rem 1rem; }
    .timeline time { grid-column: 1 / -1; }
}
