/* ------------------------------------------------------------------------
   Heimdal brand layer — Intropy "deck" design system for the backoffice.

   Mirrors the pitch-deck / landing look (apps/landing): Inter, the single
   orange accent (#ff6600), warm-ink neutrals, hairline-bordered soft cards,
   999px pills, and dark panels for the shell + KPI bands.

   This file layers on top of Tailwind (Play CDN). Tailwind's palette/font/
   shadow are remapped in base.html's inline `tailwind.config`; the component
   classes below (`.hd-*`) provide the signature pieces utilities can't.
   ------------------------------------------------------------------------ */

/* Metric-adjusted fallback so the swap to Inter (Google Fonts, display=swap)
   doesn't shift layout. Values from Vercel's Inter/Arial pairing. */
@font-face {
  font-family: 'Inter Fallback';
  src: local('Arial');
  size-adjust: 107.4%;
  ascent-override: 90.49%;
  descent-override: 22.55%;
  line-gap-override: 0%;
}

:root {
  --orange: #ff6600;
  --orange-hover: #ff8800;
  --orange-soft: #fff7ed;
  --orange-line: #ffd8b5;
  --burnt: #c2410c;

  --ink: #141414;
  --black: #0a0a0a;
  --panel: #131313;
  --panel-line: #262626;

  --gray: #767676;
  --gray-2: #9a9a9a;
  --gray-light: #f5f5f5;
  --border: #e6e6e6;

  --red: #e04434;
  --green: #1f9d55;

  --radius-card: 16px;
  --radius-pill: 999px;
  --shadow-card: 0 0 0 1px rgba(10, 10, 10, .05), 0 10px 30px -18px rgba(10, 10, 10, .16);
  --shadow-hover: 0 0 0 1px rgba(10, 10, 10, .07), 0 18px 40px -22px rgba(10, 10, 10, .22);
}

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

body {
  font-family: 'Inter', 'Inter Fallback', -apple-system, BlinkMacSystemFont,
    'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: var(--ink);
}

::selection { background: rgba(255, 102, 0, .18); }

.tabular-nums, .font-mono { font-variant-numeric: tabular-nums; }

/* Slim neutral scrollbars in the content area. */
.hd-main ::-webkit-scrollbar { width: 10px; height: 10px; }
.hd-main ::-webkit-scrollbar-thumb {
  background: #d9d9d9; border-radius: 999px; border: 2px solid transparent;
  background-clip: content-box;
}
.hd-main ::-webkit-scrollbar-thumb:hover { background: #c2c2c2; background-clip: content-box; }

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

.hd-shell { display: flex; min-height: 100vh; }

.hd-side {
  width: 240px; flex-shrink: 0;
  background: #0b0b0c; color: #eaeaea;
  display: flex; flex-direction: column;
  border-right: 1px solid #1c1c1e;
  position: sticky; top: 0; height: 100vh;
}

.hd-brand { padding: 20px 22px 16px; }
.hd-brand-logo {
  font-size: 22px; font-weight: 800; letter-spacing: -.03em; color: #fff;
  display: inline-block; text-decoration: none;
}
.hd-brand-logo .dot { color: var(--orange); }
.hd-brand-sub {
  font-size: 10px; font-weight: 700; letter-spacing: .16em;
  text-transform: uppercase; color: #7f7f83; margin-top: 6px;
}

.hd-nav { flex: 1; overflow-y: auto; padding: 6px 12px 16px; }
.hd-nav-group { margin-top: 16px; }
.hd-nav-group:first-child { margin-top: 4px; }
.hd-nav-group-label {
  padding: 0 12px 7px; font-size: 10px; font-weight: 700;
  letter-spacing: .13em; text-transform: uppercase; color: #6c6c70;
}
.hd-nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 9px;
  font-size: 14px; font-weight: 500; color: #c4c4c8;
  position: relative; text-decoration: none;
  transition: background .14s, color .14s;
}
.hd-nav-link:hover { background: #161618; color: #fff; }
.hd-nav-link.active {
  background: linear-gradient(90deg, rgba(255, 102, 0, .16), rgba(255, 102, 0, 0) 62%);
  color: #fff; box-shadow: inset 3px 0 0 var(--orange);
}

.hd-side-foot {
  padding: 14px 18px; border-top: 1px solid #1c1c1e;
  font-size: 12px; color: #8a8a8a;
}
.hd-side-user {
  color: #d4d4d7; font-weight: 600; margin-bottom: 8px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hd-logout {
  background: none; border: none; padding: 0; cursor: pointer;
  font: inherit; color: #9a9a9a; font-weight: 500;
}
.hd-logout:hover { color: var(--orange); }

.hd-main { flex: 1; min-width: 0; padding: 28px 32px 48px; }

/* ---- page header ------------------------------------------------------- */

.hd-eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--orange); margin-bottom: 6px;
}
.hd-title { font-size: 25px; font-weight: 800; letter-spacing: -.02em; color: var(--ink); line-height: 1.1; }
.hd-subtitle { font-size: 13px; color: var(--gray); }

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

.hd-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 18px; border-radius: var(--radius-pill);
  font-size: 14px; font-weight: 600; font-family: inherit; line-height: 1;
  border: 1.5px solid transparent; cursor: pointer; white-space: nowrap;
  text-decoration: none;
  transition: background .15s, border-color .15s, color .15s, transform .15s, filter .15s;
}
.hd-btn:active { transform: translateY(1px); }
.hd-btn-sm { padding: 7px 14px; font-size: 13px; }
.hd-btn-primary { background: var(--orange); color: #fff; border-color: var(--orange); }
.hd-btn-primary:hover { background: var(--orange-hover); border-color: var(--orange-hover); }
.hd-btn-dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.hd-btn-dark:hover { background: #000; border-color: #000; }
.hd-btn-ghost { background: #fff; color: var(--ink); border-color: var(--border); }
.hd-btn-ghost:hover { border-color: var(--ink); }
.hd-btn-danger { background: var(--red); color: #fff; border-color: var(--red); }
.hd-btn-danger:hover { filter: brightness(.93); }

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

.hd-card {
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius-card); box-shadow: var(--shadow-card);
}
.hd-card-lift { transition: transform .15s, box-shadow .15s, border-color .15s; }
.hd-card-lift:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: var(--orange-line); }

/* Thin orange bar along a card top, for accented panels. */
.hd-accent-top { position: relative; overflow: hidden; }
.hd-accent-top::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--orange);
}

/* Left orange stripe callout (deck ".road/.extra" motif). */
.hd-callout {
  border-left: 3px solid var(--orange); background: var(--orange-soft);
  border-radius: 0 12px 12px 0; padding: 12px 16px;
}

/* ---- chips / tabs / tags ---------------------------------------------- */

.hd-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: var(--radius-pill);
  border: 1px solid var(--border); background: #fff;
  font-size: 13px; font-weight: 600; color: var(--ink);
  text-decoration: none; cursor: pointer; line-height: 1.2;
  transition: border-color .15s, color .15s, background .15s;
}
.hd-chip:hover { border-color: #cfcfcf; }
.hd-chip.is-active { border-color: var(--orange); background: var(--orange-soft); color: var(--burnt); }

.hd-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 2px; margin-bottom: -1px;
  font-size: 14px; font-weight: 600; color: var(--gray);
  border-bottom: 2px solid transparent; text-decoration: none;
  transition: color .15s, border-color .15s;
}
.hd-tab:hover { color: var(--ink); }
.hd-tab.is-active { color: var(--ink); border-bottom-color: var(--orange); }

.hd-tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: var(--radius-pill);
  font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--burnt); background: var(--orange-soft); border: 1px solid var(--orange-line);
}

/* State pills (small, solid) — for bucket / status cells in tables. */
.hd-pill {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; padding: 2px 8px; border-radius: var(--radius-pill);
  font-size: 11px; font-weight: 700; line-height: 1.4;
}
.hd-pill-soft {
  display: inline-flex; align-items: center; padding: 2px 9px;
  border-radius: var(--radius-pill); font-size: 12px; font-weight: 600;
}

/* ---- dark KPI band ----------------------------------------------------- */

.hd-band {
  background: var(--black); color: #fff;
  border-radius: var(--radius-card); padding: 22px 26px;
}
.hd-kpi-num { font-size: 30px; font-weight: 800; color: var(--orange); letter-spacing: -.02em; line-height: 1; }
.hd-kpi-label { font-size: 12px; color: #9a9a9a; margin-top: 5px; }

/* ---- icon tile (orange-soft square) ----------------------------------- */

.hd-icon-tile {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 11px;
  background: var(--orange-soft); color: var(--orange);
  border: 1px solid var(--orange-line);
}

/* ---- inputs (focus polish; base look via Tailwind utilities) ---------- */

.hd-main input:focus, .hd-main select:focus, .hd-main textarea:focus { outline: none; }

/* ---- modal ------------------------------------------------------------- */

.hd-modal-backdrop { background: rgba(10, 10, 10, .55); backdrop-filter: blur(2px); }
.hd-modal-card {
  background: #fff; border-radius: 18px;
  box-shadow: 0 30px 70px -30px rgba(10, 10, 10, .5), 0 0 0 1px rgba(10, 10, 10, .06);
}

/* ---- decorative geometry (login hero) --------------------------------- */

.hd-decoration {
  position: absolute; pointer-events: none;
  background: var(--orange); opacity: .06; border-radius: 60px;
  transform: rotate(12deg);
}

/* ---- kanban deal card -------------------------------------------------- */

.deal-card { transition: box-shadow .15s, transform .15s; }
.deal-card:hover {
  box-shadow: 0 0 0 1px rgba(10, 10, 10, .06), 0 8px 20px -8px rgba(10, 10, 10, .22) !important;
  transform: translateY(-1px);
}

/* ---- KPI tile (deep-dive) --------------------------------------------- */

.hd-kpi-tile {
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 0 0 1px rgba(10, 10, 10, .01), 0 4px 14px -10px rgba(10, 10, 10, .12);
  padding: 10px 14px;
}
.hd-kpi-tile .k-label { font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--gray-2); }
.hd-kpi-tile .k-value { font-size: 19px; font-weight: 800; letter-spacing: -.01em; color: var(--ink); line-height: 1.15; }
.hd-kpi-tile.is-hero { background: var(--black); border-color: var(--black); }
.hd-kpi-tile.is-hero .k-label { color: #9a9a9a; }
.hd-kpi-tile.is-hero .k-value { color: var(--orange); }

@media (prefers-reduced-motion: reduce) {
  .hd-btn, .hd-card-lift, .hd-nav-link, .hd-chip, .hd-tab, .deal-card { transition: none; }
}
