/* IVR Schedule Portal
   Palette: ink / mist / sea (open) / amber (notice) / brick (danger) */

@font-face {
  font-family: "Instrument Sans";
  src: url("../fonts/instrument-sans-latin-wght-normal.woff2") format("woff2-variations");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #12262e;
  --ink-soft: #55676d;
  --mist: #f1f5f4;
  --surface: #ffffff;
  --line: #d3dddb;
  --line-soft: #e6ecea;
  --sea: #0e7c6b;
  --sea-deep: #0a5f52;
  --sea-wash: #dcefea;
  --amber: #8f5206;
  --amber-wash: #fbefd9;
  --brick: #a8322b;
  --brick-wash: #f9e4e1;
  --radius: 10px;
  --radius-small: 6px;
  --font: "Instrument Sans", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--mist);
  color: var(--ink);
  font: 400 1rem/1.5 var(--font);
  font-variant-numeric: tabular-nums;
}

h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -0.015em; }
h1 { font-size: clamp(1.75rem, 1.3rem + 1.6vw, 2.45rem); font-weight: 650; }
h2 { font-size: 1.25rem; font-weight: 650; }
h3 { font-size: 1.125rem; font-weight: 600; }
p { margin: 0; }
a { color: var(--sea-deep); text-underline-offset: 0.15em; }
a:hover { color: var(--ink); }
code { font: inherit; font-weight: 600; background: var(--line-soft); padding: 0.05em 0.4em; border-radius: 4px; white-space: nowrap; }
small { font-size: 0.875rem; color: var(--ink-soft); }
em { font-style: normal; color: var(--ink-soft); font-weight: 400; }

:focus-visible { outline: 3px solid var(--sea); outline-offset: 2px; border-radius: 4px; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: #fff; padding: 0.5rem 1rem; z-index: 10; }
.skip:focus { left: 0; }
.muted { color: var(--ink-soft); font-size: 0.9375rem; }
.num { white-space: nowrap; }

/* --- Brand bar: provider logo left, client logo right, on every page --- */
.brandbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0.9rem clamp(1rem, 4vw, 2.5rem);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; }
.brand-provider { display: block; height: 44px; width: auto; max-width: 46vw; }
.brand-client { display: block; height: 24px; width: auto; max-width: 42vw; object-fit: contain; }

/* --- Navigation --- */
.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 1.5rem;
  padding: 0 clamp(1rem, 4vw, 2.5rem);
  background: var(--ink);
  color: #fff;
  font-size: 0.9375rem;
}
.nav-links, .nav-user { display: flex; align-items: center; gap: 0.25rem; flex-wrap: wrap; }
.nav a, .nav .link {
  display: inline-block;
  padding: 0.7rem 0.8rem;
  color: #d5e2e0;
  text-decoration: none;
  border-bottom: 3px solid transparent;
}
.nav a:hover, .nav .link:hover { color: #fff; }
.nav a[aria-current="page"] { color: #fff; border-bottom-color: #58c9b4; font-weight: 600; }
.nav-name { padding: 0.7rem 0.8rem; color: #9db3b0; }
.nav form { margin: 0; }
.nav :focus-visible { outline-color: #58c9b4; }

/* --- Page shell --- */
.page { width: 100%; max-width: 60rem; margin: 0 auto; padding: 2.5rem clamp(1rem, 4vw, 2.5rem) 4rem; flex: 1; }
.page-narrow { max-width: 32rem; }
.page-wide { max-width: 76rem; }
.lede { margin-top: 0.6rem; color: var(--ink-soft); font-size: 1.0625rem; max-width: 62ch; }
.crumb { font-size: 0.9375rem; color: var(--ink-soft); margin-bottom: 0.6rem; }
.title-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; }
.group { margin-top: 2.5rem; }
.group > h2 { margin-bottom: 0.9rem; }
.below { margin-top: 1rem; }
.lede + .table-wrap { margin-top: 1.5rem; }
.dialog h2 + * { margin-top: 1.4rem; }
.stack > * + * { margin-top: 1.1rem; }
.row { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
.row-fields { align-items: flex-start; }
.row-fields > .field { flex: 1 1 9rem; }

.foot { padding: 1.25rem clamp(1rem, 4vw, 2.5rem); color: var(--ink-soft); font-size: 0.875rem; border-top: 1px solid var(--line); }

/* --- Panels --- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; }
.page > .panel { margin-top: 1.5rem; }
.sched + .sched { margin-top: 1rem; }
.sched-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 1.1rem; }
.empty { color: var(--ink-soft); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; }
.panel .empty { border: 0; padding: 0; }

/* --- Week strip: one bar per day, midnight to midnight --- */
.week { display: grid; row-gap: 0.55rem; }
.week-axis, .week-row { display: grid; grid-template-columns: 2.75rem minmax(0, 1fr) minmax(8.5rem, 15rem); column-gap: 0.9rem; align-items: center; }
.week-ticks { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--ink-soft); }
.week-day { font-weight: 600; }
.week-bar { display: block; width: 100%; height: 1.5rem; border-radius: var(--radius-small); }
.bar-track { fill: var(--line-soft); }
.bar-open { fill: var(--sea); }
.bar-tick { stroke: var(--surface); stroke-width: 1; vector-effect: non-scaling-stroke; opacity: 0.7; }
.week-text { font-size: 0.9375rem; }
.is-closed .week-text, .is-closed .week-day { color: var(--ink-soft); }
.is-closed .week-day { font-weight: 400; }
.week-compact { row-gap: 0.35rem; }
.week-compact .week-bar { height: 0.9rem; border-radius: 4px; }
.week-compact .week-text, .week-compact .week-day { font-size: 0.875rem; }

/* --- Holiday date list on the dashboard --- */
.dates { list-style: none; margin: 0; padding: 0; }
.dates li { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; padding: 0.55rem 0; border-top: 1px solid var(--line-soft); }
.dates li:first-child { border-top: 0; padding-top: 0; }
.dates-when { font-weight: 600; min-width: 14rem; }
.dates-what { color: var(--ink-soft); }
.dates + .muted { margin-top: 0.4rem; }

/* --- Tables --- */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.table th { text-align: left; font-weight: 600; font-size: 0.875rem; color: var(--ink-soft); padding: 0.7rem 1rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 0.8rem 1rem; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table-dense td { padding: 0.5rem 1rem; }
.row-warn td:nth-child(3) { color: var(--brick); font-weight: 600; }
.actions { text-align: right; white-space: nowrap; }
.actions form { display: inline; }
.actions .btn { margin-left: 0.15rem; }
.past { margin-top: 2rem; }
.past summary { cursor: pointer; font-weight: 600; padding: 0.4rem 0; width: fit-content; }
.past .table-wrap { margin-top: 0.75rem; }

/* --- Pills, dots --- */
.pill { display: inline-block; padding: 0.1rem 0.6rem; border-radius: 999px; font-size: 0.8125rem; font-weight: 600; }
.pill-ok { background: var(--sea-wash); color: var(--sea-deep); }
.pill-bad { background: var(--brick-wash); color: var(--brick); }
.pill-off { background: var(--line-soft); color: var(--ink-soft); }
.servers { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.75rem; }
.servers li { display: flex; align-items: center; gap: 0.6rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.6rem 1rem; }
.dot { width: 0.65rem; height: 0.65rem; border-radius: 50%; }
.dot-ok { background: var(--sea); }
.dot-bad { background: var(--brick); }

/* --- Notices --- */
.notices { margin-bottom: 1.5rem; display: grid; gap: 0.5rem; }
.notice { padding: 0.75rem 1rem; border-radius: var(--radius-small); border-left: 4px solid; font-weight: 500; }
.notice-ok { background: var(--sea-wash); border-color: var(--sea); color: #073f37; }
.notice-error { background: var(--brick-wash); border-color: var(--brick); color: #6d1e19; }
.notice-info { background: var(--amber-wash); border-color: #c98a2b; color: #5f3704; }
.notice-block { margin-top: 1.5rem; font-weight: 400; }
.notice-block strong { display: block; }
.notice-block small { display: block; margin-top: 0.5rem; color: inherit; opacity: 0.8; }

/* --- Forms --- */
fieldset { margin: 0; }
.field { display: block; border: 0; padding: 0; min-width: 0; }
.field > span, .field > legend { display: block; padding: 0; font-weight: 600; font-size: 0.9375rem; margin-bottom: 0.35rem; }
.field small { display: block; margin-top: 0.35rem; }
input[type="text"], input[type="password"], input[type="time"], input[type="date"], select {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.55rem 0.75rem;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid #9fb0ad;
  border-radius: var(--radius-small);
}
input:focus-visible, select:focus-visible { outline-offset: 0; border-color: var(--sea); }
input:disabled { background: var(--line-soft); color: var(--ink-soft); border-color: var(--line); }
::placeholder { color: #8a9a9d; }
.check { display: flex; align-items: center; gap: 0.6rem; cursor: pointer; width: fit-content; }
.check input, .daypick input { accent-color: var(--sea); }
.check input { width: 1.15rem; height: 1.15rem; margin: 0; }
.subfields { border: 0; padding: 0; min-width: 0; }
.subfields > * + * { margin-top: 0.9rem; }
.subfields:disabled { opacity: 0.5; }

.daypick { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.daypick label { position: relative; cursor: pointer; }
.daypick input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.daypick span { display: block; min-width: 3.1rem; text-align: center; padding: 0.5rem 0.6rem; border: 1px solid #9fb0ad; border-radius: var(--radius-small); font-weight: 600; font-size: 0.9375rem; background: var(--surface); }
.daypick input:checked + span { background: var(--sea); border-color: var(--sea); color: #fff; }
.daypick input:focus-visible + span { outline: 3px solid var(--sea); outline-offset: 2px; }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.5rem 1.15rem;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: var(--radius-small);
  cursor: pointer;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.6; cursor: default; }
.btn-primary { background: var(--sea); color: #fff; }
.btn-primary:hover { background: var(--sea-deep); color: #fff; }
.btn-quiet { background: var(--surface); color: var(--ink); border-color: #9fb0ad; }
.btn-quiet:hover { border-color: var(--ink); color: var(--ink); }
.btn-danger { background: var(--brick); color: #fff; }
.btn-danger:hover { background: #8a2620; }
.btn-danger-text { color: var(--brick); }
.btn-danger-text:hover { border-color: var(--brick); color: var(--brick); }
.btn-small { min-height: 2.1rem; padding: 0.25rem 0.7rem; font-size: 0.875rem; }
.btn-wide { width: 100%; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--sea-deep); text-decoration: underline; text-underline-offset: 0.15em; cursor: pointer; }

/* --- Dialogs --- */
.dialog { width: min(32rem, calc(100vw - 2rem)); padding: 1.75rem; border: 0; border-radius: 14px; color: var(--ink); box-shadow: 0 24px 60px rgba(18, 38, 46, 0.28); }
.dialog::backdrop { background: rgba(18, 38, 46, 0.55); }
.dialog-small { width: min(26rem, calc(100vw - 2rem)); }
.dialog-small h2 { font-size: 1.125rem; line-height: 1.35; font-weight: 600; letter-spacing: 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 1.6rem; }
@media (prefers-reduced-motion: no-preference) {
  .dialog[open] { animation: rise 160ms ease-out; }
  @keyframes rise { from { opacity: 0; transform: translateY(8px); } }
}

/* --- Sign-in page --- */
.signin { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.signin .notices { grid-column: 1; grid-row: 1; margin: 2rem clamp(1.25rem, 6vw, 5rem) -1rem; max-width: 24rem; justify-self: center; width: calc(100% - 2.5rem); }
.signin-form { grid-column: 1; padding: 3.5rem clamp(1.25rem, 6vw, 5rem); width: 100%; max-width: 34rem; justify-self: center; align-self: center; }
.signin-form form { margin-top: 2rem; }
.signin-form .field + .field { margin-top: 1.1rem; }
.signin-form .btn { margin-top: 1.6rem; }
.hint { margin-top: 1.5rem; color: var(--ink-soft); font-size: 0.9375rem; }
.signin-art { grid-column: 2; grid-row: 1 / span 2; background: var(--ink); color: #c6d6d3; display: flex; flex-direction: column; justify-content: center; gap: 2rem; padding: 3rem clamp(1.5rem, 5vw, 4.5rem); }
.art-week { display: grid; row-gap: 0.8rem; }
.art-row { display: grid; grid-template-columns: 2.75rem minmax(0, 1fr); column-gap: 0.9rem; align-items: center; font-weight: 600; color: #9db3b0; }
.art-row svg { display: block; width: 100%; height: 1.6rem; border-radius: var(--radius-small); }
.art-track { fill: #1e3943; }
.art-open { fill: #58c9b4; }
.signin-art p { max-width: 30ch; font-size: 1.0625rem; }
@media (prefers-reduced-motion: no-preference) {
  .art-open { transform-box: fill-box; transform-origin: left center; animation: open-up 700ms cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .art-row:nth-child(2) .art-open { animation-delay: 60ms; }
  .art-row:nth-child(3) .art-open { animation-delay: 120ms; }
  .art-row:nth-child(4) .art-open { animation-delay: 180ms; }
  .art-row:nth-child(5) .art-open { animation-delay: 240ms; }
  .art-row:nth-child(6) .art-open { animation-delay: 300ms; }
  @keyframes open-up { from { transform: scaleX(0); } }
}

/* --- Small screens --- */
@media (max-width: 46rem) {
  .signin { grid-template-columns: minmax(0, 1fr); }
  .signin-art { display: none; }
  .week-axis, .week-row { grid-template-columns: 2.5rem minmax(0, 1fr); }
  .week-axis > span:last-child { display: none; }
  .week-text { grid-column: 2; font-size: 0.8125rem; color: var(--ink-soft); }
  .week-row { row-gap: 0.15rem; }
  .table-stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .table-stack tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.1rem 0.9rem; padding: 0.9rem 1rem; border-bottom: 1px solid var(--line-soft); }
  .table-stack tr:last-child { border-bottom: 0; }
  .table-stack td { display: block; padding: 0; border: 0; }
  .table-stack td:first-child { width: 100%; font-weight: 600; }
  .table-stack td:empty { display: none; }
  .table-stack .actions { width: 100%; text-align: left; margin-top: 0.5rem; }
  .table-stack .actions .btn { margin: 0 0.3rem 0 0; }
  .brand-provider { height: 34px; }
  .brand-client { height: 18px; }
  .nav-name { display: none; }
  .actions { white-space: normal; }
  .dates-when { min-width: 0; width: 100%; }
}
