@font-face {
  font-family: "Bahnschrift";
  src: url("../fonts/bahnschrift.ttf") format("truetype");
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
}

:root {
  --primary: #ed1c24;
  --primary-dark: #c9151c;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --text: rgba(0, 0, 0, 0.87);
  --muted: rgba(0, 0, 0, 0.6);
  --border: #e0e0e0;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Bahnschrift", Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
}

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

img {
  max-width: 100%;
  height: auto;
  display: block;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  background: var(--primary);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.14);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.topbar-left {
  display: flex;
  align-items: center;
  min-width: 0;
}

.topbar-logo {
  height: 44px;
  width: auto;
  display: block;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.container {
  max-width: 100%;
  margin: 24px auto;
  padding: 0;
}

.panel,
.hero-card,
.stat-card,
.detail-card,
.subpanel,
.module-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.page-grid {
  display: grid;
  gap: 16px;
}

.module-grid,
.stats-grid,
.details-grid,
.preset-grid {
  display: grid;
  gap: 16px;
}

.module-grid,
.stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.details-grid,
.page-grid.two-columns,
.form-grid,
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.button,
.primary-button,
.secondary-button,
.table-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
  font-size: 16px;
  line-height: 1;
  box-shadow: none;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.button:hover,
.primary-button:hover,
.secondary-button:hover,
.table-action:hover {
  opacity: 0.96;
}

.button-primary,
.primary-button {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.button-primary:hover,
.primary-button:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.secondary-button {
  background: #fff;
  border-color: var(--border);
  color: var(--text);
}

.hero-card,
.panel,
.subpanel,
.detail-card,
.stat-card {
  padding: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 32px;
  line-height: 1.1;
  font-weight: 800;
}

h2 {
  margin-bottom: 0;
  font-size: 24px;
  line-height: 1.1;
  font-weight: 800;
}

h3 {
  margin-bottom: 0;
  font-size: 16px;
  line-height: 1.2;
  font-weight: 800;
}

.lead,
.stat-label,
.detail-label,
.module-card p,
.muted {
  color: var(--muted);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

.module-card {
  min-height: 180px;
  padding: 48px 30px 34px;
  display: grid;
  gap: 14px;
}

.module-card strong {
  font-size: 16px;
  line-height: 1.2;
  font-weight: 800;
}

.module-card p {
  margin-bottom: 0;
  font-size: 16px;
  line-height: 1.35;
}

.module-card-label {
  display: none;
}

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

.stat-card strong {
  font-size: 32px;
  line-height: 1;
}

.button-row,
.form-actions,
.actions-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.stack-form,
.invoice-form,
.login-form {
  display: grid;
  gap: 16px;
}

.form-group {
  display: grid;
  gap: 8px;
  width: 100%;
}

label {
  display: grid;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
}

.input,
.select,
.textarea,
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  max-width: 100%;
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  background: #fff;
  color: var(--text);
  font-size: 16px;
  line-height: 1.35;
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
  font-family: inherit;
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
}

input[type="date"],
input[type="time"],
input[type="datetime-local"] {
  display: block !important;
  height: 48px !important;
  min-height: 48px !important;
  border: 1px solid var(--border) !important;
  border-radius: 12px !important;
  padding: 12px 14px !important;
  background-color: #fff !important;
  color: var(--text) !important;
  font-family: "Bahnschrift", Arial, Helvetica, sans-serif !important;
  font-size: 16px !important;
  font-weight: 400 !important;
  line-height: 1.35 !important;
  box-shadow: none;
}

textarea,
.textarea {
  min-height: 140px;
  resize: vertical;
  padding-top: 14px;
}

select[multiple] {
  min-height: 180px;
  padding-top: 10px;
}

.input:focus,
.select:focus,
.textarea:focus,
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(237, 28, 36, 0.12);
}

.input::placeholder,
input::placeholder,
textarea::placeholder {
  color: rgba(0, 0, 0, 0.45);
  font-weight: 500;
}

.span-two {
  grid-column: 1 / -1;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.checkbox-row input[type="checkbox"] {
  transform: scale(1);
  margin: 0;
  min-height: 18px;
  width: 18px;
  height: 18px;
}

.notice {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  font-weight: 700;
}

.notice.error,
.login-error {
  background: rgba(237, 28, 36, 0.08);
  color: #b00020;
}

.notice.success {
  background: rgba(46, 125, 50, 0.1);
  color: #2e7d32;
}

.notice.warning {
  background: rgba(255, 193, 7, 0.12);
  color: #8a6500;
}

.login-page {
  background: var(--bg);
  min-height: 100vh;
}

.login-shell {
  min-height: 100vh;
}

.login-topbar {
  height: 40px;
  background: var(--primary);
  width: 100%;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.login-layout {
  max-width: 1200px;
  margin: 24px auto 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 40px;
}

.login-brand-side {
  flex: 0 1 320px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.login-brand-logo {
  display: block;
  width: 100%;
  max-width: 320px;
  height: auto;
}

.login-panel {
  flex: 0 1 520px;
  width: 100%;
}

.login-panel-inner {
  background: var(--surface);
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.04);
  padding: 32px;
}

.login-title {
  margin: 0 0 24px 0;
  font-size: 24px;
  line-height: 1.05;
  font-weight: 800;
  color: var(--text);
}

.login-actions {
  margin-top: 22px;
}

.login-submit {
  min-width: 180px;
  min-height: 52px;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
}

.login-error {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  font-weight: 700;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}

.data-table,
.print-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
}

.data-table th,
.data-table td,
.print-table th,
.print-table td {
  padding: 8px 10px;
  text-align: left;
  vertical-align: middle;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.data-table th,
.print-table th {
  font-weight: 700;
  background: #fff;
}

.data-table th:last-child,
.data-table td:last-child,
.print-table th:last-child,
.print-table td:last-child {
  border-right: none;
}

.data-table tr:last-child td,
.print-table tr:last-child td {
  border-bottom: none;
}

.data-table .action-cell {
  background: #eeeeee !important;
  color: var(--text);
  font-weight: 800;
  white-space: nowrap;
}

.data-table .action-cell a {
  color: var(--text);
  text-decoration: none;
}

.data-table .action-cell a:hover {
  color: var(--primary);
}

.event-row-red td {
  color: #d71920;
}

.event-row-blue td {
  color: #0057b8;
}

.event-row-green td {
  color: #20803a;
}

.event-row-purple td {
  color: #7b2cbf;
}

.event-row-brown td {
  color: #8a5a2b;
}

.event-row-red .action-cell,
.event-row-red .action-cell a {
  color: #d71920;
}

.event-row-blue .action-cell,
.event-row-blue .action-cell a {
  color: #0057b8;
}

.event-row-green .action-cell,
.event-row-green .action-cell a {
  color: #20803a;
}

.event-row-purple .action-cell,
.event-row-purple .action-cell a {
  color: #7b2cbf;
}

.event-row-brown .action-cell,
.event-row-brown .action-cell a {
  color: #8a5a2b;
}

.preset-card {
  width: 100%;
  text-align: left;
  padding: 18px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: var(--shadow);
}

.preset-card strong,
.preset-card span {
  display: block;
}

.preset-card span {
  margin-top: 8px;
}

.preset-calculator {
  margin-bottom: 24px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}

.calculator-summary {
  margin-top: 14px;
  margin-bottom: 12px;
  font-size: 18px;
  font-weight: 800;
}

.preset-group-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.permissions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}

.event-section {
  display: grid;
  gap: 16px;
}

.compact-subpanel {
  padding: 18px;
}

.member-checklist,
.assignment-members,
.vehicle-assignment-grid {
  display: grid;
  gap: 12px;
}

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

.selected-member-box {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

.selected-member-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.selected-member-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid #cfcfcf;
  border-radius: 999px;
  background: #f1f1f1;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.selected-member-chip span {
  color: var(--primary);
  font-size: 12px;
}

.vehicle-assignment-grid {
  margin-top: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.vehicle-assignment-card h3 {
  margin-bottom: 12px;
}

.permission-item {
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}

.preset-group-button.is-active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.hidden {
  display: none !important;
}

.totals-box,
.note-box {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

.totals-box p,
.print-totals p {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.grand-total {
  font-size: 1.15rem;
  font-weight: 700;
}

.print-body {
  background: #fff;
  font-family: Arial, Helvetica, sans-serif;
}

.fixed-print-header,
.fixed-print-footer {
  width: min(900px, 100%);
  margin: 0 auto;
}

.print-document {
  width: min(900px, 100%);
  margin: 0 auto;
  padding: 132px 24px 120px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
}

.graphic-header img,
.graphic-footer img {
  width: 100%;
  display: block;
}

.print-header,
.print-footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
}

.print-intro {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 24px;
  margin-top: 18px;
  margin-bottom: 18px;
}

.print-recipient,
.print-meta-card {
  font-size: 13px;
  line-height: 1.45;
}

.print-label {
  margin-bottom: 10px;
  font-weight: 700;
}

.print-section,
.print-totals,
.tax-breakdown {
  margin-top: 22px;
}

.compact-table th,
.compact-table td {
  font-size: 12px;
}

.print-tax-breakdown h2 {
  margin-bottom: 10px;
  font-size: 16px;
}

.print-footer-block {
  margin-top: 24px;
  align-items: flex-end;
}

.signature-box {
  min-width: 230px;
  text-align: center;
  font-size: 12px;
}

.signature-line {
  height: 48px;
  border-bottom: 1px solid #111;
  margin: 8px 0;
}

@media (max-width: 900px) {
  .module-grid,
  .stats-grid,
  .details-grid,
  .page-grid.two-columns,
  .form-grid,
  .form-grid-2,
  .permissions-grid,
  .member-checklist,
  .vehicle-assignment-grid {
    grid-template-columns: 1fr;
  }

  .login-layout {
    gap: 28px;
    margin-top: 20px;
  }

  .login-brand-side {
    flex-basis: 220px;
  }

  .login-brand-logo {
    max-width: 170px;
  }

  .login-panel-inner {
    padding: 26px;
  }
}

@media (max-width: 700px) {
  html {
    font-size: 80%;
  }

  .container {
    padding: 0 10px;
  }

  .panel,
  .hero-card,
  .stat-card,
  .detail-card,
  .subpanel,
  .module-card {
    padding: 14px;
  }

  .topbar {
    padding: 8px 10px;
  }

  .topbar-logo {
    height: 30px;
  }

  .topbar-actions {
    gap: 6px;
  }

  .topbar-actions .button,
  .button,
  .primary-button,
  .secondary-button,
  .table-action {
    min-height: 35px;
    padding: 0 12px;
    font-size: 12.8px;
    border-radius: 8px;
  }

  .input,
  .select,
  .textarea,
  input[type="text"],
  input[type="password"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
select,
textarea {
    min-height: 42px;
    font-size: 13.6px;
  }

  .login-topbar {
    height: 32px;
  }

  .login-layout {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    margin-top: 14px;
    padding: 0 10px;
  }

  .login-brand-side {
    flex: none;
    padding-top: 0;
  }

  .login-brand-logo {
    max-width: 96px;
    margin: 0 auto;
  }

  .login-panel {
    flex: none;
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
  }

  .login-panel-inner {
    padding: 18px 14px;
    border-radius: 14px;
  }

  .login-title {
    font-size: 20px;
    margin-bottom: 14px;
    text-align: center;
  }

  .login-submit {
    width: 100%;
    min-width: 0;
    min-height: 38px;
    font-size: 13.6px;
  }

  .data-table th,
  .data-table td {
    padding: 6px 8px;
    font-size: 12.8px;
  }
}

@media print {
  @page {
    size: A4;
    margin: 0;
  }

  .fixed-print-header,
  .fixed-print-footer {
    position: fixed;
    left: 0;
    right: 0;
    width: 100%;
    margin: 0;
    z-index: 10;
    background: #fff;
  }

  .fixed-print-header {
    top: 0;
  }

  .fixed-print-footer {
    bottom: 0;
  }

  .fixed-print-header img,
  .fixed-print-footer img {
    width: 100%;
    display: block;
  }

  .print-document {
    width: 100%;
    max-width: none;
    padding: 138px 24px 128px;
  }

  .print-intro {
    grid-template-columns: 1fr 1fr;
  }
}
