:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #d1d5db;
  --primary: #0f766e;
  --primary-hover: #115e59;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(180deg, #eef2ff 0%, var(--bg) 100%);
  color: var(--text);
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.form-card {
  width: 100%;
  max-width: 640px;
  background: var(--panel);
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.brand-lockup {
  display: flex;
  justify-content: center;
  margin-bottom: 18px;
}

.brand-logo {
  display: block;
  width: min(100%, 220px);
  height: auto;
}

h1 {
  margin: 0 0 8px;
  font-size: 1.5rem;
  text-align: center;
}

p {
  margin: 0 0 20px;
  color: var(--muted);
  text-align: center;
}

form {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 6px;
}

label {
  font-weight: 600;
}

input,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  background: #fff;
}

input:focus,
select:focus {
  outline: 2px solid #99f6e4;
  outline-offset: 1px;
  border-color: var(--primary);
}

input:disabled,
select:disabled {
  background: #f3f4f6;
  color: var(--muted);
  cursor: not-allowed;
}

input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.hint {
  color: var(--muted);
  font-size: 0.875rem;
}

.sales-tax-message {
  margin: 0;
  text-align: left;
  line-height: 1.4;
}

.sales-tax-message a {
  color: var(--primary);
  font-weight: 600;
}

.invoice-total {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f8fafc;
  color: var(--text);
  font-weight: 700;
  text-align: left;
}

.upload-zone {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 120px;
  padding: 24px;
  border: 2px dashed var(--border);
  border-radius: 10px;
  background: #f8fafc;
  text-align: center;
  cursor: pointer;
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.upload-zone:hover,
.upload-zone:focus-within,
.upload-zone.is-drag-over {
  border-color: var(--primary);
  background: #f0fdfa;
}

.upload-zone.is-drag-over {
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.14);
  transform: translateY(-1px);
}

.upload-zone:focus-within {
  outline: 2px solid #99f6e4;
  outline-offset: 2px;
}

.upload-zone-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 1;
}

.upload-zone-content {
  display: grid;
  gap: 6px;
  pointer-events: none;
}

.upload-zone-filename {
  color: var(--muted);
  font-size: 0.875rem;
  overflow-wrap: anywhere;
}

.required {
  color: #b91c1c;
}

button,
.button-link {
  display: inline-block;
  margin-top: 6px;
  border: 0;
  border-radius: 8px;
  padding: 11px 14px;
  font: inherit;
  font-weight: 600;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
}

button:hover,
.button-link:hover {
  background: var(--primary-hover);
}

button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.submit-status {
  min-height: 1.25em;
  margin: 0;
  text-align: center;
}

#retrySubmitButton {
  justify-self: center;
  padding: 8px 10px;
  font-size: 0.9rem;
}

.button-link {
  display: table;
  margin-left: auto;
  margin-right: auto;
}

.field-help {
  width: min(100%, 360px);
  margin: 4px 0 0;
  padding: 10px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #f8fafc;
}

.field-help-trigger {
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}

.field-help-trigger:focus-visible {
  outline: 2px solid #99f6e4;
  outline-offset: 4px;
  border-radius: 10px;
}

.field-help-image {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.field-help-caption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.4;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.55);
  z-index: 1000;
}

.modal[hidden] {
  display: none;
}

.modal-content {
  width: min(100%, 720px);
  max-height: 90vh;
  overflow: auto;
  background: var(--panel);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.2);
}

.modal-content-image {
  width: min(100%, 920px);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.modal-title {
  margin: 0;
  font-size: 1.1rem;
}

.modal-close {
  margin-top: 0;
  background: #e5e7eb;
  color: var(--text);
}

.modal-close:hover {
  background: #d1d5db;
}

.modal-image {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}
