/* ============================================================================
   AI Digital — Design System
   Portable stylesheet: design tokens + generic, reusable components.
   Extracted from the "Report Constructor" app and generalized for any service.
   Plain CSS + custom properties — framework-agnostic (works with React, Vue,
   plain HTML, etc.). Load the fonts (see DESIGN_SYSTEM.md) before using.
   ============================================================================ */

/* -- RESET ------------------------------------------------------------------*/
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* -- TOKENS -----------------------------------------------------------------*/
:root {
  /* Brand */
  --blue: #0006df;            /* primary */
  --blue-hover: #0005c0;
  --blue-light: rgba(0, 6, 223, 0.07);
  --blue-border: rgba(0, 6, 223, 0.2);
  --lime: #aef33f;            /* accent / primary CTA */
  --lime-hover: #c2ff4a;
  --lime-light: rgba(174, 243, 63, 0.15);
  --lime-border: rgba(174, 243, 63, 0.5);

  /* Neutrals */
  --black: #111111;
  --white: #ffffff;
  --gray-light: #f5f5f5;      /* input fills, subtle surfaces */
  --gray-mid: #e8e8e8;
  --gray: #aaaaaa;            /* muted icons / placeholders */
  --text-muted: #666666;
  --border: #e4e4e4;

  /* Status */
  --red: #d93025;
  --orange: #f59e0b;
  --green: #4caf50;

  /* Typography */
  --font-display: 'DM Serif Display', serif;   /* headings, titles */
  --font-sans: 'DM Sans', sans-serif;          /* body, buttons, inputs */
  --font-mono: 'DM Mono', monospace;           /* badges, labels, numbers, meta */
  --text-base: 15px;

  /* Shape */
  --radius-card: 10px;
  --radius-control: 7px;
  --radius-pill: 20px;
  --radius-sm: 5px;
  --focus-ring: 0 0 0 3px var(--blue-light);

  /* Spacing scale */
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
  --space-5: 20px; --space-6: 24px; --space-8: 32px; --space-12: 48px;

  /* Elevation */
  --shadow-modal: 0 24px 64px rgba(0, 0, 0, 0.22);
  --shadow-pop:   0 8px 28px rgba(0, 6, 223, 0.25);
}

/* -- BASE -------------------------------------------------------------------*/
html { background: var(--white); color: var(--black); font-family: var(--font-sans); font-size: var(--text-base); }
body { min-height: 100vh; font-family: var(--font-sans); font-size: var(--text-base); color: var(--black); background: var(--white); }

h1, h2, h3 { font-family: var(--font-display); font-weight: 400; letter-spacing: -0.3px; line-height: 1.15; }
a { color: var(--blue); text-decoration: none; }

/* Utility: mono label (uppercase tracked) */
.ds-mono-label { font-family: var(--font-mono); font-size: 10px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--text-muted); }

/* -- NAV (sticky top bar) ----------------------------------------------------*/
.ds-nav {
  background: var(--white); border-bottom: 1px solid var(--border);
  padding: 0 var(--space-12); display: flex; align-items: center;
  height: 64px; position: sticky; top: 0; z-index: 50;
}
.ds-nav-logo { display: flex; align-items: center; gap: 10px; }
.ds-nav-logo-mark { width: 30px; height: 30px; background: var(--blue); border-radius: 6px; display: grid; place-items: center; }
.ds-nav-logo-mark svg { color: var(--lime); }
.ds-nav-logo-text { font-family: var(--font-display); font-size: 17px; color: var(--blue); letter-spacing: -0.3px; }
.ds-nav-logo-text span { color: var(--black); }
.ds-nav-right { margin-left: auto; display: flex; align-items: center; gap: var(--space-3); }
.ds-nav-user { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 7px; }
.ds-nav-user-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 2px rgba(174,243,63,0.3); }

/* -- HERO (blue banner with dotted pattern) ----------------------------------*/
.ds-hero { background: var(--blue); padding: 60px var(--space-12) 56px; position: relative; overflow: hidden; }
.ds-hero-dots { position: absolute; inset: 0; background-image: radial-gradient(circle, rgba(174,243,63,0.15) 1px, transparent 1px); background-size: 28px 28px; }
.ds-hero-inner { max-width: 960px; margin: 0 auto; position: relative; }
.ds-hero h1 { font-family: var(--font-display); font-size: 48px; color: var(--white); line-height: 1.08; letter-spacing: -0.8px; margin-bottom: 18px; }
.ds-hero h1 em { color: var(--lime); font-style: italic; }
.ds-hero-sub { font-size: 16px; color: rgba(255,255,255,0.55); font-weight: 300; max-width: 520px; line-height: 1.65; }

/* -- TAG / BADGE / PILL -------------------------------------------------------*/
.ds-tag {            /* lime tag pill, e.g. section eyebrow */
  display: inline-flex; align-items: center; gap: 7px; background: var(--lime); color: var(--black);
  font-family: var(--font-mono); font-size: 10px; font-weight: 500; letter-spacing: 1.5px;
  text-transform: uppercase; padding: 6px 12px; border-radius: 4px;
}
.ds-tag-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--blue); }
.ds-badge {          /* blue outline badge */
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--blue); background: var(--blue-light); border: 1px solid var(--blue-border);
  padding: 5px 11px; border-radius: var(--radius-pill);
}

/* -- BUTTONS ------------------------------------------------------------------*/
.ds-btn-primary {    /* lime CTA — the main action */
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 13px 18px; background: var(--lime); color: var(--black); border: none;
  border-radius: var(--radius-control); font-family: var(--font-sans); font-size: 14px;
  font-weight: 600; cursor: pointer; transition: all 0.18s; letter-spacing: -0.1px;
}
.ds-btn-primary:hover:not(:disabled) { background: var(--lime-hover); transform: translateY(-1px); box-shadow: 0 6px 20px rgba(174,243,63,0.4); }
.ds-btn-primary:disabled { opacity: 0.35; cursor: not-allowed; }

.ds-btn-blue {       /* solid blue button — secondary primary */
  display: inline-flex; align-items: center; gap: 7px; padding: 11px 16px;
  background: var(--blue); color: var(--white); border: none; border-radius: var(--radius-control);
  font-family: var(--font-sans); font-size: 13px; font-weight: 500; cursor: pointer;
  white-space: nowrap; transition: all 0.18s;
}
.ds-btn-blue:hover:not(:disabled) { background: var(--blue-hover); }
.ds-btn-blue:disabled { opacity: 0.45; cursor: not-allowed; }

.ds-btn-outline {    /* blue outline button */
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 11px 18px; background: var(--white); color: var(--blue); border: 1.5px solid var(--blue);
  border-radius: var(--radius-control); font-family: var(--font-sans); font-size: 13px;
  font-weight: 500; cursor: pointer; transition: all 0.18s;
}
.ds-btn-outline:hover:not(:disabled) { background: var(--blue-light); }
.ds-btn-outline:disabled { opacity: 0.35; cursor: not-allowed; }

.ds-btn-ghost {      /* low-emphasis bordered button */
  padding: 9px; background: transparent; color: var(--text-muted); border: 1px solid var(--border);
  border-radius: var(--radius-control); font-family: var(--font-sans); font-size: 13px; cursor: pointer; transition: all 0.15s;
}
.ds-btn-ghost:hover { border-color: var(--gray); color: var(--black); }

/* -- INPUTS -------------------------------------------------------------------*/
.ds-input, .ds-textarea {
  width: 100%; background: var(--gray-light); border: 1.5px solid var(--border);
  border-radius: var(--radius-control); color: var(--black); font-family: var(--font-sans);
  font-size: 14px; outline: none; transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}
.ds-input { padding: 12px 17px; }
.ds-textarea { padding: 15px 17px; min-height: 196px; line-height: 1.7; resize: vertical; }
.ds-input::placeholder, .ds-textarea::placeholder { color: var(--gray); }
.ds-input:focus, .ds-textarea:focus { border-color: var(--blue); background: var(--white); box-shadow: var(--focus-ring); }

.ds-field-error { font-size: 12px; color: var(--red); margin-top: 7px; }

/* -- CARD ---------------------------------------------------------------------*/
.ds-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-card); overflow: hidden; }
.ds-card-header { padding: 20px 24px 16px; border-bottom: 1px solid var(--gray-light); display: flex; align-items: flex-start; gap: 14px; }
.ds-card-num {  /* blue numbered tile with lime number */
  width: 28px; height: 28px; background: var(--blue); border-radius: var(--radius-sm); display: grid; place-items: center;
  flex-shrink: 0; font-family: var(--font-mono); font-size: 11px; color: var(--lime); font-weight: 500; margin-top: 1px;
}
.ds-card-title { font-family: var(--font-display); font-size: 19px; color: var(--blue); letter-spacing: -0.2px; line-height: 1.2; }
.ds-card-desc { font-size: 12px; color: var(--text-muted); margin-top: 3px; line-height: 1.5; }
.ds-card-body { padding: 22px 24px 24px; }

/* Card entrance animation (optional) */
.ds-fade-up { opacity: 0; transform: translateY(10px); animation: dsFadeUp 0.3s ease forwards; }
@keyframes dsFadeUp { to { opacity: 1; transform: translateY(0); } }

/* -- STEPPER (sticky progress) --------------------------------------------------*/
.ds-stepper { background: var(--white); border-bottom: 1px solid var(--border); position: sticky; top: 64px; z-index: 40; }
.ds-stepper-inner { max-width: 960px; margin: 0 auto; padding: 0 var(--space-12); display: flex; }
.ds-step { display: flex; align-items: center; gap: 10px; padding: 16px 0; border-bottom: 2px solid transparent; cursor: pointer; transition: border-color 0.2s; color: inherit; }
.ds-step + .ds-step { margin-left: var(--space-8); }
.ds-step.active { border-bottom-color: var(--blue); }
.ds-step-circle { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--border); display: grid; place-items: center; flex-shrink: 0; font-family: var(--font-mono); font-size: 10px; color: var(--gray); transition: all 0.2s; }
.ds-step.active .ds-step-circle { border-color: var(--blue); color: var(--blue); background: var(--blue-light); }
.ds-step.done .ds-step-circle { border-color: var(--lime); background: var(--lime); color: var(--black); }
.ds-step-label { font-size: 13px; font-weight: 500; color: var(--gray); transition: color 0.2s; }
.ds-step.active .ds-step-label { color: var(--blue); }
.ds-step.done .ds-step-label { color: var(--black); }

/* -- STATUS LIST (e.g. sidebar) --------------------------------------------------*/
.ds-status-card { border: 1px solid var(--border); border-radius: var(--radius-card); overflow: hidden; }
.ds-status-head { padding: 13px 18px; background: var(--blue); display: flex; align-items: center; gap: 8px; }
.ds-status-head svg { color: var(--lime); flex-shrink: 0; }
.ds-status-head span { font-family: var(--font-mono); font-size: 10px; letter-spacing: 1.4px; text-transform: uppercase; color: rgba(255,255,255,0.65); }
.ds-status-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 18px; border-bottom: 1px solid var(--gray-light); background: var(--white); }
.ds-status-row:last-child { border-bottom: none; }
.ds-status-key { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 7px; }
.ds-status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--gray-mid); flex-shrink: 0; transition: background 0.2s; }
.ds-status-dot.on { background: var(--lime); box-shadow: 0 0 0 2px rgba(174,243,63,0.3); }
.ds-status-val { font-family: var(--font-mono); font-size: 11px; color: var(--gray); }
.ds-status-val.on { color: var(--blue); font-weight: 500; }

/* -- SEGMENTED TOGGLE -------------------------------------------------------------*/
.ds-segmented { display: flex; gap: var(--space-2); }
.ds-segmented-btn { flex: 1; padding: 10px 0; border: 1.5px solid var(--border); border-radius: var(--radius-control); background: var(--gray-light); font-family: var(--font-sans); font-size: 13px; font-weight: 500; color: var(--text-muted); cursor: pointer; transition: all 0.18s; display: flex; flex-direction: column; align-items: center; gap: var(--space-1); }
.ds-segmented-btn:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-light); }
.ds-segmented-btn.active { border-color: var(--blue); background: var(--blue); color: var(--white); }

/* -- HINT / CALLOUT ----------------------------------------------------------------*/
.ds-hint { font-size: 12px; color: var(--text-muted); line-height: 1.5; padding: 10px 13px; background: var(--gray-light); border-radius: 6px; border: 1px solid var(--border); }
.ds-hint strong { color: var(--black); font-weight: 600; }
.ds-callout { display: flex; align-items: center; gap: var(--space-3); padding: 12px 15px; border-radius: 8px; font-size: 12px; }
.ds-callout.warn { background: #fff8e1; border: 1.5px solid #ffd54f; color: #7a5c00; }
.ds-callout.warn svg { color: var(--orange); flex-shrink: 0; }
.ds-callout.ok { background: #e8f5e9; border: 1.5px solid #a5d6a7; color: #1b5e20; }
.ds-callout.ok svg { color: var(--green); flex-shrink: 0; }

/* -- TABLE ---------------------------------------------------------------------------*/
.ds-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.ds-table th { background: var(--blue); color: var(--white); padding: 7px 10px; text-align: left; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.4px; }
.ds-table td { padding: 6px 10px; border-bottom: 1px solid var(--gray-light); color: var(--black); }
.ds-table tr:last-child td { border-bottom: none; }
.ds-table tr:hover td { background: var(--gray-light); }

/* -- MODAL ----------------------------------------------------------------------------*/
.ds-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; }
.ds-modal { background: var(--white); border-radius: 14px; width: 100%; max-width: 720px; max-height: 90vh; display: flex; flex-direction: column; box-shadow: var(--shadow-modal); animation: dsFadeUp 0.25s ease; }
.ds-modal-head { padding: 20px 24px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: flex-start; gap: 14px; flex-shrink: 0; }
.ds-modal-icon { width: 34px; height: 34px; border-radius: 7px; background: var(--blue); display: grid; place-items: center; flex-shrink: 0; color: var(--lime); }
.ds-modal-title { font-family: var(--font-display); font-size: 19px; color: var(--blue); line-height: 1.2; }
.ds-modal-desc { font-size: 12px; color: var(--text-muted); margin-top: 3px; line-height: 1.5; }
.ds-modal-body { flex: 1; overflow-y: auto; padding: 18px 24px 24px; }
.ds-modal-foot { padding: 14px 24px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; gap: var(--space-3); flex-wrap: wrap; }

/* -- TOAST -------------------------------------------------------------------------------*/
.ds-toast { position: fixed; bottom: 24px; right: 24px; background: var(--blue); border-radius: 8px; padding: 13px 17px; font-size: 13px; line-height: 1.5; color: var(--white); display: flex; align-items: flex-start; gap: 10px; transform: translateY(70px); opacity: 0; transition: all 0.28s cubic-bezier(0.34,1.56,0.64,1); z-index: 200; box-shadow: var(--shadow-pop); max-width: 440px; overflow-wrap: anywhere; }
.ds-toast.show { transform: translateY(0); opacity: 1; }
.ds-toast.error { background: var(--red); }
.ds-toast-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--lime); flex-shrink: 0; margin-top: 5px; }

/* -- LOADING (spinner + overlay) ----------------------------------------------------------*/
.ds-overlay-fixed { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; background: rgba(255,255,255,0.94); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.ds-loading { display: flex; flex-direction: column; gap: 14px; padding: 28px 24px; text-align: center; background: var(--white); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 24px 64px rgba(0,0,0,0.12); min-width: 320px; }
.ds-spinner { width: 44px; height: 44px; border-radius: 50%; border: 3px solid var(--gray-mid); border-top-color: var(--blue); animation: dsSpin 0.85s linear infinite; margin: 0 auto; }
.ds-progress-track { width: 100%; max-width: 320px; margin: 4px auto 0; height: 5px; background: var(--gray-mid); border-radius: 3px; overflow: hidden; }
.ds-progress-bar { height: 100%; background: var(--blue); border-radius: 3px; transition: width 0.6s ease; }
@keyframes dsSpin { to { transform: rotate(360deg); } }

/* -- LAYOUT HELPERS -------------------------------------------------------------------------*/
.ds-page { max-width: 960px; margin: 0 auto; padding: 44px var(--space-12) 80px; }
.ds-page-2col { display: grid; grid-template-columns: 1fr 264px; gap: 28px; align-items: start; }
.ds-stack { display: flex; flex-direction: column; gap: var(--space-6); }

@media (max-width: 820px) {
  .ds-page-2col { grid-template-columns: 1fr; }
}
