/* ============================================================================
   Morton Volunteer Center — design system (v1, light mode only)
   Calm, warm-professional, healthcare-adjacent but not clinical.
   Token-based: change the :root custom properties, the app follows.
   ============================================================================ */

:root {
  /* color tokens */
  --vc-primary: #2F7E6D;        /* soft sage/teal */
  --vc-primary-dark: #256456;
  --vc-primary-soft: #E5F0ED;   /* tinted backgrounds, hover fills */
  --vc-bg: #FAF8F4;             /* warm off-white page background */
  --vc-surface: #FFFFFF;
  --vc-border: #E5E1D8;
  --vc-text: #27322F;
  --vc-text-soft: #5F6E69;
  --vc-danger: #B3473D;
  --vc-danger-soft: #F8ECEA;
  --vc-ok: #2F7E6D;

  /* shape + depth */
  --vc-radius: 10px;
  --vc-radius-sm: 7px;
  --vc-shadow: 0 1px 3px rgba(39, 50, 47, .07), 0 6px 20px rgba(39, 50, 47, .07);

  /* type — generous base for non-technical users */
  --vc-font: 'Source Sans 3', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 17px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--vc-font);
  background: var(--vc-bg);
  color: var(--vc-text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.25rem; }
a { color: var(--vc-primary); }

/* ---- top nav ---------------------------------------------------------- */
.vc-nav {
  display: flex; align-items: center; gap: .25rem;
  background: var(--vc-surface);
  border-bottom: 1px solid var(--vc-border);
  padding: 0 1.25rem;
  position: sticky; top: 0; z-index: 50;
}
.vc-nav .wordmark {
  font-weight: 700; color: var(--vc-primary-dark);
  font-size: 1.05rem; padding: .9rem 1rem .9rem 0; margin-right: .5rem;
  white-space: nowrap; text-decoration: none;
}
.vc-nav a.nav-link {
  text-decoration: none; color: var(--vc-text-soft);
  padding: .9rem .85rem; font-weight: 600; border-bottom: 3px solid transparent;
}
.vc-nav a.nav-link:hover { color: var(--vc-primary-dark); background: var(--vc-primary-soft); }
.vc-nav a.nav-link.active { color: var(--vc-primary-dark); border-bottom-color: var(--vc-primary); }
.vc-nav .spacer { flex: 1; }
.vc-nav .who { color: var(--vc-text-soft); font-size: .9rem; padding-right: .75rem; white-space: nowrap; }

/* ---- layout ------------------------------------------------------------ */
.vc-main { max-width: 1080px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }

.card {
  background: var(--vc-surface);
  border: 1px solid var(--vc-border);
  border-radius: var(--vc-radius);
  box-shadow: var(--vc-shadow);
  padding: 1.25rem 1.4rem;
  margin-bottom: 1.25rem;
}

.toolbar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: end; margin-bottom: 1rem; }
.toolbar .grow { flex: 1; min-width: 200px; }

/* ---- forms ------------------------------------------------------------- */
label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: .25rem; }
.field { margin-bottom: .9rem; }
.hint { font-size: .82rem; color: var(--vc-text-soft); margin-top: .25rem; }
.hint.phi { color: var(--vc-danger); }

input[type="text"], input[type="email"], input[type="password"], input[type="date"],
input[type="number"], input[type="tel"], input[type="search"], select, textarea {
  width: 100%;
  font: inherit;
  color: var(--vc-text);
  background: var(--vc-surface);
  border: 1.5px solid var(--vc-border);
  border-radius: var(--vc-radius-sm);
  padding: .6rem .7rem;            /* big touch targets */
  min-height: 2.75rem;
}
textarea { min-height: 5rem; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
  outline: 3px solid rgba(47, 126, 109, .35);
  outline-offset: 1px;
  border-color: var(--vc-primary);
}

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.form-grid .span2 { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

fieldset.areas-pick { border: 1.5px solid var(--vc-border); border-radius: var(--vc-radius-sm); padding: .5rem .75rem; }
fieldset.areas-pick legend { font-weight: 600; font-size: .92rem; padding: 0 .25rem; }
fieldset.areas-pick label { display: inline-flex; align-items: center; gap: .4rem; font-weight: 400; margin: .25rem 1rem .25rem 0; }
fieldset.areas-pick input[type="checkbox"] { width: 1.2rem; height: 1.2rem; accent-color: var(--vc-primary); }

/* ---- buttons ------------------------------------------------------------ */
.btn {
  font: inherit; font-weight: 600;
  border-radius: var(--vc-radius-sm);
  border: 1.5px solid transparent;
  padding: .6rem 1.1rem;
  min-height: 2.75rem;
  cursor: pointer;
  background: var(--vc-primary-soft);
  color: var(--vc-primary-dark);
}
.btn:hover { filter: brightness(.97); }
.btn-primary { background: var(--vc-primary); color: #fff; }
.btn-primary:hover { background: var(--vc-primary-dark); filter: none; }
.btn-ghost { background: transparent; border-color: var(--vc-border); color: var(--vc-text-soft); }
.btn-danger { background: var(--vc-danger-soft); color: var(--vc-danger); }
.btn-sm { padding: .3rem .65rem; min-height: 2.1rem; font-size: .88rem; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---- tables ------------------------------------------------------------- */
table.vc-table { width: 100%; border-collapse: collapse; }
.vc-table th, .vc-table td { text-align: left; padding: .6rem .65rem; border-bottom: 1px solid var(--vc-border); vertical-align: middle; }
.vc-table th { font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; color: var(--vc-text-soft); }
.vc-table th.sortable { cursor: pointer; user-select: none; }
.vc-table th.sortable:hover { color: var(--vc-primary-dark); }
.vc-table tbody tr:hover { background: var(--vc-primary-soft); }
.vc-table td .row-actions { display: flex; gap: .4rem; justify-content: flex-end; }
.vc-table td input, .vc-table td select { min-height: 2.2rem; padding: .25rem .4rem; }

.badge { display: inline-block; padding: .1rem .6rem; border-radius: 99px; font-size: .8rem; font-weight: 600; }
.badge.active { background: var(--vc-primary-soft); color: var(--vc-primary-dark); }
.badge.inactive { background: #EEEBE4; color: var(--vc-text-soft); }

.empty { color: var(--vc-text-soft); text-align: center; padding: 2rem 1rem; }

/* ---- modal (slide-over on wide screens) --------------------------------- */
.modal-scrim {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(39, 50, 47, .4);
  display: flex; justify-content: flex-end;
}
.modal-panel {
  background: var(--vc-surface);
  width: min(560px, 100%);
  height: 100%;
  overflow-y: auto;
  padding: 1.5rem 1.6rem 3rem;
  box-shadow: -8px 0 30px rgba(39, 50, 47, .18);
  animation: vc-slide-in .18s ease-out;
}
@keyframes vc-slide-in { from { transform: translateX(30px); opacity: .4; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.modal-foot { display: flex; gap: .75rem; margin-top: 1.25rem; }

/* ---- combobox (volunteer quick-pick on Hours) ---------------------------- */
.combo { position: relative; }
.combo .combo-list {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 60;
  background: var(--vc-surface); border: 1.5px solid var(--vc-border);
  border-radius: var(--vc-radius-sm); box-shadow: var(--vc-shadow);
  max-height: 280px; overflow-y: auto; margin: .2rem 0 0; padding: .25rem; list-style: none;
}
.combo .combo-list li { padding: .5rem .6rem; border-radius: 6px; cursor: pointer; }
.combo .combo-list li .sub { font-size: .8rem; color: var(--vc-text-soft); }
.combo .combo-list li:hover, .combo .combo-list li[aria-selected="true"] { background: var(--vc-primary-soft); }

/* ---- toasts + saved flash ------------------------------------------------ */
#vc-toasts { position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: .5rem; }
.toast {
  background: var(--vc-text); color: #fff;
  border-radius: var(--vc-radius-sm); padding: .6rem 1.1rem;
  box-shadow: var(--vc-shadow); font-weight: 600;
  animation: vc-toast-in .15s ease-out;
}
.toast.error { background: var(--vc-danger); }
@keyframes vc-toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

.saved-flash { color: var(--vc-ok); font-weight: 700; opacity: 0; transition: opacity .25s; }
.saved-flash.show { opacity: 1; }

/* ---- login page ----------------------------------------------------------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.login-card { width: 100%; max-width: 420px; }
.login-card .wordmark { text-align: center; color: var(--vc-primary-dark); font-size: 1.35rem; font-weight: 700; margin-bottom: .25rem; }
.login-card .tagline { text-align: center; color: var(--vc-text-soft); font-size: .92rem; margin-bottom: 1.5rem; }
.login-card .btn { width: 100%; }
.form-error { background: var(--vc-danger-soft); color: var(--vc-danger); border-radius: var(--vc-radius-sm); padding: .55rem .8rem; margin-bottom: .9rem; font-weight: 600; display: none; }
.form-error.show { display: block; }

/* utility */
.muted { color: var(--vc-text-soft); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt-1 { margin-top: 1rem; }

/* ---- CSV import button group -------------------------------------------- */
.import-group { display: flex; gap: .4rem; align-items: flex-end; flex-wrap: wrap; }
.import-label { cursor: pointer; }
.import-label:hover { filter: brightness(.97); }

/* ---- Import results modal body ------------------------------------------- */
.import-result { padding-top: .25rem; }
.import-created {
  font-size: 1.1rem; font-weight: 600; color: var(--vc-ok);
  margin: 0 0 .75rem;
}
.import-errors { margin-top: .75rem; }
.import-errors-hd {
  font-weight: 600; font-size: .92rem; color: var(--vc-danger);
  margin: 0 0 .4rem;
}
.import-errors-list {
  margin: 0; padding: 0 0 0 1.2rem;
  max-height: 320px; overflow-y: auto;
  font-size: .9rem; color: var(--vc-text);
  border: 1px solid var(--vc-border);
  border-radius: var(--vc-radius-sm);
  padding: .6rem .75rem;
  background: var(--vc-bg);
  list-style: disc;
}
.import-errors-list li { margin-bottom: .3rem; line-height: 1.4; }
.import-errors-list li:last-child { margin-bottom: 0; }

/* ---- Reports view --------------------------------------------------------- */

/* Landing cards grid */
.reports-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.1rem;
  margin-top: .25rem;
}
.rpt-card {
  background: var(--vc-surface);
  border: 1.5px solid var(--vc-border);
  border-radius: var(--vc-radius);
  box-shadow: var(--vc-shadow);
  padding: 1.25rem 1.4rem;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.rpt-card:hover, .rpt-card:focus {
  border-color: var(--vc-primary);
  box-shadow: 0 0 0 3px rgba(47, 126, 109, .15), var(--vc-shadow);
  outline: none;
}
.rpt-card-title {
  font-weight: 700; font-size: 1.08rem;
  color: var(--vc-primary-dark); margin-bottom: .35rem;
}
.rpt-card-desc  { font-size: .92rem; color: var(--vc-text); line-height: 1.4; }
.rpt-card-note  {
  font-size: .82rem; color: var(--vc-text-soft);
  margin-top: .5rem; font-style: italic;
}

/* Back bar */
.rpt-back {
  display: flex; align-items: center; gap: .75rem;
  margin-bottom: .75rem;
}
.rpt-back-label { font-weight: 600; color: var(--vc-text-soft); font-size: .92rem; }

/* Preset chips */
.rpt-presets { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .25rem; }
.rpt-preset.active {
  background: var(--vc-primary); color: #fff;
  border-color: var(--vc-primary);
}

/* Area block: allow page break between areas in print, not inside a row */
.rpt-area-block { break-inside: avoid-page; }
.rpt-area-name  { margin-bottom: .75rem; color: var(--vc-primary-dark); }

/* Subtotal + grand total rows */
.rpt-subtotal td { background: var(--vc-primary-soft); font-style: italic; }
.rpt-grand-total  { border-top: 2px solid var(--vc-primary); }
.rpt-grand-row td { font-size: 1.03rem; }

/* Stat tiles (individual volunteer report) */
.rpt-tiles {
  display: flex; flex-wrap: wrap; gap: .9rem;
  margin-bottom: 1.1rem;
}
.rpt-tile {
  background: var(--vc-surface);
  border: 1.5px solid var(--vc-border);
  border-radius: var(--vc-radius);
  box-shadow: var(--vc-shadow);
  padding: .9rem 1.4rem;
  min-width: 120px; text-align: center;
}
.rpt-tile-val   { font-size: 1.7rem; font-weight: 700; color: var(--vc-primary-dark); }
.rpt-tile-label { font-size: .82rem; color: var(--vc-text-soft); margin-top: .2rem; }

/* Profile table (individual) */
.rpt-profile th {
  font-weight: 600; font-size: .88rem; color: var(--vc-text-soft);
  text-align: right; padding-right: 1rem; white-space: nowrap;
  width: 11rem; text-transform: none; letter-spacing: 0;
}
.rpt-profile td { text-align: left; }

/* Action buttons below the report */
.rpt-actions {
  display: flex; gap: .75rem; margin: .75rem 0 1.5rem;
}

/* Print-only header — hidden on screen */
.rpt-header.print-only { display: none; }
.rpt-print-org   { font-weight: 700; font-size: 1.1rem; }
.rpt-print-title { font-size: 1.4rem; font-weight: 700; margin: .2rem 0; }
.rpt-print-params{ font-size: .9rem; color: #444; }
.rpt-print-gen   { font-size: .8rem; color: #666; margin-top: .15rem; }

/* ---- @media print --------------------------------------------------------- */
@media print {
  /* Hide nav, config controls, action buttons, toasts */
  .vc-nav,
  #vc-toasts,
  #vc-modal-root,
  .rpt-back,
  .rpt-presets,
  #rpt-custom-range,
  .rpt-actions,
  .no-print        { display: none !important; }

  /* Show the print-only report header */
  .rpt-header.print-only { display: block; margin-bottom: 1.25rem; }

  /* Remove config card when printing */
  .card:has(#rpt-run), .card:has(#rpt-status), .card:has(#rpt-vol-sel) { display: none; }

  /* White page, black text */
  body { background: #fff !important; color: #000 !important; font-size: 11pt; }
  .vc-main { max-width: 100% !important; padding: 0 !important; }

  /* Clean table borders for print */
  table.vc-table { border-collapse: collapse; width: 100%; }
  .vc-table th, .vc-table td {
    border: 1px solid #bbb !important;
    padding: .3rem .5rem !important;
    color: #000 !important;
    background: none !important;
  }
  .vc-table th {
    background: #f0f0f0 !important;
    font-size: 9pt !important;
  }
  /* Repeat table header on each page */
  thead { display: table-header-group; }
  /* Never break inside a row; allow breaks between area groups */
  tr { break-inside: avoid; }
  .rpt-area-block { break-inside: avoid-page; margin-bottom: .75rem; }
  .rpt-grand-total { break-inside: avoid; }

  /* Subtotal row: light grey on print */
  .rpt-subtotal td { background: #f5f5f5 !important; }

  /* Stat tiles: inline on print */
  .rpt-tiles { display: flex; gap: .5rem; flex-wrap: wrap; }
  .rpt-tile  { border: 1px solid #bbb !important; box-shadow: none !important; padding: .4rem .7rem; }
  .rpt-tile-val   { font-size: 1.2rem; color: #000 !important; }
  .rpt-tile-label { font-size: 8pt; color: #444 !important; }

  /* Profile table */
  .rpt-profile th { color: #333 !important; }

  /* Cards: no shadow, no radius on print */
  .card { box-shadow: none !important; border: 1px solid #ccc !important; border-radius: 0 !important;
          padding: .5rem .75rem !important; margin-bottom: .5rem !important; }

  /* Keep badge text visible */
  .badge.active   { background: none !important; color: #000 !important; }
  .badge.inactive { background: none !important; color: #555 !important; }
}
