/*
 * Dentaland design system
 * ---------------------------------------------------------------------
 * A small, self-contained set of tokens and components for the clinic
 * workspace and the patient portal. Everything is prefixed `dl-` so it can
 * sit alongside the Bootstrap-based screens that have not been rebuilt yet
 * without either one bleeding into the other.
 *
 * Built mobile-first; touch targets are never smaller than 44px, because
 * most of this is used on a tablet with gloves on.
 */

:root {
    --dl-primary: #2563eb;
    --dl-primary-dark: #1d4ed8;
    --dl-primary-soft: #eff4ff;
    --dl-accent: #0d9488;
    --dl-accent-soft: #ecfdf9;

    --dl-bg: #f5f7fb;
    --dl-surface: #ffffff;
    --dl-surface-alt: #f8fafc;
    --dl-border: #e4e9f2;
    --dl-border-strong: #cbd5e1;

    --dl-text: #0f172a;
    --dl-text-muted: #64748b;
    --dl-text-faint: #94a3b8;

    --dl-success: #059669;
    --dl-success-soft: #e7f7f1;
    --dl-warning: #b45309;
    --dl-warning-soft: #fdf3e3;
    /* A true orange, not the amber of --dl-warning: at 3px of border width
       that amber is too close to --dl-danger to tell apart at a glance,
       which is the one thing the status colours exist to do. */
    --dl-progress: #ea580c;
    --dl-danger: #dc2626;
    --dl-danger-soft: #fdeded;
    --dl-info: #0369a1;
    --dl-info-soft: #e8f4fc;

    --dl-radius-sm: 8px;
    --dl-radius: 14px;
    --dl-radius-lg: 20px;

    --dl-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --dl-shadow: 0 4px 16px rgba(15, 23, 42, 0.07);
    --dl-shadow-lg: 0 18px 44px rgba(15, 23, 42, 0.16);

    --dl-sidebar-width: 248px;
    --dl-topbar-height: 64px;
    --dl-tap: 44px;

    --dl-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* ------------------------------------------------------------------ base */

body.dl-body {
    margin: 0;
    background: var(--dl-bg);
    color: var(--dl-text);
    font-family: var(--dl-font);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

.dl-body a { color: var(--dl-primary); text-decoration: none; }
.dl-body a:hover { color: var(--dl-primary-dark); text-decoration: none; }
.dl-body h1, .dl-body h2, .dl-body h3, .dl-body h4, .dl-body h5 {
    margin: 0;
    font-weight: 650;
    letter-spacing: -0.015em;
    color: var(--dl-text);
}
.dl-body h1 { font-size: 1.5rem; }
.dl-body h2 { font-size: 1.25rem; }
.dl-body h3 { font-size: 1.05rem; }
.dl-body p { margin: 0 0 0.75rem; }

.dl-muted { color: var(--dl-text-muted); }
.dl-faint { color: var(--dl-text-faint); }
.dl-small { font-size: 0.82rem; }
.dl-tiny { font-size: 0.74rem; }
.dl-strong { font-weight: 650; }
.dl-mono-num { font-variant-numeric: tabular-nums; }
.dl-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-uppercase { text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.72rem; font-weight: 700; color: var(--dl-text-muted); }

/* ----------------------------------------------------------------- shell */

.dl-shell { min-height: 100vh; }

.dl-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--dl-sidebar-width);
    background: var(--dl-surface);
    border-right: 1px solid var(--dl-border);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    overflow-y: auto;
}

.dl-sidebar.is-open { transform: translateX(0); box-shadow: var(--dl-shadow-lg); }

.dl-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 1rem 1.1rem;
    border-bottom: 1px solid var(--dl-border);
    min-height: var(--dl-topbar-height);
}

.dl-sidebar-brand-name {
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dl-nav { padding: 0.85rem 0.7rem; display: flex; flex-direction: column; gap: 0.15rem; flex: 1; }

.dl-nav-label { padding: 0.9rem 0.6rem 0.35rem; }

.dl-nav-link {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    min-height: var(--dl-tap);
    padding: 0.6rem 0.75rem;
    border-radius: var(--dl-radius-sm);
    color: var(--dl-text-muted) !important;
    font-weight: 550;
    transition: background 0.15s ease, color 0.15s ease;
}

.dl-nav-link i { width: 1.15rem; text-align: center; font-size: 0.95rem; }
.dl-nav-link:hover { background: var(--dl-surface-alt); color: var(--dl-text) !important; }
.dl-nav-link.is-active { background: var(--dl-primary-soft); color: var(--dl-primary-dark) !important; font-weight: 650; }

.dl-nav-badge {
    margin-left: auto;
    background: var(--dl-danger-soft);
    color: var(--dl-danger);
    border-radius: 999px;
    padding: 0.05rem 0.45rem;
    font-size: 0.72rem;
    font-weight: 700;
}

.dl-main { min-height: 100vh; display: flex; flex-direction: column; }

.dl-topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-height: var(--dl-topbar-height);
    padding: 0.6rem 0.9rem;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--dl-border);
}

.dl-content { flex: 1; padding: 1rem 0.9rem 5.5rem; }

.dl-icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--dl-tap);
    height: var(--dl-tap);
    border-radius: var(--dl-radius-sm);
    border: 1px solid transparent;
    background: transparent;
    color: var(--dl-text-muted);
    font-size: 1rem;
    cursor: pointer;
}
.dl-icon-button:hover { background: var(--dl-surface-alt); color: var(--dl-text); }

.dl-scrim {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.42);
    z-index: 1030;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.dl-scrim.is-open { opacity: 1; pointer-events: auto; }

/* Bottom navigation replaces the sidebar on phones. */
.dl-tabbar {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 1035;
    display: flex;
    background: var(--dl-surface);
    border-top: 1px solid var(--dl-border);
    padding-bottom: env(safe-area-inset-bottom);
}

.dl-tabbar a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    min-height: 58px;
    color: var(--dl-text-faint) !important;
    font-size: 0.7rem;
    font-weight: 600;
}
.dl-tabbar a i { font-size: 1.05rem; }
.dl-tabbar a.is-active { color: var(--dl-primary) !important; }

/* ----------------------------------------------------------------- cards */

.dl-card {
    background: var(--dl-surface);
    border: 1px solid var(--dl-border);
    border-radius: var(--dl-radius);
    box-shadow: var(--dl-shadow-sm);
}

/* A title on the left, the card's actions on the right — until the two do
   not fit, which on a phone is most of the time. Without wrapping, the
   actions cannot shrink (a `.dl-btn` is nowrap by design) and the last
   button is pushed straight out through the side of the card: at 360px
   the photos card lost 15px of its button, at 320px 55px. Wrapping drops
   the actions under the title instead. */
.dl-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.95rem 1.05rem;
    border-bottom: 1px solid var(--dl-border);
}

/* And when the actions themselves are several, they wrap among each other
   rather than as one indivisible block. */
.dl-card-head > .dl-row { flex-wrap: wrap; }

.dl-card-body { padding: 1.05rem; }
.dl-card-body.is-tight { padding: 0.65rem; }
.dl-card-foot { padding: 0.85rem 1.05rem; border-top: 1px solid var(--dl-border); background: var(--dl-surface-alt); border-radius: 0 0 var(--dl-radius) var(--dl-radius); }

.dl-stack { display: flex; flex-direction: column; gap: 1rem; }
.dl-stack.is-tight { gap: 0.55rem; }
.dl-row { display: flex; align-items: center; gap: 0.7rem; }
.dl-row.is-wrap { flex-wrap: wrap; }
.dl-spacer { flex: 1; }

.dl-grid { display: grid; gap: 0.85rem; grid-template-columns: 1fr; }
.dl-grid.is-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* Two of something that is itself a card, rather than two form fields.
   A pair of date and category inputs is perfectly readable in half a
   phone's width; a card is not — at 320px each column is about 140px, and
   the buttons inside end up wider than the card holding them. These stack
   until there is room for two. */
.dl-grid.is-cards { grid-template-columns: 1fr; }

/* --------------------------------------------------------------- buttons */

.dl-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: var(--dl-tap);
    padding: 0.55rem 1.05rem;
    border-radius: var(--dl-radius-sm);
    border: 1px solid var(--dl-border-strong);
    background: var(--dl-surface);
    color: var(--dl-text) !important;
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
    white-space: nowrap;
}
.dl-btn:hover { background: var(--dl-surface-alt); }
.dl-btn:active { transform: translateY(1px); }
.dl-btn[disabled] { opacity: 0.55; cursor: not-allowed; }

.dl-btn.is-primary { background: var(--dl-primary); border-color: var(--dl-primary); color: #fff !important; }
.dl-btn.is-primary:hover { background: var(--dl-primary-dark); border-color: var(--dl-primary-dark); }
.dl-btn.is-accent { background: var(--dl-accent); border-color: var(--dl-accent); color: #fff !important; }
.dl-btn.is-danger { background: var(--dl-surface); border-color: var(--dl-danger); color: var(--dl-danger) !important; }
.dl-btn.is-danger:hover { background: var(--dl-danger-soft); }
.dl-btn.is-ghost { border-color: transparent; background: transparent; }
.dl-btn.is-ghost:hover { background: var(--dl-surface-alt); }
.dl-btn.is-block { width: 100%; }
.dl-btn.is-sm { min-height: 36px; padding: 0.3rem 0.7rem; font-size: 0.82rem; }
.dl-btn.is-lg { min-height: 52px; font-size: 1rem; padding: 0.7rem 1.4rem; }

/* Big, thumb-sized entry points for the four things done most often. */
.dl-quick-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.65rem; }

.dl-quick-action {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0.9rem;
    min-height: 92px;
    padding: 0.9rem;
    border-radius: var(--dl-radius);
    border: 1px solid var(--dl-border);
    background: var(--dl-surface);
    color: var(--dl-text) !important;
    font-weight: 650;
    box-shadow: var(--dl-shadow-sm);
    transition: transform 0.08s ease, box-shadow 0.15s ease;
}
.dl-quick-action:hover { box-shadow: var(--dl-shadow); transform: translateY(-1px); }
.dl-quick-action i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--dl-primary-soft);
    color: var(--dl-primary);
    font-size: 0.95rem;
}
.dl-quick-action.is-accent i { background: var(--dl-accent-soft); color: var(--dl-accent); }

/* The same entry points on a screen that is mostly information: one row of
   compact buttons instead of four tiles. Actions stay reachable without
   spending a third of the first screenful on them, which is what the
   patient record needs — the dentist came here to read, not to click. */
.dl-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; }

.dl-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 46px;
    padding: 0.4rem 0.7rem;
    border-radius: var(--dl-radius-sm);
    border: 1px solid var(--dl-border);
    background: var(--dl-surface);
    box-shadow: var(--dl-shadow-sm);
    color: var(--dl-text) !important;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 650;
    cursor: pointer;
    min-width: 0;
}
.dl-action:hover { background: var(--dl-surface-alt); border-color: var(--dl-border-strong); }
.dl-action i { color: var(--dl-primary); font-size: 0.88rem; flex: none; }
.dl-action span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-action.is-accent i { color: var(--dl-accent); }

/* -------------------------------------------------------- overview cards */

/* Denser than a normal card: a small label, then the answer. Used where
   several cards sit together and the title is a caption rather than a
   heading. */
.dl-card.is-compact .dl-card-head {
    padding: 0.75rem 0.9rem 0.4rem;
    border-bottom: 0;
}
.dl-card.is-compact .dl-card-body { padding: 0 0.9rem 0.85rem; }
.dl-card.is-compact .dl-card-foot { padding: 0.55rem 0.9rem; }

.dl-card-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--dl-text-muted);
}
.dl-card-value { font-size: 1.05rem; font-weight: 700; line-height: 1.25; }

/* A text action that is clearly secondary to the card's content. */
.dl-btn.is-link {
    min-height: 32px;
    padding: 0.2rem 0.4rem;
    border-color: transparent;
    background: none;
    color: var(--dl-primary) !important;
    font-size: 0.82rem;
}
.dl-btn.is-link:hover { background: var(--dl-primary-soft); }

/* Two lines of a clinical note, enough to recognise it without opening it. */
.dl-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* The most recent photos, small, as a way into the gallery. */
.dl-photo-strip { display: flex; gap: 0.4rem; }
.dl-photo-strip img,
.dl-photo-strip .dl-photo-more {
    width: 54px;
    height: 54px;
    border-radius: 10px;
    object-fit: cover;
    background: var(--dl-surface-alt);
    border: 1px solid var(--dl-border);
    flex: none;
}
.dl-photo-strip .dl-photo-more {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--dl-text-muted);
}

/* ---------------------------------------------------------------- badges */

.dl-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 650;
    background: var(--dl-surface-alt);
    color: var(--dl-text-muted);
    border: 1px solid var(--dl-border);
    white-space: nowrap;
}
.dl-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.dl-badge.is-plain::before { display: none; }
.dl-badge.is-scheduled { background: var(--dl-info-soft); color: var(--dl-info); border-color: transparent; }
.dl-badge.is-confirmed { background: var(--dl-accent-soft); color: var(--dl-accent); border-color: transparent; }
.dl-badge.is-completed { background: var(--dl-success-soft); color: var(--dl-success); border-color: transparent; }
.dl-badge.is-cancelled { background: var(--dl-surface-alt); color: var(--dl-text-muted); border-color: transparent; }
.dl-badge.is-no_show { background: var(--dl-warning-soft); color: var(--dl-warning); border-color: transparent; }
.dl-badge.is-danger { background: var(--dl-danger-soft); color: var(--dl-danger); border-color: transparent; }
.dl-badge.is-active { background: var(--dl-success-soft); color: var(--dl-success); border-color: transparent; }
.dl-badge.is-invited { background: var(--dl-info-soft); color: var(--dl-info); border-color: transparent; }
.dl-badge.is-expired,
.dl-badge.is-revoked,
.dl-badge.is-disabled { background: var(--dl-warning-soft); color: var(--dl-warning); border-color: transparent; }

/* --------------------------------------------------------------- avatars */

.dl-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 50%;
    background: var(--dl-primary-soft);
    color: var(--dl-primary-dark);
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.02em;
}
.dl-avatar.is-lg { width: 64px; height: 64px; flex-basis: 64px; font-size: 1.2rem; }
.dl-avatar.is-sm { width: 34px; height: 34px; flex-basis: 34px; font-size: 0.72rem; }

/* ----------------------------------------------------------------- stats */

.dl-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.65rem; }

.dl-stat {
    padding: 0.85rem 0.95rem;
    background: var(--dl-surface);
    border: 1px solid var(--dl-border);
    border-radius: var(--dl-radius);
    box-shadow: var(--dl-shadow-sm);
}
.dl-stat-value { font-size: 1.55rem; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.dl-stat-label { font-size: 0.76rem; font-weight: 600; color: var(--dl-text-muted); }
.dl-stat.is-success .dl-stat-value { color: var(--dl-success); }
.dl-stat.is-warning .dl-stat-value { color: var(--dl-warning); }
.dl-stat.is-danger .dl-stat-value { color: var(--dl-danger); }
.dl-stat.is-primary .dl-stat-value { color: var(--dl-primary); }

/* ---------------------------------------------------------------- lists */

.dl-list { display: flex; flex-direction: column; }
.dl-list > * + * { border-top: 1px solid var(--dl-border); }

.dl-list-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem 1.05rem;
    min-height: 62px;
    color: var(--dl-text) !important;
}
a.dl-list-item:hover { background: var(--dl-surface-alt); }
.dl-list-item-main { min-width: 0; flex: 1; }
.dl-list-item-title { font-weight: 650; }

/* --------------------------------------------------------- appointments */

.dl-appointment {
    display: flex;
    align-items: stretch;
    gap: 0.85rem;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--dl-border);
    border-radius: var(--dl-radius);
    background: var(--dl-surface);
    color: var(--dl-text) !important;
    box-shadow: var(--dl-shadow-sm);
    min-height: 72px;
}
a.dl-appointment:hover { border-color: var(--dl-border-strong); box-shadow: var(--dl-shadow); }

.dl-appointment-time {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 0 0 62px;
    border-right: 1px solid var(--dl-border);
    padding-right: 0.7rem;
}
.dl-appointment-time strong { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.dl-appointment-body { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 0.2rem; }
.dl-appointment.is-completed { background: var(--dl-surface-alt); }
.dl-appointment.is-cancelled { opacity: 0.62; }
.dl-appointment.is-next { border-color: var(--dl-primary); box-shadow: 0 0 0 3px var(--dl-primary-soft); }

/* ------------------------------------------------------------- calendar */

.dl-calendar-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.9rem;
}

.dl-segment {
    display: inline-flex;
    background: var(--dl-surface);
    border: 1px solid var(--dl-border);
    border-radius: var(--dl-radius-sm);
    overflow: hidden;
}
.dl-segment a {
    min-height: var(--dl-tap);
    display: inline-flex;
    align-items: center;
    padding: 0 0.95rem;
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--dl-text-muted) !important;
}
.dl-segment a + a { border-left: 1px solid var(--dl-border); }
.dl-segment a.is-active { background: var(--dl-primary); color: #fff !important; }

/*
 * The day timeline.
 *
 * One grid row per bookable slot, all of them the same height, so an
 * appointment spanning four rows is visibly four times an appointment
 * spanning one. Nothing is stacked in document order and nothing is drawn
 * to fill the space between two cards — the empty rows *are* the gap.
 *
 * Column one is the hour gutter, column two everything else. Items in
 * column two share a cell when they overlap, which booking prevents but
 * older data still contains; --dl-lane / --dl-lanes tile them side by side
 * instead of on top of each other.
 */
.dl-dayline {
    --dl-slot-height: 46px;
    --dl-gutter: 52px;
    --dl-gutter-gap: 0.6rem;
    position: relative;
    display: grid;
    grid-template-columns: var(--dl-gutter) minmax(0, 1fr);
    /* Every row is placed explicitly by the view, so they are all implicit
       rows — sizing them here is what makes height mean duration. */
    grid-auto-rows: var(--dl-slot-height);
    column-gap: var(--dl-gutter-gap);
    padding: 0.35rem 0.5rem 0.35rem 0;
    border-radius: var(--dl-radius-sm);
    background: var(--dl-surface-alt);
}

/*
 * The ruler: a hairline on every slot, on its own layer so it starts where
 * the appointments do and never runs through an hour label. Everything
 * else in the grid sits above it.
 */
.dl-dayline::before {
    content: '';
    position: absolute;
    inset: 0.35rem 0.5rem 0.35rem calc(var(--dl-gutter) + var(--dl-gutter-gap));
    pointer-events: none;
    background-image: repeating-linear-gradient(
        to bottom,
        var(--dl-border) 0,
        var(--dl-border) 1px,
        transparent 1px,
        transparent var(--dl-slot-height)
    );
}

.dl-dayline > * { position: relative; }

.dl-dayline-time {
    grid-column: 1;
    padding-top: 0.1rem;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.2;
    color: var(--dl-text-faint);
    font-variant-numeric: tabular-nums;
    text-align: right;
}
/* Every fourth label — the full hours — carries the eye down the day. */
.dl-dayline-time:nth-child(4n + 1) { color: var(--dl-text-muted); font-weight: 700; }

.dl-dayline-item,
.dl-dayline > .dl-slot-free,
.dl-dayline > .dl-slot-open,
.dl-dayline > .dl-slot-busy {
    grid-column: 2;
    /* Lanes only ever differ from 1 on legacy double bookings. */
    width: calc((100% - (var(--dl-lanes, 1) - 1) * 4px) / var(--dl-lanes, 1));
    margin-left: calc(var(--dl-lane, 0) * (100% + 4px) / var(--dl-lanes, 1));
}

.dl-dayline-item { min-width: 0; padding: 2px 0; }

/* ------------------------------------------------------ timeline cards */

/*
 * Mostly white, one thin accent, one dot, one word — all three taking the
 * same colour from --dl-tl-accent, so the status can be read off the left
 * edge of a column of cards without reading any of them.
 *
 * Four states, four hues, nothing else coloured: green still to come,
 * orange happening now, blue done, red did not happen.
 */
.dl-tl-card {
    position: relative;
    display: flex;
    height: 100%;
    min-height: 42px;
    overflow: hidden;
    padding: 0.45rem 0.7rem 0.45rem calc(0.7rem + 3px);
    border: 1px solid var(--dl-border);
    border-radius: var(--dl-radius-sm);
    background: var(--dl-surface);
    color: var(--dl-text) !important;
    box-shadow: var(--dl-shadow-sm);
    --dl-tl-accent: var(--dl-success);
}
/* The accent is a pseudo-element rather than a left border, because a 3px
   border under a 8px radius renders as a curve — a parenthesis down the
   side of the card instead of the straight bar this wants. */
.dl-tl-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--dl-tl-accent);
}
.dl-tl-card.is-upcoming { --dl-tl-accent: var(--dl-success); }
.dl-tl-card.is-now { --dl-tl-accent: var(--dl-progress); }
.dl-tl-card.is-done { --dl-tl-accent: var(--dl-info); }
.dl-tl-card.is-off { --dl-tl-accent: var(--dl-danger); }

/* A finished visit is still worth seeing, but it is no longer anything to
   act on — so it keeps its blue and gives up its lift. */
.dl-tl-card.is-done { box-shadow: none; }

.dl-tl-card:hover { border-color: var(--dl-border-strong); box-shadow: var(--dl-shadow); }
.dl-tl-card:active { background: var(--dl-surface-alt); }

.dl-tl-body { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; width: 100%; }

.dl-tl-head { display: flex; align-items: baseline; gap: 0.5rem; min-width: 0; }
.dl-tl-time { font-weight: 700; font-size: 0.85rem; font-variant-numeric: tabular-nums; flex: none; }
.dl-tl-name {
    font-weight: 600;
    font-size: 0.9rem;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dl-tl-status {
    display: inline-flex;
    align-items: center;
    gap: 0.32rem;
    flex: none;
    font-size: 0.72rem;
    font-weight: 650;
    white-space: nowrap;
    color: var(--dl-tl-accent);
}
.dl-tl-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex: none;
}

.dl-tl-meta {
    display: flex;
    gap: 0.35rem;
    min-width: 0;
    font-size: 0.78rem;
    color: var(--dl-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* Phones get the four things that matter — time, name, type, status — and
   nothing else. The rest is one tap away on the patient. */
.dl-tl-staff,
.dl-tl-duration { display: none; }
.dl-tl-staff::before { content: '· '; }

/* A card one slot tall has room for a single line — the label is dropped
   there rather than clipped mid-word. */
.dl-tl-card.is-short { padding-top: 0.35rem; padding-bottom: 0.35rem; align-items: center; }

/*
 * A week column is a seventh of the screen: too narrow for the status word
 * (the dot says it instead), and too narrow to keep the name on the same
 * line as the time without cutting it down to an initial. So the name gets
 * a line of its own, which is the one thing nobody can read around.
 */
.dl-tl-card.is-compact { min-height: 52px; }
.dl-tl-card.is-compact .dl-tl-status-label { display: none; }
.dl-tl-card.is-compact .dl-tl-status { margin-left: auto; }
.dl-tl-card.is-compact .dl-tl-head { flex-wrap: wrap; gap: 0 0.35rem; }
/* Ordered so the dot rides beside the time on the first line and the name
   takes the second, rather than being pushed onto a third. */
.dl-tl-card.is-compact .dl-tl-name { order: 3; flex: 1 0 100%; font-size: 0.84rem; }
.dl-tl-card.is-compact .dl-tl-staff { display: none; }

.dl-slot-free {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    width: 100%;
    min-height: var(--dl-tap);
    padding: 0.4rem 0.7rem;
    border: 1px dashed var(--dl-border-strong);
    border-radius: var(--dl-radius-sm);
    background: transparent;
    color: var(--dl-text-faint);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}
.dl-slot-free:hover { border-color: var(--dl-primary); border-style: solid; color: var(--dl-primary); background: var(--dl-primary-soft); }
.dl-slot-free:active { background: var(--dl-primary-soft); }
/* The timeline sizes its own rows, so the tap target comes from the row
   height rather than from a minimum that would overflow a 15-minute slot. */
.dl-dayline > .dl-slot-free { min-height: 0; height: calc(100% - 4px); margin-top: 2px; }

/* A slot that is taken. For a viewer who may see the appointment this never
   renders; for a scoped viewer it is all they get — the time reads as
   occupied, at its true length, without naming who is in it. */
.dl-slot-busy {
    min-height: 34px;
    display: flex;
    align-items: center;
    border-radius: var(--dl-radius-sm);
    background: repeating-linear-gradient(
        45deg,
        var(--dl-surface-alt),
        var(--dl-surface-alt) 6px,
        var(--dl-border) 6px,
        var(--dl-border) 7px
    );
}
.dl-slot-busy-label {
    padding: 0 0.6rem;
    font-size: 0.76rem;
    font-weight: 650;
    color: var(--dl-text-muted);
}
.dl-dayline > .dl-slot-busy { height: calc(100% - 4px); margin-top: 2px; }

/* The same open slot, for a role that cannot book it: shown, not tappable. */
.dl-slot-open {
    display: flex;
    align-items: center;
    min-height: 34px;
    padding: 0 0.6rem;
    font-size: 0.76rem;
    color: var(--dl-text-faint);
}

.dl-weekgrid { display: grid; grid-template-columns: 1fr; gap: 0.7rem; }
.dl-weekday-head { display: flex; align-items: baseline; justify-content: space-between; padding: 0 0.2rem 0.4rem; }

.dl-monthgrid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.dl-monthgrid-head { font-size: 0.7rem; font-weight: 700; color: var(--dl-text-faint); text-align: center; text-transform: uppercase; padding-bottom: 0.3rem; }
.dl-monthday {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    min-height: 62px;
    border-radius: var(--dl-radius-sm);
    border: 1px solid var(--dl-border);
    background: var(--dl-surface);
    color: var(--dl-text) !important;
    font-weight: 600;
}
.dl-monthday.is-outside { opacity: 0.42; }
.dl-monthday.is-today { border-color: var(--dl-primary); background: var(--dl-primary-soft); }
.dl-monthday-count { font-size: 0.7rem; font-weight: 700; color: var(--dl-primary); }
.dl-monthday-count.is-busy { color: var(--dl-text-faint); font-size: 1.1rem; line-height: 0.6; }

/* ----------------------------------------------------------------- tabs */

.dl-tabs {
    display: flex;
    gap: 0.35rem;
    overflow-x: auto;
    scrollbar-width: none;
    border-bottom: 1px solid var(--dl-border);
    margin-bottom: 1rem;
}
.dl-tabs::-webkit-scrollbar { display: none; }
.dl-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-height: var(--dl-tap);
    padding: 0 0.9rem;
    border-bottom: 2px solid transparent;
    color: var(--dl-text-muted) !important;
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    background: none;
    border-top: 0; border-left: 0; border-right: 0;
    font-family: inherit;
    cursor: pointer;
}
.dl-tab.is-active { color: var(--dl-primary) !important; border-bottom-color: var(--dl-primary); }
.dl-tab-count { font-size: 0.72rem; color: var(--dl-text-faint); font-weight: 700; }
.dl-tabpanel[hidden] { display: none; }

/* ---------------------------------------------------------------- forms */

.dl-field { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 0.85rem; }
.dl-label { font-size: 0.8rem; font-weight: 650; color: var(--dl-text-muted); }

.dl-input,
.dl-select,
.dl-textarea {
    width: 100%;
    min-height: var(--dl-tap);
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--dl-border-strong);
    border-radius: var(--dl-radius-sm);
    background: var(--dl-surface);
    color: var(--dl-text);
    font-family: inherit;
    font-size: 16px; /* keeps iOS from zooming on focus */
}
.dl-textarea { min-height: 92px; resize: vertical; }
.dl-input:focus,
.dl-select:focus,
.dl-textarea:focus {
    outline: none;
    border-color: var(--dl-primary);
    box-shadow: 0 0 0 3px var(--dl-primary-soft);
}
.dl-input::placeholder { color: var(--dl-text-faint); }

.dl-check { display: flex; align-items: center; gap: 0.6rem; min-height: var(--dl-tap); font-weight: 550; cursor: pointer; }
.dl-check input { width: 20px; height: 20px; accent-color: var(--dl-primary); }

.dl-error { color: var(--dl-danger); font-size: 0.8rem; font-weight: 600; }
.dl-input.has-error,
.dl-select.has-error,
.dl-textarea.has-error { border-color: var(--dl-danger); }
.dl-required { color: var(--dl-danger); font-weight: 700; }
.dl-hint { font-size: 0.78rem; color: var(--dl-text-faint); }

/* Long forms split into labelled groups. One column on phones so every
   field gets the full width; two from tablet up. */
.dl-fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.dl-fieldset + .dl-fieldset { margin-top: 1.5rem; }
.dl-fieldset-legend {
    display: block;
    width: 100%;
    float: none;
    padding: 0 0 0.45rem;
    margin-bottom: 0.9rem;
    border-bottom: 1px solid var(--dl-border);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--dl-text-muted);
}
.dl-fieldset-legend i { color: var(--dl-primary); margin-right: 0.45rem; }

.dl-formgrid { display: grid; grid-template-columns: 1fr; column-gap: 0.9rem; }
.dl-formgrid > .is-full { grid-column: 1 / -1; }

/* Stacked and full-width on phones, right-aligned in a row from tablet up. */
.dl-form-actions { display: flex; flex-direction: column-reverse; gap: 0.6rem; }
.dl-form-actions .dl-btn { width: 100%; justify-content: center; }

/* Role picker: tappable cards rather than a <select>, so the meaning of
   each role is readable at the moment of choosing it. */
.dl-rolepicker { display: grid; grid-template-columns: 1fr; gap: 0.55rem; }
.dl-roleoption {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--dl-border-strong);
    border-radius: var(--dl-radius-sm);
    background: var(--dl-surface);
    cursor: pointer;
    margin: 0;
}
.dl-roleoption:hover { border-color: var(--dl-primary); }
.dl-roleoption input { width: 20px; height: 20px; margin-top: 0.1rem; flex: none; accent-color: var(--dl-primary); }
.dl-roleoption input:disabled { cursor: not-allowed; }
.dl-roleoption:has(input:checked) { border-color: var(--dl-primary); background: var(--dl-primary-soft); }
.dl-roleoption:has(input:disabled) { opacity: 0.5; cursor: not-allowed; }
.dl-roleoption.is-selected { border-color: var(--dl-primary); background: var(--dl-primary-soft); }
.dl-roleoption-body { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.dl-roleoption-title { font-weight: 650; }
.dl-roleoption-desc { font-size: 0.8rem; color: var(--dl-text-muted); }

/* Any table wide enough to overflow scrolls inside its own box, so the
   page body never scrolls sideways on a phone. */
.dl-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.dl-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.dl-table th,
.dl-table td { padding: 0.55rem 0.7rem; text-align: left; border-bottom: 1px solid var(--dl-border); white-space: nowrap; }
.dl-table th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--dl-text-muted); font-weight: 700; }
.dl-table tbody tr:last-child td { border-bottom: 0; }

.dl-search { position: relative; flex: 1; }
.dl-search i { position: absolute; left: 0.8rem; top: 50%; transform: translateY(-50%); color: var(--dl-text-faint); font-size: 0.85rem; }
.dl-search .dl-input { padding-left: 2.1rem; }

.dl-suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 30;
    background: var(--dl-surface);
    border: 1px solid var(--dl-border);
    border-radius: var(--dl-radius-sm);
    box-shadow: var(--dl-shadow-lg);
    max-height: 280px;
    overflow-y: auto;
}
.dl-suggestions:empty { display: none; }
.dl-suggestion {
    display: flex;
    flex-direction: column;
    width: 100%;
    text-align: left;
    padding: 0.6rem 0.85rem;
    min-height: var(--dl-tap);
    border: 0;
    background: none;
    font-family: inherit;
    cursor: pointer;
    color: var(--dl-text) !important;
}
.dl-suggestion:hover, .dl-suggestion.is-active { background: var(--dl-primary-soft); }

/* Time-slot picker: a wrap of big, tappable times. */
.dl-slots { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.dl-slot-pill {
    min-height: var(--dl-tap);
    min-width: 74px;
    padding: 0.4rem 0.85rem;
    border-radius: var(--dl-radius-sm);
    border: 1px solid var(--dl-border-strong);
    background: var(--dl-surface);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
}
.dl-slot-pill:hover { border-color: var(--dl-primary); color: var(--dl-primary); }
.dl-slot-pill.is-selected { background: var(--dl-primary); border-color: var(--dl-primary); color: #fff; }

/* --------------------------------------------------------------- modals */

.dl-modal {
    position: fixed;
    inset: 0;
    z-index: 1060;
    display: none;
    align-items: flex-end;
    justify-content: center;
}
.dl-modal.is-open { display: flex; }
.dl-modal-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.45); }

.dl-modal-panel {
    position: relative;
    width: 100%;
    max-height: 92vh;
    overflow-y: auto;
    background: var(--dl-surface);
    border-radius: var(--dl-radius-lg) var(--dl-radius-lg) 0 0;
    box-shadow: var(--dl-shadow-lg);
    padding-bottom: env(safe-area-inset-bottom);
    animation: dl-sheet-in 0.2s ease;
}
@keyframes dl-sheet-in { from { transform: translateY(14px); opacity: 0.6; } to { transform: none; opacity: 1; } }

.dl-modal-head {
    position: sticky;
    top: 0;
    background: var(--dl-surface);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1.1rem 0.75rem;
    border-bottom: 1px solid var(--dl-border);
}
.dl-modal-body { padding: 1.05rem 1.1rem; }
.dl-modal-foot {
    position: sticky;
    bottom: 0;
    display: flex;
    gap: 0.6rem;
    padding: 0.85rem 1.1rem;
    background: var(--dl-surface);
    border-top: 1px solid var(--dl-border);
}
.dl-modal-foot .dl-btn { flex: 1; }

/* --------------------------------------------------------------- photos */

.dl-photo-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.7rem; }

.dl-photo {
    position: relative;
    display: block;
    border-radius: var(--dl-radius);
    overflow: hidden;
    background: var(--dl-surface);
    border: 1px solid var(--dl-border);
    box-shadow: var(--dl-shadow-sm);
    cursor: pointer;
    padding: 0;
    width: 100%;
    text-align: left;
}
.dl-photo img { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; background: var(--dl-surface-alt); }
.dl-photo-meta { padding: 0.55rem 0.65rem; }
.dl-photo-visible {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(15, 23, 42, 0.72);
    color: #fff;
    border-radius: 999px;
    padding: 0.1rem 0.5rem;
    font-size: 0.68rem;
    font-weight: 700;
}
.dl-photo.is-selected { outline: 3px solid var(--dl-primary); outline-offset: -3px; }

.dl-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1080;
    display: none;
    flex-direction: column;
    background: rgba(2, 6, 23, 0.96);
}
.dl-lightbox.is-open { display: flex; }
.dl-lightbox-head { display: flex; align-items: center; gap: 0.6rem; padding: 0.6rem 0.8rem; color: #e2e8f0; }
.dl-lightbox-head .dl-icon-button { color: #e2e8f0; }
.dl-lightbox-head .dl-icon-button:hover { background: rgba(255,255,255,0.12); color: #fff; }
.dl-lightbox-stage { flex: 1; display: flex; align-items: center; justify-content: center; overflow: auto; padding: 0.5rem; }
.dl-lightbox-stage img { max-width: 100%; max-height: 100%; object-fit: contain; transition: transform 0.2s ease; touch-action: pan-x pan-y; }
.dl-lightbox-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; padding: 0.7rem 0.9rem calc(0.7rem + env(safe-area-inset-bottom)); color: #cbd5e1; }

/* Before/current comparison: side by side when there is room, a drag
   slider when there is not. */
.dl-compare { display: grid; grid-template-columns: 1fr; gap: 0.7rem; }
.dl-compare figure { margin: 0; }
.dl-compare img { width: 100%; border-radius: var(--dl-radius); border: 1px solid var(--dl-border); }

.dl-compare-slider {
    position: relative;
    width: 100%;
    border-radius: var(--dl-radius);
    overflow: hidden;
    touch-action: none;
    user-select: none;
    background: #000;
}
.dl-compare-slider img { display: block; width: 100%; }
.dl-compare-slider .dl-compare-top { position: absolute; inset: 0; overflow: hidden; width: 50%; }
.dl-compare-slider .dl-compare-top img { position: absolute; inset: 0; width: auto; height: 100%; max-width: none; }
.dl-compare-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 3px;
    background: #fff;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.25);
}
.dl-compare-handle::after {
    content: '\f337';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    color: var(--dl-text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

/* ------------------------------------------------------------- sharing */

.dl-share-status {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 1.4rem 0;
    color: var(--dl-text-muted);
    font-size: 0.9rem;
}

.dl-share-preview {
    display: block;
    width: 100%;
    max-height: 200px;
    object-fit: contain;
    border-radius: 12px;
    background: var(--dl-surface-alt);
    margin-bottom: 0.9rem;
}

/* The field stays selectable rather than being a copy-only button: on a
   browser that refuses the clipboard API, reading the link out of the
   input is the fallback. */
.dl-share-link { display: flex; gap: 0.5rem; }
.dl-share-link .dl-input { flex: 1; min-width: 0; font-size: 0.82rem; }
.dl-share-link .dl-btn { flex: 0 0 auto; }

.dl-share-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; }
.dl-share-actions .dl-btn { width: 100%; }

.dl-share-warning {
    margin: 0.9rem 0 0;
    padding: 0.6rem 0.7rem;
    border-radius: 10px;
    background: var(--dl-surface-alt);
}

/* ------------------------------------------------------------- timeline */

.dl-timeline { position: relative; padding-left: 1.75rem; }
.dl-timeline::before { content: ''; position: absolute; left: 12px; top: 6px; bottom: 6px; width: 2px; background: var(--dl-border); }
.dl-timeline-item { position: relative; padding: 0 0 1.1rem; }
.dl-timeline-item::before {
    content: '';
    position: absolute;
    left: -1.75rem;
    top: 4px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--dl-primary-soft);
    border: 2px solid var(--dl-surface);
}
.dl-timeline-item i {
    position: absolute;
    left: -1.75rem;
    top: 4px;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--dl-primary);
    font-size: 0.72rem;
}
.dl-timeline-date { font-size: 0.76rem; font-weight: 700; color: var(--dl-text-faint); }

/* The kind of event is readable from the colour of its dot before any of
   the text is read: appointments blue, photos teal, notes amber. */
.dl-timeline-item.is-photo::before { background: var(--dl-accent-soft); }
.dl-timeline-item.is-photo i { color: var(--dl-accent); }
.dl-timeline-item.is-note::before { background: var(--dl-warning-soft); }
.dl-timeline-item.is-note i { color: var(--dl-warning); }

/* Everything past the first few events is folded away until asked for. */
.dl-timeline-item.is-folded { display: none; }
.dl-timeline.is-open .dl-timeline-item.is-folded { display: block; }

/* -------------------------------------------------------------- notices */

.dl-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.75rem 0.95rem;
    border-radius: var(--dl-radius-sm);
    font-weight: 550;
    font-size: 0.9rem;
    background: var(--dl-success-soft);
    color: var(--dl-success);
    margin-bottom: 1rem;
}
.dl-alert.is-danger { background: var(--dl-danger-soft); color: var(--dl-danger); }
.dl-alert.is-info { background: var(--dl-info-soft); color: var(--dl-info); }
.dl-alert ul { margin: 0; padding-left: 1.1rem; }

.dl-empty { text-align: center; padding: 2.25rem 1rem; color: var(--dl-text-muted); }
.dl-empty i { font-size: 1.6rem; color: var(--dl-text-faint); margin-bottom: 0.6rem; display: block; }
.dl-empty h5 { margin-bottom: 0.3rem; }

.dl-skeleton {
    background: linear-gradient(90deg, var(--dl-surface-alt) 25%, #eef2f7 37%, var(--dl-surface-alt) 63%);
    background-size: 400% 100%;
    animation: dl-shimmer 1.3s ease infinite;
    border-radius: var(--dl-radius-sm);
    min-height: 16px;
}
@keyframes dl-shimmer { from { background-position: 100% 50%; } to { background-position: 0 50%; } }

.dl-pagination { display: flex; justify-content: center; padding-top: 1rem; }
.dl-pagination .pagination { margin: 0; }

/* ------------------------------------------------------------- tablet + */

@media (min-width: 700px) {
    .dl-content { padding: 1.4rem 1.5rem 2rem; }
    .dl-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .dl-quick-actions { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    /* Four across only where the labels still fit without truncating. */
    .dl-actions { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .dl-photo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .dl-grid.is-2 { gap: 1.1rem; }
    .dl-grid.is-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem; }
    .dl-formgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 1.1rem; }
    .dl-form-actions { flex-direction: row; justify-content: flex-end; }
    .dl-form-actions .dl-btn { width: auto; }
    .dl-rolepicker { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .dl-table th,
    .dl-table td { white-space: normal; }
    .dl-compare { grid-template-columns: 1fr 1fr; }
    .dl-weekgrid { grid-template-columns: repeat(7, minmax(0, 1fr)); align-items: start; }
    .dl-monthday { min-height: 84px; }
    /* More room per slot once there is a mouse or a tablet-sized screen,
       and the two lines a phone leaves out. */
    .dl-dayline { --dl-slot-height: 52px; grid-template-columns: 58px minmax(0, 1fr); column-gap: 0.85rem; }
    .dl-dayline-time { font-size: 0.8rem; }
    .dl-tl-card { padding: 0.55rem 0.85rem 0.55rem 0.75rem; }
    .dl-tl-time { font-size: 0.9rem; }
    .dl-tl-name { font-size: 0.95rem; }
    .dl-tl-status { font-size: 0.74rem; }
    .dl-tl-staff { display: inline; }
    .dl-tl-duration { display: block; font-size: 0.72rem; color: var(--dl-text-faint); }
    .dl-tl-card.is-compact .dl-tl-duration { display: none; }
    .dl-modal { align-items: center; padding: 1.5rem; }
    .dl-modal-panel { max-width: 560px; border-radius: var(--dl-radius-lg); }
    .dl-modal-panel.is-wide { max-width: 860px; }
}

/* ------------------------------------------------------------ desktop + */

@media (min-width: 992px) {
    .dl-sidebar { transform: none; box-shadow: none; }
    .dl-main { margin-left: var(--dl-sidebar-width); }
    .dl-content { padding: 1.6rem 2rem 2.5rem; }
    .dl-tabbar { display: none; }
    .dl-scrim { display: none; }
    .dl-menu-toggle { display: none; }
    .dl-photo-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .dl-layout-split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); gap: 1.25rem; align-items: start; }
    .dl-layout-split.is-reverse { grid-template-columns: minmax(320px, 1fr) minmax(0, 2fr); }
}

@media (min-width: 1400px) {
    .dl-content { padding: 1.8rem 2.75rem 3rem; }
}

@media print {
    .dl-sidebar, .dl-topbar, .dl-tabbar, .dl-quick-actions { display: none !important; }
    .dl-main { margin-left: 0; }
}

/* ---------------------------------------------------------------- portal */

/*
 * The patient portal reuses the same tokens and components; it only needs a
 * different chrome — no sidebar, a branded header, and a tab bar that stays
 * visible on every screen size.
 */
.dl-portal-main { min-height: 100vh; display: flex; flex-direction: column; }

.dl-portal-header {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1rem;
    background: var(--dl-surface);
    border-bottom: 1px solid var(--dl-border);
}

.dl-portal-content { flex: 1; padding: 1rem 1rem 5.5rem; max-width: 760px; width: 100%; margin: 0 auto; }

.dl-portal-hero {
    background: linear-gradient(135deg, var(--dl-primary) 0%, var(--dl-accent) 100%);
    color: #fff;
    border-radius: var(--dl-radius-lg);
    padding: 1.25rem;
}
.dl-portal-hero h1 { color: #fff; font-size: 1.35rem; }
.dl-portal-hero .dl-portal-hero-meta { color: rgba(255, 255, 255, 0.86); }

.dl-portal-auth {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background: var(--dl-bg);
}
.dl-portal-auth-card { width: 100%; max-width: 420px; }

.dl-portal-clinic {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.9rem 1.05rem;
    border-top: 1px solid var(--dl-border);
}

@media (min-width: 992px) {
    .dl-portal-content { padding-bottom: 2.5rem; }
    .dl-tabbar.is-portal { display: flex; }
}

/* ----------------------------------------------------------- public site */

/*
 * The landing page on the bare domain. It reuses the tokens above so the
 * marketing page and the product read as one thing, but none of the
 * workspace chrome — there is no company here and nobody signed in.
 *
 * Mobile-first like the rest: one column until 900px, where the hero and
 * the grids split.
 */

/*
 * The workspace gets border-box from the Bootstrap bundle it loads; this
 * page loads no Bootstrap, so without this every padded full-width row is
 * wider than the screen by exactly its own padding. Scoped to the site so
 * it cannot reach the app.
 */
.dl-site,
.dl-site *,
.dl-site *::before,
.dl-site *::after { box-sizing: border-box; }

.dl-site-shell { width: 100%; max-width: 1140px; margin: 0 auto; padding: 0 1.1rem; }

.dl-site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--dl-border);
}
.dl-site-header-inner {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    padding-block: 0.5rem;
    min-height: var(--dl-topbar-height);
}

.dl-site-brand {
    display: inline-flex;
    align-items: center;
    /* 44px of height to tap even though the wordmark itself is shorter. */
    min-height: var(--dl-tap);
    flex: none;
}
/* A stacked lockup: mark above wordmark. It needs more height than a
   horizontal one before the wordmark under it is legible at all. */
.dl-site-brand img { display: block; width: auto; height: 40px; }
.dl-site-brand picture { display: block; }

/*
 * The section links. They used to be hidden outright below 900px, which
 * left a phone with no way to reach Features / How it works / Contact at
 * all. Instead they drop to their own full-width row under the header and
 * scroll sideways if they have to — still one tap, never a burger menu for
 * three links.
 */
.dl-site-nav {
    display: flex;
    order: 3;
    width: 100%;
    gap: 1.1rem;
    overflow-x: auto;
    scrollbar-width: none;
    border-top: 1px solid var(--dl-border);
    padding-top: 0.15rem;
}
.dl-site-nav::-webkit-scrollbar { display: none; }
.dl-site-nav a {
    display: inline-flex;
    align-items: center;
    min-height: var(--dl-tap);
    white-space: nowrap;
    color: var(--dl-text-muted) !important;
    font-weight: 550;
    font-size: 0.9rem;
}
.dl-site-nav a:hover { color: var(--dl-text) !important; }

.dl-site-header-actions { display: flex; align-items: center; gap: 0.6rem; margin-left: auto; }

.dl-site-langs { display: inline-flex; border: 1px solid var(--dl-border); border-radius: var(--dl-radius-sm); overflow: hidden; }
.dl-site-langs a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.6rem;
    min-width: 40px;
    min-height: var(--dl-tap);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--dl-text-faint) !important;
}
.dl-site-langs a + a { border-left: 1px solid var(--dl-border); }
.dl-site-langs a:hover { background: var(--dl-surface-alt); color: var(--dl-text) !important; }
.dl-site-langs a.is-active { background: var(--dl-primary-soft); color: var(--dl-primary-dark) !important; }

.dl-site-hero { background: linear-gradient(180deg, var(--dl-primary-soft) 0%, var(--dl-bg) 100%); padding: 2.5rem 0 2rem; }
.dl-site-hero-inner { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2rem; align-items: center; }
.dl-site-hero-copy h1 { font-size: 2rem; line-height: 1.18; margin: 0 0 0.75rem; }

.dl-site-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 1rem;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    background: var(--dl-surface);
    border: 1px solid var(--dl-border);
    color: var(--dl-primary-dark);
    font-size: 0.76rem;
    font-weight: 650;
}

.dl-site-lead { color: var(--dl-text-muted); font-size: 1.02rem; line-height: 1.6; margin: 0; }
.dl-site-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.4rem; }
.dl-btn.is-lg { min-height: 52px; padding: 0 1.5rem; font-size: 0.98rem; }

/* The screenshot is the product, so it is framed like a window rather than
   bled to the edge — a cropped screenshot reads as decoration. */
.dl-site-shot { margin: 0; }
.dl-site-shot img {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    border-radius: var(--dl-radius);
    border: 1px solid var(--dl-border);
    box-shadow: var(--dl-shadow-lg);
    background: var(--dl-surface);
}

.dl-site-section { padding: 3rem 0; }
.dl-site-section.is-alt { background: var(--dl-surface); border-block: 1px solid var(--dl-border); }
.dl-site-heading { max-width: 620px; margin-bottom: 2rem; }
.dl-site-heading h2 { font-size: 1.6rem; margin-bottom: 0.5rem; }

.dl-site-grid { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); }

.dl-site-card {
    padding: 1.25rem;
    border: 1px solid var(--dl-border);
    border-radius: var(--dl-radius);
    background: var(--dl-surface);
    box-shadow: var(--dl-shadow-sm);
}
.dl-site-card h3 { font-size: 1rem; margin-bottom: 0.35rem; }
.dl-site-card p { margin: 0; color: var(--dl-text-muted); font-size: 0.92rem; line-height: 1.6; }
.dl-site-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin-bottom: 0.85rem;
    border-radius: var(--dl-radius-sm);
    background: var(--dl-primary-soft);
    color: var(--dl-primary);
    font-size: 1rem;
}

.dl-site-steps { display: grid; gap: 1.25rem; margin: 0; padding: 0; list-style: none; grid-template-columns: minmax(0, 1fr); }
.dl-site-step { display: flex; gap: 0.9rem; align-items: flex-start; }
.dl-site-step h3 { font-size: 1rem; margin-bottom: 0.25rem; }
.dl-site-step p { margin: 0; color: var(--dl-text-muted); font-size: 0.92rem; line-height: 1.6; }
.dl-site-step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--dl-primary);
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
}

.dl-site-plans { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); align-items: start; }
.dl-site-plan {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1.4rem;
    border: 1px solid var(--dl-border);
    border-radius: var(--dl-radius);
    background: var(--dl-surface);
    box-shadow: var(--dl-shadow-sm);
}
.dl-site-plan.is-featured { border-color: var(--dl-primary); box-shadow: 0 0 0 3px var(--dl-primary-soft); }
.dl-site-plan h3 { font-size: 1.05rem; }
.dl-site-price { margin: 0.35rem 0 0.5rem; display: flex; align-items: baseline; gap: 0.4rem; }
.dl-site-price strong { font-size: 1.5rem; letter-spacing: -0.02em; }
.dl-site-plan-features { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; flex-direction: column; gap: 0.45rem; }
.dl-site-plan-features li { display: flex; align-items: flex-start; gap: 0.5rem; font-size: 0.86rem; color: var(--dl-text-muted); }
.dl-site-plan-features i { color: var(--dl-success); font-size: 0.78rem; margin-top: 0.25rem; }
.dl-site-plan .dl-btn { margin-top: auto; }

.dl-site-cta { padding: 3rem 0; background: var(--dl-surface); border-top: 1px solid var(--dl-border); }
.dl-site-cta-inner { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.25rem; align-items: center; }
.dl-site-cta h2 { font-size: 1.5rem; margin-bottom: 0.4rem; }

.dl-site-footer { padding: 1.5rem 0; border-top: 1px solid var(--dl-border); background: var(--dl-bg); }
.dl-site-footer-inner { display: flex; flex-wrap: wrap; gap: 0.6rem; justify-content: space-between; align-items: center; }
.dl-site-footer-inner a { display: inline-flex; align-items: center; min-height: var(--dl-tap); }

@media (min-width: 700px) {
    .dl-site-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dl-site-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .dl-site-plans { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .dl-site-hero { padding: 3.5rem 0 3rem; }
    .dl-site-hero-copy h1 { font-size: 2.5rem; }
    .dl-site-section { padding: 4rem 0; }
    .dl-site-cta-inner { grid-template-columns: minmax(0, 1fr) auto; }
}

@media (min-width: 900px) {
    .dl-site-nav { order: 0; width: auto; margin-left: 1.5rem; border-top: 0; padding-top: 0; overflow: visible; }
    .dl-site-brand img { height: 48px; }
    .dl-site-hero-inner { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 3rem; }
    .dl-site-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .dl-site-hero-copy h1 { font-size: 2.8rem; }
}
