:root {
  color-scheme: light;
  --bg: #f7fafc;
  --panel: #ffffff;
  --text: #0f172a;
  --muted: #475569;
  --border: #cbd5e1;
  --primary: #0f766e;
  --danger: #b91c1c;
  --warning: #b45309;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-size: 16px;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  line-height: 1.5;
}

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
}

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

.field-form,
.field-actions {
  display: grid;
  gap: 8px;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  align-items: center;
}

.field-form {
  margin-bottom: 12px;
}

.auth-login {
  grid-template-columns: 1fr;
}

.auth-login .sidebar,
.auth-login .topbar,
.auth-login .workspace-main,
.auth-login #taskFilterPanel,
.auth-login #taskActionPanel,
.auth-login #weatherPanel {
  display: none;
}

.auth-login .workspace-shell {
  display: grid;
  align-content: safe center;
  width: 100%;
  min-height: 100vh;
  margin-left: 0;
  padding: 12px;
}

.auth-login .workspace-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-content: center;
  justify-items: center;
  width: 100%;
}

.auth-login .workspace-aside {
  width: min(100%, 440px);
  justify-self: center;
}

.auth-login #loginPanel {
  margin: 0;
  padding: 18px;
  border-color: #99f6e4;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.12);
}

.auth-ready #loginPanel {
  display: none;
}

.login-card-head {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
}

.login-card-head h2 {
  font-size: 1.4rem;
}

.login-brand-lockup {
  margin-bottom: 2px;
}

.login-brand-lockup .brand-title {
  color: var(--text);
}

.login-brand-lockup .brand-subtitle {
  color: var(--muted);
}

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

.login-step {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  background: #f8fafc;
}

@media (max-width: 520px) {
  .login-flow {
    grid-template-columns: 1fr;
  }

  .auth-login .login-block {
    grid-template-columns: 1fr;
  }
}

.login-step.is-active {
  border-color: var(--primary);
  background: #ecfdf5;
}

.login-step.is-done {
  border-color: #94a3b8;
  background: #f1f5f9;
}

.step-number {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  font-weight: 800;
}

.login-step.is-active .step-number,
.login-step.is-done .step-number {
  background: var(--primary);
  color: #fff;
}

.step-title {
  font-weight: 800;
}

.step-caption {
  color: var(--muted);
  font-size: 0.86rem;
}

.login-block {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
}

.login-block > :is(.login-block-title, .company-confirmation, .status, .login-primary-action, .button-text) {
  grid-column: 1 / -1;
}

.login-block-title {
  margin-bottom: 10px;
  font-weight: 800;
}

.login-primary-action {
  width: 100%;
  min-height: 48px;
  margin-top: 4px;
}

.company-confirmation {
  border-left: 4px solid var(--primary);
  padding: 10px 12px;
  background: #ecfdf5;
  color: #14532d;
  font-weight: 800;
}

.button-text {
  justify-self: center;
  border-color: transparent;
  background: transparent;
  color: #475569;
  text-decoration: underline;
}

.field-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 12px;
}

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

.dashboard-card {
  display: grid;
  gap: 6px;
  min-height: 104px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--text);
  text-decoration: none;
}

.dashboard-card:hover {
  border-color: var(--primary);
  background: #ecfdf5;
}

.dashboard-card-title {
  font-weight: 800;
}

.dashboard-card-text {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.weather-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  margin: 12px 22px 0;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  background: #eff6ff;
}

.weather-strip-button {
  display: flex;
  align-items: center;
  gap: 18px;
  width: 100%;
  min-height: 46px;
  padding: 8px 52px 8px 14px;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

#weatherSummary {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.weather-pop,
.weather-day-pop {
  color: #075985;
  font-weight: 800;
}

.weather-stale {
  color: var(--warning);
}

.weather-strip-open {
  color: #075985;
  font-size: 0.88rem;
  white-space: nowrap;
}

.weather-refresh {
  position: static;
  grid-column: 2;
  grid-row: 1;
  margin: 7px 8px 0 0;
  width: 32px;
  height: 32px;
  border: 1px solid #93c5fd;
  border-radius: 4px;
  background: #fff;
  color: #075985;
  font-size: 1.15rem;
  cursor: pointer;
}

.weekly-weather {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(7, minmax(108px, 1fr));
  overflow-x: auto;
  border-top: 1px solid #bfdbfe;
}

.weekly-weather[hidden] {
  display: none;
}

.weather-day {
  display: grid;
  gap: 3px;
  min-width: 108px;
  padding: 10px 12px;
  border-right: 1px solid #dbeafe;
}

.dashboard-alerts {
  display: grid;
  gap: 6px;
}

.dashboard-alert {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(240px, 1.2fr);
  gap: 16px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #fde68a;
  border-radius: 5px;
  background: #fffbeb;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.dashboard-clear {
  padding: 10px 12px;
  color: var(--muted);
}

.task-field-group {
  border-top: 1px solid var(--border);
}

.task-field-group:first-child {
  border-top: 0;
}

.task-field-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 10px 6px;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.task-field-heading span {
  font-weight: 800;
}

.task-field-heading small,
.field-status-table small {
  display: block;
  color: var(--muted);
}

.task-row {
  display: grid;
  grid-template-columns: minmax(230px, 1fr) minmax(160px, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 9px 6px 9px 18px;
  border-top: 1px solid #e2e8f0;
}

.task-row-main {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.task-row-note {
  color: var(--muted);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.task-row > * {
  min-width: 0;
}

.status-pill {
  padding: 2px 7px;
  border-radius: 999px;
  background: #e2e8f0;
  font-size: 0.78rem;
}

.task-actions-compact {
  display: flex;
  gap: 5px;
}

.task-actions-compact .button {
  width: auto;
  min-height: 36px;
  padding: 6px 9px;
}

.field-status-table-wrap {
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
}

.field-status-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.field-status-table th,
.field-status-table td {
  padding: 9px 10px;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
  white-space: nowrap;
}

.field-status-table th {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.field-address-button {
  display: grid;
  gap: 2px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #0f766e;
  text-align: left;
  cursor: pointer;
}

.health-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  border: 1px solid rgba(15, 23, 42, 0.18);
  border-radius: 50%;
}

.dashboard-field-map {
  width: 100%;
  height: 260px;
}

.field-map-row td {
  padding: 8px 0 16px;
}

.management-workspace {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.management-wide,
.management-status {
  grid-column: 1 / -1;
}

.management-status:empty {
  display: none;
}

.quantity-row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(120px, 1fr);
  gap: 10px;
}

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

.management-workspace .field-form > .quantity-row {
  grid-column: 1 / -1;
}

.management-workspace .field-form > .button {
  justify-self: start;
  min-width: 180px;
}

.backup-restore-form {
  grid-template-columns: minmax(200px, 1fr) minmax(300px, 2fr);
}

.backup-restore-form .field-inline {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  gap: 10px;
}

.backup-restore-form .field-inline > span {
  flex: 0 0 auto;
}

.backup-restore-form input[type="checkbox"] {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  padding: 0;
}

#restoreBackupButton {
  justify-self: start;
  min-width: 180px;
}

.approval-list {
  display: grid;
  gap: 8px;
}

.approval-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #e2e8f0;
}

.approval-row > div:first-child {
  display: grid;
  gap: 3px;
}

.approval-actions {
  display: flex;
  gap: 6px;
}

.management-status {
  position: sticky;
  bottom: 12px;
  padding: 10px 14px;
  border: 1px solid #99f6e4;
  border-radius: 6px;
  background: #ecfdf5;
  color: #065f46;
}

@media (max-width: 800px) {
  .management-workspace,
  .approval-row {
    grid-template-columns: 1fr;
  }

  .management-workspace .field-form {
    grid-template-columns: 1fr;
  }

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

.eyebrow {
  margin: 0 0 4px;
  font-size: 0.875rem;
  color: var(--muted);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 1.5rem;
  line-height: 1.2;
}

.panel {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.field span,
.status,
.task-meta,
.note {
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  font: inherit;
  background: #fff;
  color: var(--text);
}

.field {
  min-width: 0;
}

input:disabled,
select:disabled,
textarea:disabled {
  background: #f1f5f9;
  color: #64748b;
  cursor: not-allowed;
}

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

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 16px;
  font: inherit;
  font-weight: 700;
}

.button-current {
  pointer-events: none;
  cursor: default;
}

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

.button:disabled,
.button[aria-disabled="true"] {
  opacity: 0.62;
  cursor: not-allowed;
}

.coming-soon {
  position: relative;
  overflow: hidden;
  pointer-events: none;
}

.coming-soon::after {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  border-radius: inherit;
  background: rgba(248, 250, 252, 0.68);
  color: #0f766e;
  content: attr(data-coming-soon);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  backdrop-filter: blur(1px);
}

.sidebar-link.coming-soon::after {
  justify-content: end;
  padding-right: 0.75rem;
  background: linear-gradient(90deg, rgba(248, 250, 252, 0.18), rgba(248, 250, 252, 0.82));
  font-size: 0.62rem;
}

.coming-soon-panel {
  position: relative;
  overflow: hidden;
}

.coming-soon-panel::after {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: inherit;
  background: rgba(248, 250, 252, 0.58);
  color: #0f766e;
  content: attr(data-coming-soon);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  backdrop-filter: blur(1px);
  pointer-events: none;
}

.coming-soon-panel > * {
  filter: saturate(0.82);
}

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

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

.button-warning {
  background: var(--warning);
  color: #fff;
}

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

.task-list {
  display: grid;
  gap: 12px;
}

.task-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.task-card[data-field-id] {
  cursor: pointer;
  user-select: none;
}

.task-card[data-field-id]:hover {
  border-color: rgba(15, 118, 110, 0.35);
}

.task-card[data-field-id]:focus-within {
  outline: 2px solid rgba(15, 118, 110, 0.55);
  outline-offset: 2px;
}

.task-card-selected {
  border-color: var(--primary);
  background: #f0fdf4;
  box-shadow: inset 4px 0 0 var(--primary), 0 0 0 1px rgba(15, 118, 110, 0.16);
}

.task-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.task-title {
  font-size: 1rem;
  margin-bottom: 0;
  line-height: 1.25;
}

.task-card-badge {
  flex: 0 0 auto;
  align-self: flex-start;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.12);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 24px;
  white-space: nowrap;
}

.task-grid {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
  font-size: 0.92rem;
}

.task-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.task-actions .button {
  width: 100%;
}

.task-actions .button:disabled {
  background: #d1d5db;
  border-color: #d1d5db;
  color: #475569;
  cursor: default;
  opacity: 1;
}

.task-form {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.summary {
  min-height: 40px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 3px 0;
}

.empty {
  padding: 16px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
}

@media (max-width: 480px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .field-actions {
    grid-template-columns: 1fr;
  }

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

  .task-actions {
    grid-template-columns: 1fr;
  }

  .weather-strip {
    margin: 8px 10px 0;
  }

  #weatherSummary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2px 10px;
  }

  .weather-strip-open {
    display: none;
  }

  .dashboard-alert,
  .task-row {
    grid-template-columns: 1fr;
  }

  .task-actions-compact {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .task-actions-compact .button {
    width: 100%;
  }
}
:where([hidden]) {
  display: none !important;
}

:where(a, button, input, select, textarea, summary):focus-visible {
  outline: 3px solid #f59e0b;
  outline-offset: 2px;
}
