* { box-sizing: border-box; }

:root{
  --bg: #000;
  --card: #111;
  --border: #333;
  --muted: #aaa;
  --primary: #ffd400;
  --secondary: #444;
  --green: #28a745;
  --red: #dc3545;
}

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: #fff;
  font-family: Arial, sans-serif;
}

main {
  padding: 20px;
  max-width: none;
  width: 100%;
  margin: 0;
}

h1, h2, h3 { margin-top: 0; }
p { line-height: 1.35; }
.hidden { display: none !important; }
.muted { opacity: 0.7; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #111;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  gap: 10px;
  flex-wrap: wrap;
}

.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo {
  font-weight: bold;
  font-size: 18px;
}

#view-login {
  min-height: calc(100vh - 60px);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.auth-card {
  width: min(380px, 100%);
  background: var(--card);
  padding: 25px;
  border-radius: 10px;
  border: 1px solid var(--border);
  box-shadow: 0 0 20px rgba(0,0,0,0.6);
}

.auth-card h1 {
  text-align: center;
  margin-bottom: 20px;
  color: #fff;
}

.auth-card label {
  display: block;
  margin-top: 8px;
  font-size: 14px;
}

.auth-card input {
  width: 100%;
  padding: 10px;
  margin-top: 3px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: #000;
  caret-color: #000;
}

.auth-card input::placeholder {
  color: #666;
}

.auth-card input:-webkit-autofill,
.auth-card input:-webkit-autofill:hover,
.auth-card input:-webkit-autofill:focus,
.auth-card input:-webkit-autofill:active {
  -webkit-text-fill-color: #000;
  -webkit-box-shadow: 0 0 0 1000px #fff inset;
  transition: background-color 9999s ease-in-out 0s;
}

.auth-card button {
  width: 100%;
  margin-top: 15px;
}

.btn-primary,
.btn-secondary,
.btn-green,
.btn-red {
  padding: 10px 12px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-size: 14px;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-secondary { background: var(--secondary); color: #fff; }
.btn-green { background: var(--green); color: #fff; }
.btn-red { background: var(--red); color: #fff; }

.btn-primary:disabled,
.btn-secondary:disabled,
.btn-green:disabled,
.btn-red:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.error { color: #ff4d4d; margin-top: 10px; font-size: 13px; }
.info  { margin-top: 10px; font-size: 13px; }
.small-note { font-size: 12px; color: var(--muted); margin-top: 8px; }

.card {
  background: var(--card);
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: 15px;
  margin-bottom: 20px;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.worker-extra { margin-top: 10px; }
.worker-extra input, .worker-extra select {
  width: 100%;
  padding: 10px;
  margin-top: 4px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #000;
  color: #fff;
}

.btn-row {
  margin-top: 15px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.btn-row button { flex: 1 1 160px; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 620px;
}
.table th, .table td {
  border: 1px solid var(--border);
  padding: 8px;
  text-align: left;
  vertical-align: top;
}
.table th { background: #222; }

.green { color: var(--green); }
.red { color: var(--red); }

.admin-layout {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 20px;
  width: 100%;
}

.admin-layout > .card {
  width: 100%;
}

.card h2,
.card h3 {
  color: #fff;
  font-size: clamp(22px, 3vw, 34px);
  line-height: 1.1;
  margin-bottom: 14px;
}


.site-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px;
}

.site-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #050505;
}

.site-main {
  min-width: 0;
  flex: 1 1 auto;
}

.site-name {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  word-break: break-word;
}

.site-meta {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.site-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.site-item.is-inactive {
  opacity: 0.82;
}

.workers-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.workers-list li {
  padding: 10px 12px;
  border-bottom: 1px solid #222;
  cursor: pointer;
  font-size: 14px;
}
.workers-list li:last-child { border-bottom: none; }
.workers-list li:hover { background: rgba(255, 212, 0, 0.18); }
.workers-list li.selected { background: var(--primary); color: #000; font-weight: bold; }

.form-vertical label {
  display: block;
  font-size: 13px;
  margin-top: 8px;
}
.form-vertical input,
.form-vertical textarea,
.form-vertical select {
  width: 100%;
  padding: 10px;
  margin-top: 3px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #000;
  color: #fff;
}

.stats-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.map-container {
  width: 100%;
  height: 260px;
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
  min-width: 280px;
}

.gps-info { margin-top: 8px; font-size: 12px; }

.status-busy { color: #ff4d4d; font-weight: bold; }

@media (max-width: 780px) {
  main { padding: 12px; }
  .card { padding: 12px; border-radius: 12px; }
  .logo { font-size: 16px; }

  h1 { font-size: 24px; }
  .card h2 { font-size: 22px; }
  .card h3 { font-size: 18px; }

  input, select, textarea, button { font-size: 16px; }

  .table { min-width: 680px; }
  .workers-list { max-height: 40vh; }
  .workers-list li { padding: 12px; }

  .map-container { height: 260px; min-width: 0; }
  .stats-row { align-items: stretch; }
  .stats-row label { width: 100%; }
  .site-item { flex-direction: column; align-items: stretch; }
  .site-actions { justify-content: stretch; }
  .site-actions button { width: 100%; }
}


.worker-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.worker-row-main {
  min-width: 0;
  flex: 1 1 auto;
}

.btn-delete-inline {
  flex: 0 0 auto;
  padding: 8px 12px;
}

@media (max-width: 640px) {
  .worker-row {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-delete-inline {
    width: 100%;
  }
}


.gov2-app-wrap {
  width: 100%;
  max-width: 100%;
}

.gov2-app-wrap main,
.gov2-app-wrap #view-admin,
.gov2-app-wrap #view-worker,
.gov2-app-wrap .admin-layout {
  width: 100%;
  max-width: none;
}

@media (max-width: 980px) {
  .gov2-app-wrap {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
  }

  .gov2-app-wrap main {
    padding: 10px;
  }

  .gov2-app-wrap .topbar {
    padding: 10px 12px;
  }

  .gov2-app-wrap .card,
  .gov2-app-wrap .auth-card {
    width: 100%;
    max-width: none;
    margin-left: 0;
    margin-right: 0;
  }

  .gov2-app-wrap .btn-row,
  .gov2-app-wrap .stats-row,
  .gov2-app-wrap .topbar-right,
  .gov2-app-wrap .topbar-left {
    width: 100%;
  }

  .gov2-app-wrap .btn-row button,
  .gov2-app-wrap .stats-row button,
  .gov2-app-wrap .stats-row select,
  .gov2-app-wrap .stats-row input,
  .gov2-app-wrap .site-actions button {
    width: 100%;
    flex: 1 1 100%;
  }

  .gov2-app-wrap .table {
    min-width: 640px;
  }
}

@media (max-width: 640px) {
  .gov2-app-wrap main {
    padding: 8px;
  }

  .gov2-app-wrap .card {
    padding: 12px;
    border-radius: 12px;
    margin-bottom: 12px;
  }

  .gov2-app-wrap .topbar {
    gap: 8px;
  }

  .gov2-app-wrap .logo {
    font-size: 17px;
  }

  .gov2-app-wrap h1 {
    font-size: 24px;
  }

  .gov2-app-wrap .card h2 {
    font-size: 22px;
  }

  .gov2-app-wrap .card h3 {
    font-size: 18px;
  }

  .gov2-app-wrap .workers-list,
  .gov2-app-wrap #admin-workers {
    max-height: none;
  }

  .gov2-app-wrap .site-item,
  .gov2-app-wrap .worker-row {
    width: 100%;
  }
}
