/* Declare the Tailwind layer order up front so `components` (this file) sits BELOW
   `utilities` (compiled dashboard.css) — otherwise unlayered rules like `.alert{display:flex}`
   would override utilities such as `.hidden` and break show/hide behaviour. */
@layer theme, base, components, utilities;

/* ===== Easy Invoicer dashboard — design tokens & components (moda.app export) ===== */

/* Self-hosted fonts, shared with the landing page (only the weights in use). */
@font-face { font-family: 'Hanken Grotesk'; src: url("../../landing/fonts/hankengrotesk-light.ttf") format("truetype"); font-style: normal; font-weight: 300; font-display: swap; }
@font-face { font-family: 'Hanken Grotesk'; src: url("../../landing/fonts/hankengrotesk-regular.ttf") format("truetype"); font-style: normal; font-weight: 400; font-display: swap; }
@font-face { font-family: 'Hanken Grotesk'; src: url("../../landing/fonts/hankengrotesk-medium.ttf") format("truetype"); font-style: normal; font-weight: 500; font-display: swap; }
@font-face { font-family: 'Hanken Grotesk'; src: url("../../landing/fonts/hankengrotesk-semibold.ttf") format("truetype"); font-style: normal; font-weight: 600; font-display: swap; }
@font-face { font-family: 'Source Code Pro'; src: url("../../landing/fonts/sourcecodepro-regular.ttf") format("truetype"); font-style: normal; font-weight: 400; font-display: swap; }
@font-face { font-family: 'Source Code Pro'; src: url("../../landing/fonts/sourcecodepro-medium.ttf") format("truetype"); font-style: normal; font-weight: 500; font-display: swap; }

@layer components {

:root {
  --primary: #533AFD;        /* blurple — action only */
  --primary-active: #4032C8;
  --primary-tint: #E2E4FF;
  --ink: #061B31;            /* blue-black */
  --body: #50617A;
  --muted: #64748D;
  --quiet: #7D8BA4;
  --hairline: #E5EDF5;
  --surface: #F8FAFD;
  --canvas: #FFFFFF;
  --success: #00D66F;
  --success-ink: #059b53;
  --warning: #F5A623;
  --warning-ink: #b4740a;
  --error: #EA2261;
  --dark: #0D1738;           /* dark surface */
  --shadow-card: 0 1px 2px rgba(6,27,49,.06), 0 8px 24px rgba(6,27,49,.06);
  --shadow-lift: 0 1px 2px rgba(6,27,49,.06), 0 22px 54px -16px rgba(6,27,49,.18);
}

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Hanken Grotesk', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--body);
  background: var(--surface);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { color: var(--ink); font-weight: 300; }
.display { font-weight: 300; letter-spacing: -0.028em; line-height: 1.04; }
.h2 { font-weight: 300; letter-spacing: -0.02em; line-height: 1.14; }
.eyebrow { font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; font-size: 12px; }
.mono { font-family: 'Source Code Pro', ui-monospace, 'SF Mono', monospace; font-variant-numeric: tabular-nums; }

a { color: inherit; }
::selection { background: var(--primary-tint); color: var(--ink); }

/* signature brand gradient */
.brand-gradient {
  background: linear-gradient(115deg, #FB76FA 0%, #FF6118 30%, #FFCF5E 55%, #533AFD 100%);
}
.gradient-icon {
  background: linear-gradient(135deg, #FB76FA 0%, #FF6118 40%, #FFCF5E 65%, #533AFD 100%);
}

/* Buttons — pill radius reserved for buttons only.
   Default padding so legacy (un-restyled) Pegasus pages still get usable buttons;
   restyled templates override it with px-*/py-* utilities. */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 16px; font-size: 14px; cursor: pointer; border-radius: 999px; font-weight: 500; transition: background .15s ease, color .15s ease, border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(83,58,253,.35); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-active); }
.btn-secondary { background: #fff; color: var(--ink); border: 1px solid var(--hairline); }
.btn-secondary:hover { border-color: var(--quiet); }
.btn-onlight-ghost { color: var(--primary); }
.btn-onlight-ghost:hover { color: var(--primary-active); }
/* legacy Pegasus button variants mapped onto the theme */
.btn-outline { background: #fff; color: var(--ink); border: 1px solid var(--hairline); }
.btn-outline:hover { border-color: var(--quiet); }
.btn-ghost { background: transparent; color: var(--primary); }
.btn-ghost:hover { color: var(--primary-active); }
.btn-error { background: var(--error); color: #fff; }
.btn-error:hover { filter: brightness(.92); }
.btn-danger-outline { background: #fff; color: var(--error); border: 1px solid rgba(234,34,97,.4); }
.btn-danger-outline:hover { border-color: var(--error); }
.btn-sm, .btn-xs { padding: 5px 12px; font-size: 12px; }

.link { color: var(--primary); font-weight: 500; }
.link:hover { color: var(--primary-active); }

/* Cards — 16px radius, soft low-contrast elevation */
.card { border-radius: 16px; background: #fff; box-shadow: var(--shadow-card); border: 1px solid var(--hairline); }
.lift { box-shadow: var(--shadow-lift); }
/* legacy Pegasus card sections keep working on un-restyled pages */
.app-card { border-radius: 16px; background: #fff; box-shadow: var(--shadow-card); border: 1px solid var(--hairline); padding: 24px; margin-bottom: 20px; }

.divide-hair > * + * { border-top: 1px solid var(--hairline); }

/* Sidebar nav item */
.nav-item { border-radius: 10px; transition: background .15s ease, color .15s ease; color: var(--body); }
.nav-item:hover { background: var(--surface); color: var(--ink); }
.nav-item.active { background: var(--ink); color: #fff; }
.nav-item.active svg { color: #fff; }

/* Table */
.dash-table th { font-weight: 500; color: var(--muted); font-size: 13px; text-align: left; }
.dash-table td { color: var(--body); }
.dash-table tbody tr + tr { border-top: 1px solid var(--hairline); }
.dash-table tbody tr:hover { background: var(--surface); }
/* legacy Pegasus tables on un-restyled pages */
.table { width: 100%; font-size: 14px; }
.table th { font-weight: 500; color: var(--muted); font-size: 13px; text-align: left; padding: 12px 16px; background: var(--surface); }
.table td { color: var(--body); padding: 14px 16px; }
.table tbody tr + tr { border-top: 1px solid var(--hairline); }

/* Status pill */
.pill { border-radius: 999px; font-size: 12px; font-weight: 500; padding: 3px 10px; display: inline-flex; align-items: center; gap: 6px; }
.pill-paid { background: rgba(0,214,111,.12); color: var(--success-ink); }
.pill-due { background: rgba(245,166,35,.14); color: var(--warning-ink); }
.pill-overdue { background: rgba(234,34,97,.10); color: var(--error); }
.pill-neutral { background: var(--primary-tint); color: var(--primary-active); }

/* Inputs */
.field { border: 1px solid var(--hairline); border-radius: 10px; background: #fff; color: var(--ink); transition: border-color .15s ease, box-shadow .15s ease; }
.field:focus-within, .field:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(83,58,253,.12); outline: none; }

/* Django-rendered forms (render_field / render_form_fields output): style by element
   inside a .dash-form wrapper so widget classes coming from Python stay irrelevant. */
.dash-form label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 500; color: var(--ink); }
.dash-form input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="file"]),
.dash-form select,
.dash-form textarea {
  width: 100%; padding: 10px 14px; font-size: 14px; font-family: inherit;
  border: 1px solid var(--hairline); border-radius: 10px; background: #fff; color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.dash-form input:focus, .dash-form select:focus, .dash-form textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(83,58,253,.12); outline: none;
}
.dash-form input::placeholder, .dash-form textarea::placeholder { color: var(--quiet); }
.dash-form small { display: block; margin-top: 6px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.dash-form small:empty { display: none; }
.dash-form .helptext { font-size: 12px; color: var(--muted); }
.dash-form ul.errorlist { margin-top: 6px; font-size: 13px; color: var(--error); list-style: none; padding: 0; }
.dash-form input[type="submit"] { cursor: pointer; }

/* Messages */
.alert { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-radius: 12px; border: 1px solid var(--hairline); background: #fff; padding: 12px 16px; font-size: 14px; color: var(--ink); box-shadow: var(--shadow-card); }
.alert-success { border-color: rgba(0,214,111,.35); background: rgba(0,214,111,.07); }
.alert-info { border-color: var(--primary-tint); background: rgba(83,58,253,.06); }
.alert-warning { border-color: rgba(245,166,35,.4); background: rgba(245,166,35,.08); }
.alert-error, .alert-danger { border-color: rgba(234,34,97,.35); background: rgba(234,34,97,.06); }

/* Checkbox-toggle modal (same mechanic Pegasus templates already use) */
.modal-toggle { display: none; }
.modal { position: fixed; inset: 0; z-index: 60; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(6,27,49,.45); }
.modal-toggle:checked + .modal { display: flex; }
.modal-box { max-width: 640px; width: 100%; border-radius: 16px; background: #fff; padding: 28px; box-shadow: var(--shadow-lift); }
.modal-action { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }

/* htmx loading */
.htmx-indicator { opacity: 0; transition: opacity .2s ease; pointer-events: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }

/* Alpine: hide bound elements until initialized */
[x-cloak] { display: none !important; }

/* Subscription plan selector */
#plan-selector .plan { border: 2px solid var(--hairline); transition: border-color .15s ease, box-shadow .15s ease; }
#plan-selector .plan.is-selected { border-color: var(--primary); }

} /* @layer components */
