/*
  ============================================================================
  adminkit — admin chrome
  ============================================================================

  Loaded through UNFOLD["STYLES"], after Unfold's own prebuilt stylesheet.

  Two jobs:

  1. Dashboard components (templates/admin/index.html). Plain CSS, not Tailwind
     utilities — Unfold ships a prebuilt stylesheet that never sees this app's
     templates, so any utility invented here simply would not exist.

  2. Chrome the Unfold COLORS setting cannot reach: the accent bar, focus
     rings, and the display face used for headings. The base/primary ramps
     generated by adminkit.palette handle everything else.

  ---------------------------------------------------------------------------
  BRANDING THIS: do not edit this file. Every color and face below is a CSS
  variable with a neutral default. Override the handful you care about in your
  own stylesheet, passed via build_unfold(extra_styles=["css/brand.css"]) so it
  loads after this one:

      :root {
        --ak-accent-1: #fad02c;
        --ak-accent-2: #9c5539;
        --ak-accent-3: #48a899;
        --ak-display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
      }

  Dark mode keys off Unfold's own `html.dark` class rather than a
  prefers-color-scheme query, so the manual theme switch and the OS setting
  cannot disagree.
  ---------------------------------------------------------------------------
*/

:root {
  /* Three accent slots. The dashboard assigns them to cards in order. */
  --ak-accent-1: #6366f1;
  --ak-accent-2: #8b5cf6;
  --ak-accent-3: #14b8a6;

  --ak-ink: #18181b;
  --ak-line: rgb(24 24 27 / 0.1);
  --ak-surface: #fff;
  --ak-text: #18181b;
  --ak-text-soft: #64748b;

  /* Welcome band gradient. */
  --ak-hero-from: #0a0a0b;
  --ak-hero-to: #27272a;
  --ak-hero-text: #fafafa;
  --ak-hero-glow: var(--ak-accent-1);

  --ak-display: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --ak-radius: 12px;
}

html.dark {
  --ak-line: rgb(255 255 255 / 0.12);
  --ak-surface: rgb(255 255 255 / 0.04);
  --ak-text: #fafafa;
  --ak-text-soft: rgb(250 250 250 / 0.6);
}

/* ---------------------------------------------------------------------
   Accent bar + focus
   --------------------------------------------------------------------- */
.ak-accentbar {
  display: inline-flex;
  height: 6px;
  width: 40px;
  border-radius: 99px;
  overflow: hidden;
}
.ak-accentbar i { flex: 1; }
.ak-accentbar i:nth-child(1) { background: var(--ak-accent-1); }
.ak-accentbar i:nth-child(2) { background: var(--ak-accent-2); }
.ak-accentbar i:nth-child(3) { background: var(--ak-accent-3); }

/* Accent 1 is the focus color: it has to stay visible on both the light and
   the dark admin surface, so it is the one slot a brand should keep bright. */
.ak-card:focus-visible,
.ak-tile a:focus-visible,
#content a:focus-visible,
#content button:focus-visible {
  outline: 2px solid var(--ak-accent-1);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---------------------------------------------------------------------
   Welcome band
   --------------------------------------------------------------------- */
.ak-hero {
  position: relative;
  overflow: hidden;
  border-radius: calc(var(--ak-radius) + 2px);
  padding: 1.9rem 1.9rem 1.75rem;
  margin-bottom: 2rem;
  color: var(--ak-hero-text);
  background:
    radial-gradient(120% 140% at 88% 8%,
      color-mix(in srgb, var(--ak-hero-glow) 16%, transparent), transparent 58%),
    linear-gradient(104deg,
      var(--ak-hero-from) 0%,
      var(--ak-hero-mid, color-mix(in srgb, var(--ak-hero-from) 70%, var(--ak-hero-to))) 46%,
      var(--ak-hero-to) 100%);
}
.ak-hero .ak-accentbar { margin-bottom: 1.1rem; }
.ak-hero-title {
  font-family: var(--ak-display);
  font-weight: 700;
  font-size: 1.65rem;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0;
}
.ak-hero-sub {
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
  color: color-mix(in srgb, var(--ak-hero-text) 68%, transparent);
}

/* ---------------------------------------------------------------------
   Section headings and grids
   --------------------------------------------------------------------- */
.ak-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ak-text-soft);
  margin: 2.25rem 0 0.85rem;
}
.ak-section-title:first-of-type { margin-top: 0; }

.ak-grid { display: grid; gap: 0.85rem; }
.ak-grid-3 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.ak-grid-4 { grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); }

/* ---------------------------------------------------------------------
   "Needs attention" cards
   --------------------------------------------------------------------- */
.ak-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 1.25rem 1.3rem 1.15rem;
  border-radius: var(--ak-radius);
  border: 1px solid var(--ak-line);
  background: var(--ak-surface);
  text-decoration: none;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.ak-card::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--ak-tone, var(--ak-accent-1));
}
.ak-card:hover {
  transform: translateY(-2px);
  border-color: var(--ak-tone, var(--ak-accent-1));
  box-shadow: 0 8px 20px rgb(0 0 0 / 0.08);
}
.ak-card--a1 { --ak-tone: var(--ak-accent-1); }
.ak-card--a2 { --ak-tone: var(--ak-accent-2); }
.ak-card--a3 { --ak-tone: var(--ak-accent-3); }
.ak-card-value {
  font-family: var(--ak-display);
  font-size: 2.1rem;
  font-weight: 700;
  line-height: 1;
  color: var(--ak-text);
  font-variant-numeric: tabular-nums;
}
.ak-card-label {
  margin-top: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ak-text);
}
.ak-card-meta { font-size: 0.75rem; color: var(--ak-text-soft); }

/* ---------------------------------------------------------------------
   Content tiles. A zero reads as a to-do, not a failure, so an empty tile is
   dimmed and dashed rather than colored red.
   --------------------------------------------------------------------- */
.ak-tile {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  border-radius: var(--ak-radius);
  border: 1px solid var(--ak-line);
  background: var(--ak-surface);
  overflow: hidden;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}
.ak-tile--empty { border-style: dashed; background: transparent; }
.ak-tile:hover { border-color: var(--ak-accent-2); }
.ak-tile-main {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 1rem 0.5rem 0.95rem 1.1rem;
  flex: 1;
  min-width: 0;
  text-decoration: none;
}
.ak-tile-value {
  font-family: var(--ak-display);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
  color: var(--ak-text);
  font-variant-numeric: tabular-nums;
}
.ak-tile--empty .ak-tile-value { color: var(--ak-text-soft); }
.ak-tile-label {
  font-size: 0.78rem;
  color: var(--ak-text-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ak-tile-add {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  flex: none;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  color: var(--ak-text-soft);
  border-inline-start: 1px solid var(--ak-line);
  transition: background-color 0.2s ease, color 0.2s ease;
}
.ak-tile-add:hover { background: var(--ak-accent-1); color: var(--ak-ink); }

/* ---------------------------------------------------------------------
   Recent activity list
   --------------------------------------------------------------------- */
.ak-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--ak-line);
  border-radius: var(--ak-radius);
  overflow: hidden;
  background: var(--ak-surface);
}
.ak-list-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 1rem;
  font-size: 0.85rem;
  color: var(--ak-text);
}
.ak-list-row + .ak-list-row { border-top: 1px solid var(--ak-line); }
.ak-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
  background: var(--ak-accent-1);
}
.ak-dot--handled { background: transparent; box-shadow: inset 0 0 0 1px var(--ak-text-soft); }
.ak-list-name { font-weight: 600; }
.ak-list-meta { color: var(--ak-text-soft); }
.ak-list-date {
  margin-inline-start: auto;
  color: var(--ak-text-soft);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  .ak-card, .ak-tile, .ak-tile-add { transition: none; }
  .ak-card:hover { transform: none; }
}
