/* ==================== BASE ==================== */

* {
  box-sizing: border-box;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

p {
  margin-top: 0;
  margin-bottom: 12px;
}

small {
  color: var(--text-muted);
}

.nav-spacer {
  flex: 1;
}

.logout-form {
  margin: 0;
  padding: 0;
}

.page-title p {
  margin: 0;
}

.panel-actions {
  margin-top: 20px;
  padding-top: 0;
}

/* Main summary cards */

/* ==================== DASHBOARD ==================== */

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}

.card {
  display: block;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  text-decoration: none;
}

a.card:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.card span {
  display: block;
  color: var(--text-muted);
  font-size: 13px;
}

.card strong {
  display: block;
  margin-top: 3px;
  font-size: 27px;
  line-height: 1.2;
  color: var(--primary);
}

.card small {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
}

/* Needs attention */

.dashboard-attention {
  padding-top: 16px;
  padding-bottom: 16px;
}

.dashboard-attention-header h2 {
  margin-bottom: 12px;
  font-size: 17px;
}

.dashboard-attention-items {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dashboard-attention-item {
  display: block;
  padding: 4px 18px;
  border-right: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
}

.dashboard-attention-item:first-child {
  padding-left: 0;
}

.dashboard-attention-item:last-child {
  border-right: 0;
}

.dashboard-attention-item:hover {
  text-decoration: none;
}

.dashboard-attention-item span {
  display: block;
  color: var(--text-muted);
  font-size: 13px;
}

.dashboard-attention-item strong {
  display: inline-block;
  margin-top: 2px;
  font-size: 20px;
}

.dashboard-attention-item small {
  margin-left: 5px;
  color: var(--text-muted);
}

/* Contracts requiring attention */

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

.dashboard-section-header h2 {
  margin-bottom: 2px;
  font-size: 18px;
}

.dashboard-section-header p {
  margin: 0;
}

.dashboard-section-header > a {
  flex-shrink: 0;
  font-size: 14px;
}

/* Small dashboard status badges */

.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge.warning {
  background: #fff3cd;
  color: #664d03;
}

.badge.success {
  background: #ecfdf3;
  color: #027a48;
}

.badge.terminated {
  background: #f2f4f7;
  color: #475467;
}

.badge.inactive {
  background: #f2f4f7;
  color: #475467;
}

.button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ==================== FORMS ==================== */

form {
  max-width: 650px;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

input[type="checkbox"]:not(.mobile-nav-toggle):not(.filter-toggle-input) {
  display: inline-block;
  width: auto;
  margin-right: 8px;
}

form .button {
  width: auto;
}

.inline-form {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: none;
  margin: 0;
}

.inline-form select {
  width: auto;
  margin: 0;
}

.inline-form .button {
  margin: 0;
}

.auth-card h1 {
  margin-bottom: 24px;
}

.alert {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid #ffe69c;
  border-radius: 6px;
  background: #fff3cd;
  color: #664d03;
}

.panel table {
  margin-bottom: 0;
}

/* ==================== STATUS ==================== */

.status {
  display: inline-block;
  font-weight: 700;
}

.status.in {
  color: #188038;
}

.status.out {
  color: #b3261e;
}

.vehicle-summary,
.owner-summary {
  min-height: 0;
}

.vehicle-summary p,
.owner-summary p {
  margin-bottom: 10px;
}

.vehicle-link {
  font-weight: 600;
  color: var(--primary);
}

.vehicle-subtitle {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 13px;
}

/* ==================== DETAIL GRIDS ==================== */

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

.detail-grid > div {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.contract-detail-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px 32px;
}

/* ==================== VEHICLE CONDITION ==================== */

.condition-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}

.condition-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 20px 0;
}

.condition-summary > div {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 14px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  border-radius: 8px;
}

.condition-summary span {
  color: var(--text-muted);
  font-size: 13px;
}

.condition-summary strong {
  font-size: 16px;
}

.condition-notes {
  margin: 20px 0;
  padding: 14px;
  border-left: 3px solid var(--accent);
  background: var(--surface-soft);
}

.condition-notes p {
  margin: 5px 0 0;
}

/* ==================== VEHICLE MOVEMENTS ==================== */

.movement {
  padding: 18px 0;
  border-top: 1px solid var(--border);
}

.movement:first-of-type {
  border-top: 0;
}

.movement-condition {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin: 10px 0;
  font-size: 14px;
}

/* ==================== VEHICLE PHOTOS ==================== */

.vehicle-photos {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.vehicle-photos a {
  display: block;
  line-height: 0;
}

.vehicle-photos img {
  width: 150px;
  height: 110px;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-soft);
}

.vehicle-photos img:hover {
  opacity: 0.9;
}

.vehicle-photos.large img {
  width: 190px;
  height: 140px;
}

/* ==================== PHOTO UPLOAD / PREVIEW ==================== */

#photoPreview {
  margin-bottom: 20px;
}

#photoPreview:empty {
  display: none;
}

/* ==================== CHECK-IN / CHECK-OUT ==================== */

.vehicle-check-form {
  max-width: none;
}

.vehicle-check-form .panel-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

/* ==================== INVOICE DISPLAY ==================== */

.invoice-status {
  font-weight: 600;
}

.invoice-status.paid {
  color: #188038;
}

.invoice-status.overdue {
  color: #b3261e;
}

.invoice-table {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.invoice-table table {
  margin: 0;
}

.invoice-table tbody tr:last-child td {
  border-bottom: 0;
}

.section-link {
  color: var(--primary);
  font-size: 13px;
  font-weight: 500;
}

.section-link:hover {
  color: var(--primary-hover);
  text-decoration: none;
}

.invoice-table td:first-child a {
  color: var(--primary);
  font-weight: 600;
}

/* ==================== SMALL HELPERS ==================== */

.text-right {
  text-align: right;
}

.text-center {
  text-align: center;
}

.no-margin {
  margin: 0;
}

.mb-0 {
  margin-bottom: 0;
}

.mt-20 {
  margin-top: 20px;
}

/* ==================== LIST FILTERS ==================== */

.filter-panel {
  padding: 18px 20px;
}

.filter-form {
  display: grid;
  grid-template-columns:
    minmax(240px, 2fr)
    minmax(120px, 0.8fr)
    minmax(140px, 1fr)
    minmax(160px, 1fr)
    auto;
  align-items: end;
  gap: 12px;
  max-width: none;
}

.filter-form label {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
}

.filter-form input,
.filter-form select {
  min-height: 44px;
}

.filter-actions {
  display: flex;
  gap: 7px;
}

.filter-actions .button {
  min-height: 44px;
  padding-top: 10px;
  padding-bottom: 10px;
}

.owner-filter-form {
  grid-template-columns: minmax(280px, 500px) auto;
  justify-content: start;
}

.contract-filter-form {
  grid-template-columns:
    minmax(240px, 2fr)
    minmax(130px, 0.8fr)
    minmax(150px, 1fr)
    minmax(190px, 1.2fr)
    auto;
}

.invoice-filter-form {
  grid-template-columns:
    minmax(280px, 500px)
    minmax(150px, 180px)
    auto;
  justify-content: start;
}

.text-warning {
  color: #b26a00;
  font-weight: 600;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

@media (max-width: 900px) {
  .detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

  .filter-search {
    grid-column: 1 / -1;
  }

  .filter-actions {
    grid-column: 1 / -1;
  }
}

@media (max-width: 700px) {
  body {
    font-size: 15px;
  }

  nav {
    flex-wrap: wrap;
    gap: 14px;
    padding: 14px 18px;
  }

  nav .brand {
    width: 100%;
    margin-right: 0;
  }

  .nav-spacer {
    display: none;
  }

  .tenant-name {
    margin-left: auto;
  }

  main {
    margin-top: 16px;
    padding: 0 14px;
  }

  .page-title {
    align-items: center;
    gap: 2px;
    margin-bottom: 14px;
  }
  .page-title > div:first-child {
    min-width: 0;
  }

  .page-title .page-actions {
    flex-shrink: 0;
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }

  /* Dashboard */

  .cards {
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
    gap: 10px;
  }
  .cards .card {
    padding: 16px 20px;
  }

  .dashboard-attention-items {
    grid-template-columns: 1fr;
  }

  .dashboard-attention-item,
  .dashboard-attention-item:first-child {
    padding: 10px 0;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .dashboard-attention-item:last-child {
    border-bottom: 0;
  }

  .dashboard-section-header {
    flex-direction: column;
    gap: 6px;
  }

  /* Details */

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .condition-grid {
    grid-template-columns: 1fr;
  }

  .condition-summary {
    grid-template-columns: 1fr;
  }

  .movement-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .movement-condition {
    flex-direction: column;
    gap: 6px;
  }

  .vehicle-photos img,
  .vehicle-photos.large img {
    width: 120px;
    height: 90px;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    white-space: nowrap;
  }

  th,
  td {
    padding: 10px;
  }

  form {
    max-width: 100%;
  }

  .auth-card {
    margin: 25px auto;
    padding: 20px;
  }

  .filter-form {
    grid-template-columns: 1fr;
  }

  .filter-search,
  .filter-actions {
    grid-column: auto;
  }

  .owner-filter-form {
    grid-template-columns: 1fr;
  }

  .invoice-filter-form {
    grid-template-columns: 1fr;
  }

  .page-actions {
    flex-wrap: wrap;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 450px) {
  .vehicle-photos {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }

  .vehicle-photos a {
    width: 100%;
  }

  .vehicle-photos img,
  .vehicle-photos.large img {
    width: 100%;
    height: 110px;
  }

  .button {
    min-height: 42px;
  }

  .panel {
    padding: 16px;
  }
}

/* ==================== TABLE EMPTY STATES ==================== */

.table-empty {
  text-align: center;
  padding: 48px 24px !important;
}

.table-empty strong {
  display: block;
  font-size: 17px;
  margin-bottom: 6px;
}

.table-empty span {
  display: block;
  margin-bottom: 18px;
  color: #6b7280;
}

.table-empty .button {
  display: inline-block;
}

/* Standalone empty state used inside forms */

.empty-state {
  text-align: center;
  padding: 40px 24px;
}

.empty-state h2 {
  margin-top: 0;
  margin-bottom: 8px;
}

.empty-state p {
  max-width: 520px;
  margin: 0 auto 20px;
  color: #6b7280;
}

.empty-state .panel-actions {
  justify-content: center;
}

:root {
  --bg: #f7f9fb;
  --surface: #ffffff;
  --surface-soft: #f7f9fb;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --text: #18202a;
  --text-secondary: #667085;
  --text-muted: #667085;
  --primary: #14213d;
  --primary-hover: #0d192e;
  --accent: #16b887;
  --accent-hover: #129b73;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --radius: 12px;
}

html {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

h1,
h2,
h3 {
  font-family: "Manrope", "Inter", sans-serif;
  color: var(--primary);
}

h1 {
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 30px;
  line-height: 1.2;
  letter-spacing: -0.5px;
}

h2 {
  margin-top: 0;
  margin-bottom: 18px;
  font-size: 17px;
  line-height: 1.3;
}

.muted {
  color: var(--text-muted);
}

/* ==================== MAIN LAYOUT ==================== */

main {
  width: calc(100% - 96px);
  max-width: 1320px;
  margin: 40px auto 60px;
  padding: 0;
}

.page-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.page-title h1 {
  margin-bottom: 4px;
  margin: 0 0 5px;
}

/* ==================== INFO LAYOUT ==================== */

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px 32px;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-label,
.detail-label {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
}

.info-item strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

/* ==================== PANELS ==================== */

.panel {
  margin-bottom: 24px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(20, 33, 61, 0.04);
}

.panel-heading,
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 20px;
}

.panel-heading h2,
.section-heading h2 {
  margin: 0;
  color: var(--primary);
}

/* ==================== TWO COLUMN LAYOUT ==================== */

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  margin-bottom: 24px;
}

/* ==================== BUTTONS ==================== */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 10px 16px;
  border: 1px solid var(--primary);
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.button:hover {
  opacity: 1;
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #fff;
  text-decoration: none;
}

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

.button.secondary:hover {
  background: var(--surface-soft);
  border-color: var(--primary);
  color: var(--primary);
}

.button.danger {
  background: var(--danger);
  border-color: var(--danger);
}

.button.danger:hover {
  background: var(--danger-hover);
  border-color: var(--danger-hover);
}

input,
select,
textarea {
  display: block;
  width: 100%;
  margin-top: 7px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px rgba(22, 184, 135, 0.12);
}

form label {
  display: block;
  margin-bottom: 15px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
}

/* ==================== TABLES ==================== */

table {
  width: 100%;
  margin-bottom: 30px;
  border-collapse: separate;
  background: #fff;
  border-spacing: 0;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

th {
  background: var(--surface-soft);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

tbody tr:hover {
  background: var(--surface-soft);
}

.table-card {
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(20, 33, 61, 0.04);
}

.table-card table {
  margin: 0;
}

.table-card th {
  padding: 14px 16px;
}

.table-card td {
  padding: 16px;
}

.detail-label {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
}

.detail-grid strong {
  font-size: 14px;
  color: var(--text);
}

.status,
.invoice-status,
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
}

.status.in,
.invoice-status.paid {
  background: #ecfdf3;
  color: #027a48;
}

.status.out,
.invoice-status.overdue {
  background: #fef3f2;
  color: #b42318;
}

.invoice-status.sent {
  color: #175cd3;
  background: #eff6ff;
}

.invoice-status.draft {
  color: #475467;
  background: #f2f4f7;
}

/* ==================== NAVIGATION ==================== */

nav {
  display: flex;
  align-items: center;
  gap: 28px;
  min-height: 68px;
  padding: 0 32px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.02);
}

nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}

nav a:hover {
  text-decoration: none;
  color: var(--primary);
}

nav .brand {
  display: inline-flex;
  align-items: center;
  margin-right: 24px;
  font-family: "Manrope", "Inter", sans-serif;
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -1.2px;
  white-space: nowrap;
  text-decoration: none;
}

.brand-stori {
  color: var(--primary);
}

.brand-go {
  color: var(--accent);
}

.tenant-name {
  color: var(--text-muted);
  font-size: 13px;
  white-space: nowrap;
}

.nav-button {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.nav-button:hover {
  color: var(--primary);
  background: transparent;
  text-decoration: none;
}

/* ==================== VEHICLE MOVEMENT TIMELINE ==================== */

.movement-list {
  margin-top: 4px;
}

.movement-item {
  position: relative;
  display: grid;
  grid-template-columns: 16px 1fr;
  gap: 10px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}

.movement-item:first-child {
  padding-top: 4px;
}

.movement-item:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.movement-marker {
  width: 10px;
  height: 10px;
  margin-top: 6px;
  border-radius: 50%;
  background: #98a2b3;
}

.movement-marker.in {
  background: #12b76a;
}

.movement-marker.out {
  background: #f04438;
}

.movement-content {
  min-width: 0;
}

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

.movement-header strong {
  font-size: 15px;
  display: block;
  color: var(--text);
}

.movement-details {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}

.movement-details > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.movement-details span {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
}

.movement-details strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.movement-pdf {
  flex-shrink: 0;
}

.movement-notes .info-label {
  font-size: 13px;
}

@media (max-width: 700px) {
  .movement-details {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 20px;
  }

  .movement-header {
    flex-direction: column;
  }
}

/* ==================== OWNER LIST / DETAILS ==================== */

.owner-link {
  color: var(--primary);
  font-weight: 600;
}

.owner-link:hover {
  color: var(--primary-hover);
  text-decoration: none;
}

.owner-vehicle-link {
  color: var(--primary);
  font-weight: 600;
}

.owner-vehicle-link:hover {
  color: var(--primary-hover);
  text-decoration: none;
}

/* Owner details */

.owner-details {
  width: 100%;
  max-width: none;
}

.owner-detail-groups {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  max-width: 900px;
}

.owner-detail-row {
  display: grid;
  column-gap: 48px;
}

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

.owner-detail-row-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 700px) {
  .owner-detail-groups {
    max-width: none;
    gap: 18px;
  }

  .owner-detail-row-2,
  .owner-detail-row-3 {
    grid-template-columns: 1fr;
    row-gap: 18px;
  }
}

/* ==================== CONTRACT DETAILS ==================== */

.contract-summary {
  max-width: 1050px;
}

.contract-summary .contract-detail-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: 40px;
  row-gap: 14px;
}

.contract-summary .panel-heading {
  margin-bottom: 16px;
}

@media (max-width: 900px) {
  .contract-summary {
    max-width: none;
  }

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

@media (max-width: 600px) {
  .contract-summary .contract-detail-grid {
    grid-template-columns: 1fr;
  }
}

/* ==================== INVOICE LIST ==================== */

.invoice-link {
  color: var(--primary);
  font-weight: 600;
}

.invoice-link:hover {
  color: var(--primary-hover);
  text-decoration: none;
}

/* ==================== BUILDING LIST ==================== */

.building-link {
  color: var(--primary);
  font-weight: 600;
}

.building-link:hover {
  color: var(--primary-hover);
  text-decoration: none;
}

/* ==================== COMPANY SETTINGS ==================== */

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  margin-bottom: 24px;
  align-items: start;
}

.settings-grid .panel {
  margin: 0;
  height: auto;
  min-height: 0;
}

.settings-wide {
  grid-column: 1 / -1;
}

@media (max-width: 900px) {
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .settings-wide {
    grid-column: auto;
  }
}

.settings-grid .panel .grid-2 {
  align-items: start;
}

.settings-form {
  width: 100%;
  max-width: none;
}

/* ==================== AUTH PAGE ==================== */

.auth-page {
  display: flex;
  justify-content: center;
  padding: 64px 20px;
}

/* ==================== AUTH ==================== */

.auth-card {
  max-width: 440px;
  margin: 50px auto;
  padding: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  width: 100%;
  box-shadow: 0 1px 3px rgba(20, 33, 61, 0.04);
}

.auth-heading {
  margin-bottom: 28px;
}

.auth-heading h1 {
  margin: 0 0 8px;
  font-size: 30px;
}

.auth-heading p {
  margin: 0;
}

.auth-card form {
  width: 100%;
  max-width: none;
}

.auth-card label {
  margin-bottom: 18px;
}

.auth-submit {
  width: 100%;
  margin-top: 4px;
}

.auth-footer {
  margin: 24px 0 0;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  color: var(--text-secondary);
  text-align: center;
}

.auth-footer a {
  font-weight: 600;
}

/* ==================== INTERNAL SERVICE NOTES ==================== */

.internal-service-notes {
  margin: 1.5rem 0;
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
}

.internal-service-notes h3 {
  margin-top: 0;
}

.movement-notes {
  margin-top: 1rem;
  margin-bottom: 10px;
}

.movement-notes p {
  margin: 0.35rem 0 0;
  font-size: 14px;
}

.movement-internal-notes {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
}

.movement-internal-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.movement-internal-item + .movement-internal-item {
  margin-top: 0.75rem;
}

.movement-internal-item span {
  font-size: 0.85rem;
  font-weight: 600;
}

.movement-internal-item p {
  margin: 0.2rem 0 0;
}

/* ==================== RESPONSIVE NAVIGATION ==================== */

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
  flex: 1;
  min-width: 0;
}

.main-nav .brand {
  margin-right: 0;
}

.mobile-nav-toggle,
.mobile-nav-button {
  display: none;
}
@media (max-width: 1000px) {
  /* Detail pages: stack large information cards before they get cramped */

  .vehicle-primary-grid,
  .vehicle-secondary-grid,
  .contract-parties-grid,
  .invoice-details-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 800px) {
  .main-nav {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 12px;
    min-height: 64px;
    padding: 10px 18px;
  }

  .main-nav .brand {
    width: auto;
    margin: 0;
    flex: 0 0 auto;
    font-size: 26px;
  }

  .mobile-nav-toggle {
    display: none;
  }

  .mobile-nav-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    margin-left: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: var(--text-secondary);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    user-select: none;
    flex-direction: column;
    gap: 4px;
  }
  .mobile-nav-button span {
    display: block;
    width: 20px;
    height: 2px;
    border-radius: 2px;
    background: var(--primary);
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    width: 100%;
    padding: 8px 18px 16px;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 8px 20px rgba(16, 24, 40, 0.08);
  }

  .mobile-nav-toggle:checked ~ .nav-links {
    display: flex;
  }

  .nav-links > a {
    display: block;
    width: 100%;
    padding: 11px 4px;
    border-bottom: 1px solid var(--border);
  }

  .nav-links .nav-spacer {
    display: none;
  }

  .nav-links .tenant-name {
    margin: 0;
    padding: 14px 4px 6px;
    font-size: 13px;
  }

  .nav-links .logout-form {
    width: 100%;
  }

  .nav-links .nav-button {
    width: 100%;
    padding: 11px 4px;
    text-align: left;
  }

  main {
    width: 100%;
    max-width: none;
    margin: 24px auto 40px;
    padding: 0 14px;
  }
}

/* ==================== ACTIONS MENU ==================== */

.actions-menu {
  position: relative;
}

.actions-menu > summary {
  list-style: none;
  cursor: pointer;
}

.actions-menu > summary::-webkit-details-marker {
  display: none;
}

.actions-menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 50;
  min-width: 190px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(20, 33, 61, 0.12);
}

.actions-menu-dropdown a,
.actions-menu-dropdown button {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  border-radius: 7px;
  color: inherit;
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.actions-menu-dropdown a:hover,
.actions-menu-dropdown button:hover {
  background: var(--surface-soft);
}

.actions-menu-dropdown form {
  margin: 0;
}

.actions-menu-dropdown .danger-link {
  color: var(--danger);
}

.movement-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: 100%;
}

.movement-date {
  display: block;
  margin-top: 3px;
  font-size: 13px;
  white-space: nowrap;
  font-weight: 500;
  color: var(--text-muted);
}

.movement-actions {
  margin-top: 12px;
  text-align: right;
}

.movement-pdf-link {
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.movement-inline-pdf {
  margin-left: 4px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}

.movement-inline-link {
  margin-left: 5px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}

.movement-inline-link:hover {
  text-decoration: underline;
}

/* ==================== OWNER DOCUMENT ==================== */

.owner-document-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.owner-document-row > div:first-child {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.owner-document-placeholder {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 150px;
  padding: 10px 14px;
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
  border: 1px solid var(--border);
  background: var(--surface-soft);
}

a.owner-document-placeholder:hover {
  background: var(--surface-soft);
  border-color: var(--accent);
}

.owner-document-placeholder.empty {
  color: var(--text-muted);
}

.owner-document-icon {
  font-size: 20px;
  line-height: 1;
}

.owner-notes {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.owner-notes p {
  margin-bottom: 0;
}

@media (max-width: 700px) {
  .owner-document-row {
    align-items: stretch;
    flex-direction: column;
  }

  .owner-document-placeholder {
    width: 100%;
  }
}

.vehicle-filter-form,
.contract-filter-form,
.invoice-filter-form {
  grid-template-columns: minmax(240px, 2fr) minmax(0, 3fr);
}

.vehicle-filter-options,
.contract-filter-options {
  display: grid;
  grid-template-columns:
    minmax(120px, 0.8fr)
    minmax(140px, 1fr)
    minmax(160px, 1fr)
    auto;
  align-items: end;
  gap: 12px;
}

.invoice-filter-options {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto;
  align-items: end;
  gap: 12px;
}

.filter-toggle-input,
.filter-toggle-button {
  display: none;
}

@media (max-width: 700px) {
  .vehicle-filter-form,
  .contract-filter-form,
  .invoice-filter-form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .vehicle-filter-form .filter-search,
  .contract-filter-form .filter-search,
  .invoice-filter-form .filter-search {
    grid-column: auto;
  }

  .vehicle-filter-form .filter-toggle-input,
  .contract-filter-form .filter-toggle-input,
  .invoice-filter-form .filter-toggle-input {
    display: none;
  }

  .vehicle-filter-form .filter-toggle-button,
  .contract-filter-form .filter-toggle-button,
  .invoice-filter-form .filter-toggle-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font-weight: 600;
    cursor: pointer;
  }

  .vehicle-filter-options,
  .contract-filter-options,
  .invoice-filter-options {
    display: none;
  }

  .filter-toggle-input:checked
    + .filter-toggle-button
    + .vehicle-filter-options,
  .filter-toggle-input:checked
    + .filter-toggle-button
    + .contract-filter-options,
  .filter-toggle-input:checked
    + .filter-toggle-button
    + .invoice-filter-options {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .filter-toggle-caret {
    transition: transform 0.15s ease;
  }

  .filter-toggle-input:checked + .filter-toggle-button .filter-toggle-caret {
    transform: rotate(180deg);
  }

  .vehicle-filter-options .filter-actions,
  .contract-filter-options .filter-actions,
  .invoice-filter-options .filter-actions {
    grid-column: auto;
  }
}
