/* NY Visits — NYC subway-signage styling. Line colors carry meaning:
   S grey = not visited, N/Q/R/W yellow = 1 of 2, 4/5/6 green = done, B/D/F/M orange = review,
   1/2/3 red = flagged, A/C/E blue = routes, G lime = brand (Brooklyn's own line). */
:root {
	--mta-ace: #0039A6; --mta-bdfm: #FF6319; --mta-g: #6CBE45; --mta-jz: #996633; --mta-l: #A7A9AC;
	--mta-nqrw: #FCCC0A; --mta-123: #EE352E; --mta-456: #00933C; --mta-7: #B933AD; --mta-s: #808183;
	--font: "Helvetica Neue", Helvetica, Arial, "Nimbus Sans", system-ui, sans-serif;
	--radius: 6px;
}
:root, :root[data-theme="dark"] {
	--bg: #0b0b0c; --panel: #151517; --panel-2: #1d1d20; --line: #2c2c31; --text: #f4f4f5; --muted: #a1a1aa;
	--sign: #000; --sign-text: #fff; --input: #0f0f11; --shadow: 0 1px 0 rgba(255,255,255,.04), 0 8px 24px rgba(0,0,0,.4);
}
:root[data-theme="light"] {
	--bg: #f3f1ec; --panel: #ffffff; --panel-2: #f7f6f2; --line: #dedbd3; --text: #111; --muted: #5f5f66;
	--sign: #111; --sign-text: #fff; --input: #fff; --shadow: 0 1px 2px rgba(0,0,0,.06), 0 6px 18px rgba(0,0,0,.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
h1, h2, h3 { font-weight: 700; letter-spacing: -.01em; margin: 0 0 .6rem; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
a { color: var(--mta-g); }

/* signage */
.sign { display: flex; align-items: center; gap: .7rem; }
.sign strong { display: block; font-size: 18px; letter-spacing: -.01em; }
.sign .sub { display: block; font-size: 12px; color: #c9c9cf; }
.adchips { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .15rem; }
.adchips button { font: 600 11px var(--font); color: #c9c9cf; background: transparent; border: 1px solid #3f3f46; border-radius: 999px; padding: .1rem .5rem; cursor: pointer; }
.adchips button:hover { color: #fff; border-color: #a1a1aa; }
.adchips button.on { background: var(--mta-g); border-color: var(--mta-g); color: #000; }
.adchips button i { font-style: normal; opacity: .7; margin-left: .25rem; }
.tile.go { cursor: pointer; transition: transform .08s, border-color .08s; }
.tile.go:hover { border-color: var(--mta-g); transform: translateY(-1px); }
.filter-note { font-size: 12px; color: var(--mta-g); margin: 0 0 .6rem; }
.bullet { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; font-weight: 700; color: #fff; font-size: 14px; flex: none; }
.bullet.g { background: var(--mta-g); color: #000; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: .45rem; vertical-align: 0; }
.ace { background: var(--mta-ace); } .bdfm { background: var(--mta-bdfm); } .nqrw { background: var(--mta-nqrw); }
.s4 { background: var(--mta-456); } .r123 { background: var(--mta-123); } .l7 { background: var(--mta-7); }
.jz { background: var(--mta-jz); } .s { background: var(--mta-s); }

.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 1.2rem; padding: .55rem 1rem;
	background: var(--sign); color: var(--sign-text); border-bottom: 3px solid #fff; }
.topbar .right { margin-left: auto; display: flex; align-items: center; gap: .6rem; }
.tabs { display: flex; gap: .15rem; overflow-x: auto; scrollbar-width: none; }
.tabs button { background: none; border: 0; color: #d4d4d8; padding: .55rem .7rem; font: 600 13px var(--font); border-radius: var(--radius); cursor: pointer; white-space: nowrap; }
.tabs button:hover { background: #1f1f23; color: #fff; }
.tabs button.active { background: #fff; color: #000; }
.who { font-size: 12px; color: #c9c9cf; }
.icon { background: none; border: 1px solid #3f3f46; color: #fff; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 15px; }

main { padding: 1rem; max-width: 1500px; margin: 0 auto; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 1rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1rem; }
.scroll { overflow: auto; max-height: 60vh; }
.row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: end; margin-bottom: .75rem; }
.fine { font-size: 12px; color: var(--muted); }
.err { color: var(--mta-123); min-height: 1.2em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1rem 0; }

/* forms */
label { display: flex; flex-direction: column; gap: .25rem; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: .6rem; }
label.chk { flex-direction: row; align-items: center; gap: .45rem; color: var(--text); font-weight: 500; }
input, select { font: 14px var(--font); color: var(--text); background: var(--input); border: 1px solid var(--line); border-radius: var(--radius); padding: .5rem .6rem; min-width: 0; }
input:focus, select:focus, .btn:focus-visible { outline: 2px solid var(--mta-g); outline-offset: 1px; }
form.inline { display: flex; flex-wrap: wrap; gap: .5rem; }
.btn { font: 600 13px var(--font); border-radius: 999px; padding: .5rem 1rem; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); cursor: pointer; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--mta-g); border-color: var(--mta-g); color: #000; }
.btn.danger { background: transparent; border-color: var(--mta-123); color: var(--mta-123); }
.btn.ghost { background: transparent; color: inherit; border-color: #3f3f46; }
.btn.sm { padding: .3rem .7rem; font-size: 12px; }

/* tables */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: .5rem; border-bottom: 2px solid var(--line); position: sticky; top: 0; background: var(--panel); white-space: nowrap; }
td { padding: .45rem .5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr.clickable { cursor: pointer; } tr.clickable:hover td, tr.sel td { background: var(--panel-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.pill { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: 11px; font-weight: 700; color: #000; }
.pill.ok { background: var(--mta-456); color: #fff; } .pill.review, .pill.not_found, .pill.error { background: var(--mta-bdfm); }
.pill.pending { background: var(--mta-s); color: #fff; } .pill.flag { background: var(--mta-123); color: #fff; }
.pill.active { background: var(--mta-g); } .pill.ended { background: var(--mta-l); }
.progress { height: 8px; border-radius: 99px; background: var(--panel-2); overflow: hidden; display: flex; min-width: 120px; }
.progress i { display: block; height: 100%; }

/* tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: .9rem 1rem; display: flex; gap: .8rem; align-items: center; box-shadow: var(--shadow); }
.tile .bullet { width: 40px; height: 40px; font-size: 13px; }
.tile b { display: block; font-size: 24px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tile span { font-size: 12px; color: var(--muted); }
.bars { display: flex; align-items: end; gap: 6px; height: 180px; padding-top: 1rem; }
.bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: end; font-size: 10px; color: var(--muted); }
.bars .bar i { width: 100%; max-width: 34px; background: var(--mta-g); border-radius: 4px 4px 0 0; min-height: 2px; }
.bars .bar i.second { background: var(--mta-nqrw); border-radius: 0; }

/* maps */
.map-tab { position: relative; height: calc(100vh - 62px); margin: -1rem; }
#map, #route-map { position: absolute; inset: 0; }
.map-panel { position: absolute; top: 1rem; left: 1rem; width: 290px; max-height: calc(100% - 2rem); overflow: auto; z-index: 2; }
.map-panel.wide { width: 420px; }
.legend { display: grid; grid-template-columns: 1fr 1fr; gap: .3rem; font-size: 12px; margin: .4rem 0; }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: .35rem; vertical-align: -1px; border: 2px solid rgba(255,255,255,.7); }
.maplibregl-popup-content { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 8px; font: 13px var(--font); }
.maplibregl-popup-tip { border-top-color: var(--panel) !important; border-bottom-color: var(--panel) !important; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { border-left: 3px solid var(--mta-ace); padding: .3rem 0 .6rem .8rem; position: relative; cursor: pointer; }
.timeline li::before { content: ""; position: absolute; left: -8px; top: .55rem; width: 13px; height: 13px; border-radius: 50%; background: var(--panel); border: 3px solid var(--mta-ace); }
.timeline li.has-visit::before { border-color: var(--mta-456); }
.timeline small { color: var(--muted); display: block; }

/* visits */
.visit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .8rem; }
.visit { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--panel-2); }
.visit .ph { aspect-ratio: 4/3; background: #000 center/cover no-repeat; cursor: zoom-in; }
.visit .meta { padding: .6rem .7rem; font-size: 12px; }
.visit .meta b { font-size: 13px; display: block; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 1rem;
	background: linear-gradient(180deg, rgba(0,0,0,.65), rgba(0,0,0,.85)), repeating-linear-gradient(90deg, #7a3b2e 0 46px, #6b3327 46px 48px), #7a3b2e; }
.login-card { width: min(380px, 100%); background: var(--panel); border-radius: 12px; padding: 1.4rem; border-top: 6px solid var(--mta-g); box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.login-card .sign { margin-bottom: 1.2rem; } .login-card h1 { font-size: 22px; margin: 0; } .login-card p { margin: 0; color: var(--muted); }
.login-card .btn { width: 100%; margin-top: .4rem; }
.result { background: var(--panel-2); padding: .7rem; border-radius: 8px; font-size: 12px; white-space: pre-wrap; max-height: 260px; overflow: auto; }
.secret { margin-top: .8rem; padding: .8rem; border-radius: 8px; border: 2px dashed var(--mta-nqrw); font: 13px ui-monospace, Menlo, monospace; }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.88); z-index: 50; display: grid; place-items: center; padding: 2rem; }
.lightbox img { max-width: 100%; max-height: 85vh; border-radius: 8px; }
.lightbox button { position: absolute; top: 1rem; right: 1rem; color: #fff; }
.toast { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); background: var(--sign); color: #fff; padding: .6rem 1rem; border-radius: 999px; z-index: 60; border: 1px solid #3f3f46; font-weight: 600; }

@media (max-width: 760px) {
	.topbar { flex-wrap: wrap; gap: .5rem; }
	.topbar .right { margin-left: 0; }
	.map-panel, .map-panel.wide { width: auto; right: 1rem; max-height: 45%; }
	main { padding: .75rem 16px; }
}

/* leads table + edit dialog */
.bulk { background: var(--panel-2); border-radius: 8px; padding: .5rem .7rem; }
.bulk label { margin-bottom: 0; }
td.chk, th.chk { width: 28px; }
.dlg { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--text); padding: 1.2rem; width: min(560px, calc(100vw - 32px)); }
.dlg::backdrop { background: rgba(0,0,0,.6); }
.dlg input, .dlg select { width: 100%; }
.grid2c { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; } .grid3c { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .6rem; }
.row.end { margin: .8rem 0 0; }

textarea { font: 14px var(--font); color: var(--text); background: var(--input); border: 1px solid var(--line); border-radius: var(--radius); padding: .5rem .6rem; width: 100%; }
.chips-pick { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; }
.chips-pick label { flex-direction: row; align-items: center; gap: .3rem; margin: 0; padding: .25rem .6rem; border: 1px solid var(--line); border-radius: 999px; color: var(--text); font-weight: 500; }

.qr { display: grid; place-items: center; background: #fff; border-radius: 10px; padding: 12px; margin: .6rem auto; width: fit-content; }
.qr svg, .qr img { width: 240px; height: 240px; display: block; }
#inv-url { width: 100%; font: 12px ui-monospace, Menlo, monospace; }
