/* DWC Vendor Portal — mobile-first, high-contrast, no animations */
:root {
  --dwc-blue: #004B91;
  --dwc-blue-dark: #003666;
  --dwc-orange: #F47C27;
  --dwc-orange-dark: #d8651a;
  --ink: #1a1a1a;
  --ink-soft: #4a4a4a;
  --line: #d8dde3;
  --bg: #f3f5f8;
  --card-bg: #ffffff;
  --urgent: #c0271a;
  --high: #e07215;
  --medium: #2a6dd1;
  --low: #6b7280;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  font-size: 17px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

a { color: var(--dwc-blue); text-decoration: underline; }
a:active { color: var(--dwc-blue-dark); }

/* ---------- LOGIN ---------- */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: var(--dwc-blue);
}

.login-card {
  background: var(--card-bg);
  width: 100%;
  max-width: 420px;
  padding: 2rem 1.5rem;
  border-radius: 14px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.18);
}

.login-card h1 {
  margin: 1rem 0 0.25rem;
  font-size: 1.5rem;
}

.login-card label {
  display: block;
  font-weight: 600;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
}

.login-card input[type="password"] {
  width: 100%;
  font-size: 1.125rem;
  padding: 0.85rem 1rem;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.login-card input[type="password"]:focus {
  outline: none;
  border-color: var(--dwc-blue);
}

.btn-primary {
  display: block;
  width: 100%;
  margin-top: 1.25rem;
  padding: 0.9rem 1rem;
  font-size: 1.0625rem;
  font-weight: 700;
  background: var(--dwc-blue);
  color: #fff;
  border: none;
  border-radius: 10px;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  min-height: 50px;
}

.btn-primary:active { background: var(--dwc-blue-dark); }

.error {
  background: #fde8e6;
  color: #8b1a10;
  border-left: 4px solid var(--urgent);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-top: 1rem;
}

/* ---------- BRAND ---------- */
.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--dwc-blue);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  font-size: 1rem;
}

.brand-mark.small { padding: 0.2rem 0.45rem; font-size: 0.85rem; }

.brand-name {
  font-weight: 700;
  color: var(--ink);
}

/* ---------- TOPBAR ---------- */
.topbar {
  background: var(--dwc-blue);
  color: #fff;
  padding: 1rem 1rem 1.25rem;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar .brand-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  opacity: 0.95;
}

.topbar .brand-row .brand-name { color: #fff; font-weight: 500; }
.topbar .brand-row .brand-mark { background: #fff; color: var(--dwc-blue); }

.topbar h1 {
  margin: 0.5rem 0 0.5rem;
  font-size: 1.25rem;
  color: #fff;
  font-weight: 700;
}

.meta-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.875rem;
  color: rgba(255,255,255,0.92);
}

.meta { white-space: nowrap; }

.refresh-btn {
  margin-left: auto;
  background: rgba(255,255,255,0.18);
  color: #fff;
  text-decoration: none;
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
}

.refresh-btn:active { background: rgba(255,255,255,0.32); }

/* ---------- CARDS ---------- */
.cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  padding: 1rem;
  max-width: 1100px;
  margin: 0 auto;
}

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

.card {
  background: var(--card-bg);
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 1rem 1.1rem 1.25rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.card-closed {
  opacity: 0.65;
  background: #f6f7f9;
}

.card-header {
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.75rem;
  margin-bottom: 0.75rem;
}

.address {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  margin-bottom: 0.5rem;
  line-height: 1.25;
}

.address:active { color: var(--dwc-blue); }

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid transparent;
}

.badge-wo { background: #eef2f7; color: var(--ink-soft); }
.badge-priority { color: #fff; }
.badge-urgent { background: var(--urgent); }
.badge-high { background: var(--high); }
.badge-medium { background: var(--medium); }
.badge-low { background: var(--low); }
.badge-closed { background: #1f7a3a; color: #fff; }

.section {
  margin-top: 0.85rem;
}

.section h3 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  margin: 0 0 0.4rem;
  font-weight: 700;
}

.section .label {
  font-weight: 600;
  color: var(--ink-soft);
}

.description { margin: 0; }

.tenant {
  margin-bottom: 0.6rem;
}

.tenant:last-child { margin-bottom: 0; }

.tenant-name { font-weight: 600; }

.tap-link {
  display: inline-block;
  margin-top: 0.25rem;
  margin-right: 0.75rem;
  background: #eef2f7;
  color: var(--dwc-blue);
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  text-decoration: none;
  min-height: 40px;
  line-height: 1.3;
  font-weight: 600;
}

.tap-link:active { background: #dde4ee; }

.muted { color: var(--ink-soft); font-style: italic; }

/* ---------- CTA (the big mailto button) ---------- */
.cta {
  display: block;
  margin-top: 1.1rem;
  padding: 1rem;
  background: var(--dwc-orange);
  color: #fff;
  font-weight: 800;
  font-size: 1.05rem;
  text-align: center;
  text-decoration: none;
  border-radius: 12px;
  min-height: 56px;
  line-height: 1.4;
  box-shadow: 0 2px 0 var(--dwc-orange-dark);
}

.cta:active {
  background: var(--dwc-orange-dark);
  color: #fff;
  transform: translateY(1px);
  box-shadow: 0 1px 0 var(--dwc-orange-dark);
}

/* ---------- EMPTY / FOOTER ---------- */
.empty {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 2rem 1rem;
  text-align: center;
  font-size: 1.1rem;
  grid-column: 1 / -1;
}

.empty p { margin: 0.25rem 0; }

.footer {
  padding: 1rem;
  text-align: center;
}

.subtle { color: var(--ink-soft); }
.small { font-size: 0.875rem; }

/* ---------- INVOICE: secondary CTA, form, banners ---------- */

/* Card CTAs: always stacked, full-width, identical metrics — only color differs. */
.cta-row {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 1.1rem;
}
.cta-row .cta { margin-top: 0; }

.cta-invoice {
  display: block;
  margin: 0;
  padding: 1rem;
  background: var(--dwc-blue);
  color: #fff;
  font-weight: 800;
  font-size: 1.05rem;
  text-align: center;
  text-decoration: none;
  border-radius: 12px;
  min-height: 56px;
  line-height: 1.4;
  box-shadow: 0 2px 0 var(--dwc-blue-dark);
}
.cta-invoice:active {
  background: var(--dwc-blue-dark);
  color: #fff;
  transform: translateY(1px);
  box-shadow: 0 1px 0 var(--dwc-blue-dark);
}

/* ----- Form page layout ----- */

.invoice-context {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-left: 4px solid var(--dwc-blue);
}
.invoice-context .card-header { padding-bottom: 0.5rem; }
.invoice-context .description {
  margin: 0.4rem 0 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.5;
}

.invoice-form {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.5rem 1.25rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-top: 1rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
@media (min-width: 640px) {
  .invoice-form { padding: 1.75rem 1.75rem 2rem; }
}

.invoice-form .form-section-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  margin: 0;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--line);
}

.invoice-form .field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.invoice-form .field-label {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink);
}
.invoice-form .field-help {
  font-size: 0.84rem;
  color: var(--ink-soft);
  line-height: 1.45;
}

.invoice-form input[type="text"],
.invoice-form input[type="number"],
.invoice-form input[type="date"],
.invoice-form textarea {
  width: 100%;
  padding: 0.75rem 0.85rem;
  font-size: 1rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.invoice-form input[type="text"]:hover,
.invoice-form input[type="number"]:hover,
.invoice-form input[type="date"]:hover,
.invoice-form textarea:hover {
  border-color: #b8c2cf;
}
.invoice-form input[type="text"]:focus,
.invoice-form input[type="number"]:focus,
.invoice-form input[type="date"]:focus,
.invoice-form textarea:focus {
  outline: none;
  border-color: var(--dwc-blue);
  box-shadow: 0 0 0 3px rgba(0, 75, 145, 0.15);
}

/* Side-by-side dates */
.invoice-form .field-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}
@media (min-width: 540px) {
  .invoice-form .field-row { grid-template-columns: 1fr 1fr; gap: 1rem; }
}

/* Money input with leading "$" */
.input-money {
  position: relative;
}
.input-money::before {
  content: "$";
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-soft);
  font-weight: 700;
  pointer-events: none;
  font-size: 1rem;
}
.input-money input[type="number"] {
  padding-left: 1.85rem;
  font-variant-numeric: tabular-nums;
}

/* Scope of Work — the hero textarea */
.field-scope textarea {
  min-height: 160px;
  font-size: 1.02rem;
  line-height: 1.55;
  padding: 0.95rem 1rem;
  background: #fbfcfe;
  resize: vertical;
}
.field-scope textarea::placeholder {
  color: #9aa3b1;
  font-style: italic;
}
.field-scope .scope-foot {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--ink-soft);
  margin-top: -0.05rem;
}
.field-scope .scope-counter.over { color: var(--urgent); font-weight: 700; }

/* File input — styled wrapper */
.input-file {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  border: 1.5px dashed #cdd5e0;
  border-radius: 10px;
  background: #fafbfd;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.input-file:hover { border-color: var(--dwc-blue); background: #f5f8fc; }
.input-file input[type="file"] {
  flex: 1;
  font-size: 0.95rem;
  padding: 0;
  border: 0;
  background: transparent;
}
.input-file input[type="file"]::file-selector-button {
  font-family: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.4rem 0.8rem;
  margin-right: 0.7rem;
  border: 1px solid var(--dwc-blue);
  background: #fff;
  color: var(--dwc-blue);
  border-radius: 6px;
  cursor: pointer;
}
.input-file input[type="file"]::file-selector-button:hover {
  background: var(--dwc-blue);
  color: #fff;
}
.input-file .file-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  color: var(--ink-soft);
}

/* Submit button — substantial, confident */
.btn-orange {
  background: var(--dwc-orange);
  border: none;
  color: #fff;
  font-weight: 800;
  font-size: 1.05rem;
  padding: 1rem;
  border-radius: 12px;
  cursor: pointer;
  min-height: 56px;
  box-shadow: 0 2px 0 var(--dwc-orange-dark);
  margin-top: 0.4rem;
  transition: background 0.12s ease;
}
.btn-orange:hover { background: #e8741f; }
.btn-orange:active {
  background: var(--dwc-orange-dark);
  transform: translateY(1px);
  box-shadow: 0 1px 0 var(--dwc-orange-dark);
}

.invoice-form .submit-note {
  text-align: center;
  margin-top: -0.25rem;
}

.banner-success, .banner-warn, .banner-error {
  border-radius: 12px;
  padding: 1.5rem 1.25rem;
  border: 1px solid;
}
.banner-success {
  background: #ecf6ee;
  border-color: #b8dcc1;
}
.banner-success .banner-title {
  color: #1f6c3a;
  margin: 0 0 0.5rem;
}
.banner-warn {
  background: #fff7e6;
  border-color: #f3d68a;
}
.banner-warn .banner-title {
  color: #8a5b00;
  margin: 0 0 0.5rem;
}
.banner-error {
  background: #fde8e6;
  border-color: #f3b9b1;
  color: #8b1a10;
  padding: 0.85rem 1rem;
  margin-bottom: 0.5rem;
}
.banner-error p { margin: 0.2rem 0; font-size: 0.95rem; }

.kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.35rem 1rem;
  margin: 1rem 0;
  font-size: 0.95rem;
}
.kv dt { color: var(--ink-soft); }
.kv dd { margin: 0; font-weight: 600; }
