/* TÜV Inspection Check-In — indigo card UI */
:root {
  --indigo: #3B3891;
  --indigo-2: #4A47AE;
  --indigo-ink: #2A2870;
  --tuv-blue: #0A6ECC;
  --bg: #EEF0FA;
  --card: #FFFFFF;
  --soft: #E3E6F6;
  --line: #E4E7F2;
  --ink: #1E2040;
  --muted: #8A90AD;
  --ok: #1E9E6A;
  --warn: #D98A0B;
  --bad: #D14343;
  --r: 18px;
  --shadow: 0 8px 24px rgba(59, 56, 145, .08);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: #DADDEE; color: var(--ink);
  font: 400 15px/1.5 Poppins, system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--indigo); }
img { max-width: 100%; display: block; }
.app {
  max-width: 480px; min-height: 100dvh; margin: 0 auto; background: var(--bg);
  padding: 18px 18px 110px; position: relative; overflow-x: hidden;
}
body.admin .app { max-width: 980px; }
.ic { width: 20px; height: 20px; flex: none; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.center { text-align: center; }
.warn-text { color: var(--warn); font-weight: 600; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h2 { font-size: 18px; font-weight: 600; }

/* ---------- top bar & greeting ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.topbar-logo { height: 34px; width: auto; }
.avatar {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  background: var(--indigo); color: #fff; font-weight: 600; font-size: 14px; text-decoration: none;
  box-shadow: 0 0 0 3px #fff, var(--shadow);
}
.avatar.big { width: 56px; height: 56px; font-size: 18px; }
.greet h1 { font-size: 28px; font-weight: 400; }
.greet h1 strong { font-weight: 700; }
.greet p { margin: 2px 0 16px; font-size: 13px; }

/* ---------- pills ---------- */
.pills { display: flex; gap: 10px; margin-bottom: 18px; overflow-x: auto; }
.pill {
  padding: 7px 16px; border-radius: 999px; background: var(--soft); color: var(--indigo);
  font-size: 12.5px; font-weight: 500; text-decoration: none; white-space: nowrap;
}
.pill.on { background: var(--indigo); color: #fff; }

/* ---------- hero cards ---------- */
.card-rail {
  display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory;
  margin: 0 -18px 24px; padding: 2px 18px 10px; scrollbar-width: none;
}
.card-rail::-webkit-scrollbar { display: none; }
.hero-card {
  flex: 0 0 68%; scroll-snap-align: start; min-height: 196px; border-radius: 16px; padding: 16px;
  color: #fff; text-decoration: none; display: flex; flex-direction: column; gap: 8px;
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(255,255,255,.12), transparent 55%),
    linear-gradient(160deg, var(--indigo-2), var(--indigo));
  box-shadow: 0 12px 28px rgba(59, 56, 145, .28);
}
.hero-soft { background: linear-gradient(160deg, #6461C4, #4F4CB0); }
.hero-date { align-self: flex-end; font-size: 11px; opacity: .85; }
.hero-title { font-size: 19px; font-weight: 600; line-height: 1.3; margin-top: 8px; flex: 1; }
.hero-title small { font-size: 12.5px; font-weight: 400; opacity: .85; }
.hero-foot { display: flex; justify-content: space-between; font-size: 11.5px; }
.bar { height: 4px; border-radius: 4px; background: rgba(255,255,255,.25); overflow: hidden; }
.bar span { display: block; height: 100%; background: #fff; border-radius: 4px; }
.hero-cta { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; margin-top: 4px; }
.hero-cta .ic { width: 16px; height: 16px; }

/* ---------- lists ---------- */
.section-title { font-size: 15px; font-weight: 600; margin: 6px 0 12px; }
.section-title.row { display: flex; justify-content: space-between; align-items: baseline; }
.task-list { display: grid; gap: 12px; }
body.admin .task-list { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.task {
  display: flex; align-items: center; gap: 14px; background: var(--card); border-radius: 14px;
  padding: 10px 14px 10px 10px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow);
  min-height: 64px;
}
.task-ic {
  width: 44px; height: 52px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: var(--indigo); color: #fff;
}
.avatar-ic { font-weight: 600; font-size: 14px; height: 44px; border-radius: 50%; }
.task-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.task-body strong { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-body small { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-row.off { opacity: .55; }
.chip { font-size: 10.5px; font-weight: 600; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.chip-live { background: #FFF3DC; color: #A86A00; }
.chip-done { background: #DDF4EA; color: #137852; }
.head-panel .chip-live { background: #FFE7B3; }
.empty { text-align: center; color: var(--muted); padding: 28px 10px; }
.empty .ic { width: 40px; height: 40px; color: #C3C7E0; margin: 0 auto 8px; }

/* ---------- FAB & bottom nav ---------- */
.fab {
  position: fixed; bottom: 86px; right: max(18px, calc(50% - 222px)); width: 54px; height: 54px; border-radius: 50%;
  background: var(--indigo); color: #fff; display: grid; place-items: center;
  box-shadow: 0 10px 24px rgba(59,56,145,.4); z-index: 5;
}
.fab .ic { width: 26px; height: 26px; }
.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px;
  background: #fff; display: flex; justify-content: space-around; padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  border-radius: 22px 22px 0 0; box-shadow: 0 -6px 20px rgba(59,56,145,.08); z-index: 6;
}
body.admin .bottom-nav { max-width: 980px; }
.nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px; color: #B4B8D2;
  text-decoration: none; font-size: 10.5px; font-weight: 500; padding: 4px 14px; border-radius: 12px;
}
.nav-item.on { color: var(--indigo); }
.nav-item.on .ic { stroke-width: 2.2; }

/* ---------- form pages ---------- */
body.form-page .app { padding: 0 0 110px; }
.head-panel {
  background: radial-gradient(120% 90% at 100% 0%, rgba(255,255,255,.1), transparent 60%), var(--indigo);
  color: #fff; padding: 18px 22px 48px; border-radius: 0 0 0 0;
}
.head-panel.compact { padding-bottom: 44px; }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 18px; }
.head-row h1 { font-size: 16px; font-weight: 600; flex: 1; text-align: center; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; color: #fff;
  background: rgba(255,255,255,.12); text-decoration: none;
}
.icon-btn.ghost { background: transparent; opacity: .6; }
.line-field { display: block; padding: 8px 0 10px; border-bottom: 1px solid rgba(255,255,255,.22); }
.line-field + .line-field { margin-top: 6px; }
.line-field span { display: block; font-size: 12px; font-weight: 600; opacity: .9; }
.line-field input, .line-field select {
  width: 100%; border: 0; background: transparent; color: #fff; font: inherit; font-size: 14px;
  padding: 4px 0; outline: none; -webkit-appearance: none; appearance: none;
}
.line-field input::placeholder { color: rgba(255,255,255,.55); }
.line-field select option { color: var(--ink); }
.line-field select { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='white' stroke-width='1.8'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E") no-repeat right 4px center; }
.head-meta { display: grid; grid-template-columns: auto 1fr; gap: 6px 18px; font-size: 13px; }
.head-meta span { opacity: .75; font-size: 12px; }

.sheet {
  background: #fff; border-radius: 26px 26px 0 0; margin-top: -26px; padding: 26px 22px 24px;
  position: relative; min-height: 50vh;
}
body:not(.form-page) .sheet { border-radius: var(--r); margin-top: 0; }
.login-sheet { margin: -26px 0 0; }
.field { display: block; margin: 0 0 18px; border: 0; padding: 0; min-width: 0; }
.field > span, .field > legend { display: block; font-size: 12.5px; font-weight: 600; color: var(--indigo); margin-bottom: 6px; padding: 0; }
.field input, .field select, .field textarea, .menu input {
  width: 100%; font: inherit; font-size: 14px; color: var(--ink); background: #F6F7FC;
  border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; outline: none;
}
.field input:focus, .field textarea:focus, .menu input:focus { border-color: var(--indigo-2); box-shadow: 0 0 0 3px rgba(74,71,174,.14); background: #fff; }
.field textarea { resize: vertical; }
.field.static strong { display: block; font-size: 14px; font-weight: 500; padding: 4px 0; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.stack > * + * { margin-top: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-opt input { position: absolute; opacity: 0; pointer-events: none; }
.chip-opt span {
  display: inline-block; padding: 7px 14px; border-radius: 999px; background: var(--soft); color: var(--indigo);
  font-size: 12.5px; font-weight: 500; cursor: pointer; transition: background .15s, color .15s;
}
.chip-opt input:checked + span { background: var(--indigo); color: #fff; }
.chip-opt input:focus-visible + span { outline: 2px solid var(--indigo-2); outline-offset: 2px; }

.gps {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px;
  font-size: 13px; background: #F6F7FC; border: 1px solid var(--line);
}
.gps[data-state="wait"] .ic { animation: pulse 1.2s infinite; color: var(--muted); }
.gps[data-state="ok"] { background: #E8F7F0; border-color: #BFE7D4; color: #116A48; }
.gps[data-state="weak"] { background: #FFF6E3; border-color: #F3DCA6; color: #8A5A00; }
.gps[data-state="err"] { background: #FDECEC; border-color: #F4C4C4; color: #9E2A2A; }
@keyframes pulse { 50% { opacity: .3; } }

.camera {
  position: relative; border-radius: 16px; overflow: hidden; background: #1B1C3A; aspect-ratio: 4 / 3;
  display: grid; grid-template-columns: minmax(0, 1fr); place-items: center;
}
.camera video, .camera img { width: 100%; height: 100%; min-width: 0; object-fit: cover; grid-area: 1 / 1; }
.camera img { object-fit: contain; }
.cam-msg { grid-area: 1 / 1; color: #C9CCE8; display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 13px; text-align: center; padding: 16px; }
.cam-msg .ic { width: 34px; height: 34px; }
.cam-actions { display: flex; gap: 10px; margin: 10px 0 4px; }
.cam-actions .btn { flex: 1; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 600; padding: 13px 20px; border-radius: 14px; text-decoration: none;
  transition: transform .06s, opacity .15s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--indigo); color: #fff; box-shadow: 0 8px 20px rgba(59,56,145,.25); }
.btn-soft { background: var(--soft); color: var(--indigo); }
.btn-danger { background: #FBE3E3; color: var(--bad); }
.btn-block { display: flex; width: 100%; margin-top: 6px; }
.btn-sm { padding: 8px 14px; font-size: 12.5px; border-radius: 12px; }
.btn-sm .ic { width: 16px; height: 16px; }

/* ---------- details & photo ---------- */
.details { margin: 0 0 18px; display: grid; gap: 0; }
.details > div { display: grid; grid-template-columns: 118px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.details dt { color: var(--muted); font-size: 12.5px; }
.details dd { margin: 0; font-size: 13.5px; font-weight: 500; word-break: break-word; }
.photo { width: 100%; border-radius: 16px; margin: 4px 0 18px; background: var(--soft); min-height: 120px; }
.map { width: 100%; height: 220px; border: 0; border-radius: 16px; margin-bottom: 18px; }
.admin-grid { display: grid; gap: 22px; }
@media (min-width: 760px) { .admin-grid { grid-template-columns: 1.1fr .9fr; } }
.danger-zone { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 16px; margin-top: 8px; }

/* ---------- admin dashboard ---------- */
.title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.month { font-size: 24px; font-weight: 700; margin-bottom: 14px; }
.title-row .month { margin: 0; }
.day-strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 18px; scrollbar-width: none; }
.day {
  flex: 0 0 56px; height: 80px; border-radius: 28px; background: var(--soft); color: var(--indigo);
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-decoration: none;
}
.day b { font-size: 16px; }
.day small { font-size: 10.5px; opacity: .8; }
.day.on { background: var(--indigo); color: #fff; box-shadow: 0 10px 20px rgba(59,56,145,.3); }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 18px; }
@media (min-width: 760px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: #fff; border-radius: 16px; padding: 14px 16px; box-shadow: var(--shadow); }
.stat small { display: block; font-size: 11.5px; color: var(--muted); }
.stat b { font-size: 26px; font-weight: 700; color: var(--indigo); }
.stat-main { background: var(--indigo); }
.stat-main small { color: rgba(255,255,255,.8); }
.stat-main b { color: #fff; }
.search {
  display: flex; align-items: center; gap: 8px; background: #fff; border-radius: 14px; padding: 4px 6px 4px 14px;
  box-shadow: var(--shadow); margin-bottom: 20px; color: var(--muted);
}
.search input { flex: 1; min-width: 0; border: 0; outline: none; font: inherit; font-size: 13.5px; padding: 10px 0; background: transparent; }
.search select { border: 0; background: var(--soft); color: var(--indigo); font: inherit; font-size: 12.5px; font-weight: 500; border-radius: 10px; padding: 8px 10px; }

/* ---------- cards, users, account ---------- */
.card { background: #fff; border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card h2 { margin-bottom: 14px; }
.add-card summary { cursor: pointer; font-weight: 600; color: var(--indigo); display: flex; align-items: center; gap: 8px; list-style: none; }
.add-card summary::-webkit-details-marker { display: none; }
.add-card[open] summary { margin-bottom: 16px; }
.row-menu { position: relative; }
.row-menu summary { list-style: none; cursor: pointer; font-size: 20px; color: var(--muted); padding: 4px 10px; }
.row-menu summary::-webkit-details-marker { display: none; }
.menu {
  position: absolute; right: 0; top: 36px; width: 250px; background: #fff; border-radius: 14px; padding: 12px;
  box-shadow: 0 16px 40px rgba(30,32,64,.18); z-index: 10; display: grid; gap: 10px;
}
.menu form { display: grid; gap: 8px; }
.profile { display: flex; align-items: center; gap: 14px; }
.profile strong { display: block; }
.profile small { display: block; }

/* ---------- login ---------- */
.login-page .app { padding: 0; background: var(--bg); }
.login-hero {
  background: radial-gradient(120% 80% at 100% 0%, rgba(255,255,255,.12), transparent 55%), var(--indigo);
  color: #fff; padding: 28px 24px 60px;
}
.login-logo { background: #fff; border-radius: 16px; padding: 12px 16px; display: inline-block; margin-bottom: 28px; box-shadow: 0 10px 24px rgba(0,0,0,.15); }
.login-logo img { height: 40px; width: auto; }
.login-hero h1 { font-size: 30px; font-weight: 700; line-height: 1.15; }
.login-hero p { opacity: .8; font-size: 13.5px; margin: 8px 0 0; }
.login-sheet h2 { margin-bottom: 18px; }

/* ---------- alerts & toast ---------- */
.alert { background: #FDECEC; color: #9E2A2A; border-radius: 12px; padding: 10px 14px; font-size: 13px; margin-bottom: 16px; }
.toast {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 20; width: calc(100% - 32px); max-width: 440px;
  padding: 12px 16px; border-radius: 14px; font-size: 13.5px; font-weight: 500; color: #fff; background: var(--ok);
  box-shadow: 0 12px 30px rgba(0,0,0,.18); transition: opacity .4s, transform .4s;
}
.toast-warn { background: var(--warn); }
.toast.hide { opacity: 0; transform: translate(-50%, -20px); pointer-events: none; }

@media (max-width: 380px) {
  .two-col { grid-template-columns: 1fr; }
  .hero-card { flex-basis: 78%; }
  .details > div { grid-template-columns: 100px 1fr; }
}

/* ---------- camera switch ---------- */
.camera video.mirror { transform: scaleX(-1); }
.cam-flip {
  position: absolute; top: 10px; right: 10px; z-index: 2; width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: rgba(20,20,60,.55); color: #fff; display: grid; place-items: center; cursor: pointer;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.cam-flip:disabled { opacity: .5; }
.cam-flip .ic { width: 22px; height: 22px; }

/* ---------- install card ---------- */
.install-card { display: grid; gap: 12px; }
.install-head { display: flex; align-items: center; gap: 12px; }
.install-head .task-ic { height: 44px; }
.install-head strong { display: block; }
.install-head small { display: block; color: var(--muted); font-size: 12px; }
.steps { margin: 0; padding-left: 20px; font-size: 13px; display: grid; gap: 6px; }
.share-ic { display: inline-block; vertical-align: -3px; width: 16px; height: 16px; }
