/* ============================================================
   WERC Plant Management — app components
   Layered on css/werc.css (WERC design system tokens).
   ============================================================ */

/* ---------- App header ---------- */
.app-nav__tag {
  font-family: var(--font-display); font-weight: 500; font-size: 11px;
  letter-spacing: 0.2em; text-transform: uppercase; color: var(--werc-red);
  border: 1px solid rgba(255,255,255,0.25); border-radius: var(--radius-sm);
  padding: 3px 8px; margin-left: 12px; color: rgba(255,255,255,0.75);
}

/* ---------- Role gating: elements admins can see but members can't ---------- */
body:not(.is-admin) .admin-only { display: none !important; }
body:not(.is-site-admin) .site-admin-only { display: none !important; }

/* ---------- Account chip + dropdown in nav ---------- */
.nav-account {
  position: relative; display: inline-flex; align-items: center;
  padding-left: 18px; border-left: 1px solid rgba(255,255,255,0.2);
}
.nav-account__btn {
  background: none; border: none; cursor: pointer; padding: 0;
  display: inline-flex; align-items: center; gap: 10px;
}
.nav-account__name { color: #fff; font-size: 12px; letter-spacing: 0.08em; }
.nav-account__role {
  font-size: 10px; letter-spacing: 0.14em; color: var(--werc-ink);
  background: #fff; border-radius: var(--radius-sm); padding: 2px 7px;
}
.nav-account__caret { color: rgba(255,255,255,0.6); font-size: 10px; }
.nav-account__btn:hover .nav-account__caret { color: var(--werc-red); }
.nav-account__menu {
  display: none; position: absolute; top: calc(100% + 12px); right: 0; z-index: 80;
  background: #fff; border: 1px solid var(--border-color); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); min-width: 180px; padding: 6px 0;
  flex-direction: column;
}
.nav-account__menu.open { display: flex; }
.nav-account__menu a, .nav-account__menu button {
  background: none; border: none; cursor: pointer; text-align: left;
  padding: 9px 16px; font-family: var(--font-body); font-size: 14px;
  color: var(--werc-ink); font-weight: 400; text-transform: none; letter-spacing: 0;
}
.nav-account__menu a:hover, .nav-account__menu button:hover {
  background: var(--grey-50); color: var(--werc-red);
}
@media (max-width: 960px) {
  .nav-account { border-left: none; padding-left: 0; margin-top: 8px; }
  .nav-account__menu { position: static; box-shadow: none; border: none; background: none; }
  .nav-account__menu a, .nav-account__menu button { color: rgba(255,255,255,0.85); }
}
/* Between full-width and the hamburger breakpoint the account chip makes the
   nav row tight — let the links wrap under the brand instead of overlapping */
@media (max-width: 1240px) and (min-width: 961px) {
  .site-nav { flex-wrap: wrap; padding-top: 12px; padding-bottom: 12px; row-gap: 4px; }
}

/* ---------- Auth pages (login / register) ---------- */
.auth-page { min-height: 100vh; display: flex; flex-direction: column; background: var(--werc-paper); }
.auth-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 48px 24px; }
.auth-card {
  background: #fff; border: 1px solid var(--border-color); border-top: 5px solid var(--werc-red);
  border-radius: var(--radius-md); box-shadow: var(--shadow-md);
  width: 100%; max-width: 440px; padding: 40px 40px 36px;
}
.auth-card h1 { font-size: 30px; margin: 6px 0 4px; }
.auth-card .lede { font-size: 14.5px; color: var(--text-secondary); margin: 0 0 24px; }
.auth-card form { display: flex; flex-direction: column; gap: 16px; }
.auth-alt { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--grey-100); font-size: 14px; color: var(--text-secondary); }
.auth-alt a { font-weight: 600; color: var(--werc-red); }

/* ---------- Page hero (compact, app-scale) ---------- */
.app-hero { background: var(--werc-ink); color: #fff; position: relative; }
.app-hero__inner {
  max-width: var(--container-max); margin: 0 auto;
  padding: 40px 32px 46px;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap;
}
.app-hero h1 { color: #fff; font-size: 40px; margin: 0; }
.app-hero .eyebrow { display: block; margin-bottom: 8px; }
.app-hero__actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------- Stat tiles ---------- */
.stat-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.stat-tile {
  background: #fff; border: 1px solid var(--border-color); border-radius: var(--radius-md);
  border-top: 4px solid var(--werc-ink); padding: 22px 24px 20px;
}
.stat-tile--red { border-top-color: var(--werc-red); }
.stat-tile--harbour { border-top-color: var(--werc-harbour); }
.stat-tile--grey { border-top-color: var(--grey-400); }

/* ---------- Status + priority badges ---------- */
.status-badge {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px;
  font-family: var(--font-display); font-weight: 500; font-size: 11px;
  letter-spacing: 0.12em; text-transform: uppercase; border-radius: var(--radius-sm);
  white-space: nowrap;
}
.status-badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-available   { background: var(--werc-harbour-tint); color: var(--werc-harbour-dark); }
.status-maintenance { background: var(--werc-red-tint); color: var(--werc-red-dark); }
.status-retired     { background: var(--grey-100); color: var(--grey-600); }
.status-open        { background: var(--werc-red-tint); color: var(--werc-red-dark); }
.status-in_progress { background: #f5ead4; color: #8a6210; }
.status-completed   { background: var(--werc-harbour-tint); color: var(--werc-harbour-dark); }

.priority-flag {
  font-family: var(--font-display); font-weight: 600; font-size: 10.5px;
  letter-spacing: 0.14em; text-transform: uppercase;
}
.priority-urgent { color: var(--werc-red); }
.priority-high   { color: #b86a10; }
.priority-normal { color: var(--grey-600); }
.priority-low    { color: var(--grey-400); }

/* ---------- Data table (extends .results-table look) ---------- */
.data-table { border-collapse: collapse; width: 100%; font-size: 14.5px; background: #fff; }
.data-table th {
  font-family: var(--font-display); font-weight: 600; font-size: 12px;
  letter-spacing: 0.12em; text-transform: uppercase; text-align: left;
  background: var(--werc-ink); color: #fff; padding: 12px 14px; white-space: nowrap;
}
.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--grey-100); vertical-align: middle; color: #3a3733; line-height: 1.45; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background var(--dur-fast) var(--ease-standard); }
.data-table tbody tr:hover { background: var(--grey-50); }
.data-table a { font-weight: 600; color: var(--werc-ink); }
.data-table a:hover { color: var(--werc-red); }
.data-table .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table .boat-class {
  font-family: var(--font-display); font-weight: 600; font-size: 13px;
  color: var(--werc-ink); white-space: nowrap;
}
.row-actions { display: flex; gap: 10px; justify-content: flex-end; }
.row-actions a, .row-actions button {
  font-family: var(--font-display); font-weight: 500; font-size: 11.5px;
  letter-spacing: 0.12em; text-transform: uppercase; background: none; border: none;
  cursor: pointer; color: var(--werc-ink); padding: 0;
}
.row-actions a:hover, .row-actions button:hover { color: var(--werc-red); }
.row-actions .danger { color: var(--werc-red); }
.row-actions .danger:hover { color: var(--werc-red-dark); }

/* ---------- Filter bar ---------- */
.filter-bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 26px 0 18px; }
.filter-bar label {
  font-family: var(--font-display); font-weight: 500; font-size: 11.5px;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-muted);
}

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-family: var(--font-display); font-weight: 500; font-size: 11.5px;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--grey-600);
}
.field input, .field select, .field textarea, .filter-bar select, .filter-bar input {
  font-family: var(--font-body); font-size: 15px; color: var(--werc-ink);
  background: #fff; border: 1px solid var(--grey-300); border-radius: var(--radius-sm);
  padding: 10px 12px; transition: border-color var(--dur-fast) var(--ease-standard);
}
.field input:focus, .field select:focus, .field textarea:focus,
.filter-bar select:focus, .filter-bar input:focus {
  outline: none; border-color: var(--werc-harbour);
  box-shadow: 0 0 0 3px var(--werc-harbour-tint);
}
.field textarea { resize: vertical; min-height: 72px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.form-grid .field--full { grid-column: 1 / -1; }
.field--check { flex-direction: row; align-items: center; gap: 10px; }
.field--check input { width: 18px; height: 18px; accent-color: var(--werc-red); }
.field--check label { color: var(--werc-ink); font-size: 12.5px; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(20,20,20,0.55); z-index: 50;
  display: none; align-items: flex-start; justify-content: center; padding: 6vh 20px;
  overflow-y: auto;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: #fff; border-radius: var(--radius-md); width: 100%; max-width: 640px;
  box-shadow: var(--shadow-lg); border-top: 5px solid var(--werc-red);
}
.modal__head { display: flex; align-items: baseline; justify-content: space-between; padding: 26px 30px 0; }
.modal__head h3 { margin: 0; }
.modal__close { background: none; border: none; font-size: 26px; line-height: 1; cursor: pointer; color: var(--grey-500); }
.modal__close:hover { color: var(--werc-red); }
.modal__body { padding: 20px 30px 30px; }
.modal__footer { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; }
.form-error {
  display: none; background: var(--werc-red-tint); color: var(--werc-red-dark);
  border-left: 4px solid var(--werc-red); border-radius: var(--radius-sm);
  padding: 10px 14px; font-size: 14px; margin-bottom: 16px;
}
.form-error.show { display: block; }

/* ---------- Bookings board ---------- */
.day-nav { display: flex; align-items: center; gap: 16px; }
.day-nav button {
  background: #fff; border: 1px solid var(--grey-300); border-radius: var(--radius-sm);
  width: 38px; height: 38px; cursor: pointer; font-size: 16px; color: var(--werc-ink);
}
.day-nav button:hover { border-color: var(--werc-ink); }
.day-nav__date { font-family: var(--font-display); font-weight: 600; text-transform: uppercase; font-size: 19px; min-width: 260px; text-align: center; }
.day-nav input[type="date"] { border: 1px solid var(--grey-300); border-radius: var(--radius-sm); padding: 8px 10px; font-family: var(--font-body); }

.booking-card {
  display: flex; gap: 18px; align-items: center; background: #fff;
  border: 1px solid var(--border-color); border-left: 4px solid var(--werc-harbour);
  border-radius: var(--radius-md); padding: 14px 18px;
}
.booking-card--cancelled { opacity: 0.65; border-left-color: var(--grey-400); }
.booking-card--cancelled .booking-card__time,
.booking-card--cancelled .booking-card__boat { text-decoration: line-through; }

/* ---------- View toggle (day / week) ---------- */
.view-toggle {
  display: inline-flex; border: 1px solid var(--grey-300);
  border-radius: var(--radius-sm); overflow: hidden;
}
.view-toggle button {
  background: #fff; border: none; cursor: pointer; padding: 9px 16px;
  font-family: var(--font-display); font-weight: 500; font-size: 11.5px;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--grey-600);
}
.view-toggle button + button { border-left: 1px solid var(--grey-300); }
.view-toggle button.active { background: var(--werc-ink); color: #fff; }

/* ---------- Week view ---------- */
.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; }
.week-day {
  background: #fff; border: 1px solid var(--border-color); border-radius: var(--radius-md);
  padding: 8px; display: flex; flex-direction: column; gap: 6px; min-height: 130px; min-width: 0;
}
.week-day--today { border-color: var(--werc-harbour); box-shadow: 0 0 0 1px var(--werc-harbour); }
.week-day__head {
  background: none; border: none; cursor: pointer; text-align: left; padding: 4px 6px;
  font-family: var(--font-display); font-weight: 600; font-size: 12px;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted);
  display: flex; justify-content: space-between; align-items: baseline; gap: 6px;
}
.week-day__head:hover { color: var(--werc-red); }
.week-day__date { font-size: 12.5px; color: var(--werc-ink); white-space: nowrap; }
.week-day__empty { text-align: center; color: var(--grey-300); padding: 14px 0; }
.week-card {
  display: flex; flex-direction: column; background: var(--werc-paper);
  border-left: 3px solid var(--werc-harbour); border-radius: var(--radius-sm);
  padding: 6px 8px; font-size: 12.5px; color: inherit; min-width: 0;
}
.week-card:hover { background: var(--werc-harbour-tint); }
.week-card__time { font-family: var(--font-display); font-weight: 600; font-size: 11.5px; color: var(--werc-ink); }
.week-card__boat { font-weight: 600; }
.week-card__boat, .week-card__who { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.week-card__who { color: var(--text-muted); font-size: 11.5px; }
.booking-card__time {
  flex: none; width: 96px; font-family: var(--font-display); font-weight: 600;
  font-size: 15px; color: var(--werc-ink); font-variant-numeric: tabular-nums;
}
.booking-card__boat { font-family: var(--font-display); font-weight: 600; text-transform: uppercase; font-size: 16px; }
.booking-card__who { font-size: 13.5px; color: var(--text-secondary); margin-top: 2px; }

/* ---------- Empty state ---------- */
.empty-state {
  text-align: center; padding: 48px 24px; background: var(--werc-paper);
  border: 1px dashed var(--grey-300); border-radius: var(--radius-md);
  color: var(--text-muted); font-size: 15px;
}
.empty-state .eyebrow { display: block; margin-bottom: 6px; }

/* ---------- Detail page ---------- */
.spec-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px 28px; }
.spec__label {
  font-family: var(--font-display); font-weight: 500; font-size: 11px;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-muted);
}
.spec__value { font-size: 16px; color: var(--werc-ink); margin-top: 3px; font-weight: 500; }

/* ---------- Verify-email banner ---------- */
.verify-banner {
  display: flex; align-items: center; justify-content: center; gap: 16px; flex-wrap: wrap;
  background: #f5ead4; color: #6b4c0a; border-bottom: 1px solid #e3d1a5;
  padding: 10px 24px; font-size: 14px; text-align: center;
}
.verify-banner__resend {
  background: none; border: 1px solid #b8925a; border-radius: var(--radius-sm);
  color: #6b4c0a; cursor: pointer; padding: 4px 12px;
  font-family: var(--font-display); font-weight: 500; font-size: 11px;
  letter-spacing: 0.12em; text-transform: uppercase;
}
.verify-banner__resend:hover:not(:disabled) { background: #efe0ba; }
.verify-banner__resend:disabled { opacity: 0.5; cursor: default; }

/* ---------- Group badges + pickers ---------- */
.group-badge {
  display: inline-flex; align-items: center; height: 20px; padding: 0 8px;
  font-family: var(--font-display); font-weight: 500; font-size: 10.5px;
  letter-spacing: 0.1em; text-transform: uppercase; border-radius: var(--radius-sm);
  background: var(--werc-harbour-tint); color: var(--werc-harbour-dark);
  border: none; white-space: nowrap;
}
.group-badge--pending {
  background: #f5ead4; color: #6b4c0a; cursor: pointer;
}
.group-badge--pending:hover { background: #efe0ba; }
.group-checks { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 4px 0; }
.group-check {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  font-size: 14px; color: var(--werc-ink);
}
.group-check input { width: 16px; height: 16px; accent-color: var(--werc-red); }
.group-input {
  font-family: var(--font-body); font-size: 14.5px; color: var(--werc-ink);
  background: #fff; border: 1px solid var(--grey-300); border-radius: var(--radius-sm);
  padding: 8px 10px;
}

/* ---------- Password feedback line ---------- */
.pw-feedback { font-size: 12.5px; min-height: 0; }
.pw-feedback--bad { color: var(--werc-red-dark); }
.pw-feedback--ok { color: var(--werc-harbour-dark); }

/* ---------- Typeahead ---------- */
.typeahead { position: relative; display: flex; flex-direction: column; }
.typeahead input { width: 100%; }
.typeahead__list {
  display: none; position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 70;
  background: #fff; border: 1px solid var(--grey-300); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md); max-height: 260px; overflow-y: auto;
}
.typeahead__list.open { display: block; }
.typeahead__item {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 9px 12px; font-size: 14.5px; cursor: pointer; color: var(--werc-ink);
}
.typeahead__item:hover, .typeahead__item--active { background: var(--werc-harbour-tint); }
.typeahead__sub { color: var(--text-muted); font-size: 12.5px; white-space: nowrap; }

/* ---------- Long-content hardening ---------- */
.truncate { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.data-table td { overflow-wrap: anywhere; }
.booking-card > div { min-width: 0; }
.booking-card__boat, .booking-card__who { overflow-wrap: anywhere; }
.spec__value { overflow-wrap: anywhere; }
.app-hero h1 { overflow-wrap: anywhere; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--werc-ink); color: #fff; padding: 13px 22px;
  border-left: 4px solid var(--werc-harbour); border-radius: var(--radius-sm);
  font-size: 14.5px; opacity: 0; pointer-events: none; z-index: 60;
  transition: opacity var(--dur-base) var(--ease-standard), transform var(--dur-base) var(--ease-standard);
  box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast--error { border-left-color: var(--werc-red); }

/* ---------- Print (monthly report → PDF) ---------- */
@media print {
  .site-nav, .site-footer, .no-print, .toast { display: none !important; }
  .app-hero { background: none; color: var(--werc-ink); }
  .app-hero h1, .app-hero .eyebrow { color: var(--werc-ink) !important; }
  .app-hero__inner { padding: 0 0 8px; }
  .sash { display: none; }
  main.container { padding-top: 0 !important; }
  .stat-tile, .table-wrap { break-inside: avoid; box-shadow: none; }
  .data-table th { background: #fff !important; color: var(--werc-ink) !important; border-bottom: 2px solid var(--werc-ink); }
  a { color: inherit !important; text-decoration: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .stat-tiles { grid-template-columns: repeat(2, 1fr); }
  .week-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 620px) {
  .app-hero h1 { font-size: 30px; }
  .stat-tiles { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .day-nav__date { min-width: 0; font-size: 15px; }
  .booking-card { flex-wrap: wrap; }
  .week-grid { grid-template-columns: 1fr; }
}
