/* ==========================================================================
   Fey — the commercial admin's own shell and its charts.
   --------------------------------------------------------------------------
   Everything underneath this file is the shared design system: the tokens, the
   components, the type scale. What lives here is the furniture this app does
   not share with the product — a darker rail, a denser page — and the chart
   primitives, which only exist where there are charts.

   The charts are HTML, not SVG, and that is a decision rather than a shortcut:
   bars made of boxes reflow with the page, their text stays crisp at any zoom,
   and every bar is a real hover target without a hit-testing layer.
   ========================================================================== */

/* ── Shell ── */

.ad-shell {
    display: grid;
    grid-template-columns: 208px minmax(0, 1fr);
    min-height: 100vh;
}

.ad-rail {
    display: flex;
    flex-direction: column;
    gap: var(--s5);
    padding: var(--s5) var(--s4);
    background: var(--fey-ink);
    position: sticky;
    top: 0;
    height: 100vh;
}

/* The rail is the one dark surface in Fey. It is how somebody who has both apps
   open knows, at a glance and before reading anything, which one they are
   typing into — the product is paper, the back office is ink. */

.ad-brand {
    font-family: var(--fey-display);
    font-size: 24px;
    color: var(--fey-paper);
    line-height: 1;
}

.ad-brand-dot { color: var(--fey-accent); }

.ad-brand-tag {
    display: block;
    font-family: var(--fey-sans);
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--fey-ink-faint);
    margin-top: 6px;
}

.ad-brand-lg { font-size: 34px; }

.ad-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }

.ad-nav-item {
    display: block;
    padding: 9px var(--s3);
    border-radius: var(--fey-radius-sm);
    color: #B9B4C9;
    font-size: 14px;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.ad-nav-item:hover { background: rgba(255, 255, 255, 0.06); color: var(--fey-paper); }

.ad-nav-item.active {
    background: rgba(139, 126, 200, 0.26);
    color: #FFFFFF;
    font-weight: 500;
}

.ad-rail-foot {
    display: flex;
    flex-direction: column;
    gap: var(--s2);
    font-size: 12px;
}

.ad-who { color: var(--fey-ink-faint); }

.ad-leave { color: #B9B4C9; text-decoration: none; }
.ad-leave:hover { color: var(--fey-paper); }

.ad-main {
    padding: var(--s6) var(--s6) var(--s8);
    max-width: 1280px;
    width: 100%;
}

.ad-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--s4);
    margin-bottom: var(--s5);
}

.ad-sub { color: var(--fey-ink-soft); font-size: 14px; margin: 4px 0 0; }

.ad-gap { margin-top: var(--s5); }

.ad-card-note {
    color: var(--fey-ink-soft);
    font-size: 13px;
    margin: 0 0 var(--s3);
}

.ad-boot { display: grid; place-items: center; min-height: 100vh; }

/* ── Sign in ── */

.ad-signin-shell { min-height: 100vh; background: var(--fey-paper); }

.ad-signin { display: grid; place-items: center; min-height: 100vh; padding: var(--s5); }

.ad-signin-card {
    width: 100%;
    max-width: 380px;
    background: var(--fey-surface);
    border: 1px solid var(--fey-line);
    border-radius: var(--fey-radius-lg);
    box-shadow: var(--fey-lift);
    padding: var(--s6);
}

.ad-signin-card .ad-brand { color: var(--fey-ink); }

.ad-signin-sub { font-size: 14px; margin: var(--s4) 0 var(--s5); }

.ad-signin-foot {
    margin: var(--s5) 0 0;
    font-size: 12px;
    color: var(--fey-ink-faint);
    line-height: 1.5;
}

/* ── The month's money ── */

.ad-money {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--s5);
    margin-bottom: var(--s4);
}

.ad-money-figure {
    font-family: var(--fey-display);
    font-size: 48px;
    line-height: 1.05;
    margin-top: 6px;
}

/* Profit and loss are a state, not a series, so they wear the status colours —
   and they never travel on colour alone: the sign is in the number and the line
   underneath says which it is in words. */
.is-green { color: var(--fey-green); }
.is-red   { color: var(--fey-red); }

.ad-money-note { color: var(--fey-ink-soft); font-size: 13px; margin-top: 4px; }

.ad-money-parts { display: flex; gap: var(--s5); flex-wrap: wrap; }

.ad-part { display: flex; flex-direction: column; gap: 2px; }

.ad-part-figure { font-family: var(--fey-mono); font-size: 18px; color: var(--fey-ink); }
.ad-part-figure.is-cost { color: var(--fey-ink-soft); }

/* ── Charts ── */

.ad-chart { display: flex; flex-direction: column; gap: var(--s3); }

.ad-chart-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--s4);
}

.ad-chart-caption { color: var(--fey-ink-soft); font-size: 12px; margin-top: 2px; }
.ad-chart-figure { font-size: 26px; }

.ad-chart-empty {
    color: var(--fey-ink-faint);
    font-size: 13px;
    padding: var(--s5) 0;
    text-align: center;
}

.ad-plot {
    display: flex;
    align-items: flex-end;
    gap: 2px;                       /* the surface gap between adjacent bars */
    border-bottom: 1px solid var(--fey-line-strong);
    padding-top: 22px;              /* room for a direct label above the tallest bar */
}

.ad-slot {
    position: relative;
    flex: 1;
    min-width: 0;
    height: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.ad-bar {
    width: 100%;
    background: var(--fey-primary);
    border-radius: 4px 4px 0 0;     /* rounded data-end, square on the baseline */
    transition: background 0.15s;
}

/* A month that measured zero still draws a tick. A bar of no height at all reads
   as missing data, which is a different claim from "nothing happened". */
.ad-bar.is-zero { background: var(--fey-line-strong); border-radius: 2px 2px 0 0; }

.ad-slot:hover .ad-bar { background: var(--fey-primary-deep); }

.ad-slot-value {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--fey-mono);
    font-size: 11px;
    color: var(--fey-ink-soft);
    white-space: nowrap;
}

/* ── Hover ── */

.ad-tip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--fey-ink);
    color: var(--fey-paper);
    font-size: 12px;
    padding: 6px 10px;
    border-radius: var(--fey-radius-sm);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.12s;
    z-index: 5;
}

.ad-slot:hover .ad-tip { opacity: 1; }

.ad-axis { display: flex; gap: 2px; }

.ad-axis-tick {
    flex: 1;
    min-width: 0;
    text-align: center;
    font-size: 10px;
    color: var(--fey-ink-faint);
    white-space: nowrap;
    overflow: hidden;
}

/* ── Average against peak ── */

.ad-plot-band .ad-bar.is-peak {
    background: var(--fey-accent);
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
}

/* The average sits inside the peak rather than beside it, so the gap between
   them is the spread — the thing the pair is drawn to show. */
.ad-bar-inner.is-avg {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--fey-primary-deep);
    border-radius: 4px 4px 0 0;
}

.ad-legend { display: flex; gap: var(--s3); font-size: 12px; color: var(--fey-ink-soft); }

.ad-key { display: inline-flex; align-items: center; gap: 6px; }

.ad-swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.ad-swatch.is-peak { background: var(--fey-accent); }
.ad-swatch.is-avg  { background: var(--fey-primary-deep); }

/* ── Small multiples ── */

.ad-minis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: var(--s4);
}

.ad-mini {
    background: var(--fey-surface);
    border: 1px solid var(--fey-line);
    border-radius: var(--fey-radius);
    padding: var(--s4);
}

.ad-mini-figure {
    font-family: var(--fey-mono);
    font-size: 20px;
    color: var(--fey-ink);
    margin-top: 4px;
}

.ad-mini-note {
    font-size: 11px;
    color: var(--fey-ink-faint);
    line-height: 1.4;
    margin-top: 2px;
    min-height: 30px;
}

.ad-mini-plot {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 44px;
    margin-top: var(--s3);
}

.ad-mini-bar {
    flex: 1;
    min-width: 0;
    background: var(--fey-primary);
    border-radius: 3px 3px 0 0;
}

.ad-mini-bar.is-zero { background: var(--fey-line-strong); }

@media (max-width: 900px) {
    .ad-shell { grid-template-columns: 1fr; }
    .ad-rail { position: static; height: auto; }
    .ad-nav { flex-direction: row; flex-wrap: wrap; }
    .ad-main { padding: var(--s4); }
}
