* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: #f4f6f8;
  color: #1f2933;
  overflow-x: hidden;
}

.app-header {
  background: #1f2933;
  color: white;
  padding: 28px 20px;
}

.page-header {
  display: grid;
  gap: 18px;
}

.app-header h1 {
  margin: 0 0 8px;
  font-size: clamp(26px, 5vw, 36px);
  line-height: 1.15;
}

.app-header p {
  margin: 0;
  max-width: 900px;
  line-height: 1.5;
  color: #d8dee9;
}

.app-link {
  color: #1d4ed8;
  font-weight: 700;
  text-decoration: none;
}

.app-link:hover,
.app-link:focus {
  text-decoration: underline;
  outline: 3px solid rgba(37, 99, 235, 0.2);
  outline-offset: 3px;
}

.header-link {
  color: #ffffff;
  justify-self: start;
}

.container {
  width: min(1100px, 92%);
  margin: 24px auto 40px;
}

.section-heading {
  margin: 0 0 14px;
}

.section-heading h2 {
  margin: 0 0 6px;
  font-size: 22px;
  color: #102a43;
}

.section-heading p {
  margin: 0;
  color: #52606d;
  line-height: 1.5;
}

.quick-actions,
.supplier-snapshot,
.records-section,
.form-section {
  margin-bottom: 24px;
}

.dashboard-grid + .supplier-snapshot {
  margin-top: 32px;
}

.dashboard-summary {
  margin-bottom: 24px;
}

.future-modules {
  margin-top: 24px;
}

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

.action-card {
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 14px 16px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  color: #102a43;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.05);
}

.action-card:focus,
.action-card:hover {
  border-color: #2563eb;
  outline: 3px solid rgba(37, 99, 235, 0.16);
}

.dashboard-grid,
.supplier-list,
.record-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.card {
  background: white;
  border: 1px solid #d9e2ec;
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
  min-height: 120px;
}

.coming-soon-card {
  background: #f8fafc;
  border-style: dashed;
  box-shadow: none;
}

.coming-soon-card h2 {
  color: #334e68;
}

.coming-soon-card p {
  color: #627d98;
}

.card-link {
  color: inherit;
  display: block;
  text-decoration: none;
}

.card-link:focus,
.card-link:hover {
  border-color: #2563eb;
  outline: 3px solid rgba(37, 99, 235, 0.16);
}

.card h2 {
  margin: 0 0 10px;
  font-size: 20px;
  color: #102a43;
}

.summary-card {
  display: grid;
  gap: 8px;
}

.summary-card h2 {
  margin-bottom: 0;
  font-size: 18px;
}

.summary-value {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  line-height: 1.1;
  color: #102a43;
}

.summary-note {
  margin: 0;
  color: #52606d;
  line-height: 1.5;
}

.card p {
  margin: 0;
  color: #52606d;
  line-height: 1.5;
}

.app-form {
  background: #ffffff;
  border: 1px solid #d9e2ec;
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

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

.form-field span {
  color: #334e68;
  font-size: 14px;
  font-weight: 700;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid #bcccdc;
  border-radius: 8px;
  padding: 12px;
  color: #102a43;
  font: inherit;
  background: #ffffff;
}

.form-field textarea {
  min-height: 108px;
  resize: vertical;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: #2563eb;
  outline: 3px solid rgba(37, 99, 235, 0.16);
}

.form-field input[readonly] {
  background: #f8fafc;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 18px;
}

.button {
  min-height: 50px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 12px 16px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.button-small {
  min-height: 40px;
  padding: 9px 14px;
}

.button-primary {
  background: #1d4ed8;
  color: #ffffff;
}

.button-secondary {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #102a43;
}

.button:focus,
.button:hover {
  outline: 3px solid rgba(37, 99, 235, 0.16);
}

.form-message {
  border-radius: 8px;
  margin-bottom: 14px;
  padding: 12px 14px;
  font-weight: 700;
  line-height: 1.4;
}

.form-message.success {
  background: #ecfdf3;
  border: 1px solid #bbf7d0;
  color: #166534;
}

.form-message.error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.filter-help {
  margin: 12px 0 0;
  color: #52606d;
  line-height: 1.5;
  font-size: 14px;
}

.empty-state {
  background: #ffffff;
  border: 1px dashed #bcccdc;
  border-radius: 8px;
  color: #52606d;
  grid-column: 1 / -1;
  line-height: 1.5;
  padding: 20px;
  text-align: center;
}

.card-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.supplier-card,
.record-card {
  background: #ffffff;
  border: 1px solid #d9e2ec;
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

.contractor-balance-card {
  display: grid;
  gap: 16px;
}

.contractor-balance-card .finance-list {
  margin-bottom: 0;
}

.contractor-scope-breakdown {
  display: grid;
  gap: 12px;
}

.contractor-scope-breakdown-heading {
  margin: 2px 0 0;
  font-size: 16px;
  color: #334e68;
}

.contractor-scope-breakdown-note {
  margin: 0;
  color: #52606d;
  line-height: 1.5;
  font-size: 14px;
}

.contractor-scope-stack {
  display: grid;
  gap: 12px;
}

.contractor-scope-card {
  background: #f8fafc;
  border-color: #cbd5e1;
  box-shadow: none;
}

.contractor-scope-card.excluded {
  opacity: 0.82;
}

.contractor-scope-card h4 {
  margin: 0;
  font-size: 17px;
  color: #102a43;
}

.supplier-card-header,
.record-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.supplier-card h3,
.record-card h3 {
  margin: 0;
  font-size: 19px;
  color: #102a43;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.status-partial {
  background: #fef3c7;
  color: #92400e;
}

.status-pending {
  background: #fee2e2;
  color: #991b1b;
}

.status-paid {
  background: #dcfce7;
  color: #166534;
}

.status-overpaid {
  background: #dbeafe;
  color: #1e40af;
}

.status-cancelled {
  background: #e5e7eb;
  color: #374151;
}

.status-active {
  background: #dcfce7;
  color: #166534;
}

.status-paused {
  background: #fef3c7;
  color: #92400e;
}

.status-completed {
  background: #dbeafe;
  color: #1e40af;
}

.status-inactive {
  background: #e5e7eb;
  color: #374151;
}

.status-disputed {
  background: #fee2e2;
  color: #991b1b;
}

.finance-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.finance-list div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #edf2f7;
}

.finance-list div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.finance-list dt {
  color: #52606d;
  font-size: 14px;
}

.finance-list dd {
  margin: 0;
  color: #102a43;
  font-size: 15px;
  font-weight: 700;
  text-align: right;
}

.notice {
  margin-top: 28px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  padding: 18px;
}

.notice h2 {
  margin: 0 0 10px;
  color: #7c2d12;
}

.notice p {
  margin: 0;
  line-height: 1.6;
  color: #7c2d12;
}

@media (min-width: 560px) {
  .quick-actions-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .supplier-list,
  .record-list {
    grid-template-columns: repeat(2, 1fr);
  }

  .button-row {
    grid-template-columns: repeat(2, minmax(0, 180px));
  }
}

@media (min-width: 760px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .form-field-full {
    grid-column: 1 / -1;
  }
}

@media (min-width: 980px) {
  .dashboard-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .quick-actions-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 640px) {
  .app-header {
    padding: 24px 16px;
  }

  .app-header p {
    font-size: 14px;
  }

  .container {
    width: min(100% - 28px, 1100px);
    margin: 20px auto;
  }

  .card {
    padding: 18px;
    min-height: auto;
  }

  .card h2 {
    font-size: 18px;
  }

  .card p {
    font-size: 14px;
  }

  .notice {
    padding: 18px;
  }

  .notice h2 {
    font-size: 18px;
  }

  .notice p {
    font-size: 14px;
  }

  .finance-list div {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .finance-list dd {
    text-align: left;
  }
}
