/* Dark "light & shadow" glow cards */
:root {
  --bg: #050507;
  --card: rgba(22, 22, 30, 0.72);
  --card-solid: #121219;
  --ink: #f4f4f8;
  --muted: #8d8da0;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --blue: #3d6bff;
  --violet: #8b5cf6;
  --pink: #ff5fa8;
  --cyan: #4cc9ff;
  --green: #3ee07f;
  --danger: #ff6b7d;
  --grad: linear-gradient(135deg, #4a7bff 0%, #8b5cf6 55%, #d65cff 100%);
  --radius: 26px;
  --brand: #8b5cf6;
  --brand-ink: #fff;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
  overflow-x: hidden;
}
/* ambient light in the background */
body::before {
  content: ""; position: fixed; inset: -20vmax; z-index: -1; pointer-events: none;
  background:
    radial-gradient(40vmax 30vmax at 85% 0%, rgba(139, 92, 246, .22), transparent 70%),
    radial-gradient(35vmax 30vmax at 0% 45%, rgba(61, 107, 255, .16), transparent 70%),
    radial-gradient(30vmax 25vmax at 90% 95%, rgba(255, 95, 168, .12), transparent 70%);
  filter: blur(10px);
}
.wrap { max-width: 520px; margin: 0 auto; padding: 0 16px 110px; }
header.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 16px 14px; max-width: 520px; margin: 0 auto;
}
.logo { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 20px; letter-spacing: -.02em; }
.logo img { width: 36px; height: 36px; border-radius: 11px; box-shadow: 0 0 24px rgba(139, 92, 246, .55); }
.who {
  color: var(--ink); font: inherit; font-size: 14px; background: rgba(255,255,255,.06);
  border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; cursor: pointer;
}

/* glow card */
.card {
  position: relative; overflow: hidden; isolation: isolate;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 14px;
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 20px 50px -20px rgba(0,0,0,.8);
}
.card::before {
  content: ""; position: absolute; z-index: -1; pointer-events: none;
  left: -15%; right: -15%; bottom: -60%; height: 115%;
  background: radial-gradient(closest-side, var(--glow, rgba(61,107,255,.55)), transparent);
  filter: blur(28px); opacity: .85;
}
.card::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,.05), transparent 40%);
}
/* each card gets its own colour of light */
#tab-log .card:nth-child(1) { --glow: rgba(76, 201, 255, .6); }
#tab-log .card:nth-child(2) { --glow: rgba(139, 92, 246, .7); }
#tab-log .card:nth-child(3) { --glow: rgba(214, 92, 255, .75); }
#tab-log .card:nth-child(3)::before { opacity: .8; }
#tab-log .card:nth-child(4) { --glow: rgba(61, 107, 255, .75); }
#setup .card { --glow: rgba(139, 92, 246, .8); }
#setup .card::before { opacity: .9; bottom: -55%; }

.label {
  font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase;
  letter-spacing: .12em; margin: 0 0 12px;
}
h2 { font-size: 28px; letter-spacing: -.03em; line-height: 1.15; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.chip {
  border: 1px solid var(--line-strong); background: rgba(255,255,255,.04); color: var(--ink);
  border-radius: 999px; padding: 10px 16px; font: inherit; font-weight: 600; cursor: pointer;
  min-height: 44px; transition: background .15s, box-shadow .15s, transform .1s;
}
.chip:active { transform: scale(.96); }
.chip.on {
  background: var(--grad); border-color: transparent; color: #fff;
  box-shadow: 0 0 22px rgba(139, 92, 246, .55);
}
.chip.small { padding: 6px 13px; min-height: 36px; font-size: 14px; }
#hourChips { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
#hourChips .chip { padding: 10px 0; }

input, select, textarea {
  font: inherit; color: var(--ink); background: rgba(0,0,0,.35); border: 1px solid var(--line-strong);
  border-radius: 14px; padding: 12px 14px; width: 100%; min-height: 48px;
}
input::placeholder, textarea::placeholder { color: #6c6c7e; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px rgba(139,92,246,.25); }
input[type="time"], input[type="date"], input[type="month"] { font-size: 19px; font-weight: 700; }
::-webkit-calendar-picker-indicator { filter: invert(1) brightness(1.4); opacity: .8; cursor: pointer; }
select option { background: var(--card-solid); }

.stepper { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 18px; }
.stepper button {
  width: 52px; height: 52px; border-radius: 16px; border: 1px solid var(--line-strong);
  background: rgba(255,255,255,.05); color: var(--ink); font-size: 26px; cursor: pointer;
}
.stepper .val {
  font-size: 56px; font-weight: 800; letter-spacing: -.04em; line-height: 1; text-align: center; flex: 1;
  background: linear-gradient(180deg, #fff 30%, #c9b8ff); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.range { color: var(--muted); font-size: 15px; margin-top: 10px; text-align: center; letter-spacing: .02em; }

.search { position: relative; }
.results { margin-top: 10px; max-height: 260px; overflow-y: auto; border-radius: 14px; border: 1px solid var(--line); }
.results:empty { display: none; }
.results button {
  display: block; width: 100%; text-align: left; padding: 13px 14px; border: 0; border-bottom: 1px solid var(--line);
  background: rgba(10,10,16,.7); color: var(--ink); font: inherit; cursor: pointer;
}
.results button:last-child { border-bottom: 0; }
.results button:hover { background: rgba(139,92,246,.15); }
.results button small { color: var(--muted); display: block; font-size: 13px; }
.results button.add { color: #c4a8ff; font-weight: 700; }
.picked {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: linear-gradient(135deg, rgba(61,107,255,.22), rgba(139,92,246,.22));
  border: 1px solid rgba(139,92,246,.4); border-radius: 16px; padding: 14px 16px; font-weight: 700; font-size: 17px;
}
.picked button { background: rgba(255,255,255,.08); border: 0; border-radius: 999px; color: var(--ink); font: inherit; font-size: 14px; cursor: pointer; padding: 6px 12px; }

.go {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  padding: 16px 16px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 60%, transparent);
}
.go button, .btn {
  display: block; width: 100%; max-width: 520px; margin: 0 auto; border: 0; border-radius: 20px;
  background: var(--grad); color: #fff; font: inherit; font-size: 18px; font-weight: 800; letter-spacing: -.01em;
  padding: 16px; min-height: 60px; cursor: pointer;
  box-shadow: 0 10px 40px -8px rgba(139, 92, 246, .75), inset 0 1px 0 rgba(255,255,255,.3);
  transition: transform .1s, opacity .2s;
}
.go button:active, .btn:active { transform: scale(.98); }
.go button:disabled { background: rgba(255,255,255,.08); box-shadow: none; color: var(--muted); }
.btn.ghost {
  background: rgba(255,255,255,.05); color: var(--ink); border: 1px solid var(--line-strong);
  font-size: 16px; min-height: 48px; padding: 12px; box-shadow: none;
}

.tabs {
  display: flex; gap: 4px; background: rgba(255,255,255,.04); border: 1px solid var(--line);
  border-radius: 999px; padding: 5px; margin: 0 0 16px;
}
.tabs button { flex: 1; border: 0; background: none; color: var(--muted); font: inherit; font-weight: 700; padding: 10px; border-radius: 999px; cursor: pointer; }
.tabs button.on { background: rgba(255,255,255,.1); color: var(--ink); box-shadow: inset 0 1px 0 rgba(255,255,255,.12); }

/* history */
#tab-history .card:nth-child(2) { --glow: rgba(214, 92, 255, .8); }
#tab-history .card:nth-child(2)::before { opacity: .9; }
.day { margin: 18px 6px 8px; display: flex; justify-content: space-between; font-weight: 600; color: var(--muted); font-size: 13px; letter-spacing: .04em; text-transform: uppercase; }
#list .card { --glow: rgba(61, 107, 255, .45); padding: 6px 18px; }
#list .card::before { opacity: .35; }
.entry { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.entry:last-child { border-bottom: 0; }
.entry b { display: block; }
.entry span { color: var(--muted); font-size: 14px; }
.entry .h { font-weight: 800; font-size: 20px; white-space: nowrap; color: var(--ink); letter-spacing: -.02em; }
.del { background: none; border: 0; color: var(--danger); font-size: 18px; cursor: pointer; padding: 6px 8px; opacity: .7; }
.del:hover { opacity: 1; }
.pending { color: #ffc46b !important; font-size: 12px; font-weight: 700; }
.total { display: flex; justify-content: space-between; align-items: flex-end; font-weight: 700; }
.total span:first-child { color: var(--muted); text-transform: uppercase; letter-spacing: .12em; font-size: 12px; }
.total span:last-child { font-size: 52px; font-weight: 800; letter-spacing: -.04em; line-height: 1; }

.toast {
  position: fixed; left: 50%; bottom: 104px; transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none;
  background: rgba(30,30,42,.92); border: 1px solid var(--line-strong); color: var(--ink);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  padding: 12px 18px; border-radius: 16px; font-weight: 600; box-shadow: 0 10px 40px rgba(0,0,0,.6);
  transition: .2s; display: flex; gap: 14px; align-items: center; z-index: 10; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
.toast button { background: none; border: 0; color: #c4a8ff; font: inherit; font-weight: 800; cursor: pointer; }
.empty { text-align: center; color: var(--muted); padding: 24px 0; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 14px; }
code { background: rgba(255,255,255,.08); padding: 1px 6px; border-radius: 6px; }

/* admin */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
tbody tr:hover td { background: rgba(255,255,255,.03); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.scroll { overflow-x: auto; }
#tab-logs .card:nth-child(1) { --glow: rgba(61, 107, 255, .6); }
#tab-logs .card:nth-child(2) { --glow: rgba(214, 92, 255, .8); }
#tab-logs .card:nth-child(2)::before { opacity: .85; }
#tab-logs .card:nth-child(3) { --glow: rgba(76, 201, 255, .35); }
#tab-logs .card:nth-child(3)::before { opacity: .3; }
#tab-sites .card { --glow: rgba(139, 92, 246, .55); }
#lock .card { --glow: rgba(139, 92, 246, .85); }
#lock .card::before { opacity: .9; }

#tab-history .grid2 { grid-template-columns: 1fr auto; }
#pdfBtn { white-space: nowrap; padding: 12px 18px; width: auto; }
