:root {
  color-scheme: dark;
  --bg: #07101d;
  --panel: rgba(17, 29, 48, .86);
  --panel-2: rgba(24, 39, 63, .72);
  --line: rgba(255, 255, 255, .09);
  --text: #f5f8ff;
  --muted: #93a4bb;
  --accent: #58d7ff;
  --accent-2: #65f0bd;
  --danger: #ff6b7b;
  --warning: #ffc46b;
  --shadow: 0 30px 70px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 20% 0%, rgba(52, 135, 255, .18), transparent 35%),
    radial-gradient(circle at 100% 20%, rgba(64, 242, 189, .11), transparent 28%),
    var(--bg);
  color: var(--text);
}
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .42; }

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card {
  width: min(100%, 470px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 26px;
  padding: 34px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.auth-card.compact { width: min(100%, 420px); }
.brand-mark {
  width: 52px; height: 52px; border-radius: 16px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, var(--accent), var(--accent-2));
  color: #04131c; font-weight: 900; letter-spacing: -.04em;
  margin-bottom: 28px;
}
.eyebrow, .label {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .16em;
  color: var(--muted);
}
h1 { margin: 0; font-size: clamp(28px, 5vw, 42px); letter-spacing: -.04em; }
.muted { color: var(--muted); line-height: 1.6; }
.small { font-size: 13px; }
.auth-form { display: grid; gap: 16px; margin-top: 26px; }
.auth-form label, .device-config label { display: grid; gap: 8px; color: #c8d3e4; font-size: 13px; }
input {
  width: 100%; border: 1px solid var(--line); background: rgba(255,255,255,.045);
  color: var(--text); border-radius: 14px; padding: 14px 16px; outline: none;
}
input:focus { border-color: rgba(88,215,255,.65); box-shadow: 0 0 0 3px rgba(88,215,255,.09); }
button, .icon-link {
  border: 0; border-radius: 14px; padding: 13px 18px; font-weight: 800;
  transition: transform .15s ease, opacity .15s ease, background .15s ease;
}
button:not(:disabled):active { transform: translateY(1px) scale(.99); }
.primary { background: linear-gradient(135deg, var(--accent), #7fe8ff); color: #04131c; }
.secondary { background: rgba(255,255,255,.09); color: var(--text); border: 1px solid var(--line); }
.danger-ghost { background: rgba(255,107,123,.08); color: #ff9ba7; border: 1px solid rgba(255,107,123,.22); }
.large { min-height: 52px; }
.alert { padding: 12px 14px; border-radius: 12px; margin-top: 18px; font-size: 14px; }
.alert.error { color: #ffb6bf; background: rgba(255,107,123,.09); border: 1px solid rgba(255,107,123,.18); }

.app-shell { width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 34px 0 70px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 28px; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.icon-link { color: #b8c6da; text-decoration: none; background: rgba(255,255,255,.05); border: 1px solid var(--line); font-size: 13px; }
.badge { display: inline-flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 999px; font-size: 12px; font-weight: 800; border: 1px solid var(--line); }
.badge span { width: 8px; height: 8px; border-radius: 50%; }
.badge.online { color: #9dfbd5; background: rgba(101,240,189,.07); }
.badge.online span { background: var(--accent-2); box-shadow: 0 0 14px var(--accent-2); }
.badge.offline { color: #a9b7ca; background: rgba(255,255,255,.035); }
.badge.offline span { background: #65738a; }

.dashboard { display: grid; gap: 18px; }
.timer-card, .info-card, .device-config {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.hero-card { border-radius: 28px; padding: clamp(22px, 5vw, 40px); }
.section-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; }
.big-timer { font-variant-numeric: tabular-nums; font-size: clamp(42px, 9vw, 86px); font-weight: 800; letter-spacing: -.055em; line-height: 1; }
.status-pill { border-radius: 999px; padding: 9px 12px; font-size: 12px; font-weight: 800; white-space: nowrap; border: 1px solid var(--line); }
.status-pill.running { color: #97f3d0; background: rgba(101,240,189,.08); }
.status-pill.paused { color: #ffd18d; background: rgba(255,196,107,.08); }
.status-pill.finished { color: #8be5ff; background: rgba(88,215,255,.08); }
.status-pill.stopped { color: #a9b7ca; background: rgba(255,255,255,.04); }
.divider { height: 1px; background: var(--line); margin: 30px 0; }
.center { text-align: center; }
.time-inputs { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; align-items: start; gap: 14px; max-width: 650px; margin: 18px auto 30px; }
.time-inputs label { display: grid; gap: 9px; text-align: center; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.time-inputs input { text-align: center; font-size: clamp(28px, 6vw, 46px); font-weight: 800; padding: 15px 8px; font-variant-numeric: tabular-nums; }
.time-inputs b { font-size: clamp(28px, 6vw, 46px); line-height: 1.45; color: #62718a; }
.controls { display: grid; grid-template-columns: 1.25fr 1fr 1fr; gap: 12px; max-width: 720px; margin: 0 auto; }
.feedback { min-height: 22px; text-align: center; font-size: 13px; margin: 14px 0 0; }
.success-text { color: #8eecc7; }
.error-text { color: #ff9eaa; }
.info-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; }
.info-card { border-radius: 20px; padding: 22px; display: grid; gap: 6px; }
.info-card strong { font-size: 20px; }
.device-config { border-radius: 20px; overflow: hidden; }
.device-config summary { list-style: none; cursor: pointer; padding: 20px 22px; font-weight: 800; }
.device-config summary::-webkit-details-marker { display: none; }
.device-config-body { padding: 0 22px 24px; display: grid; gap: 16px; border-top: 1px solid var(--line); }
.copy-row { min-width: 0; background: rgba(255,255,255,.04); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; overflow: auto; }
code { color: #b9eefe; font-size: 12px; }
.token { word-break: break-all; }
.warning-text { color: #ffc989; font-size: 12px; margin: 0; }

@media (max-width: 680px) {
  .app-shell { width: min(100% - 20px, 1120px); padding-top: 20px; }
  .topbar { align-items: flex-start; }
  .topbar h1 { font-size: 30px; }
  .top-actions { flex-direction: column; align-items: flex-end; gap: 7px; }
  .section-head { align-items: center; }
  .big-timer { font-size: clamp(42px, 15vw, 66px); }
  .time-inputs { gap: 7px; }
  .time-inputs input { border-radius: 12px; }
  .controls { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr; }
  .hero-card { border-radius: 22px; }
}

@media (max-width: 430px) {
  .badge { padding: 7px 9px; font-size: 11px; }
  .icon-link { padding: 8px 10px; }
  .status-pill { padding: 7px 9px; }
  .time-inputs b { line-height: 1.55; }
}

/* KYB Timer v2 - token legible */
.token-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  overflow: visible;
}
.token-row code {
  min-width: 0;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: .12em;
  color: #d9f7ff;
}
.token-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.mini-button {
  min-height: 38px;
  padding: 9px 13px;
  border-radius: 11px;
  font-size: 12px;
  white-space: nowrap;
}

@media (max-width: 520px) {
  .token-row {
    align-items: stretch;
    flex-direction: column;
  }
  .token-row code {
    font-size: 14px;
  }
  .mini-button {
    width: 100%;
  }
}
