/*
 * assets/css/app.css — panel shell.
 *
 * What it does: design tokens (colour, typography, radius) + sidebar/content layout
 * + the form and state styles of the setup flow.
 * Used by: every panel page through includes/layout.php, and the standalone sign-in page.
 *
 * The TOKENS have the SAME VALUES as web/assets/style.css (specs/web.md "Carried-over design
 * system"): cream background · blue #2f6df6 · spring green #2fb573 · 18px radius. The marketing
 * site's COMPONENTS were not carried over — the panel needs other things; what is shared is the language, not the code.
 * The font on web is Sora/Inter; the panel uses the system stack: an external font load
 * gets in front of every screen in the panel and its brand value is close to zero.
 */

:root {
  --ink: #0e1320;
  --ink-soft: #46506b;
  --ink-faint: #8a92ab;
  --bg: #fbfaf7;
  --surface: #ffffff;
  --line: #e8e6df;
  --accent: #2f6df6;
  --accent-dark: #1d4fd7;
  --accent-soft: #e8efff;
  --spring: #2fb573;
  --spring-soft: #e3f6ec;
  --coral: #ff6b5e;
  --radius: 18px;
  --shadow-sm: 0 1px 2px rgba(14, 19, 32, .05), 0 4px 16px rgba(14, 19, 32, .05);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
}

.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.mobile-bar { display: none; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: var(--surface);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.sidebar__brand { font-weight: 700; font-size: 18px; letter-spacing: -.01em; padding: 0 8px; }
.sidebar__group { display: flex; flex-direction: column; gap: 2px; }
.sidebar__label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--ink-faint); padding: 0 8px 6px;
}

.sidebar__link {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 10px; border-radius: 10px; text-decoration: none;
  color: var(--ink-soft); font-weight: 500;
}
.sidebar__link[hidden] { display: none; }
.sidebar__link:hover { background: var(--bg); color: var(--ink); }
.sidebar__link[aria-current="page"] { background: var(--accent-soft); color: var(--accent-dark); }

/* The dot next to a product that needs setup — the visible end of ADR-0027 k.2. */
.sidebar__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--coral); }
.sidebar__dot[hidden] { display: none; }

.content { padding: 40px; max-width: 860px; }
.content__title { font-size: 26px; margin: 0 0 6px; letter-spacing: -.02em; }
.content__intro { color: var(--ink-soft); margin: 0 0 28px; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 24px; margin-bottom: 16px;
}
.card__title { font-size: 17px; margin: 0 0 4px; }
.card__note { color: var(--ink-soft); margin: 0 0 18px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.field__label { font-weight: 600; font-size: 13px; }
.field__hint { color: var(--ink-faint); font-size: 12px; }
select, input[type="text"], input[type="email"], input[type="password"] {
  font: inherit; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--surface); color: var(--ink);
}
input[readonly] { background: var(--bg); color: var(--ink-soft); }
select:focus, input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

.btn {
  font: inherit; font-weight: 600; cursor: pointer; padding: 10px 18px;
  border-radius: 10px; border: 1px solid transparent; background: var(--ink); color: #fff;
}
.btn:hover { background: var(--accent); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn--ghost { background: transparent; color: var(--ink-soft); border-color: var(--line); }
.btn--ghost:hover { background: var(--bg); color: var(--ink); }

.gates { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.gate { display: flex; align-items: center; gap: 10px; padding: 10px 12px;
        border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.gate__pill {
  font-size: 11px; font-weight: 700; letter-spacing: .04em; padding: 3px 8px;
  border-radius: 999px; background: var(--bg); color: var(--ink-faint);
}
.gate--open .gate__pill { background: var(--spring-soft); color: #1c7a4c; }
.gate__reason { color: var(--ink-faint); font-size: 12px; margin-left: auto; }

.notice { border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; }
.notice--info { background: var(--accent-soft); color: var(--accent-dark); }
.notice--warn { background: #fff1ef; color: #a33127; }

.missing { margin: 8px 0 0; padding-left: 18px; color: var(--ink-soft); }
.muted { color: var(--ink-faint); font-size: 12px; }

/* Standalone sign-in uses the same card and form tokens as the panel. */
.auth { min-height: 90vh; display: grid; place-items: center; padding: 24px 16px; }
.auth__card { width: 100%; max-width: 420px; }
.auth__header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.auth__locales { display: flex; gap: 4px; }
.auth__locales .btn { padding: 5px 9px; font-size: 12px; }
.auth__locales [aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-dark); }
.auth__submit { width: 100%; }
.auth__register { display: block; margin-top: 18px; text-align: center; color: var(--accent-dark); }
.sidebar button.sidebar__link { font: inherit; border: 0; background: transparent; cursor: pointer; text-align: left; }

/* Billing screens (Customers, Invoices, the draft editor). */
.sidebar__link--sub { padding-left: 24px; font-size: 14px; }
.notice--ok { background: var(--spring-soft); color: #1c7a4c; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.actions { display: flex; gap: 8px; }
a.btn { display: inline-block; text-decoration: none; }
.line { border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 12px; }
.line__title { font-weight: 600; font-size: 13px; margin-bottom: 10px; }
.line__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 12px; }
.sums { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; margin: 16px 0 8px; }
.sums dt { color: var(--ink-soft); }
.sums dd { margin: 0; font-weight: 600; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
.empty { text-align: center; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; color: var(--ink-faint); font-weight: 600; padding: 0 8px 8px; }
.table td { padding: 10px 8px; border-top: 1px solid var(--line); vertical-align: top; }
.table__strong { font-weight: 600; }
.table__amount { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
input[type="number"], input[type="date"], textarea {
  font: inherit; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--surface); color: var(--ink);
}

/* Sign-up: no sidebar. The card sits in the middle of the page. */
.auth-page { min-height: 100vh; display: flex; flex-direction: column; }
.auth {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 48px 20px;
}
.auth__panel { width: 100%; max-width: 440px; }
.auth__brand { font-weight: 700; font-size: 18px; letter-spacing: -.01em; margin: 0 0 12px; }
.auth__panel .card { margin-bottom: 0; }
.notice__link { display: inline-block; margin-top: 12px; }

@media (max-width: 720px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .content { padding: 24px 20px; }
  .auth { padding: 24px 20px; }
}

@media (max-width: 480px) {
  .shell { grid-template-rows: auto auto 1fr; }
  .mobile-bar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 20px; background: var(--surface); border-bottom: 1px solid var(--line);
  }
  .sidebar { display: none; }
  .sidebar[data-open="true"] { display: flex; }
  .content { grid-row: 3; }
}
