:root {
  color-scheme: light;
  font-family: 'DM Sans', 'Segoe UI', sans-serif;
  color: #1d1d1d;
  background: #edf9f0;
  --green: #2d7a4a;
  --green-dark: #123d32;
  --green-light: #edf9f0;
  --border: #d4ecdc;
  --muted: #606b65;
}

* { box-sizing: border-box; }
body { min-width: 320px; margin: 0; padding: 24px; background: #edf9f0; }
.portal-login-locked,
.portal-login-locked body { background: #fff; }
.location-submissions-page,
.location-submissions-page body { background: #fff; }
.location-submissions-page { --green-light: #fff; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.login-view {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  min-height: 100vh;
  padding: 24px;
  overflow: auto;
  place-items: center;
  isolation: isolate;
  background: url('login-background.jpg') center / cover no-repeat;
}
.login-view::before,
.login-view::after {
  position: absolute;
  inset: 0;
  z-index: -1;
  content: '';
  pointer-events: none;
  background-repeat: no-repeat;
}
.login-view::before {
  opacity: .8;
  background-image:
    radial-gradient(circle at 8% 18%, rgba(120, 184, 144, .06) 0 30px, rgba(120, 184, 144, .2) 31px 34px, transparent 35px),
    radial-gradient(circle at 90% 22%, rgba(120, 184, 144, .03) 0 46px, rgba(120, 184, 144, .18) 47px 50px, transparent 51px),
    radial-gradient(circle at 16% 78%, rgba(120, 184, 144, .05) 0 24px, rgba(120, 184, 144, .16) 25px 27px, transparent 28px);
}
.login-view::after {
  opacity: .72;
  background-image:
    radial-gradient(circle at 82% 76%, rgba(120, 184, 144, .05) 0 34px, rgba(120, 184, 144, .17) 35px 38px, transparent 39px),
    radial-gradient(circle at 30% 42%, rgba(120, 184, 144, .03) 0 13px, rgba(120, 184, 144, .14) 14px 16px, transparent 17px),
    radial-gradient(circle at 70% 46%, rgba(120, 184, 144, .10) 0 9px, transparent 11px);
}
.login-card { position: relative; z-index: 1; width: min(440px, 100%); padding: 36px; border: 1px solid var(--border); border-radius: 18px; background: #fff; box-shadow: 0 12px 36px rgba(23, 86, 65, .12); }
.login-logo { display: block; width: 150px; height: auto; margin: 0 auto 24px; object-fit: contain; }
.login-card h1 { margin: 0 0 8px; color: var(--green-dark); font-size: 24px; text-align: center; }
.login-card > p { margin: 0 0 24px; color: var(--muted); text-align: center; }
.login-card form { display: grid; gap: 10px; }
.login-card label { margin-top: 6px; font-size: 14px; font-weight: 700; }
.login-card input { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; }
.primary-button, .secondary-button, .text-button { min-height: 40px; padding: 8px 14px; border-radius: 8px; font-weight: 700; }
.primary-button { border: 1px solid var(--green); background: var(--green); color: #fff; }
.primary-button:hover { background: #24633d; }
.secondary-button { border: 1px solid #8bd8a5; background: #edf9f0; color: var(--green); }
.secondary-button:hover { background: #e6f8eb; }
.text-button { border: 0; background: transparent; color: var(--green); }
.text-button:hover { text-decoration: underline; }
.login-message { min-height: 20px; margin: 0; color: #a3332d; font-size: 13px; }

.table-view { width: min(1600px, 100%); margin: 0 auto; }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.page-header h1 { margin: 0 0 4px; color: var(--green-dark); font-size: clamp(24px, 4vw, 32px); }
.page-header p { margin: 0; color: var(--muted); }
.table-card { padding: 20px; border: 1px solid var(--border); border-radius: 16px; background: #fff; box-shadow: 0 4px 12px rgba(23, 86, 65, .08); }
.toolbar { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(220px, 320px) auto; align-items: center; gap: 10px; margin-bottom: 16px; }
.toolbar input, .toolbar textarea { width: 100%; min-width: 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; }
.toolbar input { height: 44px; }
.toolbar textarea { resize: vertical; }
.toolbar textarea { height: 52px; min-height: 52px; }
.toolbar .secondary-button { height: 44px; min-height: 44px; }
.filter-controls { display: flex; flex-wrap: wrap; gap: 8px; margin: -4px 0 16px; }
.filter-controls select { flex: 0 1 190px; width: 190px; min-width: 0; min-height: 38px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: #fff; color: inherit; font-size: 12px; }
.top-scroll { height: 17px; margin-bottom: 4px; overflow-x: auto; overflow-y: hidden; border: 1px solid var(--border); border-radius: 8px; background: #f7fbf8; }
.top-scroll > div { height: 1px; }
.top-scroll:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.table-scroll { max-height: 62vh; overflow: auto; border: 1px solid var(--border); border-radius: 8px; }
.table-end-action { display: flex; justify-content: flex-end; margin-top: 8px; }
table { width: max-content; min-width: 2250px; table-layout: auto; border-collapse: collapse; font-size: 11px; }
table.location-submissions-table { min-width: 1350px; }
table.location-submissions-table th:nth-child(1), table.location-submissions-table td:nth-child(1) { width: 36px; }
table.location-submissions-table th:nth-child(2), table.location-submissions-table td:nth-child(2) { width: 200px; min-width: 200px; }
table.location-submissions-table th:nth-child(3), table.location-submissions-table td:nth-child(3),
table.location-submissions-table th:nth-child(4), table.location-submissions-table td:nth-child(4) { width: 180px; }
table.location-submissions-table th:nth-child(5), table.location-submissions-table td:nth-child(5) { width: 190px; }
table.location-submissions-table th:nth-child(6), table.location-submissions-table td:nth-child(6) { width: 105px; }
table.location-submissions-table th:nth-child(7), table.location-submissions-table td:nth-child(7) { width: 145px; }
table.location-submissions-table th:nth-child(8), table.location-submissions-table td:nth-child(8) { width: 150px; }
table.location-submissions-table th:nth-child(9), table.location-submissions-table td:nth-child(9) { width: 125px; }
.location-submissions-page .table-card { padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.location-submissions-page .filter-controls,
.location-submissions-page .top-scroll,
.location-submissions-page .table-end-action { display: none; }
.location-submissions-page .table-scroll { max-height: none; overflow-x: auto; overflow-y: hidden; border: 0; border-radius: 0; }
table.location-submissions-table { width: 100%; min-width: 1350px; }
th, td { padding: 7px 6px; border: 1px solid var(--border); text-align: center; vertical-align: middle; white-space: nowrap; overflow-wrap: normal; word-break: normal; }
th { position: sticky; top: 0; z-index: 1; background: var(--green-light); }
th:nth-child(1), td:nth-child(1) { width: 48px; }
th:nth-child(2), td:nth-child(2) { width: 36px; }
th:nth-child(3), td:nth-child(3) { width: 180px; min-width: 180px; }
th:nth-child(4), td:nth-child(4),
th:nth-child(5), td:nth-child(5) { width: 180px; }
td:nth-child(4), td:nth-child(5), td:nth-child(6) { white-space: nowrap; }
th:nth-child(6), td:nth-child(6) { width: 210px; }
th:nth-child(7), td:nth-child(7) { width: 140px; }
th:nth-child(8), td:nth-child(8) { width: 75px; }
th:nth-child(9), td:nth-child(9) { width: 105px; }
th:nth-child(10), td:nth-child(10) { width: 145px; }
th:nth-child(11), td:nth-child(11) { width: 150px; }
th:nth-child(12), td:nth-child(12) { width: 120px; }
th:nth-child(13), td:nth-child(13) { width: 160px; }
th:nth-child(14), td:nth-child(14) { width: 125px; }
th:nth-child(15), td:nth-child(15) { width: 85px; }
th:nth-child(16), td:nth-child(16),
th:nth-child(18), td:nth-child(18) { width: 190px; }
th:nth-child(17), td:nth-child(17),
th:nth-child(19), td:nth-child(19) { width: 90px; text-align: center; }
th:nth-child(17), th:nth-child(19) { white-space: normal; }
td:nth-child(16), td:nth-child(18) {
  white-space: pre;
  text-align: left;
  vertical-align: top;
}
th:nth-child(20), td:nth-child(20) { width: 120px; text-align: center; }
th:nth-child(21), td:nth-child(21) { width: 360px; min-width: 360px; text-align: left; white-space: normal; overflow-wrap: anywhere; }
th:nth-child(22), td:nth-child(22) { width: 100px; }
th:nth-child(23), td:nth-child(23) { width: 130px; }
th:nth-child(24), td:nth-child(24) { width: 80px; }
.record-select { width: 17px; height: 17px; accent-color: #d9534f; }
.download-button { min-height: 26px; padding: 4px 7px; border: 1px solid var(--green); border-radius: 5px; background: var(--green); color: white; font-size: 10px; font-weight: 700; white-space: nowrap; }
.send-email-button { min-height: 26px; padding: 4px 9px; border: 1px solid var(--green); border-radius: 5px; background: var(--green); color: white; font-size: 10px; font-weight: 700; white-space: nowrap; }
.send-email-button:disabled { cursor: default; opacity: .7; }
.table-pagination, .table-actions { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.table-pagination { justify-content: center; }
.table-actions { justify-content: flex-start; }
.table-actions input[type="date"] { min-height: 40px; padding: 7px 9px; border: 1px solid var(--border); border-radius: 8px; }
.delete-button { min-height: 40px; padding: 8px 14px; border: 1px solid #f1a4a4; border-radius: 8px; background: #fff4f4; color: #b94141; font-weight: 700; }
.delete-button:disabled { cursor: not-allowed; opacity: .55; }
.table-status { min-height: 20px; margin: 12px 0 0; color: var(--muted); font-size: 13px; }

@media (max-width: 700px) {
  body { padding: 12px; }
  .login-card { padding: 24px 18px; }
  .page-header { align-items: flex-start; }
  .page-header .secondary-button { flex: 0 0 auto; }
  .table-card { padding: 12px; }
  .toolbar { grid-template-columns: 1fr; }
  .toolbar .secondary-button { width: 100%; }
  .filter-controls select { flex-basis: 160px; }
  .table-actions { flex-wrap: wrap; }
  .table-actions label { flex-basis: auto; }
}

@media (max-width: 420px) {
  .filter-controls select { flex-basis: 100%; }
}
