
@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@500;600;700;800&display=swap");

:root {
  --bg: #050308;
  --sidebar: #141414;
  --card: #1C1C1E;
  --card-hover: #232325;
  --head: #232325;
  --input: #18151C;
  --line: rgba(255, 255, 255, 0.06);
  --text: #F5F5F7;
  --muted: #8A8A93;
  --faint: #55555C;
  --highlight: #F7F5FF;
  --highlight-text: #0E0E12;
  --accent: #6B93FF;
  --accent-strong: #2F5BFF;
  --up: #94FDC4;
  --up-bg: rgba(148, 253, 196, 0.14);
  --down: #E87175;
  --down-bg: rgba(232, 113, 117, 0.14);
  --tile-blue: #89A4E9;
  --tile-orange: #E5A17C;
  --tile-yellow: #FEE388;
  --tile-green: #7BECAA;
  --tile-ink: #111111;
  --chip-ok: #6BE3A0;
  --chip-ok-bg: #24352F;
  --chip-bad: #F07C80;
  --chip-bad-bg: #35232A;
  --chip-warn: #F4C25B;
  --chip-warn-bg: #352F22;
  --primary: #FFFFFF;
  --primary-text: #0E0E12;
  --secondary: #232325;
  --radius-frame: 28px;
  --radius-card: 20px;
  --radius-tile: 16px;
  --radius-input: 12px;
  --radius-chip: 6px;
  --radius-pill: 999px;
  --ok: #6BE3A0;
  --flag: #F07C80;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Manrope, ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  font-weight: 500;
  font-size: 16px;
  line-height: 1.45;
  min-height: 100%;
}
body { padding: 0 0 48px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
#app {
  max-width: 430px;
  margin: 0 auto;
  padding: 0 16px 32px;
}
.app-body { min-width: 0; flex: 1; }
.sidebar { display: none; }

body.is-manager {
  padding: 24px;
  height: 100vh;
  overflow: hidden;
  box-sizing: border-box;
}
body.is-manager #app {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0;
  display: flex;
  align-items: stretch;
  height: 100%;
  min-height: 0;
  max-height: 100%;
  background: var(--bg);
  border-radius: var(--radius-frame);
  border: 1px solid var(--line);
  overflow: hidden;
}
body.is-manager .app-body {
  padding: 20px 24px 32px;
  overflow: auto;
  min-height: 0;
  flex: 1;
}
body.is-manager .top { display: none; }
body.is-manager #btn-signout { display: none !important; }

.sidebar {
  width: 72px;
  flex-shrink: 0;
  background: var(--sidebar);
  display: none;
  flex-direction: column;
  align-items: center;
  padding: 16px 0;
  gap: 8px;
}
body.is-manager .sidebar {
  display: flex;
}
.sidebar.hidden { display: none !important; }
.nav-logo {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--card);
  display: grid; place-items: center;
  margin-bottom: 8px;
  color: var(--accent);
}
.nav-logo svg { display: block; }
.nav-btn {
  width: 44px; height: 44px;
  border: 0; padding: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  display: grid; place-items: center;
}
.nav-btn svg { width: 20px; height: 20px; display: block; }
.nav-btn:hover { color: var(--text); background: var(--card); }
.nav-btn.on {
  background: #FFFFFF;
  color: var(--primary-text);
  border-radius: 12px;
}
.nav-spacer { flex: 1; min-height: 8px; }
.nav-btn.signout { color: var(--muted); }

.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 0 12px; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.mark {
  width: 44px; height: 44px; border-radius: 14px;
  background: var(--card);
  position: relative;
  flex-shrink: 0;
  border: 1px solid var(--line);
}
.mark::before {
  content: "";
  position: absolute; inset: 9px;
  border: 2px solid var(--accent); border-radius: 50%;
}
.mark-hands {
  position: absolute; left: 50%; top: 50%;
  width: 2px; height: 11px; background: var(--text);
  transform: translate(-50%, -90%);
  transform-origin: bottom center;
  border-radius: 2px;
}
.mark-hands::after {
  content: "";
  position: absolute; left: 50%; bottom: 0;
  width: 2px; height: 8px; background: var(--accent);
  transform: translateX(-50%) rotate(90deg);
  transform-origin: bottom center;
  border-radius: 2px;
}
h1 {
  font-size: 1.15rem; margin: 0; letter-spacing: -0.02em; font-weight: 700;
  color: var(--text);
}
.sub {
  margin: 0; font-size: 0.75rem; color: var(--muted);
  letter-spacing: 0.04em; text-transform: uppercase; font-weight: 500;
}
.now {
  display: flex; flex-direction: column; align-items: flex-end;
  font-variant-numeric: tabular-nums; font-size: 0.8rem; color: var(--muted);
  line-height: 1.25; white-space: nowrap; flex-shrink: 0; text-align: right;
}
.now-date, .now-time { display: block; }
.top { flex-wrap: nowrap; }
.top-right { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex-shrink: 0; }
.brand { min-width: 0; }

.banner {
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: var(--radius-tile);
  padding: 12px 16px;
  font-size: 0.84rem;
  margin-bottom: 16px;
}
.banner strong { color: var(--chip-warn); font-weight: 700; }

.card {
  background: var(--card);
  border-radius: var(--radius-card);
  padding: 20px;
  margin-bottom: 12px;
  position: relative;
}
.card h2, .page-title {
  font-size: 28px; line-height: 1.15; margin: 0 0 12px; font-weight: 700;
  letter-spacing: -0.02em;
}
.card h2.small, h3 {
  font-size: 0.95rem; margin: 16px 0 8px; font-weight: 700; letter-spacing: 0;
}
.muted { color: var(--muted); font-size: 0.9rem; font-weight: 500; }
.hidden { display: none !important; }

label {
  display: block; font-size: 13px; font-weight: 500; color: var(--muted);
  margin: 10px 0 4px;
}
select, input[type="text"], input[type="number"], input[type="password"], input[type="date"], input[type="datetime-local"], textarea {
  width: 100%; padding: 12px 14px;
  border: 0; border-radius: var(--radius-input);
  background: var(--input);
  color: var(--text);
  min-height: 44px;
}
textarea { min-height: 88px; resize: vertical; }
select:focus, input:focus, textarea:focus {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
input[type="checkbox"] { accent-color: var(--accent); width: auto; min-height: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 12px 22px;
  border-radius: var(--radius-pill); border: 0;
  background: var(--primary); color: var(--primary-text);
  font-weight: 700; letter-spacing: -0.01em;
  width: 100%;
  margin-top: 12px;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.secondary {
  background: var(--secondary); color: var(--text);
  border-radius: var(--radius-input);
  font-weight: 600;
}
.btn.gold { background: var(--primary); color: var(--primary-text); }
.btn.danger { background: var(--chip-bad-bg); color: var(--chip-bad); border-radius: var(--radius-input); }
.btn.small { min-height: 40px; width: auto; padding: 8px 16px; margin: 0; font-size: 0.9rem; }
.btn.clock {
  min-height: 64px; font-size: 1.1rem; font-weight: 800;
  margin-top: 16px;
}
.text-btn {
  background: none; border: 0; color: var(--accent); padding: 8px; min-height: 44px;
  font-size: 0.85rem; font-weight: 600; text-decoration: none;
}

.pin-pad {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px;
}
.pin-pad button {
  min-height: 56px; border-radius: var(--radius-input);
  border: 0; background: var(--input);
  font-size: 1.25rem; font-weight: 700; color: var(--text);
}
.pin-pad button:active { background: var(--card-hover); }
.pin-dots { display: flex; gap: 10px; justify-content: center; margin: 8px 0 4px; }
.pin-dots span {
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid var(--accent); background: transparent;
}
.pin-dots span.on { background: var(--accent); }

.status-hero { text-align: center; padding: 8px 0 4px; }
.status-hero .state {
  font-size: 1.7rem; margin: 0; color: var(--text); font-weight: 800;
  letter-spacing: -0.02em;
}
.status-hero .since { color: var(--muted); margin: 4px 0 0; font-size: 13px; font-weight: 500; }

.hours-row, .stat-grid, .status-tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 12px;
  width: 100%;
}
.stat-grid.four, .status-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.hours-box, .stat-card {
  background: var(--card);
  border-radius: var(--radius-tile);
  padding: 20px;
  position: relative;
  min-height: 112px;
  min-width: 0;
  overflow: hidden;
}
.hours-box .n, .stat-n {
  font-variant-numeric: tabular-nums;
  font-size: 36px; line-height: 1.05;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  display: inline-block;
  max-width: 100%;
  overflow-wrap: normal;
}
.hours-box .n { white-space: nowrap; }
.hours-box .l, .stat-l {
  font-size: 13px; font-weight: 500; color: var(--muted);
  margin: 0 0 8px;
}
.stat-sub, .hours-box .subline {
  font-size: 13px; font-weight: 500; color: var(--muted);
  margin-top: 6px;
}
.stat-top, .hours-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 8px;
}
.stat-line {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
}

.hours-box.highlight, .stat-card.highlight {
  background: var(--highlight);
  color: var(--highlight-text);
}
.hours-box.highlight .n,
.hours-box.highlight .l,
.hours-box.highlight .subline,
.stat-card.highlight .stat-n,
.stat-card.highlight .stat-l,
.stat-card.highlight .stat-sub {
  color: var(--highlight-text);
}
.hours-box.highlight .l, .stat-card.highlight .stat-l,
.hours-box.highlight .subline, .stat-card.highlight .stat-sub {
  color: rgba(14, 14, 18, 0.62);
}

.icon-arr {
  width: 40px; height: 40px; flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  display: grid; place-items: center;
  padding: 0;
  font-size: 16px; font-weight: 600; line-height: 1;
}
.stat-card.highlight .icon-arr,
.hours-box.highlight .icon-arr,
.icon-arr.strong {
  background: var(--accent-strong);
  border: 0;
  color: #fff;
}

.delta {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px; font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.delta.up { color: var(--up); background: var(--up-bg); }
.delta.down { color: var(--down); background: var(--down-bg); }
.stat-card.highlight .delta.up { color: #187A4A; background: rgba(22, 120, 74, 0.12); }
.stat-card.highlight .delta.down { color: #B42318; background: rgba(180, 35, 24, 0.1); }

.status-tiles { margin: 0 0 24px; }
.status-tile {
  border-radius: var(--radius-tile);
  padding: 16px 18px;
  color: var(--tile-ink);
  min-height: 88px;
  min-width: 0;
  overflow: hidden;
}
.status-tile .n {
  font-size: 32px; font-weight: 800; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums; line-height: 1.1;
}
.status-tile .l { font-size: 13px; font-weight: 500; margin-top: 4px; }
.status-tile.blue { background: var(--tile-blue); }
.status-tile.orange { background: var(--tile-orange); }
.status-tile.yellow { background: var(--tile-yellow); }
.status-tile.green { background: var(--tile-green); }

.dash-head { margin: 4px 0 24px; }
.hello {
  font-size: 28px; font-weight: 700; letter-spacing: -0.02em;
  margin: 0; line-height: 1.15;
}
.hello-date { margin: 6px 0 0; font-size: 13px; font-weight: 500; color: var(--muted); }
.section-gap { margin-top: 24px; }

.chart-card { padding: 20px; margin-bottom: 12px; }
.chart-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  margin-bottom: 12px;
}
.chart-head h2 { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: 0; }
.chart-wrap { position: relative; width: 100%; height: 200px; }
.chart-wrap svg { width: 100%; height: 100%; display: block; }
.chart-tip {
  position: absolute;
  pointer-events: none;
  background: #141414;
  color: var(--text);
  border-radius: var(--radius-pill);
  padding: 6px 10px;
  font-size: 12px; font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, -120%);
  transition: opacity 0.12s ease;
}
.chart-tip.on { opacity: 1; }
.chart-bar { cursor: pointer; }

.actions { display: grid; gap: 8px; margin-top: 8px; }
.flag, .geo-flag {
  margin-top: 10px; padding: 8px 12px; border-radius: 10px;
  background: var(--chip-bad-bg); color: var(--chip-bad); font-size: 0.85rem;
}
.geo-flag.ok { background: var(--chip-ok-bg); color: var(--chip-ok); }
.geo-flag.off { background: var(--input); color: var(--muted); }

.list { list-style: none; margin: 0; padding: 0 20px 0 0; box-sizing: border-box; }
.list li {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 0.92rem;
  min-width: 0;
}
.list li > * { min-width: 0; }
.list li > span:last-child { text-align: right; flex: 0 1 auto; }
.list li:last-child { border-bottom: 0; }

.tabs {
  display: flex; gap: 4px; overflow-x: auto; margin: 0 0 14px;
  padding-bottom: 4px; -webkit-overflow-scrolling: touch;
}
body.is-manager .tabs { display: none; }
.tabs button {
  flex: 0 0 auto; min-height: 44px; padding: 8px 14px;
  border: 0; border-radius: var(--radius-pill);
  background: transparent; color: var(--muted); font-weight: 600;
}
.tabs button.on { background: #fff; color: var(--primary-text); font-weight: 700; }

table { width: 100%; border-collapse: collapse; font-size: 13px; font-weight: 500; }
th, td { text-align: left; padding: 10px 8px; vertical-align: top; }
th {
  font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
  background: var(--head);
}
thead tr:first-child th:first-child { border-radius: 12px 0 0 0; }
thead tr:first-child th:last-child { border-radius: 0 12px 0 0; }
td { background: var(--input); border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: 0; }
tr:last-child td:first-child { border-radius: 0 0 0 12px; }
tr:last-child td:last-child { border-radius: 0 0 12px 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.est-banner {
  background: var(--chip-bad-bg); color: var(--chip-bad);
  border-radius: var(--radius-tile); padding: 12px 16px; margin-bottom: 16px;
  font-weight: 700; letter-spacing: -0.01em;
}
.est-banner span { display: block; font-weight: 500; font-size: 0.85rem; margin-top: 4px; color: #E8A0A3; }

.row-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.row-btns .btn { width: auto; flex: 0 1 auto; margin-top: 0; min-width: 140px; }
.err { color: var(--chip-bad); font-size: 0.9rem; margin-top: 8px; }
.okmsg { color: var(--chip-ok); font-size: 0.9rem; margin-top: 8px; }

.pill, .chip {
  display: inline-block; padding: 2px 8px;
  border-radius: var(--radius-chip);
  font-size: 11px; font-weight: 600; letter-spacing: 0;
  text-transform: none;
  background: var(--input); color: var(--muted);
}
.pill.warn, .chip.warn, .chip.estimate { background: var(--chip-warn-bg); color: var(--chip-warn); }
h2 .chip, .chart-head h2 .chip { margin-left: 8px; vertical-align: middle; position: relative; top: -2px; }
.pill.ok, .chip.ok { background: var(--chip-ok-bg); color: var(--chip-ok); }
.pill.bad, .chip.bad { background: var(--chip-bad-bg); color: var(--chip-bad); }
.pending { color: var(--chip-warn); font-size: 11px; font-weight: 600; margin-left: 6px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 10px; width: 100%; }
.form-grid > * { min-width: 0; }
@media (max-width: 560px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.scroll { overflow-x: auto; }
.footnote { font-size: 0.78rem; color: var(--muted); margin-top: 12px; }
.switch-link { text-align: center; margin-top: 8px; }
.rate-block { font-size: 0.85rem; padding: 10px 0; border-bottom: 1px solid var(--line); }
.rate-block a { color: var(--accent); }
.skel { height: 14px; background: var(--input); border-radius: 8px; animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.45; } }

.hello-staff {
  font-size: 28px; font-weight: 700; letter-spacing: -0.02em;
  margin: 0 0 4px; line-height: 1.15;
}

@media (max-width: 960px) {
  .stat-grid.four {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .stat-grid.four > .stat-card.highlight { grid-column: 1 / -1; }
  .status-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hours-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.is-manager {
    padding: 0;
    height: 100vh;
  }
  body.is-manager #app {
    margin: 0; border-radius: 0; border: 0;
    height: 100%;
    min-height: 0;
    max-height: 100%;
    flex-direction: column;
  }
  body.is-manager .app-body {
    padding: 16px 16px 96px;
    flex: 1;
    min-height: 0;
    overflow: auto;
  }
  body.is-manager .sidebar {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    width: auto; height: auto;
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
    z-index: 30;
    border-top: 1px solid var(--line);
  }
  body.is-manager .sidebar .nav-logo,
  body.is-manager .sidebar .nav-spacer { display: none; }
  body.is-manager .sidebar .nav-btn.on {
    background: #FFFFFF;
    color: var(--primary-text);
    border-radius: 12px;
  }
}

@media (max-width: 720px) {
  .hours-box, .stat-card { min-height: 0; padding: 16px; }
  .hours-box .n { font-size: 28px; white-space: nowrap; }
  .stat-n, .status-tile .n { font-size: 32px; }
  .card h2, .page-title, .hello, .hello-staff { font-size: 24px; }
  .dash-head { margin-bottom: 16px; }
  .banner { font-size: 0.78rem; padding: 8px 12px; margin-bottom: 12px; }
  .est-banner { margin-bottom: 12px; padding: 10px 14px; }
  .est-banner span { display: none; }
  .status-tile { min-height: 0; padding: 14px 16px; }
}

/* Used instead of inline styles so CSP style-src can stay strict. */
.scroll.mt-14 { margin-top: 14px; }
.scroll.mt-12 { margin-top: 12px; }
