:root {
  color-scheme: light;
  --bg: #eef2f5;
  --surface: #ffffff;
  --surface-soft: #f7f9fb;
  --text: #17212b;
  --muted: #667586;
  --line: #d9e0e7;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --accent: #c2410c;
  --good: #15803d;
  --warn: #b45309;
  --danger: #b91c1c;
  --shadow: 0 18px 40px rgba(23, 33, 43, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.login-screen {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  background: linear-gradient(135deg, #13262d 0%, #eef2f5 100%);
}

.login-card {
  display: grid;
  gap: 16px;
  width: min(440px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 24px;
}

.login-brand {
  color: var(--text);
  margin-bottom: 4px;
}

.form-error {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
  font-weight: 800;
}

.demo-users {
  display: grid;
  gap: 5px;
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
  padding: 12px;
}

.demo-users strong {
  color: var(--text);
}

.app-shell {
  display: grid;
  grid-template-columns: 300px 1fr;
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px;
  background: #13262d;
  color: #f9fafb;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 56px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: #f97316;
  color: #111827;
  font-weight: 800;
}

.brand h1,
.brand p,
.topbar h2,
.topbar p,
.section-title h3,
.section-title p {
  margin: 0;
}

.brand h1 {
  font-size: 1.2rem;
}

.brand p {
  color: #b6c4cc;
  font-size: 0.88rem;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.sidebar .panel {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

.compact {
  display: grid;
  gap: 8px;
  padding: 14px;
}

.user-panel span,
.side-label {
  color: #c9d5db;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.user-panel strong {
  font-size: 1rem;
}

.user-panel small,
.managed-locations {
  margin: 0;
  color: #c9d5db;
  line-height: 1.45;
}

.dark-ghost {
  margin-top: 6px;
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.side-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mini-button {
  min-height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: #eef2f5;
  color: #13262d;
  font-size: 0.8rem;
  font-weight: 800;
  padding: 0 9px;
}

.notification-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.notification-list li {
  display: grid;
  gap: 3px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  padding: 10px;
}

.notification-list span {
  color: #c9d5db;
  font-size: 0.82rem;
  line-height: 1.35;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.sidebar label {
  color: #c9d5db;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 10px 12px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16);
}

.status-nav {
  display: grid;
  gap: 8px;
}

.filter,
.admin-tab {
  min-height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: transparent;
  color: #dce6eb;
  text-align: left;
  padding: 0 12px;
}

.filter.active,
.filter:hover,
.admin-tab.active,
.admin-tab:hover {
  background: #eef2f5;
  color: #13262d;
}

.admin-nav {
  display: grid;
  gap: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 12px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: auto;
  padding: 12px;
}

.stats div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.stats span {
  font-size: 1.35rem;
  font-weight: 800;
}

.stats small {
  color: #c9d5db;
}

.workspace {
  min-width: 0;
  padding: 26px;
}

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

.eyebrow {
  color: var(--primary-dark);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.topbar h2 {
  margin-top: 4px;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
}

.clock {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  padding: 10px 12px;
  white-space: nowrap;
}

.flash-stack {
  display: grid;
  gap: 10px;
  margin: 0 0 18px;
}

.flash-message {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px 12px;
  align-items: center;
  border: 1px solid #fecaca;
  border-left: 5px solid var(--danger);
  border-radius: 8px;
  background: #fff1f2;
  color: #7f1d1d;
  padding: 12px 14px;
  animation: flashPulse 1.4s ease-in-out infinite;
}

.flash-message span {
  color: #991b1b;
  line-height: 1.45;
}

.flash-message.seen {
  animation: none;
  opacity: 0.74;
}

.mini-button.light {
  border-color: #fecaca;
  background: #fff;
  color: #7f1d1d;
}

@keyframes flashPulse {
  0%,
  100% {
    box-shadow: 0 0 0 rgba(185, 28, 28, 0);
  }

  50% {
    box-shadow: 0 0 0 4px rgba(185, 28, 28, 0.12);
  }
}

.form-panel {
  margin-bottom: 18px;
  padding: 18px;
}

.section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-title h3 {
  font-size: 1.05rem;
}

.section-title p {
  color: var(--muted);
  font-size: 0.92rem;
}

.task-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.task-form .full {
  grid-column: 1 / 5;
}

.team-panel {
  display: grid;
  grid-template-columns: 0.9fr 1.4fr;
  gap: 14px;
  align-items: start;
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 16px;
}

.team-panel p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.team-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.team-member {
  display: grid;
  gap: 4px;
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 10px;
}

.team-member span {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.admin-tools {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
  padding: 18px;
}

.wide-field {
  grid-column: 1 / 3;
}

.mini-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 14px;
}

.mini-form strong {
  grid-column: 1 / 3;
}

.mini-form button {
  align-self: end;
}

.records-panel {
  display: grid;
  gap: 12px;
}

.record-filters {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 12px;
}

.compact-title {
  margin-bottom: 0;
}

.record-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.record-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.record-table th,
.record-table td {
  border-bottom: 1px solid var(--line);
  padding: 11px 12px;
  text-align: left;
  vertical-align: top;
}

.record-table th {
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.record-table small {
  color: var(--muted);
}

.primary,
.secondary,
.danger,
.ghost {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 800;
}

.primary {
  align-self: end;
  background: var(--primary);
  color: #fff;
}

.primary:hover {
  background: var(--primary-dark);
}

.secondary {
  background: #e0f2f1;
  color: var(--primary-dark);
}

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

.ghost {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.task-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(320px, 1.15fr);
  gap: 18px;
  align-items: start;
}

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

.task-card {
  border-radius: 8px;
}

.task-card-button {
  width: 100%;
  min-height: 154px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 16px;
  text-align: left;
}

.task-card-button:hover,
.task-card.selected .task-card-button {
  border-color: var(--primary);
  box-shadow: 0 18px 40px rgba(15, 118, 110, 0.14);
}

.card-head,
.detail-head,
.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  background: #e5e7eb;
  color: #374151;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.badge.open {
  background: #dcfce7;
  color: var(--good);
}

.badge.submitted {
  background: #ffedd5;
  color: var(--warn);
}

.badge.locked {
  background: #fee2e2;
  color: var(--danger);
}

.badge.approved {
  background: #dbeafe;
  color: #1d4ed8;
}

.badge.rejected {
  background: #f3e8ff;
  color: #7e22ce;
}

.time-left {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.task-card h3 {
  margin: 14px 0 8px;
  font-size: 1.05rem;
}

.task-card p {
  margin: 0;
}

.assignee {
  color: var(--primary-dark);
  font-weight: 800;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.priority-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  background: #eef2f5;
  color: #374151;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.priority-pill.low {
  background: #e0f2fe;
  color: #0369a1;
}

.priority-pill.medium {
  background: #ede9fe;
  color: #6d28d9;
}

.priority-pill.high {
  background: #ffedd5;
  color: #c2410c;
}

.priority-pill.urgent {
  background: #fee2e2;
  color: var(--danger);
}

.details {
  display: -webkit-box;
  margin-top: 12px;
  overflow: hidden;
  color: var(--muted);
  line-height: 1.45;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.detail-panel {
  min-height: 460px;
  padding: 18px;
  position: sticky;
  top: 20px;
}

.empty-state {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 410px;
  color: var(--muted);
  text-align: center;
}

.empty-state h3 {
  margin: 12px 0 6px;
  color: var(--text);
}

.empty-state p {
  max-width: 280px;
  margin: 0;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #e0f2f1;
  color: var(--primary-dark);
  font-weight: 900;
}

.detail-head {
  align-items: flex-start;
  margin-bottom: 16px;
}

.detail-head h3 {
  margin: 8px 0 0;
  font-size: 1.45rem;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 16px 0;
}

.meta-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 12px;
}

.meta-box span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.meta-box strong {
  display: block;
  margin-top: 5px;
}

.proof {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.proof-preview {
  display: grid;
  place-items: center;
  min-height: 220px;
  border: 1px dashed #aeb9c4;
  border-radius: 8px;
  background: var(--surface-soft);
  overflow: hidden;
}

.proof-preview img {
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  background: #111827;
}

.proof-preview span {
  color: var(--muted);
  font-weight: 700;
}

.note-box {
  border-left: 4px solid var(--primary);
  background: #ecfeff;
  border-radius: 8px;
  color: #164e63;
  line-height: 1.5;
  padding: 12px 14px;
}

.danger-note {
  border-left-color: var(--danger);
  background: #fff1f2;
  color: #991b1b;
}

.geofence-box {
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 12px;
}

.geofence-box span {
  color: var(--muted);
  font-size: 0.9rem;
}

.disabled-label {
  opacity: 0.65;
}

.actions {
  flex-wrap: wrap;
  justify-content: flex-start;
  margin-top: 16px;
}

.hidden {
  display: none !important;
}

@media (max-width: 980px) {
  .app-shell,
  .task-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
  }

  .status-nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .filter {
    text-align: center;
  }

  .detail-panel {
    position: static;
  }
}

@media (max-width: 720px) {
  .workspace,
  .sidebar {
    padding: 16px;
  }

  .topbar,
  .section-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .task-form,
  .meta-grid,
  .team-panel,
  .team-list,
  .admin-tools,
  .mini-form,
  .record-filters,
  .flash-message {
    grid-template-columns: 1fr;
  }

  .task-form .full {
    grid-column: auto;
  }

  .mini-form strong {
    grid-column: auto;
  }

  .wide-field {
    grid-column: auto;
  }

  .status-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
