/* Shared structural styles for all three BoardRoom apps. Each app defines its
   own color tokens (--brand-bg, --brand-ink, --brand-accent, --brand-panel,
   --brand-border, --brand-font) at :root before/after this file loads. */
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--brand-font, 'Montserrat', -apple-system, sans-serif);
  background: var(--brand-bg, #F5F3EF);
  color: var(--brand-ink, #1A1A1A);
}
a { color: inherit; }
button { font-family: inherit; cursor: pointer; }
.hidden { display: none !important; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px; background: var(--brand-ink, #1A1A1A); color: #fff;
}
.topbar .brand { font-weight: 700; letter-spacing: 0.02em; }
.topbar .topbar-right { display: flex; align-items: center; gap: 12px; }

.container { max-width: 1080px; margin: 0 auto; padding: 28px; }

.card {
  background: var(--brand-panel, #fff);
  border: 1px solid var(--brand-border, #E4E1D9);
  border-radius: 10px;
  padding: 20px;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.flex-row { display: flex; gap: 16px; align-items: flex-start; }
.flex-row > * { flex: 1; }

.btn {
  border: 1px solid var(--brand-border, #E4E1D9);
  background: #fff; color: var(--brand-ink, #1A1A1A);
  padding: 9px 16px; border-radius: 8px; font-size: 14px; font-weight: 600;
}
.btn-accent { background: var(--brand-accent, #F6B618); border-color: var(--brand-accent, #F6B618); color: #1A1A1A; }
.btn-dark { background: var(--brand-ink, #1A1A1A); color: #fff; border-color: var(--brand-ink, #1A1A1A); }
.btn-small { padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.form-input, select.form-input {
  width: 100%; padding: 9px 12px; border-radius: 7px;
  border: 1px solid var(--brand-border, #E4E1D9); font-size: 14px; font-family: inherit;
  margin-top: 4px; margin-bottom: 12px;
}
label { font-size: 13px; font-weight: 600; opacity: 0.75; }

.badge {
  display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; padding: 3px 8px; border-radius: 999px; background: var(--brand-mist, #DCE3E1);
}
.badge-accent { background: var(--brand-accent, #F6B618); color: #1A1A1A; }
.badge-green { background: #DCEEDC; color: #1E6B2E; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--brand-border, #E4E1D9); margin-bottom: 20px; }
.tab-btn {
  border: none; background: none; padding: 12px 16px; font-weight: 600; font-size: 14px;
  color: var(--brand-ink, #1A1A1A); opacity: 0.55; border-bottom: 2px solid transparent;
}
.tab-btn.active { opacity: 1; border-bottom-color: var(--brand-accent, #F6B618); }

.toggle-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--brand-border, #E4E1D9); background: #fff; font-size: 12px; font-weight: 600;
}
.toggle-pill.on { background: var(--brand-accent, #F6B618); border-color: var(--brand-accent, #F6B618); }

.row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--brand-border, #E4E1D9); }
.row:last-child { border-bottom: none; }
.muted { opacity: 0.6; font-size: 13px; }
.error-text { color: #B3261E; font-size: 13px; margin: 6px 0; }
.section-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.55; margin: 0 0 12px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--brand-border, #E4E1D9); font-size: 14px; }
th { font-size: 11px; text-transform: uppercase; opacity: 0.55; letter-spacing: 0.05em; }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { width: 360px; }
.login-card h1 { font-size: 20px; margin-bottom: 4px; }

/* --- The app shell -------------------------------------------------------
   The left sidebar used by admin, trustee and superuser. These rules were
   written out identically in all three <style> blocks; they live here now so
   the breakpoint below only has to be written once. join/ and pricing/ have
   no shell and are unaffected. */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; flex-shrink: 0; background: var(--brand-ink, #1A1A1A); color: #fff;
  padding: 24px 18px; display: flex; flex-direction: column;
}
.sidebar-brand { font-size: 19px; font-weight: 700; }
.sidebar-brand .accent { color: var(--brand-accent, #F6B618); }
.sidebar-sub { font-size: 11px; letter-spacing: 0.08em; opacity: 0.55; text-transform: uppercase; margin: 2px 0 28px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar-nav .tab-btn { text-align: left; padding: 10px 12px; border-radius: 8px; border-bottom: none; opacity: 0.75; color: #cfd1d6; font-weight: 500; }
.sidebar-nav .tab-btn.active { background: rgba(255,255,255,0.08); color: #fff; opacity: 1; border-bottom: none; }
.sidebar-footer { border-top: 1px solid rgba(255,255,255,0.14); padding-top: 14px; margin-top: 14px; }
.sidebar-footer .btn { width: 100%; margin-bottom: 8px; }
.sidebar-footer .muted { color: rgba(255,255,255,0.6) !important; display: block; margin-bottom: 8px; font-size: 13px; }
.main-content { flex: 1; min-width: 0; }

/* Injected by shared/nav.js, and only ever visible under the breakpoint. */
.sidebar-toggle {
  display: none; margin-left: auto; background: none; color: #fff; font-size: 20px; line-height: 1;
  border: 1px solid rgba(255,255,255,0.25); border-radius: 8px; padding: 6px 11px;
}

.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* --- Phones and narrow tablets -------------------------------------------
   Before this the sidebar held its 240px at every width, so on a 390px phone
   it took most of the screen and pushed the content off the right edge - the
   trustee "Your meeting pack" card could only be read by scrolling sideways.
   Below 768px the sidebar becomes a top bar and its nav collapses behind the
   menu button; nothing above the breakpoint changes. */
@media (max-width: 768px) {
  .app-shell { display: block; }
  .sidebar {
    width: auto; flex-direction: row; flex-wrap: wrap; align-items: center;
    gap: 10px; padding: 12px 16px;
  }
  .sidebar-brand { font-size: 17px; }
  .sidebar-sub { margin: 0; }
  .sidebar-toggle { display: block; }

  /* Closed by default on every load: the menu is a deliberate act on a phone,
     not the first thing in the way of the page. */
  .sidebar-nav, .sidebar-footer { display: none; width: 100%; }
  .sidebar.open .sidebar-nav { display: flex; }
  .sidebar.open .sidebar-footer { display: block; }
  .sidebar-footer { margin-top: 0; padding-top: 12px; }

  .container { padding: 20px 16px; }
  /* Only the grids base.css owns. An app's own grid (admin's .settings-grid,
     superuser's .tier-card .grid-4) is declared in a stylesheet that loads
     after this one, so its override has to live beside its declaration. */
  .grid-2, .grid-4 { grid-template-columns: 1fr; }
  /* Stacked with display:block rather than by relaxing the flex rules,
     because several .flex-row children carry an inline flex value - the
     trustee overview's scorecard card is style="flex:1.4" - and an inline
     style beats anything written here. Under display:block those values are
     inert. Buttons keep their inline flow; only block children stack. */
  .flex-row { display: block; }
  .flex-row > div { margin-bottom: 12px; }
  .flex-row > div:last-child { margin-bottom: 0; }
  .row { flex-wrap: wrap; gap: 8px; }

  /* Tables stay tables and the card scrolls, rather than the page doing it.
     A table forced to 100% of a phone renders as one word per line. */
  .card { overflow-x: auto; }
  table { min-width: 520px; }

  .login-card { width: 100%; max-width: 360px; }
}
