/* Design tokens. Tenant branding can override --brand and --brand-strong (see docs/ui-polish-plan.md). */
:root {
  --brand: #1f6b46; --brand-strong: #154d32; --brand-soft: #e4f1e9; --on-brand: #fff;
  --bg: #f4f7f5; --surface: #fff; --surface-2: #f8faf9;
  --text: #17291f; --muted: #53695d; --line: #d5e0d9; --line-strong: #9db3a6;
  --info-bg: #e4f1e9; --danger: #b3261e;
  --radius: .7rem; --radius-sm: .45rem;
  --shadow: 0 1px 2px rgb(23 41 31 / .06), 0 4px 14px rgb(23 41 31 / .05);
  --focus: 0 0 0 3px rgb(31 107 70 / .35);
  --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-family: var(--font); font-size: 16px; line-height: 1.5; color: var(--text); background: var(--bg);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --brand: #4ca679; --brand-strong: #6bbf93; --brand-soft: #1d3328; --on-brand: #0d1a13;
    --bg: #0f1713; --surface: #16211b; --surface-2: #1b2821;
    --text: #e6efe9; --muted: #9bb0a4; --line: #2a3a31; --line-strong: #4b6455;
    --info-bg: #1d3328; --danger: #f2a29c;
    --shadow: 0 1px 2px rgb(0 0 0 / .4);
    --focus: 0 0 0 3px rgb(107 191 147 / .45);
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
header, main { max-width: 1100px; margin: auto; padding: 1rem 1.25rem; }
header { padding-top: 2rem; padding-bottom: .5rem; }
h1, h2, h3 { line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 1.75rem; margin: 0 0 .25rem; }
h2 { font-size: 1.2rem; margin: 0 0 .75rem; }
header h1 { color: var(--brand-strong); }
header p, small, .muted { color: var(--muted); }
header p { margin: 0; }
p { margin: .5rem 0; }
a { color: var(--brand-strong); text-underline-offset: .2em; }

.panel { background: var(--surface); padding: 1.4rem; margin-bottom: 1.1rem; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }

/* Navigation: one sticky row of pills that scrolls sideways on small screens. */
nav { position: sticky; top: 0; z-index: 2; display: flex; gap: .35rem; margin: 0 0 1rem; padding: .5rem 0; overflow-x: auto; background: var(--bg); scrollbar-width: thin; }
nav a { flex: none; padding: .45rem .85rem; border-radius: 999px; text-decoration: none; color: var(--text); background: var(--surface); border: 1px solid var(--line); font-size: .92rem; }
nav a:hover { background: var(--brand-soft); border-color: var(--brand); }
nav a[aria-current="page"] { background: var(--brand); border-color: var(--brand); color: var(--on-brand); font-weight: 600; }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; margin: 1rem 0; }

label { display: block; margin: .8rem 0; font-weight: 500; font-size: .93rem; }
input, select, textarea, button { font: inherit; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: .6rem .75rem; }
input, select, textarea { width: 100%; margin-top: .3rem; background: var(--surface); color: var(--text); font-weight: 400; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, summary:focus-visible, a:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; box-shadow: var(--focus); }
input[type="checkbox"], input[type="radio"] { width: auto; margin-right: .4rem; accent-color: var(--brand); }
textarea, pre { font-family: var(--mono); font-size: .88rem; }

button { background: var(--brand); border-color: var(--brand); color: var(--on-brand); font-weight: 600; cursor: pointer; margin: .3rem .4rem .3rem 0; transition: background .12s, transform .05s; }
button:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
button:active { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: wait; }
details { margin: .75rem 0; }
summary { cursor: pointer; color: var(--muted); padding: .25rem 0; }

.grid, .choice { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .75rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; margin: .5rem 0 1rem; }
.tile { display: flex; flex-direction: column; gap: .15rem; padding: 1rem; text-decoration: none; color: var(--text); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); transition: border-color .12s, transform .05s; }
.tile:hover { border-color: var(--brand); }
.tile strong { font-size: 1.9rem; line-height: 1.1; color: var(--brand-strong); }
.tile span { color: var(--muted); font-size: .88rem; }
.badge { display: inline-block; padding: .05rem .5rem; border-radius: 999px; font-size: .75rem; font-weight: 600; background: var(--brand-soft); color: var(--brand-strong); }
.badge-low { background: #fff1d6; color: #7a4b00; }
.badge-out { background: #fde2df; color: #8a1c14; }
@media (prefers-color-scheme: dark) { .badge-low { background: #3b2d10; color: #f3c978; } .badge-out { background: #3d1a17; color: #f2a29c; } }
#catalog-tools { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: .5rem; }
.grid > button { align-self: end; margin: 0 0 .8rem; }
.choice { border-top: 1px solid var(--line); padding: .6rem 0; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 25rem; overflow: auto; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .75rem; }

table { border-collapse: collapse; width: 100%; text-align: left; font-size: .94rem; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: var(--surface-2); }
th, td { padding: .65rem .75rem; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
tbody tr:hover { background: var(--surface-2); }
.scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.scroll table { border: 0; }

#dropzone { border: 2px dashed var(--line-strong); padding: 1.25rem; border-radius: var(--radius); background: var(--surface-2); transition: border-color .12s, background .12s; }
#dropzone:hover, #dropzone.dragover { border-color: var(--brand); background: var(--brand-soft); }

#message { position: sticky; top: 3.4rem; z-index: 3; margin: 0 0 1rem; padding: .75rem 1rem; background: var(--info-bg); border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: var(--radius-sm); white-space: pre-wrap; }
#message:empty { display: none; }

[hidden] { display: none !important; }

body[data-signed-in="true"] #signin { display: flex; justify-content: flex-end; padding: 0; margin: 0 0 .5rem; background: none; border: 0; box-shadow: none; }
body[data-signed-in="true"] #signin button { margin: 0; padding: .35rem .8rem; background: none; color: var(--muted); border-color: var(--line-strong); font-weight: 500; }
body[data-signed-in="true"] #signin button:hover { background: var(--brand-soft); color: var(--text); }

/* Wide screens: navigation becomes a sidebar next to the active module. */
@media (min-width: 900px) {
  header, main { max-width: 1280px; }
  #workspace { display: grid; grid-template-columns: 13.5rem minmax(0, 1fr); gap: 1.5rem; align-items: start; }
  #workspace[hidden] { display: none; }
  #workspace > nav { position: sticky; top: 1rem; flex-direction: column; gap: .25rem; overflow: visible; padding: 0; background: none; margin: 0; }
  #workspace > nav a { border-radius: var(--radius-sm); border-color: transparent; background: none; padding: .55rem .8rem; }
  #workspace > nav a:hover { background: var(--brand-soft); }
  #workspace > nav a[aria-current="page"] { background: var(--brand); }
  #workspace > section { grid-column: 2; margin-bottom: 0; }
  #message { top: 0; }
}
@media (max-width: 640px) {
  header, main { padding-left: .85rem; padding-right: .85rem; }
  .panel { padding: 1rem; }
  h1 { font-size: 1.45rem; }
  button { width: 100%; margin-right: 0; }
  .actions button { flex: 1 1 8rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

@media print {
  body { background: white; color: black; }
  header, #access, #message, nav, #workspace > section:not(#quotes), #quotes > :not(#quote-result) { display: none !important; }
  .panel { border: none; padding: 0; box-shadow: none; background: white; }
}
