:root {
  --bg-deep: #0c2a3a;
  --bg-panel: #123447;
  --accent: #5ec4e8;
  --accent-warm: #e8a85c;
  --text: #eef6fa;
  --muted: #8fb4c7;
  --danger: #e86c5c;
  --radius: 12px;
  --font-body: "Archivo", system-ui, sans-serif;
  --font-display: "Bitter", Georgia, serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  height: 100%;
  font-family: var(--font-body);
  background: var(--bg-deep);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.login-screen {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(ellipse 120% 80% at 50% -20%, rgba(94, 196, 232, 0.18), transparent 55%),
    linear-gradient(165deg, #0a2230 0%, #0c2a3a 45%, #081820 100%);
}

.login-card {
  width: min(100%, 22rem);
  display: grid;
  gap: 0.85rem;
}

.login-eyebrow {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.login-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 10vw, 3rem);
  font-weight: 700;
  line-height: 1;
}

.login-sub {
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.app-screen {
  height: 100dvh;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  overflow: hidden;
}

.field-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 0.85rem 1rem 0.35rem;
  background: linear-gradient(180deg, rgba(12, 42, 58, 0.98), rgba(12, 42, 58, 0.7));
  z-index: 500;
}

.field-brand {
  margin: 0;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.field-header h1 {
  margin: 0.15rem 0 0;
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
}

.filter-bar {
  display: flex;
  gap: 0.4rem;
  padding: 0 0.75rem 0.5rem;
  overflow-x: auto;
  z-index: 500;
}

.filter-chip {
  border: 1px solid rgba(94, 196, 232, 0.25);
  background: rgba(18, 52, 71, 0.85);
  color: var(--muted);
  border-radius: 999px;
  min-height: 2.75rem;
  padding: 0.6rem 0.9rem;
  font: inherit;
  font-size: 0.95rem;
  white-space: nowrap;
}

.filter-chip.active {
  background: var(--accent);
  color: var(--bg-deep);
  border-color: var(--accent);
  font-weight: 600;
}

.field-map {
  position: relative;
  min-height: 0;
  z-index: 1;
}

.field-map .leaflet-container {
  height: 100%;
  width: 100%;
  background: #081820;
}

.job-sheet {
  position: relative;
  z-index: 600;
  background: var(--bg-panel);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.35);
  min-height: 12rem;
  max-height: 44vh;
  display: flex;
  flex-direction: column;
}

.sheet-handle {
  width: 2.5rem;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  margin: 0.5rem auto 0;
}

.sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem 0.35rem;
}

.sheet-head h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
}

.job-list {
  list-style: none;
  margin: 0;
  padding: 0 0.75rem 0.75rem;
  overflow-y: auto;
  display: grid;
  gap: 0.45rem;
}

.job-item {
  border: 1px solid rgba(94, 196, 232, 0.12);
  background: rgba(12, 42, 58, 0.65);
  border-radius: var(--radius);
  padding: 0.85rem 0.9rem;
  cursor: pointer;
}

.job-item:active {
  transform: scale(0.99);
}

.job-item h3 {
  margin: 0;
  font-size: 1.05rem;
}

.job-item p {
  margin: 0.2rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.job-badge {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-warm);
}

.field-label {
  display: grid;
  gap: 0.3rem;
}

.field-label span {
  font-size: 0.82rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.field-label input,
.field-label textarea,
.field-label select {
  width: 100%;
  border: 1px solid rgba(94, 196, 232, 0.2);
  background: rgba(8, 24, 32, 0.8);
  color: var(--text);
  border-radius: 8px;
  min-height: 3rem;
  padding: 0.8rem 0.85rem;
  font: 1rem var(--font-body);
}

.btn-primary,
.btn-secondary,
.btn-ghost {
  border: none;
  border-radius: 10px;
  min-height: 2.75rem;
  padding: 0.75rem 1rem;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg-deep);
}

.btn-secondary {
  background: rgba(94, 196, 232, 0.12);
  color: var(--accent);
  border: 1px solid rgba(94, 196, 232, 0.25);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  padding: 0.35rem 0.5rem;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: end center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 12, 18, 0.72);
}

.modal-panel {
  position: relative;
  width: min(100%, 28rem);
  max-height: 92dvh;
  overflow-y: auto;
  background: var(--bg-panel);
  border-radius: 18px 18px 0 0;
  padding: 1.1rem 1rem calc(1rem + env(safe-area-inset-bottom));
  animation: slideUp 0.25s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.modal-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
}

.modal-address,
.modal-meta {
  margin: 0.25rem 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.modal-actions {
  display: grid;
  gap: 0.5rem;
  margin: 0.75rem 0;
}

.complete-form {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.5rem;
}

.form-section-label {
  margin: 0;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-warm);
}

.pnl-preview {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  border-radius: var(--radius);
  background: rgba(94, 196, 232, 0.08);
  font-size: 0.9rem;
}

.pnl-preview strong {
  font-size: 1.25rem;
  color: var(--accent);
}

.row-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.row-actions .btn-primary,
.row-actions .btn-secondary {
  flex: 1;
  min-width: 8rem;
}

.field-status {
  position: fixed;
  left: 0.75rem;
  right: 0.75rem;
  bottom: 0.75rem;
  z-index: 3000;
  margin: 0;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  font-size: 0.82rem;
  background: rgba(12, 42, 58, 0.95);
  border: 1px solid rgba(94, 196, 232, 0.2);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.field-status.show {
  opacity: 1;
}

.field-status.error {
  border-color: rgba(232, 108, 92, 0.5);
  color: #ffb4a8;
}

.field-status.success {
  border-color: rgba(94, 196, 232, 0.5);
}

@media (min-width: 640px) {
  .modal {
    place-items: center;
  }

  .modal-panel {
    border-radius: 18px;
  }
}
