:root {
  --ink: #152027;
  --muted: #5d6973;
  --soft: #edf3f1;
  --line: #d8e0df;
  --page: #f7faf9;
  --panel: #ffffff;
  --green: #0f6f5d;
  --green-2: #064f43;
  --orange: #c85d12;
  --orange-soft: #fff1e1;
  --shadow: 0 14px 34px rgba(18, 32, 39, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

.staff-shell {
  width: min(100%, 440px);
  min-height: 100vh;
  margin: 0 auto;
  padding-bottom: 92px;
  background:
    radial-gradient(circle at top right, rgba(15, 111, 93, 0.13), transparent 34%),
    var(--page);
}

.staff-topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  gap: 12px;
  align-items: center;
  padding: 22px 16px 18px;
  color: #fff;
  background: linear-gradient(135deg, #043c35 0%, #0b644f 100%);
}

.staff-topbar p,
.staff-topbar h1,
.panel h2,
.section-head h3,
.event-name,
.packet-title h2 {
  margin: 0;
}

.staff-topbar p {
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  opacity: 0.78;
}

.staff-topbar h1 {
  font-size: clamp(28px, 8vw, 36px);
  line-height: 1.02;
}

.packet-topbar h1 {
  font-size: clamp(24px, 6vw, 30px);
}

.profile-badge,
.back-link,
.icon-button {
  display: grid;
  place-items: center;
  border-radius: 999px;
}

.profile-badge {
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 17px;
  font-weight: 900;
}

.packet-topbar {
  grid-template-columns: 44px minmax(0, 1fr);
}

.back-link {
  width: 42px;
  height: 42px;
  background: rgba(255, 255, 255, 0.14);
}

.back-link svg {
  width: 24px;
  height: 24px;
}

.dev-banner {
  margin: 10px 14px 0;
  padding: 8px 12px;
  border: 1px solid rgba(200, 93, 18, 0.24);
  border-radius: 999px;
  background: var(--orange-soft);
  color: #8b4d16;
  font-size: 12px;
  font-weight: 850;
  text-align: center;
}

.dashboard-stack {
  display: grid;
  gap: 14px;
  padding: 14px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.loading-card,
.empty-card,
.access-card {
  display: grid;
  gap: 10px;
  justify-items: start;
  padding: 20px;
}

.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid var(--line);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.focus-panel {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.top-row,
.section-head,
.event-row,
.packet-status-row,
.mini-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.eyebrow {
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.focus-panel h2 {
  margin: 2px 0 4px;
  font-size: 31px;
  line-height: 1.05;
}

.meta-line,
.row-sub,
.packet-copy,
.mini-stat span,
.detail-line {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.alert-pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.alert-pill {
  background: var(--orange-soft);
  color: #8b4d16;
}

.status-pill {
  background: var(--soft);
  color: var(--green-2);
}

.status-pill.ready {
  background: #e6f5ef;
  color: var(--green);
}

.status-pill.warn {
  background: var(--orange-soft);
  color: #8b4d16;
}

.event-card {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, #fff 0%, #fbfdfc 100%);
}

.event-name {
  font-size: 20px;
  font-weight: 900;
  line-height: 1.12;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 9px;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--green-2);
  font-size: 11px;
  font-weight: 850;
}

.chip.warn {
  background: var(--orange-soft);
  color: #8b4d16;
}

.chip.ready {
  background: #e6f5ef;
  color: var(--green);
}

.action-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 46px;
  gap: 8px;
}

.hero-event-card .action-grid .primary-action {
  grid-column: 1 / -1;
}

.hero-event-card .action-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 46px;
}

.hero-event-card .icon-button {
  width: 46px;
}

.action-grid.two-up {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.primary-action,
.secondary-action,
.text-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 900;
}

button.primary-action,
button.secondary-action,
button.text-action {
  border: 0;
  cursor: pointer;
}

button.primary-action:disabled,
button.secondary-action:disabled,
button.text-action:disabled {
  cursor: wait;
  opacity: 0.78;
}

.primary-action {
  background: var(--green);
  color: #fff;
}

.secondary-action {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--green-2);
}

.icon-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--green-2);
}

.icon-button svg {
  width: 20px;
  height: 20px;
}

.section-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.section-head h3 {
  font-size: 17px;
}

.event-list {
  display: grid;
  gap: 9px;
}

.event-row {
  min-height: 68px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.row-main {
  min-width: 0;
}

.row-title {
  overflow: hidden;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-kicker {
  margin-bottom: 3px;
  color: var(--green);
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.row-sub {
  margin-top: 2px;
}

.row-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.compact-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--green-2);
  font-size: 12px;
  font-weight: 850;
}

.mini-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.dashboard-stats .mini-stat {
  min-height: 72px;
}

.mini-stat {
  display: grid;
  gap: 3px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.mini-stat strong {
  font-size: 20px;
}

.all-events {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.all-events summary {
  cursor: pointer;
  padding: 13px;
  color: var(--green-2);
  font-weight: 900;
}

.all-events .event-list {
  padding: 0 10px 10px;
}

.packet-hero {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.invoice-event-card {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.packet-title {
  display: grid;
  gap: 4px;
}

.packet-title h2 {
  font-size: 28px;
  line-height: 1.05;
}

.packet-status-row {
  align-items: flex-start;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.invoice-event-card .packet-status-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 0;
  border: 0;
  background: transparent;
}

.invoice-event-card h2 {
  margin: 12px 0 14px;
  font-size: clamp(30px, 8vw, 42px);
  line-height: 1.03;
}

.invoice-event-facts {
  display: grid;
  gap: 10px;
  margin: 0;
}

.invoice-event-facts div {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.invoice-event-facts dt {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 15px;
}

.invoice-event-facts dt svg {
  width: 18px;
  height: 18px;
}

.invoice-event-facts dd {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  font-weight: 900;
}

.packet-section {
  display: grid;
  gap: 11px;
  padding: 16px;
}

.schedule-list,
.document-list {
  display: grid;
  gap: 9px;
}

.schedule-item,
.document-item,
.arrival-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.schedule-item strong,
.document-item strong,
.arrival-card strong {
  display: block;
  margin-bottom: 4px;
}

.arrival-card {
  display: grid;
  gap: 10px;
}

.invoice-day {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.invoice-hero-date {
  width: fit-content;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--green);
  font: inherit;
  font-weight: 900;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 4px;
}

.invoice-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.invoice-edit-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.invoice-edit-grid label {
  display: grid;
  gap: 5px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.invoice-edit-grid input {
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
}

.invoice-edit-grid input {
  padding: 4px 0;
  border-bottom: 1px solid var(--line);
}

.date-dialog {
  width: min(94vw, 560px);
  max-height: 90dvh;
  padding: 0;
  border: 0;
  border-radius: 24px;
  background: transparent;
}

.date-dialog::backdrop {
  background: rgba(18, 26, 30, 0.52);
}

.date-dialog-shell {
  overflow: hidden;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(18, 26, 30, 0.26);
}

.date-dialog-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.date-dialog-header p,
.date-dialog-header h3 {
  margin: 0;
}

.date-dialog-header p {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.date-dialog-header h3 {
  font-size: 22px;
}

.date-chip-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
  padding: 12px;
}

.date-chip {
  min-height: 62px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  font-weight: 900;
}

.date-chip span,
.date-chip strong {
  display: block;
}

.date-chip span {
  color: var(--muted);
  font-size: 11px;
}

.date-chip strong {
  margin-top: 3px;
  font-size: 15px;
}

.date-chip.selected {
  border-color: var(--green);
  background: var(--soft);
  color: var(--green);
}

.date-chip.endpoint {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.date-chip.endpoint span {
  color: rgba(255, 255, 255, 0.76);
}

.date-chip.date-expand {
  border-style: dashed;
  color: var(--green);
  background: #f5faf8;
  font-size: 18px;
}

.day-setup-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  padding: 0 12px 10px;
}

.day-setup-row strong {
  font-size: 14px;
}

.day-setup-row .save {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--green);
  border-radius: 999px;
  background: var(--green);
  color: #fff;
  font-weight: 900;
}

.day-setup-row .save:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.date-warning {
  margin: 0 12px 10px;
  padding: 8px 10px;
  border: 1px solid rgba(200, 93, 18, 0.24);
  border-radius: 10px;
  background: rgba(200, 93, 18, 0.08);
  color: #8b4d16;
  font-size: 12px;
  font-weight: 850;
}

.report-day-list {
  display: grid;
  gap: 8px;
  max-height: 36dvh;
  overflow: auto;
  padding: 0 12px 12px;
}

.report-day-row {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.report-day-head {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.report-day-head strong {
  font-size: 14px;
}

.report-day-head label {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.report-day-head input {
  width: 16px;
  height: 16px;
  accent-color: var(--green);
}

.phase-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
}

.phase-grid button {
  min-height: 34px;
  padding: 6px 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fbfdfc;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.phase-grid button.selected {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.phase-grid button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.expense-line-list {
  display: grid;
  gap: 10px;
}

.expense-line-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.expense-line-row label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.expense-line-row label.wide {
  grid-column: 1 / -1;
}

.expense-line-row input,
.expense-line-row select {
  min-width: 0;
  padding: 8px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font: inherit;
}

.expense-line-row .checkbox-label {
  align-content: center;
  grid-template-columns: auto 1fr;
}

.expense-line-row .checkbox-label input {
  width: auto;
  min-width: auto;
}

.expense-line-row .danger {
  grid-column: 1 / -1;
  min-height: 36px;
  justify-content: flex-start;
  color: #9b271f;
}

.profile-stack {
  grid-template-columns: 1fr;
}

.profile-hero {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.profile-hero h2 {
  margin: 2px 0 4px;
  font-size: 30px;
  line-height: 1.05;
}

.inline-status {
  padding: 10px 12px;
  border: 1px solid rgba(15, 111, 93, 0.22);
  border-radius: 14px;
  background: #eaf7f3;
  color: var(--green-2);
  font-size: 13px;
  font-weight: 850;
}

.profile-form {
  display: grid;
  gap: 0;
  overflow: hidden;
}

.profile-section {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-top: 1px solid var(--line);
}

.profile-section:first-child {
  border-top: 0;
}

.profile-section h3 {
  margin: 0 0 3px;
  font-size: 17px;
}

.profile-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.profile-field {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.profile-field input,
.profile-field select,
.profile-field textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  color: var(--ink);
  padding: 10px 11px;
  font: inherit;
  text-transform: none;
}

.profile-field textarea {
  min-height: 82px;
  resize: vertical;
}

.gear-field {
  display: grid;
  gap: 7px;
}

.profile-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-transform: none;
}

.profile-checkbox input {
  width: 16px;
  height: 16px;
  accent-color: var(--green);
}

.profile-actions {
  position: sticky;
  bottom: 72px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
}

.profile-actions button {
  border: 0;
}

.cert-stub {
  box-shadow: none;
}

.local-signature-panel {
  display: grid;
  gap: 10px;
}

.signature-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.local-signature-pad {
  width: 100%;
  height: 138px;
  border: 1px dashed var(--green);
  border-radius: 16px;
  background:
    linear-gradient(#fff, #fff),
    repeating-linear-gradient(0deg, transparent, transparent 33px, rgba(15, 111, 93, 0.08) 34px);
  touch-action: none;
}

.local-signature-pad.locked {
  border-style: solid;
  cursor: not-allowed;
}

.local-signature-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.local-signature-actions button {
  border: 0;
  min-height: 42px;
}

.staff-bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: min(100%, 440px);
  margin: 0 auto;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 -10px 30px rgba(18, 32, 39, 0.08);
  backdrop-filter: blur(14px);
}

.staff-bottom-nav a {
  display: grid;
  gap: 3px;
  justify-items: center;
  padding: 8px 4px;
  border-radius: 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.staff-bottom-nav a.active {
  background: var(--soft);
  color: var(--green-2);
}

.staff-bottom-nav svg {
  width: 20px;
  height: 20px;
}

@media (min-width: 860px) {
  .staff-shell {
    width: min(100%, 980px);
    padding-bottom: 28px;
  }

  .staff-topbar {
    border-radius: 0 0 26px 26px;
  }

  .dashboard-stack {
    grid-template-columns: minmax(360px, 1.05fr) minmax(340px, 0.95fr);
    align-items: start;
    padding: 22px;
  }

  .profile-stack {
    grid-template-columns: minmax(0, 1fr);
    max-width: 760px;
    margin: 0 auto;
  }

  .profile-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profile-field-wide {
    grid-column: 1 / -1;
  }

  .profile-actions {
    bottom: 18px;
    border-radius: 0 0 18px 18px;
  }

  .focus-panel,
  .packet-hero {
    grid-row: span 2;
  }

  .staff-bottom-nav {
    position: sticky;
    border: 1px solid var(--line);
    border-radius: 22px;
    bottom: 18px;
  }
}
