/* Stellaris Ridge client portal — look carried over from the v1 portal
   (Blaez-13/vox portal/index.html), trimmed to sign-in, Hours, FAQs and Documents. */
@font-face { font-family: 'Inter'; src: url('/fonts/Inter-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('/fonts/Inter-700.woff2') format('woff2'); font-weight: 600 700; font-display: swap; }
@font-face { font-family: 'Space Grotesk'; src: url('/fonts/SpaceGrotesk-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }

/* SR light theme (design-systems/stellaris-ridge: cream canvas, cool accents, violet dominant). */
:root {
  color-scheme: light;
  --bg: #FBF9F4;            /* Light Cream canvas */
  --surface: #FFFCF7;       /* card */
  --surface2: #F4EFE6;      /* Dark Cream panels */
  --surface3: #ECE5F6;      /* violet tint: selected tab, neutral buttons */
  --border: #E4DDD0;
  --border-light: #CFC8BB;
  --primary: #5B3FA0;       /* SR violet */
  --primary-hover: #4A3285;
  --primary-ink: #FFFFFF;
  --primary-tint: rgba(91, 63, 160, 0.10);
  --info: #2D5AAF;          /* SR blue: unsaved / near-limit notes */
  --info-tint: rgba(45, 90, 175, 0.08);
  --success: #136B78;       /* deep SR teal, readable on cream */
  --danger: #1F3F80;        /* errors stay in the cool family; weight + border carry them */
  --danger-tint: rgba(31, 63, 128, 0.08);
  --text: #1B1630;
  --text-muted: #5A5670;
  --focus: #2D5AAF;
  --radius: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
}
[hidden] { display: none !important; }

/* Focus: always visible for keyboard users. */
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline-offset: 0; border-color: var(--primary); }
main:focus { outline: none; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: -9999px; top: 8px; background: var(--primary); color: var(--primary-ink); padding: 8px 12px; border-radius: var(--radius-sm); z-index: 100; }
.skip-link:focus { left: 8px; }

/* Header */
.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  position: sticky; top: 0; z-index: 10;
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px 12px;
}
.brand { font-size: 0.82rem; color: var(--text-muted); letter-spacing: 0.05em; font-weight: 600; text-transform: uppercase; white-space: nowrap; }
.brand b { color: var(--primary); font-weight: 700; }
.agency-badge {
  display: inline-block; background: var(--primary-tint); color: var(--primary);
  padding: 2px 8px; border-radius: 4px; font-size: 0.68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em; margin-left: 6px; vertical-align: middle;
}
.picker-wrap { flex: 1; max-width: 260px; min-width: 0; }
.client-picker {
  background: var(--surface2); border: 1px solid var(--border); color: var(--text);
  padding: 8px 12px; border-radius: var(--radius-sm); font-size: 0.9rem; font-family: inherit; width: 100%;
}
.signout-btn {
  background: transparent; border: 1px solid transparent; color: var(--text-muted);
  font-size: 0.85rem; cursor: pointer; padding: 8px 10px; border-radius: var(--radius-sm); font-family: inherit;
}
.signout-btn:hover { color: var(--text); border-color: var(--border); }

.container { max-width: 680px; margin: 0 auto; padding: 20px 16px 80px; }
.client-name { font-family: 'Space Grotesk', 'Inter', sans-serif; font-size: 1.6rem; font-weight: 700; margin-bottom: 4px; overflow-wrap: anywhere; }
.subtitle { color: var(--text-muted); font-size: 0.92rem; margin-bottom: 20px; }

/* Tabs */
.tabs { display: flex; gap: 4px; background: var(--surface2); padding: 4px; border-radius: var(--radius-sm); margin-bottom: 20px; }
.tab {
  flex: 1; background: transparent; border: none; color: var(--text-muted);
  padding: 10px 14px; border-radius: 6px; cursor: pointer; font-size: 0.92rem; font-weight: 600; font-family: inherit;
}
.tab[aria-selected="true"] { background: var(--surface); color: var(--primary); box-shadow: 0 1px 2px rgba(27, 22, 48, 0.08); }
.tab:hover:not([aria-selected="true"]) { color: var(--text); }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 16px; margin-bottom: 14px; box-shadow: 0 1px 2px rgba(27, 22, 48, 0.04); }
.card h2 { font-size: 1.05rem; font-weight: 600; margin-bottom: 6px; }
.card .description { color: var(--text-muted); font-size: 0.88rem; margin-bottom: 14px; }
.notice { background: var(--info-tint); border: 1px solid var(--info); border-left-width: 4px; color: var(--text); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 0.88rem; margin-bottom: 14px; }

/* Buttons */
.btn {
  background: var(--surface3); color: var(--text); border: 1px solid var(--border-light);
  border-radius: var(--radius-sm); padding: 12px 18px; font-size: 0.95rem; font-weight: 600;
  cursor: pointer; font-family: inherit; width: 100%;
}
.btn:hover { background: var(--primary-tint); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn.danger:hover { background: var(--danger); color: var(--primary-ink); }
.btn.ghost { background: transparent; border-color: var(--border-light); color: var(--text); }
.btn.small { width: auto; padding: 8px 14px; font-size: 0.85rem; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.add-btn { margin-bottom: 14px; }

.save-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 4px; }
.save-row .btn { width: auto; min-width: 160px; }
.save-status { font-size: 0.9rem; color: var(--text-muted); }
.save-status.ok { color: var(--success); font-weight: 600; }
.save-status.dirty { color: var(--info); font-weight: 600; }
.form-error { color: var(--danger); font-weight: 600; background: var(--danger-tint); border: 1px solid var(--danger); border-left-width: 4px; border-radius: var(--radius-sm); padding: 10px 12px; font-size: 0.9rem; margin: 10px 0; }

/* Forms */
input[type=text], input[type=email], input[type=time], select, textarea {
  background: var(--surface); border: 1px solid var(--border-light); border-radius: var(--radius-sm);
  color: var(--text); padding: 11px 12px; font-size: 1rem; font-family: inherit; width: 100%;
}
input:disabled { opacity: 0.45; }
textarea { resize: vertical; min-height: 64px; line-height: 1.5; }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger); }
.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field label, .field .label { display: block; font-size: 0.85rem; color: var(--text-muted); font-weight: 600; margin-bottom: 6px; }
.optional { font-weight: 400; }
.field-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }
.counter { font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; }
.counter.near { color: var(--info); font-weight: 600; }

/* One fieldset per form: disabled until that client's data has loaded (P1-001). */
.form-lock { border: 0; padding: 0; margin: 0; min-width: 0; }

/* Hours rows */
.hours-day { border: 0; border-top: 1px solid var(--border); padding: 12px 0; }
.hours-day:first-child { border-top: 0; padding-top: 0; }
.hours-day legend { font-weight: 600; font-size: 0.95rem; float: left; width: 100%; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.hours-day .unset { font-weight: 600; font-size: 0.8rem; color: var(--info); }
.hours-day .legacy { text-align: right; overflow-wrap: anywhere; }
.hours-day .row { clear: both; display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr); gap: 10px; align-items: end; }
.hours-day .closed-toggle { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; color: var(--text); padding-bottom: 10px; cursor: pointer; }
.hours-day .closed-toggle input { width: 20px; height: 20px; accent-color: var(--primary); }
.hours-day .time label { display: block; font-size: 0.78rem; color: var(--text-muted); margin-bottom: 4px; }
.hours-day input[type=time] { padding: 9px 8px; min-width: 0; }

/* FAQ items */
.faq-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin: 0 0 12px; }
.faq-item legend { font-weight: 600; font-size: 0.95rem; float: left; width: 100%; margin-bottom: 10px; }
.faq-item .field { clear: both; }
.faq-item .item-actions { display: flex; justify-content: flex-end; margin-top: 10px; }

/* Documents */
input[type=file] { background: var(--bg); border: 1px dashed var(--border-light); border-radius: var(--radius-sm); color: var(--text); padding: 11px 12px; font-size: 0.95rem; font-family: inherit; width: 100%; }
input[type=file]:disabled { opacity: 0.45; }
progress { width: 100%; height: 8px; margin-top: 10px; accent-color: var(--primary); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 6px; }
.card-head h2 { margin-bottom: 0; }
.doc-list { list-style: none; }
.doc-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; align-items: center; border-top: 1px solid var(--border); padding: 12px 0; }
.doc-item:first-child { border-top: 0; }
.doc-name { font-weight: 600; overflow-wrap: anywhere; }
.doc-meta { font-size: 0.82rem; color: var(--text-muted); }
.doc-status { display: inline-block; font-size: 0.78rem; font-weight: 700; padding: 2px 8px; border-radius: 4px; margin-top: 4px; }
.doc-status.ok { background: rgba(19, 107, 120, 0.10); color: var(--success); }
.doc-status.pending { background: var(--info-tint); color: var(--info); }
.doc-status.bad { background: var(--danger-tint); color: var(--danger); }
.doc-help { grid-column: 1 / -1; font-size: 0.82rem; color: var(--text-muted); }

/* Sign-in */
.login-container { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px 20px; max-width: 400px; width: 100%; }
.brand-large { text-align: center; margin-bottom: 22px; }
.brand-large b { display: block; font-family: 'Space Grotesk', 'Inter', sans-serif; font-size: 1.3rem; color: var(--primary); margin-bottom: 4px; }
.brand-large span { color: var(--text-muted); font-size: 0.88rem; }
.login-card h1 { font-size: 1.15rem; margin-bottom: 8px; }
.login-card p { color: var(--text-muted); font-size: 0.92rem; margin-bottom: 18px; }
.loader { text-align: center; padding: 24px; color: var(--text-muted); font-size: 0.92rem; }
.empty { text-align: center; padding: 24px 16px; color: var(--text-muted); font-size: 0.9rem; background: var(--surface); border: 1px dashed var(--border-light); border-radius: var(--radius-sm); margin-bottom: 14px; }

@media (max-width: 520px) {
  .picker-wrap { order: 3; flex-basis: 100%; max-width: none; }
}
@media (max-width: 420px) {
  .brand { font-size: 0.72rem; }
  .hours-day .row { grid-template-columns: 1fr 1fr; }
  .hours-day .closed-toggle { grid-column: 1 / -1; padding-bottom: 0; }
  .save-row .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
