/* EgyPrint dashboard home. Namespace: .ep-home.
   Colors come from egyprint-tokens.css (light) and their -dark twins under .dark,
   so the user's theme palette and light/dark switch apply here too. */

/* ---- Page chrome: the widget is the whole page ---- */
.fi-body:has(.ep-home) .fi-header,
.fi-body:has(.ep-home) .fi-page-header {
    display: none !important;
}

.fi-body:has(.ep-home) .fi-wi,
.fi-body:has(.ep-home) .fi-wi-widget,
.fi-body:has(.ep-home) .fi-section,
.fi-body:has(.ep-home) .fi-section-content,
.fi-body:has(.ep-home) .fi-section-content-ctn {
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    outline: none !important;
}

.fi-body:has(.ep-home) .fi-wi-widget,
.fi-body:has(.ep-home) .fi-section-content-ctn {
    padding: 0 !important;
}

.fi-body:has(.ep-home) .fi-page > section {
    row-gap: 0 !important;
}

/* ---- Tokens ---- */
.ep-home {
    --h-bg: rgb(var(--ep-canvas-bg-rgb, 246 247 249));
    --h-surface: rgb(var(--ep-surface-bg-rgb, 255 255 255));
    --h-border: rgb(var(--ep-surface-border-rgb, 226 229 235));
    --h-divider: rgb(var(--ep-divider-rgb, 238 240 244));
    --h-ink: rgb(var(--ep-ink-rgb, 16 24 40));
    --h-muted: rgb(var(--ep-muted-text-rgb, 71 84 103));
    --h-accent: rgb(var(--ep-accent-rgb, 234 88 12));
    --h-link: rgb(194 65 12);
    --h-bar: rgb(214 211 205);
    --h-green: #15803d; --h-green-bg: #dcfce7;
    --h-amber: #b45309; --h-amber-bg: #fef3c7;
    --h-red: #b91c1c; --h-red-bg: #fee2e2;
    --h-blue: #1d4ed8; --h-blue-bg: #dbeafe;
    --h-gray: #3f4552; --h-gray-bg: #eef0f3;

    direction: rtl;
    color: var(--h-ink);
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 4px 0 12px;
    max-width: 88rem;
    width: 100%;
    margin-inline: auto;
    font-variant-numeric: tabular-nums;
}

.dark .ep-home {
    --h-bg: rgb(var(--ep-canvas-bg-dark-rgb, 11 20 36));
    --h-surface: rgb(var(--ep-surface-bg-dark-rgb, 17 28 47));
    --h-border: rgb(var(--ep-surface-border-dark-rgb, 39 51 73));
    --h-divider: rgb(var(--ep-divider-dark-rgb, 30 41 59));
    --h-ink: rgb(var(--ep-section-heading-dark-rgb, 248 250 252));
    --h-muted: rgb(var(--ep-muted-text-dark-rgb, 185 195 211));
    --h-link: rgb(var(--ep-accent-dark-rgb, 251 146 60));
    --h-bar: rgb(58 64 76);
    --h-green: #4ade80; --h-green-bg: rgb(20 83 45 / 0.6);
    --h-amber: #fbbf24; --h-amber-bg: rgb(74 52 16 / 0.8);
    --h-red: #f87171; --h-red-bg: rgb(76 29 29 / 0.8);
    --h-blue: #93c5fd; --h-blue-bg: rgb(30 58 95 / 0.8);
    --h-gray: #c9ced6; --h-gray-bg: rgb(42 47 58);
}

.ep-home [data-tone="green"] { --tone: var(--h-green); --tone-bg: var(--h-green-bg); }
.ep-home [data-tone="amber"] { --tone: var(--h-amber); --tone-bg: var(--h-amber-bg); }
.ep-home [data-tone="red"] { --tone: var(--h-red); --tone-bg: var(--h-red-bg); }
.ep-home [data-tone="blue"] { --tone: var(--h-blue); --tone-bg: var(--h-blue-bg); }
.ep-home [data-tone="gray"] { --tone: var(--h-gray); --tone-bg: var(--h-gray-bg); }

.ep-home a { text-decoration: none; }

/* ---- Head ---- */
.ep-home__head {
    display: grid;
    grid-template-columns: minmax(12rem, 0.7fr) minmax(0, 2.3fr);
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.ep-home-panel { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.ep-home-panel:focus-visible { outline: 2px solid var(--h-link); outline-offset: 4px; }
.ep-home-tabs { display: flex; gap: 0.25rem; overflow-x: auto; border-bottom: 1px solid var(--h-border); scrollbar-width: thin; }
.ep-home-tabs button { flex-shrink: 0; min-height: 2.75rem; padding: 0.625rem 1rem; border-bottom: 2px solid transparent; color: var(--h-muted); font-size: 0.875rem; font-weight: 700; }
.ep-home-tabs button[aria-selected="true"] { color: var(--h-ink); border-bottom-color: var(--h-accent); }
.ep-home-tabs button:hover { background: var(--h-surface); }
.ep-home-tabs button:focus-visible { outline-offset: -3px; }

.ep-home__title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1.3;
}

.ep-home__meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.5rem 0 0;
    font-size: 0.875rem;
    color: var(--h-muted);
}
.ep-home__meta svg { width: 1rem; height: 1rem; }

.ep-home__actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(125px, 1fr));
    width: 100%;
    gap: 8px;
}

.ep-home-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 12px;
    border-radius: 10px;
    border: 1px solid var(--h-border);
    background: var(--h-surface);
    color: var(--h-ink) !important;
    font-weight: 600;
    font-size: 0.8125rem;
}

.ep-home-btn svg { width: 18px; height: 18px; }

.ep-home-btn:hover { border-color: var(--h-muted); }

.ep-home-btn--primary {
    background: color-mix(in srgb, var(--h-accent) 82%, #000);
    border-color: transparent;
    color: #fff !important;
    font-weight: 700;
}

.ep-home-btn--primary:hover { filter: brightness(0.95); border-color: var(--h-accent); }

.ep-home-notice {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    padding: 12px 16px;
    border-radius: 12px;
    background: var(--h-amber-bg);
    color: var(--h-amber);
    font-weight: 600;
}

.ep-home-notice a { color: inherit; font-weight: 800; text-decoration: underline; }

/* ---- Cards ---- */
.ep-home-card {
    background: var(--h-surface);
    border: 1px solid var(--h-border);
    border-radius: 16px;
    padding: 18px 20px;
    min-width: 0;
}

.ep-home-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.ep-home-card__head h2,
.ep-home-work__title {
    margin: 0;
    font-size: 1.0625rem;
    font-weight: 800;
}

.ep-home-card__meta {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--h-muted);
}

.ep-home-card__link,
.ep-home-card__links a {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--h-link) !important;
}

.ep-home-card__links { display: inline-flex; gap: 16px; }

.ep-home-empty {
    margin: 8px 0 0;
    color: var(--h-muted);
    font-size: 0.9375rem;
}
.ep-home-calm { display: flex; align-items: center; gap: 0.75rem; padding-block: 1.5rem; }
.ep-home-calm__icon { width: 1.75rem; height: 1.75rem; flex-shrink: 0; color: var(--h-green); }
.ep-home-calm .ep-home-empty { margin: 0; line-height: 1.8; }
.ep-home :is(a, button, summary):focus-visible { outline: 2px solid var(--h-link); outline-offset: 3px; }
.ep-home .ep-money { max-width: 100%; overflow-wrap: anywhere; }

/* ---- Money cards ---- */
/* Four cards, each with its own tone: an icon chip, the figure, and a note or a 7-day sparkline. */
.ep-home-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
}

.ep-home-kpi {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px 18px;
    overflow: hidden;
    border-radius: 16px;
    border: 1px solid var(--h-border);
    background: var(--h-surface);
    color: var(--h-ink) !important;
    transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

/* A thin tone line along the top edge. */
.ep-home-kpi::before {
    content: '';
    position: absolute;
    inset: 0 0 auto;
    height: 3px;
    background: var(--tone);
    opacity: 0.75;
}

.ep-home-kpi:hover {
    border-color: color-mix(in srgb, var(--tone) 45%, var(--h-border));
    transform: translateY(-1px);
    box-shadow: 0 6px 18px -12px color-mix(in srgb, var(--tone) 60%, transparent);
}

.ep-home-kpi__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.ep-home-kpi__label { font-size: 0.8125rem; font-weight: 700; color: var(--h-muted); }

.ep-home-kpi__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.1rem;
    height: 2.1rem;
    flex-shrink: 0;
    border-radius: 10px;
    background: var(--tone-bg);
    color: var(--tone);
}

.ep-home-kpi__icon svg { width: 1.15rem; height: 1.15rem; }

.ep-home-kpi__value { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.3px; line-height: 1.25; }

.ep-home-kpi__value[data-value-tone="red"] { color: var(--h-red); }

.ep-home-kpi__foot {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 10px;
    min-height: 1.4rem;
}

.ep-home-kpi__note { font-size: 0.8125rem; font-weight: 600; color: var(--tone, var(--h-muted)); }

.ep-home-kpi__note[data-tone="muted"] { color: var(--h-muted); }

.ep-home-spark {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 26px;
    flex-shrink: 0;
    margin-inline-start: auto;
}

.ep-home-spark span {
    width: 6px;
    border-radius: 2px 2px 0 0;
    background: color-mix(in srgb, var(--h-blue) 30%, transparent);
}

.ep-home-spark span.is-today { background: var(--h-blue); }

/* Overview: alerts beside a column with the sales chart and today's sheet. */
.ep-home-side {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

/* Alert rows lead with an icon in their tone. */
.ep-home-row__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    flex-shrink: 0;
    border-radius: 10px;
    background: var(--tone-bg);
    color: var(--tone);
}

.ep-home-row__icon svg { width: 1.15rem; height: 1.15rem; }

.ep-home-attention .ep-home-row__action {
    min-height: 34px;
    border: 1px solid var(--h-border);
    border-radius: 999px;
    padding: 0 14px;
}

.ep-home-attention .ep-home-row__action:hover {
    border-color: var(--h-link);
    background: color-mix(in srgb, var(--h-link) 8%, transparent);
}

/* ---- Work strip ---- */
.ep-home-work {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px 20px;
    padding: 14px 20px;
}

.ep-home-work__stages {
    flex: 1 1 520px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
}

.ep-home-stage {
    min-height: 68px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid color-mix(in srgb, var(--tone) 22%, var(--h-border));
    background: color-mix(in srgb, var(--tone-bg) 45%, transparent);
    color: var(--tone) !important;
    transition: background 0.15s ease;
}

.ep-home-stage:hover { background: var(--tone-bg); }

/* Nothing in a stage: it steps back so the stages with work stand out. */
.ep-home-stage.is-zero {
    border-color: var(--h-border);
    background: transparent;
    opacity: 0.7;
}

.ep-home-stage__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    flex-shrink: 0;
    border-radius: 10px;
    background: var(--tone-bg);
}

.ep-home-stage__icon svg { width: 1.2rem; height: 1.2rem; }

.ep-home-stage__text { display: flex; flex-direction: column; min-width: 0; }

.ep-home-stage__label { display: flex; align-items: center; gap: 0.375rem; font-size: 0.8125rem; font-weight: 600; color: var(--h-ink); }

.ep-home-stage__count { font-size: 1.5rem; font-weight: 800; line-height: 1.2; }

/* ---- Attention + day ---- */
.ep-home-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
    align-items: start;
    gap: 16px;
}
.ep-home-split > :only-child { grid-column: 1 / -1; }

.ep-home-attention { flex: 3 1 420px; }

.ep-home-half { flex: 1 1 380px; }

.ep-home-row__copy--link { color: var(--h-ink) !important; }

.ep-home-row__copy--link:hover strong { color: var(--h-link); }

.ep-home-late { color: var(--h-red); font-weight: 700; }

.ep-home-row .ep-home-chip { flex-shrink: 0; }

.ep-home-day {
    flex: 2 1 300px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ep-home-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 0;
    border-top: 1px solid var(--h-border);
    color: var(--h-ink) !important;
}

.ep-home-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    flex-shrink: 0;
    background: var(--tone);
}

.ep-home-row__copy {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.ep-home-row__copy strong { font-size: 0.9375rem; font-weight: 700; }

.ep-home-row__copy small { font-size: 0.8125rem; color: var(--h-muted); }

.ep-home-row__action {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding: 0 12px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    font: inherit;
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--h-link) !important;
    cursor: pointer;
}

.ep-home-row__action:hover { background: var(--h-divider); }

.ep-home-row__action:disabled { opacity: 0.6; cursor: wait; }

.ep-home-setup { padding-block: 12px; }

.ep-home-setup__summary {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 32px;
    cursor: pointer;
    list-style: none;
}

.ep-home-setup__summary::-webkit-details-marker { display: none; }

.ep-home-setup__summary::after {
    content: '';
    width: 8px;
    height: 8px;
    border-inline-end: 2px solid var(--h-muted);
    border-bottom: 2px solid var(--h-muted);
    transform: rotate(45deg);
    margin-inline-start: 4px;
    transition: transform 0.15s;
}

.ep-home-setup[open] .ep-home-setup__summary::after { transform: rotate(-135deg); }

.ep-home-setup[open] .ep-home-setup__summary { margin-bottom: 6px; }

.ep-home-setup__title { font-size: 1rem; font-weight: 800; }

.ep-home-setup__bar {
    flex: 1;
    max-width: 260px;
    height: 6px;
    border-radius: 999px;
    background: var(--h-divider);
    overflow: hidden;
}

.ep-home-setup__bar span { display: block; height: 100%; background: var(--h-accent); }

.ep-home-day__sums {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.ep-home-day__sums--wide { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

.ep-home-day__sum {
    display: flex;
    flex-direction: column;
    gap: 2px;
    color: var(--h-ink) !important;
}

.ep-home-day__sum span { font-size: 0.8125rem; color: var(--h-muted); }

.ep-home-day__sum strong { font-size: 1.05rem; font-weight: 800; color: var(--tone, var(--h-ink)); }

.ep-home-day__sum strong[data-tone="success"] { color: var(--h-green); }
.ep-home-day__sum strong[data-tone="warning"] { color: var(--h-amber); }
.ep-home-day__sum strong[data-tone="danger"] { color: var(--h-red); }

/* ---- Sales bars ---- */
.ep-home-trend { display: flex; flex-direction: column; gap: 8px; }
.ep-home-trend__empty { display: flex; align-items: center; gap: 0.75rem; min-height: 3.5rem; padding-block: 0.75rem; border-top: 1px solid var(--h-divider); color: var(--h-muted); font-size: 0.875rem; }
.ep-home-trend__empty svg { width: 1.75rem; height: 1.75rem; flex-shrink: 0; }

.ep-home-trend__title { font-size: 0.8125rem; font-weight: 700; color: var(--h-muted); }

.ep-home-trend__bars {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 8px;
}

.ep-home-trend__col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.ep-home-trend__value {
    min-height: 16px;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--h-muted);
}

.ep-home-trend__col:last-child .ep-home-trend__value { color: var(--h-ink); }

.ep-home-trend__plot {
    width: 100%;
    height: 110px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    border-bottom: 1px solid var(--h-border);
}

.ep-home-trend__bar {
    width: 100%;
    max-width: 32px;
    border-radius: 6px 6px 0 0;
    background: var(--h-bar);
}

.ep-home-trend__bar.is-today { background: var(--h-accent); }

.ep-home-trend__day {
    font-size: 0.8125rem;
    color: var(--h-muted);
    white-space: nowrap;
}

.ep-home-trend__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.ep-home-trend__range {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    border-radius: 10px;
    background: var(--h-divider);
}

.ep-home-trend__range button {
    min-height: 32px;
    padding: 0 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--h-muted);
    cursor: pointer;
}

.ep-home-trend__range button[aria-pressed="true"] {
    background: var(--h-surface);
    color: var(--h-ink);
}

.ep-home-trend__bars.is-month { gap: 2px; }

.ep-home-trend__bars.is-month .ep-home-trend__bar { border-radius: 3px 3px 0 0; }

.ep-home-trend__bars.is-month .ep-home-trend__value { display: none; }

/* ---- Wide one-line cards: my shift, this month ---- */
.ep-home-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px 24px;
}

.ep-home-strip .ep-home-day__sums { flex: 1 1 420px; }

.ep-home-strip__head { display: flex; flex-direction: column; min-width: 150px; }

.ep-home-strip__head h2 { margin: 0; font-size: 1.0625rem; font-weight: 800; }

.ep-home-strip__head small { font-size: 0.8125rem; color: var(--h-muted); }

.ep-home-strip__main { font-size: 1.35rem !important; }

.ep-home-month { display: grid; grid-template-columns: minmax(8rem, 0.65fr) minmax(0, 2fr); color: var(--h-ink) !important; }
.ep-home-month .ep-home-day__sums { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.ep-home-month:hover { border-color: var(--h-muted); }

.ep-home-due {
    flex-shrink: 0;
    min-width: 64px;
    text-align: end;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--h-muted);
}

/* ---- Latest invoices ---- */
.ep-home-table-wrap { overflow-x: auto; }

.ep-home-table {
    width: 100%;
    min-width: 520px;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.ep-home-table th {
    padding: 8px;
    text-align: start;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--h-muted);
    background: var(--h-bg);
}
.ep-home-table tbody tr:hover { background: var(--h-bg); }

.ep-home-table td {
    padding: 11px 8px;
    border-top: 1px solid var(--h-divider);
}

.ep-home-table .is-amount { text-align: end; }

.ep-home-table .is-muted { color: var(--h-muted); }

.ep-home-table .is-ref a { font-weight: 700; color: var(--h-ink) !important; }

.ep-home-table .is-ref a:hover { color: var(--h-link) !important; }

.ep-home-table td.is-amount { font-weight: 700; }

.ep-home-chip {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--tone);
    background: var(--tone-bg);
}

/* ---- Phones ---- */
@media (max-width: 1100px) {
    .ep-home-split { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1279px) {
    .ep-home__head { grid-template-columns: minmax(0, 1fr); }
    .ep-home__actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
    .ep-home-setup__summary::after { transition: none; }
}
@media (max-width: 639px) {
    .ep-home { gap: 14px; }

    .ep-home__title { font-size: 1.3rem; }

    .ep-home__actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }

    .ep-home__actions .ep-home-btn { flex: 1 1 auto; justify-content: center; }

    .ep-home-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }

    .ep-home-kpi { padding: 12px 14px; }

    .ep-home-kpi__icon { width: 1.8rem; height: 1.8rem; }

    .ep-home-kpi__value { font-size: 1.2rem; }

    .ep-home-spark { display: none; }

    .ep-home-work__stages { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }

    .ep-home-stage { flex-direction: column; justify-content: center; text-align: center; gap: 4px; padding: 8px 4px; min-height: 64px; }

    .ep-home-stage__icon { display: none; }

    .ep-home-stage__text { align-items: center; }

    .ep-home-stage__count { order: -1; font-size: 1.35rem; }

    .ep-home-stage__label { font-size: 0.8125rem; }

    .ep-home-card { padding: 14px; }
    .ep-home-month { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
    .ep-home-stage__label::before { display: none; }
    .ep-home-setup__summary { flex-wrap: wrap; gap: 0.5rem; }
    .ep-home-setup__bar { min-width: 4rem; }

    .ep-home-trend__plot { height: 90px; }
}

/* ==== Dashboard layout (one page, no tabs) ==== */
.ep-dash-eyebrow {
    margin: 0;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--h-muted);
}

.ep-dash-pill {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    gap: 0.3rem;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--tone, var(--h-muted));
    background: var(--tone-bg, var(--h-divider));
}

.ep-dash-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.6rem;
    height: 1.6rem;
    padding: 0 0.45rem;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 800;
    color: var(--h-ink);
    background: var(--h-divider);
}

/* Top row: the "today" hero and, beside it, the cash and my shift. */
.ep-dash-top {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(18rem, 1fr);
    gap: 16px;
    align-items: stretch;
}

.ep-dash-top > :only-child { grid-column: 1 / -1; }

.ep-dash-top__side {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

.ep-dash-top__side:empty { display: none; }

.ep-dash-hero {
    display: grid;
    grid-template-columns: minmax(13rem, 0.8fr) minmax(0, 1.6fr);
    gap: 20px 28px;
    padding: 22px 24px;
    border-radius: 20px;
    border: 1px solid color-mix(in srgb, var(--h-accent) 22%, var(--h-border));
    background:
        radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--h-accent) 14%, transparent) 0%, transparent 55%),
        var(--h-surface);
    min-width: 0;
}

.ep-dash-hero__figures {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.ep-dash-hero__value {
    font-size: clamp(1.9rem, 3vw, 2.6rem);
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 1.1;
    color: var(--h-ink) !important;
}

.ep-dash-hero__sub {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: auto;
    padding: 12px;
    border-radius: 14px;
    background: color-mix(in srgb, var(--h-surface) 70%, var(--h-bg));
    border: 1px solid var(--h-divider);
    color: var(--h-ink) !important;
}

.ep-dash-hero__sub > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.ep-dash-hero__sub small { font-size: 0.8125rem; color: var(--h-muted); font-weight: 600; }
.ep-dash-hero__sub strong { font-size: 1.15rem; font-weight: 800; }
.ep-dash-hero__sub em { font-style: normal; font-size: 0.8125rem; color: var(--h-muted); }

.ep-dash-hero__sub-icon,
.ep-dash-tile__icon,
.ep-dash-stage__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 12px;
    background: var(--tone-bg);
    color: var(--tone);
}

.ep-dash-hero__sub-icon svg,
.ep-dash-tile__icon svg,
.ep-dash-stage__icon svg { width: 1.2rem; height: 1.2rem; }

.ep-dash-hero__chart {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.ep-dash-hero .ep-home-trend__plot { height: 150px; }

/* Cash on hand: one big figure, then today's money in and out. */
.ep-dash-cash {
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-top: 3px solid var(--tone);
}

.ep-dash-cash .ep-home-card__head { margin-bottom: 0; }

.ep-dash-cash__value {
    font-size: 1.9rem;
    font-weight: 800;
    letter-spacing: -0.4px;
    line-height: 1.15;
    color: var(--h-ink) !important;
}

.ep-dash-cash[data-tone="red"] .ep-dash-cash__value { color: var(--h-red) !important; }

.ep-dash-cash__caption { margin-bottom: -6px; font-size: 0.8125rem; font-weight: 600; color: var(--h-muted); }

.ep-dash-cash__flow {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr));
    gap: 8px;
    margin-top: 4px;
}

.ep-dash-cash__line {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 2px 8px;
    padding: 10px 12px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--tone-bg) 55%, transparent);
    color: var(--h-ink) !important;
}

.ep-dash-cash__line svg { grid-row: span 2; width: 1.1rem; height: 1.1rem; color: var(--tone); }
.ep-dash-cash__line span { font-size: 0.8125rem; font-weight: 600; color: var(--h-muted); }
.ep-dash-cash__line strong { font-size: 0.95rem; font-weight: 800; color: var(--tone); }

.ep-dash-shift__main { display: flex; flex-direction: column; }
.ep-dash-shift__main small { font-size: 0.8125rem; color: var(--h-muted); font-weight: 600; }
.ep-dash-shift__main strong { font-size: 1.5rem; font-weight: 800; }

.ep-dash-shift__sums {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin: 10px 0 0;
    padding-top: 10px;
    border-top: 1px solid var(--h-divider);
}

.ep-dash-shift__sums dt { font-size: 0.8125rem; color: var(--h-muted); }
.ep-dash-shift__sums dd { margin: 0; font-size: 0.9rem; font-weight: 700; }

/* Quick figures: one line of tiles. */
.ep-dash-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: 12px;
}

.ep-dash-tile {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid var(--h-border);
    background: var(--h-surface);
    color: var(--h-ink) !important;
    transition: border-color 0.15s ease, transform 0.15s ease;
}

.ep-dash-tile:hover {
    border-color: color-mix(in srgb, var(--tone) 45%, var(--h-border));
    transform: translateY(-1px);
}

.ep-dash-tile__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ep-dash-tile__label { font-size: 0.8125rem; font-weight: 700; color: var(--h-muted); }
.ep-dash-tile__value { font-size: 1.3rem; font-weight: 800; line-height: 1.3; }
.ep-dash-tile[data-tone="red"] .ep-dash-tile__value { color: var(--h-red); }
.ep-dash-tile__note { font-size: 0.8125rem; font-weight: 600; color: var(--tone, var(--h-muted)); }
.ep-dash-tile__note[data-tone="muted"] { color: var(--h-muted); }

/* Main grid: alerts and invoices; beside them work, deliveries and debtors. */
.ep-dash-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.75fr) minmax(19rem, 1fr);
    gap: 16px;
    align-items: start;
}

.ep-dash-grid__main,
.ep-dash-grid__side {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

.ep-dash-grid__side:empty { display: none; }

.ep-dash-work__list { display: flex; flex-direction: column; gap: 6px; }

.ep-dash-stage {
    display: grid;
    grid-template-columns: auto minmax(5rem, auto) minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 12px;
    color: var(--h-ink) !important;
}

.ep-dash-stage:hover { background: var(--h-bg); }
.ep-dash-stage .ep-dash-stage__icon { width: 2rem; height: 2rem; border-radius: 10px; }
.ep-dash-stage .ep-dash-stage__icon svg { width: 1.05rem; height: 1.05rem; }
.ep-dash-stage__label { font-size: 0.85rem; font-weight: 600; }

.ep-dash-stage__bar {
    height: 6px;
    border-radius: 999px;
    background: var(--h-divider);
    overflow: hidden;
}

.ep-dash-stage__bar span { display: block; height: 100%; border-radius: inherit; background: var(--tone); }
.ep-dash-stage__count { min-width: 2ch; text-align: end; font-size: 1.1rem; font-weight: 800; color: var(--tone); }
.ep-dash-stage.is-zero { opacity: 0.55; }

.ep-dash-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    flex-shrink: 0;
    border-radius: 999px;
    font-weight: 800;
    color: var(--h-amber);
    background: var(--h-amber-bg);
}

.ep-dash-totals__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: 12px;
    margin-top: 12px;
}

@media (max-width: 1279px) {
    .ep-dash-top { grid-template-columns: minmax(0, 1fr); }
    .ep-dash-top__side { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }
    .ep-dash-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 767px) {
    .ep-dash-hero { grid-template-columns: minmax(0, 1fr); padding: 16px; }
    .ep-dash-hero .ep-home-trend__plot { height: 110px; }
    .ep-dash-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .ep-dash-tile { flex-direction: column; gap: 8px; padding: 12px; }
    .ep-dash-tile__icon { width: 2rem; height: 2rem; }
    .ep-dash-tile__value { font-size: 1.05rem; }
    .ep-dash-tile__note { display: none; }
    .ep-dash-cash__value { font-size: 1.5rem; }
}

/* ==== Density: smaller type, tighter spacing, aligned rows ==== */
.ep-home { gap: 12px; max-width: 84rem; font-size: 0.875rem; }

.ep-home__head { grid-template-columns: auto minmax(0, 1fr); gap: 12px; }
.ep-home__title { font-size: 1.2rem; }
.ep-home__meta { margin-top: 0.2rem; font-size: 0.8125rem; }
.ep-home__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.ep-home-btn { min-height: 34px; padding: 0 12px; border-radius: 9px; font-size: 0.8125rem; gap: 6px; }
.ep-home-btn svg { width: 15px; height: 15px; }

.ep-home-card { padding: 14px 16px; border-radius: 14px; }
.ep-home-card__head { margin-bottom: 4px; gap: 8px; }
.ep-home-card__head h2,
.ep-home-work__title { font-size: 0.92rem; }
.ep-home-card__link,
.ep-home-card__links a { min-height: 28px; font-size: 0.8125rem; }
.ep-home-card__links { gap: 12px; }
.ep-home-setup { padding-block: 8px; }
.ep-home-setup__title { font-size: 0.9rem; }

.ep-dash-eyebrow { font-size: 0.8125rem; }
.ep-dash-pill { padding: 2px 8px; font-size: 0.8125rem; }
.ep-dash-count { min-width: 1.35rem; height: 1.35rem; font-size: 0.8125rem; }

.ep-dash-top { gap: 12px; grid-template-columns: minmax(0, 1.9fr) minmax(17rem, 1fr); }
.ep-dash-top__side { gap: 12px; }
.ep-dash-hero { gap: 14px 22px; padding: 16px 18px; border-radius: 14px; grid-template-columns: minmax(11rem, 0.75fr) minmax(0, 1.6fr); }
.ep-dash-hero__figures { gap: 8px; }
.ep-dash-hero__value { font-size: clamp(1.5rem, 2.2vw, 1.9rem); }
.ep-dash-hero__sub { gap: 8px; padding: 9px 10px; border-radius: 11px; }
.ep-dash-hero__sub strong { font-size: 0.98rem; }
.ep-dash-hero__sub small,
.ep-dash-hero__sub em { font-size: 0.8125rem; }
.ep-dash-hero .ep-home-trend__plot { height: 110px; }
.ep-home-trend__bars { gap: 6px; }
.ep-home-trend__bar { max-width: 26px; border-radius: 5px 5px 0 0; }
.ep-home-trend__range button { min-height: 26px; padding: 0 8px; font-size: 0.8125rem; }
.ep-home-trend__title { font-size: 0.8125rem; }

.ep-dash-hero__sub-icon,
.ep-dash-tile__icon { width: 2rem; height: 2rem; border-radius: 10px; }
.ep-dash-hero__sub-icon svg,
.ep-dash-tile__icon svg { width: 1rem; height: 1rem; }

.ep-dash-cash { gap: 8px; border-top-width: 2px; }
.ep-dash-cash__value { font-size: 1.45rem; }
.ep-dash-cash__caption { font-size: 0.8125rem; margin-bottom: -4px; }
.ep-dash-cash__flow { gap: 6px; margin-top: 2px; }
.ep-dash-cash__line { padding: 7px 9px; border-radius: 10px; gap: 0 6px; }
.ep-dash-cash__line svg { width: 0.95rem; height: 0.95rem; }
.ep-dash-cash__line span { font-size: 0.8125rem; }
.ep-dash-cash__line strong { font-size: 0.82rem; }

.ep-dash-shift__main strong { font-size: 1.2rem; }
.ep-dash-shift__sums { margin-top: 8px; padding-top: 8px; }
.ep-dash-shift__sums dd { font-size: 0.82rem; }

/* Tiles: one even row, same height, value and label on one baseline. */
.ep-dash-tiles { gap: 10px; grid-template-columns: repeat(auto-fit, minmax(12.5rem, 1fr)); }
.ep-dash-tile { align-items: center; gap: 10px; padding: 11px 13px; border-radius: 12px; min-height: 4.4rem; }
.ep-dash-tile__label { font-size: 0.8125rem; }
.ep-dash-tile__value { font-size: 1.05rem; line-height: 1.25; }
.ep-dash-tile__note { font-size: 0.8125rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ep-dash-grid { gap: 12px; grid-template-columns: minmax(0, 1.8fr) minmax(17rem, 1fr); }
.ep-dash-grid__main,
.ep-dash-grid__side { gap: 12px; }

.ep-home-row { gap: 10px; padding: 7px 0; }
.ep-home-row__copy strong { font-size: 0.84rem; }
.ep-home-row__copy small { font-size: 0.8125rem; }
.ep-home-row__icon,
.ep-dash-avatar { width: 1.85rem; height: 1.85rem; border-radius: 9px; font-size: 0.8125rem; }
.ep-dash-avatar { border-radius: 999px; }
.ep-home-row__icon svg { width: 0.95rem; height: 0.95rem; }
.ep-home-row__action { min-height: 28px; padding: 0 10px; font-size: 0.8125rem; }
.ep-home-attention .ep-home-row__action { min-height: 28px; padding: 0 11px; }
.ep-home-chip { padding: 1px 8px; font-size: 0.8125rem; }
.ep-home-due { min-width: 52px; font-size: 0.8125rem; }
.ep-home-calm { padding-block: 0.9rem; }
.ep-home-empty { font-size: 0.82rem; }

.ep-dash-work__list { gap: 2px; }
.ep-dash-stage { gap: 8px; padding: 5px 6px; border-radius: 9px; grid-template-columns: auto minmax(4.5rem, auto) minmax(0, 1fr) auto; }
.ep-dash-stage .ep-dash-stage__icon { width: 1.6rem; height: 1.6rem; border-radius: 8px; }
.ep-dash-stage .ep-dash-stage__icon svg { width: 0.9rem; height: 0.9rem; }
.ep-dash-stage__label { font-size: 0.8125rem; }
.ep-dash-stage__bar { height: 5px; }
.ep-dash-stage__count { font-size: 0.92rem; }

.ep-home-table { font-size: 0.8125rem; min-width: 480px; }
.ep-home-table th { padding: 6px 8px; font-size: 0.8125rem; }
.ep-home-table td { padding: 7px 8px; }

.ep-dash-totals__grid { gap: 10px; margin-top: 8px; }
.ep-home-day__sum strong { font-size: 0.95rem; }

@media (max-width: 1279px) {
    .ep-home__head { grid-template-columns: minmax(0, 1fr); }
    .ep-home__actions { justify-content: flex-start; }
}

@media (max-width: 767px) {
    .ep-home__actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .ep-home-btn { padding: 0 6px; }
    .ep-dash-hero { padding: 14px; }
    .ep-dash-hero .ep-home-trend__plot { height: 90px; }
    .ep-dash-tile { min-height: 0; }
    .ep-dash-cash__value { font-size: 1.3rem; }
}

/* The side column fills the hero's height so the top row ends on one line. */
.ep-dash-top__side > :last-child { flex: 1; }


/* Responsive grid rules again, after the density block that would otherwise override them. */
@media (max-width: 1279px) {
    .ep-dash-top { grid-template-columns: minmax(0, 1fr); }
    .ep-dash-top__side { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }
    .ep-dash-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 767px) {
    .ep-dash-hero { grid-template-columns: minmax(0, 1fr); }
    .ep-dash-top__side { grid-template-columns: minmax(0, 1fr); }
    .ep-dash-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .ep-dash-tile { flex-direction: column; align-items: flex-start; gap: 6px; padding: 10px; }
    .ep-dash-tile__note { display: none; }
    .ep-dash-cash__flow { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .ep-dash-cash__line { grid-template-columns: minmax(0, 1fr); padding: 6px 7px; }
    .ep-dash-cash__line svg { display: none; }
}
