/* =============================================================
   Dashboard Design System Tokens
   2026 unified panel + button + typography language
   Loaded after app.css so it cascades over older base styles.
   ============================================================= */

:root {
    /* Radii */
    --ds-radius-card: 14px;
    --ds-radius-field: 10px;
    --ds-radius-pill: 999px;

    /* Panel chrome */
    --ds-panel-shadow: 0 8px 28px -22px rgba(15, 23, 42, 0.22), 0 1px 2px rgba(15, 23, 42, 0.04);
    --ds-panel-border: 1px solid rgba(15, 23, 42, 0.06);
    --ds-panel-bg: #ffffff;

    /* Header surfaces
       Default (brand) is a soft tonal wash so panels feel calm and
       let content lead. Accent (orange) stays bold because it is the
       deliberate "take action" moment (Ask / Education Bank). Success
       is a soft teal wash used for the completed-today card. */
    --ds-hdr-bg-brand:   linear-gradient(180deg, rgba(12, 87, 240, 0.07) 0%, rgba(12, 87, 240, 0.03) 100%);
    --ds-hdr-bg-accent:  linear-gradient(135deg, #ED7323 0%, #F59E0B 100%);
    --ds-hdr-bg-success: linear-gradient(180deg, rgba(20, 184, 166, 0.10) 0%, rgba(20, 184, 166, 0.03) 100%);
    --ds-hdr-border:     1px solid rgba(15, 23, 42, 0.06);
    --ds-hdr-title-color:      #0f172a;
    --ds-hdr-title-color-alt:  #ffffff;
    --ds-hdr-height: 52px;
    --ds-hdr-pad: 12px 20px;

    /* Typography */
    --ds-title-size: 17px;
    --ds-title-weight: 700;
    --ds-title-tracking: -0.005em;

    --ds-eyebrow-size: 11px;
    --ds-eyebrow-weight: 700;
    --ds-eyebrow-tracking: 0.12em;
    --ds-eyebrow-color: #ED7323;

    /* Type scale */
    --ds-hero-title: 30px;
    --ds-hero-title-weight: 800;
    --ds-hero-title-tracking: -0.015em;
    --ds-section-title: 17px;
    --ds-card-title: 16.5px;
    --ds-body: 14px;
    --ds-meta: 12.5px;

    /* Body padding */
    --ds-body-padding: 20px;
    --ds-body-padding-sm: 14px;
}

/* =============================================================
   Panel shell
   ============================================================= */
.ds-panel {
    background: var(--ds-panel-bg);
    border-radius: var(--ds-radius-card);
    border: var(--ds-panel-border);
    box-shadow: var(--ds-panel-shadow);
    overflow: hidden;
    position: relative;
    margin-bottom: 20px;
}

.ds-panel--flush {
    margin-bottom: 0;
}

.ds-panel__header {
    background: var(--ds-hdr-bg-brand);
    color: var(--ds-hdr-title-color);
    padding: var(--ds-hdr-pad);
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: var(--ds-hdr-height);
    border-bottom: var(--ds-hdr-border);
    position: relative;
}

.ds-panel__title {
    font-size: var(--ds-title-size);
    font-weight: var(--ds-title-weight);
    letter-spacing: var(--ds-title-tracking);
    color: inherit;
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    line-height: 1.2;
}

.ds-panel__title-icon {
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: rgba(12, 87, 240, 0.10);
    flex: 0 0 26px;
}

.ds-panel__title-icon i {
    font-size: 13px;
    line-height: 1;
    color: var(--brand-primary, #0C57F0);
}

.ds-panel__actions {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.ds-panel__body {
    padding: var(--ds-body-padding);
}

.ds-panel__body--scroll {
    max-height: calc(100vh - 240px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(15, 23, 42, 0.25) transparent;
}

.ds-panel__body--scroll::-webkit-scrollbar {
    width: 8px;
}

.ds-panel__body--scroll::-webkit-scrollbar-track {
    background: transparent;
}

.ds-panel__body--scroll::-webkit-scrollbar-thumb {
    background: rgba(15, 23, 42, 0.18);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.ds-panel__body--scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(15, 23, 42, 0.32);
    background-clip: padding-box;
}

.ds-panel__body--flush {
    padding: 0;
}

/* -------------------------------------------------------------
   Variants
   ------------------------------------------------------------- */

/* Accent = the deliberate "take action" panels (Ask / Education Bank).
   Entire panel wears the brand orange gradient with white text so they
   stand out hard against the calm blue/white defaults — this is the
   "take action" moment on the dashboard. */
.ds-panel--accent {
    background: #ED7325;
    border-color: transparent;
    box-shadow: 0 12px 32px -18px rgba(237, 115, 35, 0.55), 0 1px 2px rgba(237, 115, 35, 0.12);
    color: #ffffff;
    overflow: hidden;
}

/* Soft top-left highlight to give the gradient dimension */
.ds-panel--accent::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 0% 0%, rgba(255, 255, 255, 0.18), transparent 55%);
    pointer-events: none;
    z-index: 0;
}

.ds-panel--accent .ds-panel__header {
    background: transparent;
    color: #ffffff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.20);
    position: relative;
    z-index: 1;
}

.ds-panel--accent .ds-panel__body {
    position: relative;
    z-index: 1;
    color: #ffffff;
}

.ds-panel--accent .ds-panel__title-icon {
    background: rgba(255, 255, 255, 0.20);
}

.ds-panel--accent .ds-panel__title-icon i {
    color: #ffffff;
}

/* Any description text in an accent panel reads white on orange */
.ds-panel--accent .ask-description,
.ds-panel--accent p {
    color: rgba(255, 255, 255, 0.92);
}

/* Invert the CTA on accent panels: white pill with orange text. A
   gradient-orange button on an orange panel would vanish. */
.ds-panel--accent .btn-dash--accent {
    background: #ffffff;
    color: #B5471A;
    box-shadow: 0 10px 22px -12px rgba(15, 23, 42, 0.35);
}

.ds-panel--accent .btn-dash--accent:hover {
    background: #ffffff;
    color: #8F3612;
    transform: translateY(-1px);
    box-shadow: 0 14px 26px -12px rgba(15, 23, 42, 0.45);
}

/* Success = today's completed work. Soft teal tonal wash. */
.ds-panel--success .ds-panel__header {
    background: var(--ds-hdr-bg-success);
}

.ds-panel--success .ds-panel__title-icon {
    background: rgba(20, 184, 166, 0.14);
}

.ds-panel--success .ds-panel__title-icon i {
    color: #0D9488;
}

/* Quiet = supporting panels (Progress, Calendar). They sit in the page
   reading order but should visually recede so primary panels lead. */
.ds-panel--quiet {
    box-shadow: 0 4px 18px -16px rgba(15, 23, 42, 0.18), 0 1px 2px rgba(15, 23, 42, 0.03);
    background: #fbfcfd;
}

.ds-panel--quiet .ds-panel__header {
    background: #ED7325;
    color: #ffffff;
    min-height: 44px;
    padding: 10px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

.ds-panel--quiet .ds-panel__title {
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0;
}

.ds-panel--quiet .ds-panel__title-icon {
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    background: rgba(255, 255, 255, 0.18);
}

.ds-panel--quiet .ds-panel__title-icon i {
    font-size: 11px;
    color: #ffffff;
}

.ds-panel--quiet .ds-panel__header .btn-dash--tertiary {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.28);
}

.ds-panel--quiet .ds-panel__header .btn-dash--tertiary:hover,
.ds-panel--quiet .ds-panel__header .btn-dash--tertiary:focus {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.24);
    border-color: rgba(255, 255, 255, 0.40);
}

.ds-panel--quiet .ds-panel__header .btn-dash--tertiary i {
    color: inherit;
}

/* =============================================================
   Section head — quiet panel header with an inline contextual
   icon next to the title and an optional count fragment.
   Pages opt in by adding `.ds-section-head` to a `.ds-panel__header`
   (drop `.ds-panel--quiet` from the parent panel first).
   ============================================================= */
.ds-panel__header.ds-section-head,
.ds-panel--success > .ds-panel__header.ds-section-head {
    background: transparent;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: inherit;
    min-height: 0;
}

.ds-section-head__title {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    color: #070c2d;
    font-weight: 700;
    line-height: 1.25;
}

.ds-section-head__icon {
    font-size: 16px;
    flex-shrink: 0;
    width: 18px;
    text-align: center;
}

.ds-section-head__icon--green {
    color: #16a34a;
}

.ds-section-head__icon--blue {
    color: #0C57F0;
}

.ds-section-head__icon--amber {
    color: #d97706;
}

.ds-section-head__icon--indigo {
    color: #4F46E5;
}

.ds-section-head__count {
    color: #64748b;
    font-weight: 600;
    margin-left: 2px;
}

/* =============================================================
   Eyebrow
   ============================================================= */
.ds-eyebrow {
    font-size: var(--ds-eyebrow-size);
    font-weight: var(--ds-eyebrow-weight);
    letter-spacing: var(--ds-eyebrow-tracking);
    text-transform: uppercase;
    color: var(--ds-eyebrow-color);
    line-height: 1.2;
    display: inline-block;
}

.ds-eyebrow--muted   { color: #64748b; }
.ds-eyebrow--brand   { color: var(--brand-primary, #0C57F0); }
.ds-eyebrow--on-dark { color: rgba(255, 255, 255, 0.85); }

/* =============================================================
   Button system
   ============================================================= */
.btn-dash {
    appearance: none;
    border: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    border-radius: var(--ds-radius-pill);
    text-decoration: none;
    transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease;
    white-space: nowrap;
}

.btn-dash:focus-visible {
    outline: 2px solid rgba(12, 87, 240, 0.5);
    outline-offset: 2px;
}

.btn-dash i {
    font-size: 12px;
    line-height: 1;
}

/* Primary: solid brand-blue pill */
.btn-dash--primary {
    background: var(--brand-primary, #0c57f0);
    color: #ffffff;
    box-shadow: 0 10px 22px -12px rgba(12, 87, 240, 0.55);
}
.btn-dash--primary:hover {
    background: #0a4cd6;
    transform: translateY(-1px);
    box-shadow: 0 14px 26px -12px rgba(12, 87, 240, 0.7);
    color: #ffffff;
}

/* Secondary: white with hairline that turns blue on hover */
.btn-dash--secondary {
    background: #ffffff;
    color: #0f172a;
    border: 1px solid rgba(15, 23, 42, 0.12);
    padding: 9px 17px;
}
.btn-dash--secondary:hover {
    border-color: rgba(12, 87, 240, 0.5);
    box-shadow: 0 10px 22px -16px rgba(12, 87, 240, 0.5);
    color: #0f172a;
}

/* Tertiary: text link with subtle hover wash */
.btn-dash--tertiary {
    background: transparent;
    color: var(--brand-primary, #0C57F0);
    padding: 8px 12px;
    font-weight: 600;
}
.btn-dash--tertiary:hover {
    background: rgba(12, 87, 240, 0.08);
    color: var(--brand-primary, #0C57F0);
}

/* Accent: solid brand-orange pill (Ask / EducationBank flows) */
.btn-dash--accent {
    background: var(--brand-accent, #ed7323);
    color: #ffffff;
    box-shadow: 0 10px 22px -12px rgba(237, 115, 35, 0.5);
}
.btn-dash--accent:hover {
    background: #d4631a;
    transform: translateY(-1px);
    box-shadow: 0 14px 26px -12px rgba(237, 115, 35, 0.65);
    color: #ffffff;
}

/* Ghost on dark surfaces (e.g. used on banner header actions) */
.btn-dash--ghost-on-dark {
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(6px);
}
.btn-dash--ghost-on-dark:hover {
    background: rgba(255, 255, 255, 0.24);
    color: #ffffff;
}

/* Sizes */
.btn-dash--sm  { padding: 7px 14px;  font-size: 12.5px; }
.btn-dash--xs  { padding: 5px 10px;  font-size: 11.5px; gap: 6px; }
.btn-dash--lg  { padding: 12px 22px; font-size: 15px; }

/* Block / full-width */
.btn-dash--block { width: 100%; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .btn-dash {
        transition: none !important;
    }
    .btn-dash--primary:hover,
    .btn-dash--accent:hover {
        transform: none !important;
    }
}

/* =============================================================
   KS2 theme overrides — kid-first polish
   Lifts the existing [KS2] theme (Fredoka, --radius: 30px from app.css)
   into the dashboard design system. Larger radii, type scale, padding
   and tap targets so the dashboard feels rounder, calmer, and friendlier
   for an 11-year-old without being babyish.
   ============================================================= */
[data-theme="KS2"],
[data-theme="[KS2]"] {
    --ds-radius-card: 24px;
    --ds-radius-field: 16px;
    --ds-hero-title: clamp(28px, 2.4vw + 18px, 36px);
    --ds-title-size: 19px;
    --ds-card-title: 18px;
    --ds-body: 15.5px;
    --ds-meta: 13px;
    --ds-body-padding: 24px;
    --ds-body-padding-sm: 18px;
    --ds-hdr-height: 60px;
    --ds-hdr-pad: 14px 22px;
}

/* KS2: bigger tap targets across all interactive cards/buttons. 48px is
   the WCAG 2.2 AA target size and the natural minimum for tween thumbs.
   Order matters: the broader .btn-dash rule comes first so the more
   specific .btn-dash--sm size override below can shrink it back down. */
[data-theme="KS2"] .btn-dash,
[data-theme="[KS2]"] .btn-dash {
    min-height: 48px;
}

[data-theme="KS2"] .btn-dash--sm,
[data-theme="[KS2]"] .btn-dash--sm {
    min-height: 40px;
    padding: 9px 16px;
    font-size: 13.5px;
}

[data-theme="KS2"] .ds-panel__title,
[data-theme="[KS2]"] .ds-panel__title {
    letter-spacing: 0;
}

/* KS2: softer panel title icon — slightly larger so the rounder Fredoka
   numerals don't look orphaned next to a tiny 26px chip. */
[data-theme="KS2"] .ds-panel__title-icon,
[data-theme="[KS2]"] .ds-panel__title-icon {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    border-radius: 12px;
}

[data-theme="KS2"] .ds-panel__title-icon i,
[data-theme="[KS2]"] .ds-panel__title-icon i {
    font-size: 15px;
}

/* KS2: quiet-panel headers keep their orange wash but get a softer
   rounded edge to match the new card radius. min-height is sized to
   match a header containing a btn-dash--sm (40px) plus its 12px×2
   vertical padding, so panels with and without trailing buttons line
   up at the same height across the dashboard. */
[data-theme="KS2"] .ds-panel--quiet .ds-panel__header,
[data-theme="[KS2]"] .ds-panel--quiet .ds-panel__header {
    min-height: 64px;
    padding: 12px 22px;
}

[data-theme="KS2"] .ds-panel--quiet .ds-panel__title,
[data-theme="[KS2]"] .ds-panel--quiet .ds-panel__title {
    font-size: 15.5px;
}

/* Quiet (orange-header) panels keep their compact title-icon under KS2
   so the white-on-orange chip doesn't dominate the header bar. */
[data-theme="KS2"] .ds-panel--quiet .ds-panel__title-icon,
[data-theme="[KS2]"] .ds-panel--quiet .ds-panel__title-icon {
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
    border-radius: 9px;
}

[data-theme="KS2"] .ds-panel--quiet .ds-panel__title-icon i,
[data-theme="[KS2]"] .ds-panel--quiet .ds-panel__title-icon i {
    font-size: 12px;
}
