/* Shomabesh portal: one stylesheet, design tokens as custom properties, no external assets. */
:root {
  --page: #ffffff;
  --surface: #f3f6f4;
  --ink: #14211c;
  --muted: #5b6b64;
  --line: #dce3df;
  --accent: #1f6f5b;
  --accent-soft: #e3f0eb;
  --live: #b9811e;
  --danger: #b42318;
  --font: "Noto Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --fs-sm: 14px;
  --fs-md: 16px;
  --fs-lg: 20px;
  --fs-xl: 28px;
  --fs-xxl: 40px;
  --radius: 8px;
  --round: 999px;
  --topbar: 64px;
  --rail: 88px;
  --gutter: 32px;
  --main: 1040px;
  --control: 40px;
}

/* --- base ------------------------------------------------------------------------------ */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 400 var(--fs-md)/1.5 var(--font);
  color: var(--ink);
  background: var(--page);
}
h1, h2, h3 { font-weight: 600; line-height: 1.25; }
h1 { margin: 0 0 16px; font-size: var(--fs-xl); letter-spacing: -0.01em; }
h2 { margin: 32px 0 8px; font-size: var(--fs-lg); }
p { margin: 0 0 16px; }
a { color: var(--accent); }
img, svg { display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.skip { position: absolute; left: 16px; top: -48px; z-index: 30; padding: 8px 16px;
  color: var(--page); background: var(--accent); border-radius: var(--radius); }
.skip:focus { top: 12px; }

/* --- controls ---------------------------------------------------------------------------- */
.button, button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--control);
  padding: 0 16px;
  font: 600 var(--fs-sm)/1.2 var(--font);
  color: var(--page);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.button.secondary, button.secondary {
  color: var(--accent);
  background: var(--page);
  border-color: var(--line);
}
.button.quiet { color: var(--accent); background: transparent; border-color: transparent; }
.button.secondary:hover, .button.quiet:hover { background: var(--accent-soft); }
button.danger { background: var(--danger); border-color: var(--danger); }
button.link {
  min-height: 0;
  padding: 0;
  font-weight: 400;
  color: var(--accent);
  background: none;
  border: 0;
  text-decoration: underline;
}
input[type="text"], input[type="date"], input[type="time"], input[type="number"],
input[type="password"], input[type="email"], input[type="search"], select {
  min-height: var(--control);
  padding: 0 12px;
  font: inherit;
  color: var(--ink);
  background: var(--page);
  border: 1px solid var(--muted); /* 3:1 or better against the page for a control edge */
  border-radius: var(--radius);
}
input::placeholder { color: var(--muted); opacity: 1; }

/* --- signed-in chrome: top bar, rail, main column -------------------------------------- */
body.app {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  grid-template-rows: var(--topbar) 1fr;
  min-height: 100vh;
}
.topbar {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  gap: 16px;
  min-height: var(--topbar);
  padding: 0 24px;
  background: var(--page);
  border-bottom: 1px solid var(--line);
}
.brand { flex: none; border-radius: var(--radius); }
.brand img { height: 32px; width: auto; }
.join { display: flex; flex: 0 1 440px; gap: 8px; margin-left: auto; }
.join .pill { flex: 1 1 auto; min-width: 0; padding: 0 20px; background: var(--surface);
  border-radius: var(--round); }
.new-menu { position: relative; flex: none; }
.new-menu summary { list-style: none; }
.new-menu summary::-webkit-details-marker { display: none; }
.new-menu .menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 20;
  min-width: 248px;
  padding: 8px 0;
  background: var(--page);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.new-menu .menu form { margin: 0; }
.menu-item, button.menu-item {
  display: flex;
  justify-content: flex-start;
  width: 100%;
  min-height: 44px;
  padding: 0 16px;
  font: 400 var(--fs-md)/1.4 var(--font);
  color: var(--ink);
  background: var(--page);
  border: 0;
  border-radius: 0;
  text-decoration: none;
  align-items: center;
}
.menu-item:hover, button.menu-item:hover { background: var(--surface); }
.menu-item:focus-visible { outline-offset: -2px; }
.who { display: flex; flex: none; align-items: center; gap: 8px; margin-left: auto;
  font-size: var(--fs-sm); }
.avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: var(--round);
}

.rail {
  display: flex;
  grid-row: 2;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: sticky;
  top: var(--topbar);
  align-self: start;
  height: calc(100vh - var(--topbar));
  padding: 16px 0;
  background: var(--surface);
}
.rail-end { display: flex; margin: auto 0 0; }
.rail-item, button.rail-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 80px;
  min-height: 0;
  padding: 4px 0;
  font: 400 var(--fs-sm)/1.3 var(--font);
  color: var(--ink);
  background: none;
  border: 0;
  border-radius: var(--radius);
  text-decoration: none;
}
.rail-item .icon { box-sizing: content-box; padding: 4px 16px; color: var(--muted);
  border-radius: var(--round); }
.rail-item:hover .icon { background: var(--line); }
.rail-item[aria-current="page"] { font-weight: 600; }
.rail-item[aria-current="page"] .icon { color: var(--accent); background: var(--accent-soft); }

body.app .topbar { position: sticky; top: 0; z-index: 15; }
main.page {
  grid-column: 2;
  width: 100%;
  max-width: calc(var(--main) + 2 * var(--gutter));
  padding: var(--gutter);
}
body.plain main.page { margin: 0; }

/* --- signed-out welcome ---------------------------------------------------------------- */
main.welcome { display: grid; min-height: 100vh; padding: 16px; place-items: center; }
.welcome-col { width: min(440px, 100%); }
.welcome-col img { width: auto; height: 64px; margin-bottom: 32px; }
.welcome-col h1 { margin: 0 0 8px; font-size: var(--fs-xxl); letter-spacing: -0.02em; }
.welcome-col p { color: var(--muted); }
.welcome-col p:last-child { margin: 32px 0 0; }

/* --- home dashboard -------------------------------------------------------------------- */
.day-head { display: flex; align-items: center; gap: 12px; }
.day-head .icon { flex: none; color: var(--accent); }
.date-heading { margin: 0; font-size: var(--fs-xxl); line-height: 1.15; letter-spacing: -0.02em; }
.day-head-link { margin-left: auto; font-size: var(--fs-sm); white-space: nowrap; }

.week { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 32px 0 24px; }
.chev {
  display: grid;
  flex: none;
  place-items: center;
  width: var(--control);
  height: var(--control);
  color: var(--ink);
  border-radius: var(--round);
}
.chev:hover { background: var(--surface); }
.days { display: flex; gap: 8px; padding: 0; margin: 0; list-style: none; }
.day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 64px;
  padding: 8px 0;
  color: var(--ink);
  border-radius: var(--radius);
  text-decoration: none;
}
.day .wd { font-size: var(--fs-sm); color: var(--muted); }
.day .num {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  font-size: var(--fs-lg);
  border-radius: var(--round);
}
.day .dot { width: 6px; height: 6px; border-radius: var(--round); }
.day.has-meetings .dot { background: var(--accent); }
.day:hover .num { background: var(--surface); }
.day.today .num { font-weight: 600; color: var(--accent); }
.day[aria-current="date"] .num,
.day[aria-current="date"]:hover .num {
  font-weight: 600;
  color: var(--page);
  background: var(--accent);
  outline: 4px solid var(--accent-soft);
}

.rows { padding: 0; margin: 0; list-style: none; border-top: 1px solid var(--line); }
.day-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px 24px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.row-time { font-weight: 600; font-variant-numeric: tabular-nums; }
.row-main { min-width: 0; }
.row-title { display: block; overflow-wrap: anywhere; font-weight: 600; }
.row-meta { display: block; font-size: var(--fs-sm); color: var(--muted); }
.row-status { font-size: var(--fs-sm); color: var(--muted); }
.row-actions { display: flex; gap: 8px; }
.row-live .row-status { display: inline-flex; align-items: center; gap: 8px; font-weight: 600;
  color: var(--ink); }
.row-live .row-status::before { width: 10px; height: 10px; content: ""; background: var(--live);
  border-radius: var(--round); }
.row-ended .row-time, .row-ended .row-title { font-weight: 400; color: var(--muted); }

.empty { display: flex; flex-direction: column; align-items: center; padding: 48px 0;
  text-align: center; }
.empty-art { margin-bottom: 24px; }
.empty-title { margin: 0 0 4px; font-size: var(--fs-lg); font-weight: 600; }
.empty-hint { margin: 0; color: var(--muted); }

/* --- other pages: meeting list, detail, forms ------------------------------------------ */
.meetings { padding: 0; margin: 0 0 16px; list-style: none; border-top: 1px solid var(--line); }
.meetings li { display: flex; flex-wrap: wrap; gap: 0 16px; padding: 12px 0;
  border-bottom: 1px solid var(--line); }
.meetings li a { flex-basis: 100%; font-weight: 600; text-decoration: none; }
.meetings li a:hover { text-decoration: underline; }
.meetings .when, .meetings .code { font-size: var(--fs-sm); color: var(--muted); }
.details { display: grid; grid-template-columns: max-content 1fr; gap: 8px 24px; margin: 0 0 16px; }
.details dt { font-weight: 600; }
.details dd { margin: 0; overflow-wrap: anywhere; }
.invite { max-width: 640px; padding: 12px 16px; font: var(--fs-sm)/1.5 ui-monospace, monospace;
  white-space: pre-wrap; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); }
.actions { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.status { font-weight: 600; color: var(--danger); }
.stack { max-width: 640px; }
.stack .field { display: flex; flex-direction: column; gap: 4px; margin: 0 0 16px; }
.stack .field label { font-weight: 600; }
.stack .row { display: flex; flex-wrap: wrap; gap: 16px; padding: 0; border: 0; }
.stack .row .field { flex: 1 1 12rem; }
.check { display: block; margin: 0 0 16px; }
.hint { margin: 0; font-size: var(--fs-sm); color: var(--muted); }
.errors { max-width: 640px; padding: 8px 16px; margin-bottom: 16px; color: #8a1c1c;
  background: #fdecec; border: 1px solid #f1b5b5; border-radius: var(--radius); }
.errors p, .errors ul { margin: 4px 0; color: inherit; }
.meeting { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 16px 0; }

/* --- admin: users ---------------------------------------------------------------------- */
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin: 0 0 16px; }
.page-head h1 { margin: 0; }
.page-head .button, .page-head .head-actions { margin-left: auto; }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.head-actions .button { margin-left: 0; }
code.secret { font: 600 var(--fs-sm)/1.4 ui-monospace, monospace; letter-spacing: 0.06em;
  user-select: all; white-space: nowrap; }
.result-created { font-weight: 600; color: var(--accent); }
.result-skipped { font-weight: 600; color: var(--muted); }
.result-failed { font-weight: 600; color: var(--danger); }
progress { display: block; width: 100%; max-width: 640px; margin: 0 0 16px; }
.search { display: flex; gap: 8px; max-width: 640px; margin: 0 0 24px; }
.search input { flex: 1 1 auto; min-width: 0; }
.table-wrap { overflow-x: auto; margin: 0 0 16px; }
table.users { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.users th, .users td { padding: 12px 16px 12px 0; text-align: left; vertical-align: top;
  border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.users th { font-weight: 600; color: var(--muted); white-space: nowrap; }
.users td a { font-weight: 600; }
.chip { display: inline-block; padding: 0 8px; margin: 0 4px 4px 0; font-size: var(--fs-sm);
  font-weight: 600; line-height: 1.6; color: var(--accent); background: var(--accent-soft);
  border-radius: var(--round); }
h1 .chip { vertical-align: middle; }
.muted { color: var(--muted); }
.pager { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.notice { max-width: 640px; padding: 8px 16px; background: var(--accent-soft);
  border-radius: var(--radius); }
fieldset.roles { padding: 0; margin: 0 0 16px; border: 0; }
fieldset.roles legend { padding: 0; margin: 0 0 4px; font-weight: 600; }
fieldset.roles .check { margin: 0 0 8px; }
.actions form { margin: 0; }
pre.secret { display: inline-block; padding: 12px 20px; margin: 0 0 16px;
  font: 600 var(--fs-lg)/1.4 ui-monospace, monospace; letter-spacing: 0.08em;
  user-select: all; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); }

/* --- profile: avatar picker ------------------------------------------------------------ */
img.avatar { object-fit: cover; }
fieldset.avatars { padding: 0; margin: 0 0 16px; border: 0; }
fieldset.avatars legend { padding: 0; margin: 0 0 8px; font-weight: 600; }
.avatar-grid { display: flex; flex-wrap: wrap; gap: 12px; margin: 0 0 8px; }
.avatar-option { position: relative; display: block; margin: 0; cursor: pointer; }
.avatar-option input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; }
.avatar-option .mark {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border: 2px solid transparent;
  border-radius: var(--round);
}
.avatar-option img { width: 56px; height: 56px; border-radius: var(--round); }
.avatar-option:hover .mark { border-color: var(--line); }
.avatar-option input:checked + .mark { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 2px; }
.avatar-option input:focus-visible + .mark { outline: 2px solid var(--ink); outline-offset: 4px; }
.avatar-option .name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* --- narrow screens: the rail becomes a bottom bar ------------------------------------- */
@media (max-width: 720px) {
  body.app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .topbar { flex-wrap: wrap; gap: 12px; padding: 12px 16px; }
  body.app .topbar { position: static; }
  .join { flex: 1 1 100%; order: 3; margin-left: 0; }
  .new-menu { margin-left: auto; }
  .new-menu .menu { right: 0; left: auto; }
  .who { margin-left: 0; }
  .who-name { display: none; }
  .rail {
    position: fixed;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 10;
    height: auto;
    flex-direction: row;
    justify-content: space-around;
    padding: 8px 0;
    border-top: 1px solid var(--line);
  }
  .rail-end { margin: 0; }
  main.page { grid-column: 1; padding: 24px 16px 104px; }
  .date-heading { font-size: var(--fs-xl); }
  .day-head .icon { width: 24px; height: 24px; }
  .week { gap: 4px; margin: 24px 0 16px; }
  .chev { width: 32px; height: 32px; }
  .days { flex: 1 1 auto; gap: 0; min-width: 0; }
  .days li { flex: 1 1 0; min-width: 0; }
  .day { width: 100%; }
  .day .num { width: 32px; height: 32px; font-size: var(--fs-md); }
  .day[aria-current="date"] .num { outline-width: 3px; }
  .day-row { grid-template-columns: 56px minmax(0, 1fr); gap: 8px 16px; }
  .row-status, .row-actions { grid-column: 2; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
