/* Speed Electric portal + time clock */
:root {
  --text: #1d1d1f; --text-2: #6e6e73; --text-3: #86868b; --bg: #f5f5f7; --card: #fff; --line: #e5e5ea;
  --accent: #f5b400; --link: #0066cc; --green: #1f8a43; --red: #c9341f; --amber: #b07d00; --blue: #0066cc; --purple: #7d3fc6;
  --radius: 16px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.45; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { letter-spacing: -.02em; margin: 0 0 .5em; font-weight: 600; }
h2 { font-size: 1.15rem; }
.muted { color: var(--text-2); } .small { font-size: .85rem; }
img { max-width: 100%; }

/* Layout */
.side { position: fixed; inset: 0 auto 0 0; width: 236px; background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 18px 12px; z-index: 50; }
.side-brand { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--text); padding: 4px 10px 18px; font-size: 1.02rem; }
.side-brand:hover { text-decoration: none; }
.side-brand img { height: 32px; }
.side nav { display: grid; gap: 2px; flex: 1; align-content: start; overflow-y: auto; }
.side nav a { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 10px; color: var(--text); font-size: .93rem; }
.side nav a:hover { background: var(--bg); text-decoration: none; }
.side nav a[aria-current="page"] { background: var(--text); color: #fff; }
.side nav svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.side-user { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; align-items: center; border-top: 1px solid var(--line); padding: 14px 8px 0; }
.side-user b { display: block; font-size: .9rem; } .side-user small { color: var(--text-3); font-size: .78rem; }
.side-user .link { grid-column: 1 / -1; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: .8rem; }
.main { margin-left: 236px; min-height: 100vh; }
.top { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 12px; padding: 16px 32px; background: rgba(245,245,247,.85); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.top h1 { font-size: 1.6rem; margin: 0; }
.side-btn { display: none; background: none; border: 0; width: 36px; height: 36px; padding: 8px; cursor: pointer; }
.side-btn span { display: block; height: 2px; background: var(--text); margin: 5px 0; border-radius: 2px; }
.content { padding: 8px 32px 60px; max-width: 1280px; }
@media (max-width: 900px) {
  .side { transform: translateX(-100%); transition: transform .25s; box-shadow: 0 0 40px rgba(0,0,0,.15); }
  .side.open { transform: none; }
  .main { margin-left: 0; }
  .side-btn { display: block; }
  .top { padding: 12px 16px; } .top h1 { font-size: 1.3rem; }
  .content { padding: 4px 16px 60px; }
}

/* Cards & grids */
.card { background: var(--card); border-radius: var(--radius); padding: 22px; margin-bottom: 18px; }
.card > h2:first-child { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: 1fr 1fr; } .g3 { grid-template-columns: repeat(3, 1fr); } .g4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1000px) { .g4 { grid-template-columns: 1fr 1fr; } .g3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }
.grid > .card { margin-bottom: 0; }
.kpi { background: var(--card); border-radius: var(--radius); padding: 20px 22px; }
.kpi small { color: var(--text-2); font-size: .85rem; display: block; }
.kpi b { font-size: 2rem; font-weight: 600; letter-spacing: -.03em; display: block; margin-top: 4px; }
.kpi span { font-size: .82rem; color: var(--text-3); }
a.kpi:hover { text-decoration: none; box-shadow: 0 6px 20px rgba(0,0,0,.06); }
a.kpi { color: var(--text); }

/* Tables */
.table-wrap { overflow-x: auto; margin: 0 -22px; padding: 0 22px; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; font-weight: 500; color: var(--text-3); font-size: .8rem; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.low td { background: #fff6e0; }
tfoot td { font-weight: 600; border-top: 2px solid var(--line); }
.empty { text-align: center; color: var(--text-3); padding: 30px; }

/* Badges */
.badge { display: inline-block; font-size: .74rem; font-weight: 600; padding: 2px 8px; border-radius: 20px; white-space: nowrap; }
.badge.green { background: #e3f4e8; color: var(--green); } .badge.red { background: #fde7e4; color: var(--red); }
.badge.amber { background: #fdf1d4; color: var(--amber); } .badge.blue { background: #e1eefb; color: var(--blue); }
.badge.purple { background: #efe5fa; color: var(--purple); } .badge.gray { background: #ececf0; color: var(--text-2); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--green); margin-right: 6px; box-shadow: 0 0 0 3px #e3f4e8; }

/* Forms */
label { display: block; font-size: .85rem; font-weight: 500; margin-bottom: 12px; }
input, select, textarea { display: block; width: 100%; margin-top: 5px; font: inherit; font-size: .95rem; padding: 10px 12px; border-radius: 10px; border: 1px solid #d2d2d7; background: #fff; color: var(--text); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--link); box-shadow: 0 0 0 3px rgba(0,102,204,.15); }
input[type="checkbox"] { display: inline; width: auto; margin: 0 6px 0 0; }
textarea { min-height: 90px; resize: vertical; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0 14px; }
.inline { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 16px; }
.inline label { margin: 0; flex: 1; min-width: 140px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 500; font-size: .92rem; background: var(--text); color: #fff; border: 0; border-radius: 980px; padding: 10px 18px; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #333; text-decoration: none; }
.btn.light { background: #e8e8ed; color: var(--text); } .btn.light:hover { background: #dcdce1; }
.btn.danger { background: #fde7e4; color: var(--red); }
.btn.sm { padding: 6px 12px; font-size: .82rem; }
.link { background: none; border: 0; color: var(--link); font: inherit; cursor: pointer; padding: 0; }
.actions-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
details > summary { cursor: pointer; color: var(--link); list-style: none; font-weight: 500; }
details > summary::-webkit-details-marker { display: none; }
details[open] > summary { margin-bottom: 14px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs a { padding: 6px 14px; border-radius: 980px; background: #e8e8ed; color: var(--text); font-size: .85rem; }
.tabs a.on { background: var(--text); color: #fff; }
.tabs a:hover { text-decoration: none; }

.alert { padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; font-size: .92rem; }
.alert.ok { background: #e3f4e8; color: #135c2c; } .alert.err { background: #fde7e4; color: #8e2312; } .alert.info { background: #e1eefb; color: #0b4a8b; }

/* Charts */
.bars { display: flex; align-items: stretch; gap: 3px; padding-bottom: 20px; }
.bars .col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; position: relative; min-width: 0; }
.bars .col i { display: block; background: var(--text); border-radius: 4px 4px 0 0; min-height: 2px; }
.bars .col:hover i { background: var(--accent); }
.bars .col small { position: absolute; bottom: -19px; left: 50%; transform: translateX(-50%); font-size: .68rem; color: var(--text-3); white-space: nowrap; }
.hbar { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: .88rem; }
.hbar .bar { grid-column: 1 / -1; height: 6px; border-radius: 6px; background: var(--bg); overflow: hidden; margin-bottom: 8px; }
.hbar .bar i { display: block; height: 100%; background: var(--accent); border-radius: 6px; }
.progress { height: 8px; border-radius: 8px; background: var(--bg); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--green); }

/* Feed */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: grid; grid-template-columns: 34px 1fr; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.feed li:last-child { border-bottom: 0; }
.feed .avatar { width: 34px; height: 34px; }
.feed p { margin: 4px 0 0; white-space: pre-wrap; }
.feed img { border-radius: 10px; margin-top: 10px; max-height: 320px; }
.feed small { color: var(--text-3); }

/* Card URL / QR */
.card-url { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .8rem; background: var(--bg); padding: 8px 10px; border-radius: 8px; word-break: break-all; }
.qr { background: #fff; padding: 10px; display: inline-block; border-radius: 10px; border: 1px solid var(--line); }

/* Auth & clock pages */
body.auth, body.clock { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-card, .clock-card { width: 100%; max-width: 380px; background: #fff; border-radius: 22px; padding: 34px 28px; text-align: center; box-shadow: 0 10px 40px rgba(0,0,0,.06); }
.auth-card form, .clock-card form { text-align: left; margin-top: 18px; }
.auth-card .btn, .clock-card .btn { width: 100%; margin-top: 6px; padding: 13px; font-size: 1rem; }
.auth-logo { height: 64px; margin: 0 auto 14px; display: block; }
.auth-card h1, .clock-card h1 { font-size: 1.5rem; }
body.clock { background: #000; }
.clock-card { max-width: 420px; }
.clock-hello { font-size: 1.1rem; margin: 0; }
.clock-time { font-size: 3.6rem; font-weight: 600; letter-spacing: -.04em; line-height: 1.1; margin: 6px 0; font-variant-numeric: tabular-nums; }
.clock-status { color: var(--text-2); margin: 0 0 6px; }
.clock-status.on { color: var(--green); font-weight: 600; }
.btn.big { padding: 20px !important; font-size: 1.25rem !important; border-radius: 18px; margin-top: 10px; }
.btn.big.in { background: var(--green); } .btn.big.out { background: var(--red); }
.btn.big:disabled { opacity: .6; }
.pin { font-size: 1.6rem; text-align: center; letter-spacing: .4em; }
.clock-card .alert { margin-top: 16px; font-size: 1.05rem; font-weight: 500; }
.clock-card .link { margin-top: 18px; }
