:root {
  --bg: #eef2f5;
  --card: #ffffff;
  --text: #15202b;
  --muted: #607080;
  --line: #dbe3ea;
  --brand: #0e7c66;
  --brand-2: #0a5f4e;
  --danger: #b3261e;
  --ok: #166534;
  --warn: #92400e;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  padding-bottom: 32px;
}
a { color: var(--brand); text-decoration: none; }
h1, h2, h3 { margin: 0 0 8px; line-height: 1.25; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.topright { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.wrap { max-width: 980px; margin: 0 auto; padding: 16px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
}
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }

.btn {
  appearance: none;
  border: 0;
  border-radius: 12px;
  background: var(--brand);
  color: #fff;
  padding: 12px 18px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { background: var(--brand-2); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.big { width: 100%; padding: 16px; font-size: 18px; margin-top: 10px; }
.btn.danger { background: var(--danger); }
.btn.ghost { background: transparent; color: var(--brand); border: 1px solid var(--line); }
.btn.small { padding: 8px 12px; font-size: 13px; border-radius: 10px; }
button.small { font-size: 13px; padding: 6px 10px; border-radius: 9px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
button.small:hover { border-color: var(--brand); color: var(--brand); }

.statusrow { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.dot { width: 14px; height: 14px; border-radius: 50%; background: #cbd5e1; margin-top: 6px; flex: none; }
.dot.working { background: #22c55e; box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.18); }
.dot.done { background: #94a3b8; }
.dot.warn { background: #f59e0b; }

.gpsinfo {
  margin: 10px 0 0;
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  font-size: 13px;
  background: #f8fafc;
}
.gpsinfo.bad { border-color: #fecaca; background: #fef2f2; color: #991b1b; }

label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
input, select, textarea {
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  min-width: 0;
}
input:focus, select:focus { outline: 2px solid rgba(14, 124, 102, 0.25); border-color: var(--brand); }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 14px; align-items: end; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.chk { flex-direction: row; align-items: center; gap: 8px; }

.photo { margin-top: 14px; }
.photo input { padding: 8px; }
.preview { display: block; max-height: 220px; border-radius: 12px; margin-top: 10px; border: 1px solid var(--line); }

.msg { min-height: 20px; margin: 10px 0 0; font-size: 14px; }
.msg.ok { color: var(--ok); }
.msg.err { color: var(--danger); font-weight: 600; }

.estimate { margin-top: 10px; padding: 12px; border-radius: 12px; background: #f0fdf4; border: 1px solid #bbf7d0; }
.estimate strong { font-size: 22px; }
.estimate .note { font-size: 12px; color: var(--ok); }

.sessions { margin: 8px 0 0; padding: 0; list-style: none; }
.sessions li { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.sessions li:last-child { border-bottom: 0; }

.history { display: flex; flex-direction: column; gap: 8px; }
.history .day { padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.history .day .head { display: flex; justify-content: space-between; gap: 10px; font-weight: 600; }
.history .day .sub { font-size: 13px; color: var(--muted); }

.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; white-space: nowrap; }
tr.dayrow td { background: #f8fafc; }
.actions button { margin: 0 4px 4px 0; }

.tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 10px 16px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 61px;
  z-index: 4;
}
.tabs button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 999px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}
.tabs button.active { background: var(--brand); border-color: var(--brand); color: #fff; }
section.tab { display: none; }
section.tab.active { display: block; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; background: #e2e8f0; color: #334155; }
.badge.ok { background: #dcfce7; color: #166534; }
.badge.warn { background: #fef3c7; color: #92400e; }

.login { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login .card { width: 100%; max-width: 380px; }
.login h1 { font-size: 22px; }
.login .sub { color: var(--muted); font-size: 14px; margin-bottom: 18px; }
.login .btn { width: 100%; margin-top: 6px; }
.grid.single { grid-template-columns: 1fr; }

.foot { text-align: center; font-size: 12px; color: var(--muted); }
