:root {
  --navy: #2C3E8A;
  --navy-deep: #1a2658;
  --ink: #12172a;
  --paper: #f4f1ea;
  --card: #fffdf8;
  --line: #e4ddd0;
  --ok: #1f8a5b;
  --stop: #c4452d;
  --amber: #e08a2a;
  --muted: #6b7288;
  --shadow: 0 12px 40px rgba(18, 23, 42, 0.12);
  --radius: 22px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Segoe UI", system-ui, sans-serif;
  background:
    radial-gradient(1200px 600px at 10% -10%, #3a4ea8 0%, transparent 50%),
    linear-gradient(180deg, #0e1630 0%, #1a2658 38%, var(--paper) 38.1%);
  color: var(--ink);
  padding: 0 0 40px;
}
.wrap { max-width: 720px; margin: 0 auto; padding: 18px 16px 32px; }
.admin-wrap { max-width: min(1440px, calc(100vw - 32px)); }
@media (min-width: 1100px) {
  body {
    background:
      radial-gradient(900px 420px at 8% -8%, #3a4ea8 0%, transparent 55%),
      linear-gradient(180deg, #0e1630 0%, #1a2658 22%, var(--paper) 22.1%);
  }
  .admin-wrap { padding-top: 22px; }
}

.brand {
  display: flex; align-items: center; gap: 14px;
  color: #fff; padding: 8px 4px 22px;
}
.brand img { height: 52px; width: auto; filter: drop-shadow(0 4px 10px rgba(0,0,0,.25)); background: #fff; border-radius: 12px; padding: 6px 8px; }
.brand-text { min-width: 0; flex: 1; }
.brand h1 { margin: 0; font-size: 1.15rem; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand p { margin: 2px 0 0; opacity: .85; font-size: .82rem; }
.greet-short { display: none; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 14px;
  border: 1px solid rgba(255,255,255,.6);
}
.card h2 { margin: 0 0 12px; font-size: 1.05rem; }

label { display: block; font-size: .78rem; font-weight: 650; color: var(--muted); margin: 10px 0 6px; text-transform: uppercase; letter-spacing: .04em; }
input, textarea, select {
  width: 100%; border: 1.5px solid var(--line); border-radius: 14px;
  padding: 13px 14px; font-size: 1.05rem; background: #fff; color: var(--ink);
}
textarea { min-height: 74px; resize: vertical; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 8px; -webkit-overflow-scrolling: touch; }
.chip {
  flex: 0 0 auto; border: 0; background: #ece7dc; color: var(--ink);
  border-radius: 999px; padding: 10px 14px; font-weight: 650; font-size: .92rem;
}
.chip.active { background: var(--navy); color: #fff; }

.btn {
  border: 0; border-radius: 16px; padding: 15px 16px; font-weight: 750;
  font-size: 1.02rem; width: 100%; cursor: pointer;
}
.btn-navy { background: var(--navy); color: #fff; }
.btn-start { background: var(--ok); color: #fff; font-size: 1.2rem; padding: 18px; }
.btn-stop { background: var(--stop); color: #fff; font-size: 1.2rem; padding: 18px; }
.btn-ghost { background: transparent; color: var(--navy); border: 1.5px solid #c9d0ea; }
.btn-amber { background: var(--amber); color: #fff; }
.actions { display: grid; gap: 8px; margin-top: 12px; }
.actions.two { grid-template-columns: 1fr 1fr; }

.live {
  text-align: center; padding: 8px 0 4px;
}
.live .clock {
  font-variant-numeric: tabular-nums;
  font-size: 3rem; font-weight: 800; letter-spacing: -0.04em; color: var(--navy-deep);
}
.live .where { color: var(--muted); margin-top: 2px; }

.todo { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.todo:last-child { border-bottom: 0; }
.todo input { width: 22px; height: 22px; margin-top: 2px; }
.todo.done span { text-decoration: line-through; color: var(--muted); }
.todo small { display: block; color: var(--muted); }

.entry {
  padding: 12px 0; border-bottom: 1px solid var(--line);
  display: grid; grid-template-columns: 1fr auto; gap: 8px;
}
.entry b { display: block; }
.muted { color: var(--muted); font-size: .88rem; }
.err { color: var(--stop); font-size: .9rem; min-height: 1.2em; }

.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.tabs button {
  flex: 1; border: 0; background: rgba(255,255,255,.14); color: #fff;
  padding: 10px; border-radius: 12px; font-weight: 700;
}
.tabs button.on { background: #fff; color: var(--navy); }

table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 6px; border-bottom: 1px solid var(--line); }
td { padding: 9px 6px; border-bottom: 1px solid #f0ebe3; vertical-align: top; }
.loc-card h3 { margin: 0 0 4px; }
.hours-big { font-size: 1.6rem; font-weight: 800; color: var(--navy); }
.dash-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
.kpi-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px;
}
.kpi {
  background: var(--card); border-radius: 18px; padding: 16px 18px;
  box-shadow: var(--shadow); border: 1px solid rgba(255,255,255,.6);
}
.kpi span { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.kpi b { display: block; margin-top: 6px; font-size: 1.45rem; color: var(--navy); }
.dash-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 14px; }
.loc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.loc-card-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.bar-row { margin: 10px 0 14px; }
.bar-meta { display: flex; justify-content: space-between; font-size: .9rem; margin-bottom: 6px; }
.bar { height: 10px; background: #ece7dc; border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--navy), #5b6fd4); border-radius: 99px; }
.bar-alt i { background: linear-gradient(90deg, #c9842a, #e0b15a); }
@media (max-width: 900px) {
  .kpi-grid, .dash-grid, .loc-grid { grid-template-columns: 1fr; }
}
.werf-head {
  width: 100%; display: flex; justify-content: space-between; align-items: center;
  gap: 12px; border: 0; background: transparent; text-align: left; padding: 12px 2px;
  font: inherit; cursor: pointer; color: inherit; min-height: 48px;
}
.werf-body { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 4px; }
.werf-body h3 { margin: 8px 0 6px; font-size: .95rem; }
.info-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 0;
  background: #fff; color: var(--navy); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(18,23,42,.18);
}
.loc-info-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.loc-info-body { background: #f3efe6; border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; }
.loc-info-body p { margin: 0 0 8px; }
.loc-edit { border-bottom: 1px solid var(--line); padding: 12px 0; }
.entry-edit { border-top: 1px solid var(--line); padding: 12px 0; }
.log-row { border-bottom: 1px solid var(--line); }

.hidden { display: none !important; }
.topbar-actions { margin-left: auto; display: flex; gap: 8px; }
.topbar-actions button { width: auto; padding: 8px 12px; font-size: .85rem; }
.menu-wrap { margin-left: auto; position: relative; }
.menu-btn { width: auto; padding: 8px 14px; font-size: .9rem; background: rgba(255,255,255,.14); color: #fff; border-color: transparent; }
.menu-drop {
  position: absolute; right: 0; top: 42px; min-width: 180px;
  background: #fff; color: var(--ink); border-radius: 14px;
  box-shadow: var(--shadow); overflow: hidden; z-index: 20;
}
.menu-drop button {
  display: block; width: 100%; border: 0; background: #fff; text-align: left;
  padding: 12px 14px; font-weight: 650; cursor: pointer;
}
.menu-drop button:hover { background: #f3efe6; }

@media (max-width: 640px) {
  .row { grid-template-columns: 1fr; }
  .brand h1 { font-size: .92rem; }
  .greet-full { display: none; }
  .greet-short { display: inline; }
  .tabs button { flex: 1 1 auto; min-height: 42px; }
  .menu-drop { min-width: 200px; }
  .card { padding: 16px 14px; }
}

.photo-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px; margin: 10px 0;
}
.photo-grid img, .photo-item img {
  width: 100%; height: 110px; object-fit: cover; border-radius: 12px; display: block;
}
.photo-item { margin: 0; }
.photo-item figcaption { font-size: .72rem; color: var(--muted); margin-top: 4px; display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.photo-add { display: block; text-align: center; margin-top: 8px; cursor: pointer; }

.photo-bar { margin: 8px 0 4px; }
.photo-item { position: relative; margin: 0; }
.photo-x {
  position: absolute; top: 6px; right: 6px; width: 26px; height: 26px;
  border: 0; border-radius: 50%; background: rgba(18,23,42,.82); color: #fff;
  font-size: 16px; line-height: 1; cursor: pointer; display: grid; place-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.photo-ask {
  margin-top: 10px; background: #f3efe6; border-radius: 16px; padding: 12px 14px;
}

.loc-tools { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; background: var(--navy); color: #fff;
}
.icon-btn.icon-cam { background: var(--amber); color: #fff; }

.okmsg { color: var(--ok); font-weight: 700; margin: 8px 0; }
.upwrap { height: 8px; background: #ece7dc; border-radius: 99px; overflow: hidden; margin-top: 10px; }
.upbar { height: 100%; background: linear-gradient(90deg, var(--navy), #5b6fd4); width: 0; }
button:disabled { opacity: .55; pointer-events: none; }
.photo-day h3 { margin: 12px 0 8px; font-size: .9rem; color: var(--muted); }
.lightbox {
  position: fixed; inset: 0; background: rgba(10,14,30,.88); z-index: 80;
  display: grid; place-items: center; padding: 20px;
}
.lightbox-inner { max-width: 96vw; text-align: center; color: #fff; }
.lightbox-inner img { max-width: 96vw; max-height: 78vh; border-radius: 12px; background: #1a2658; }
.lightbox-wait { margin: 0 0 10px; font-weight: 700; }
.photo-dl {
  position: absolute; top: 6px; left: 6px; width: 26px; height: 26px;
  border-radius: 50%; background: rgba(18,23,42,.82); color: #fff;
  font-size: 14px; display: grid; place-items: center; text-decoration: none;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
#photodlall { display: block; text-align: center; text-decoration: none; margin-bottom: 12px; }
.btn-mini {
  display: inline-block; padding: 8px 12px; border-radius: 12px;
  background: var(--navy); color: #fff; font-size: .82rem; font-weight: 700;
  text-decoration: none; width: auto;
}
#photodlall { margin: 0 0 10px; }
.lightbox-frame { position: relative; display: inline-block; max-width: 96vw; }
.lightbox-frame img { max-width: 96vw; max-height: 78vh; border-radius: 12px; display: block; }
.lb-btn {
  position: absolute; top: 10px; width: 36px; height: 36px; border: 0; border-radius: 50%;
  color: #fff; font-size: 18px; cursor: pointer; display: grid; place-items: center;
  text-decoration: none; box-shadow: 0 4px 14px rgba(0,0,0,.35);
}
.lb-dl { left: 10px; background: var(--navy); }
.lb-close { right: 10px; background: var(--stop); }
#camui { position: fixed; inset: 0; z-index: 90; background: #000; }
.cam-screen { height: 100%; display: flex; flex-direction: column; }
.cam-screen video, .cam-prev { flex: 1; width: 100%; object-fit: cover; background: #111; }
.cam-q { color: #fff; text-align: center; font-weight: 800; margin: 10px 16px 0; }
.cam-bar {
  display: grid; grid-template-columns: 72px 1fr 72px; align-items: center;
  padding: 18px 22px calc(18px + env(safe-area-inset-bottom, 0px));
  background: #000;
}
.cam-slot { width: 56px; height: 56px; }
.cam-shutter {
  justify-self: center;
  width: 72px; height: 72px; min-width: 72px; min-height: 72px;
  padding: 0; aspect-ratio: 1; flex: none;
  border-radius: 50%; border: 5px solid #fff;
  background: #fff; box-sizing: border-box;
  box-shadow: 0 0 0 3px #2a2a2a; cursor: pointer;
}
.cam-close {
  justify-self: end;
  width: 56px; height: 56px; min-width: 56px; border: 0; padding: 0;
  border-radius: 50%; background: #c0392b; color: #fff;
  font-size: 32px; line-height: 1; font-weight: 600;
  display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,.4);
}

.privacy-line { text-align: center; margin: 16px 0 0; }
.privacy-line a, a.menu-priv { color: var(--navy); font-size: .88rem; }
.menu-drop a.menu-priv { display: block; padding: 10px 14px; text-decoration: none; }
