* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html, body {
  width: 100%;
  background: #080808;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, sans-serif;
}
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.app {
  background: #0d0d0d;
  width: 100%;
  padding: 20px 18px;
  color: #f0f0f0;
}
@media (min-width: 720px) {
  .app {
    max-width: 700px;
    margin: 1rem auto;
    border-radius: 32px;
    padding: 24px 22px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.8);
    border: 1px solid #1a1a1a;
  }
}
@media (max-width: 450px) {
  .timer-big { font-size: 48px; }
  .metric-val { font-size: 22px; }
  .btn { padding: 8px 16px; font-size: 13px; }
}

/* ── Status bar ── */
.status-bar {
  padding: 13px 16px;
  border-radius: 14px;
  margin-bottom: 18px;
  font-weight: 400;
  font-size: 13.5px;
  border: 1px solid transparent;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.status-bar.ok {
  background: #111;
  border-color: #1e1e1e;
  color: #666;
}
.status-bar.warn {
  background: #161610;
  border-color: #2a2710;
  color: #c8c8c8;
}
.status-bar.danger {
  background: #180a0a;
  border-color: #2e1010;
  color: #f0f0f0;
}
.status-line {
  display: flex;
  align-items: center;
  gap: 8px;
}
.status-line svg {
  flex-shrink: 0;
  opacity: 0.75;
}

/* ── Top metrics ── */
.top-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.metric {
  background: #111;
  border-radius: 18px;
  padding: 14px 10px;
  border: 1px solid #1a1a1a;
}
.metric-lbl {
  font-size: 10px;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 8px;
}
.metric-val {
  font-size: 24px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.metric-sub {
  font-size: 11px;
  color: #444;
  margin-top: 5px;
}
.cv-ok     { color: #c0c0c0; }
.cv-warn   { color: #e8e8e8; }
.cv-danger { color: #ffffff; }
.cv-base   { color: #f0f0f0; }

/* ── Timer card ── */
.timer-card {
  background: #111;
  border-radius: 24px;
  padding: 24px 16px;
  margin-bottom: 18px;
  text-align: center;
  border: 1px solid #1a1a1a;
}
.state-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 18px;
  border-radius: 60px;
  margin-bottom: 18px;
  background: #171717;
  color: #666;
  border: 1px solid #222;
  font-size: 13px;
}
.state-pill.running {
  background: #180a0a;
  border-color: #2e1010;
  color: #e0e0e0;
}
.state-pill.resting {
  background: #0a1310;
  border-color: #162516;
  color: #a0a0a0;
}
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
  flex-shrink: 0;
}
.timer-big {
  font-size: 56px;
  font-weight: 400;
  font-family: monospace;
  letter-spacing: 4px;
  color: #f0f0f0;
  margin-bottom: 24px;
}
.btn-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.btn {
  padding: 10px 20px;
  border-radius: 44px;
  font-size: 13.5px;
  font-weight: 500;
  border: 1px solid #2a2a2a;
  background: #151515;
  color: #c8c8c8;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.btn:hover { background: #1d1d1d; border-color: #353535; }
.btn:active { transform: scale(0.96); }
.btn:disabled {
  opacity: 0.28;
  cursor: not-allowed;
  transform: none;
}
.export-btn {
  background: #151515;
  border-color: #333;
  color: #aaa;
}
.export-btn:hover { background: #1c1c1c; }

/* ── Progress cards ── */
.grid2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
.pcard {
  background: #111;
  border-radius: 18px;
  padding: 16px;
  border: 1px solid #1a1a1a;
}
.pcard-lbl {
  font-size: 10.5px;
  font-weight: 500;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 8px;
}
.pcard-val {
  font-size: 23px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  margin-bottom: 10px;
}
.pcard-sub {
  font-size: 10px;
  color: #555;
  margin-bottom: 12px;
}
.track {
  height: 4px;
  background: #1e1e1e;
  border-radius: 8px;
  overflow: hidden;
}
.fill {
  height: 100%;
  border-radius: 8px;
  transition: width 0.4s ease;
}
.f-danger { background: #888; }
.f-warn   { background: #5a5a5a; }
.f-ok     { background: #444; }
.f-info   { background: #333; }

/* ── Rest & Log cards ── */
.rest-card, .log-card {
  background: #111;
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 18px;
  border: 1px solid #1a1a1a;
}
.rest-meta {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  padding-top: 12px;
  border-top: 1px solid #1e1e1e;
  margin-top: 12px;
}
.rest-meta-item {
  font-size: 13px;
  color: #666;
}
.rest-meta-item span {
  font-weight: 600;
  color: #d0d0d0;
}
.rp-row, .log-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #1a1a1a;
  font-size: 13px;
  flex-wrap: wrap;
}
.rp-row:last-child, .log-entry:last-child { border-bottom: none; }
.badge {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 40px;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge-ok   { background: #161616; color: #999; border-color: #252525; }
.badge-info { background: #131313; color: #666; border-color: #222; }
.log-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.log-type {
  font-weight: 500;
  min-width: 58px;
}
.log-time {
  color: #666;
  flex: 1;
  font-family: monospace;
  font-size: 12px;
}
.log-dur {
  font-variant-numeric: tabular-nums;
  color: #888;
  font-size: 12px;
}
.sec-lbl {
  font-size: 10.5px;
  font-weight: 600;
  color: #555;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.law {
  font-size: 10px;
  color: #333;
  text-align: center;
  padding-top: 8px;
  border-top: 1px solid #181818;
  margin-top: 4px;
}
.law a { color: #444; text-decoration: none; }
.law a:hover { color: #777; }
.empty-msg {
  font-size: 13px;
  color: #444;
  text-align: center;
  padding: 12px 0;
}

/* ── Edit session button ── */
.edit-session-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: 1px solid #252525;
  border-radius: 20px;
  padding: 3px 9px;
  font-size: 11px;
  cursor: pointer;
  color: #666;
  margin-left: 6px;
  transition: border-color 0.12s, color 0.12s;
}
.edit-session-btn:hover {
  border-color: #3a3a3a;
  color: #aaa;
}
.edit-session-btn svg { flex-shrink: 0; }

/* ── Userbar ── */
.userbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #111;
  padding: 10px 16px;
  border-radius: 40px;
  margin-bottom: 18px;
  border: 1px solid #1a1a1a;
  font-size: 13px;
  color: #666;
}
.userbar strong { color: #c0c0c0; font-weight: 500; }
.userbar > div { display: flex; gap: 8px; }
.small-btn {
  background: none;
  border: 1px solid #2a2a2a;
  padding: 4px 13px;
  border-radius: 40px;
  color: #aaa;
  cursor: pointer;
  font-size: 12px;
  transition: background 0.12s, border-color 0.12s;
}
.small-btn:hover { background: #181818; border-color: #3a3a3a; }
.admin-btn {
  background: #151515;
  border-color: #303030;
  color: #c0c0c0;
}
.admin-btn:hover { background: #1e1e1e; }

/* ── Modals ── */
.hidden { display: none; }
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.75);
  align-items: center;
  justify-content: center;
  z-index: 2000;
  backdrop-filter: blur(4px);
}
.modal.show { display: flex; }
.modal-content {
  background: #111;
  border-radius: 24px;
  padding: 24px;
  max-width: 400px;
  width: 90%;
  color: #f0f0f0;
  border: 1px solid #222;
  box-shadow: 0 30px 60px rgba(0,0,0,0.7);
}
.modal-content h3 {
  margin-bottom: 16px;
  font-size: 1.2rem;
  font-weight: 500;
  color: #e0e0e0;
}
.modal-content label {
  display: block;
  margin-top: 12px;
  margin-bottom: 4px;
  font-size: 0.82rem;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.modal-content input, .modal-content select {
  width: 100%;
  padding: 11px 13px;
  border-radius: 10px;
  background: #0d0d0d;
  border: 1px solid #252525;
  color: #f0f0f0;
  font-size: 0.95rem;
  transition: border-color 0.15s;
}
.modal-content input:focus,
.modal-content select:focus {
  outline: none;
  border-color: #555;
}
.modal-content select option { background: #111; }
.modal-buttons {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
}
.modal-save {
  background: #e8e8e8;
  color: #080808;
  border: none;
  flex: 1;
  font-weight: 600;
}
.modal-save:hover { background: #ffffff; }
.modal-delete {
  background: #1a0a0a;
  color: #d0d0d0;
  border: 1px solid #2e1010;
  flex: 1;
}
.modal-delete:hover { background: #221010; }
.modal-cancel {
  background: #151515;
  color: #888;
  border: 1px solid #222;
  flex: 1;
}
.modal-cancel:hover { background: #1d1d1d; }

/* ── Login ── */
.login-container {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: #080808;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.login-card {
  background: #0f0f0f;
  border-radius: 24px;
  padding: 36px 32px;
  max-width: 380px;
  width: 90%;
  text-align: center;
  border: 1px solid #1e1e1e;
  box-shadow: 0 30px 60px rgba(0,0,0,0.6);
}
.login-card h2 {
  font-size: 1.75rem;
  margin-bottom: 6px;
  color: #e8e8e8;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.login-card p {
  color: #555;
  margin-bottom: 24px;
  font-size: 0.88rem;
}
.input-field {
  width: 100%;
  padding: 13px 14px;
  margin: 7px 0;
  border-radius: 10px;
  background: #080808;
  border: 1px solid #222;
  color: #f0f0f0;
  font-size: 0.95rem;
  transition: border-color 0.15s;
}
.input-field:focus {
  outline: none;
  border-color: #555;
}
.input-field::placeholder { color: #3a3a3a; }
/* ── Auth tabs ── */
.auth-tabs {
  display: flex;
  background: #080808;
  border-radius: 10px;
  padding: 3px;
  margin-bottom: 20px;
  border: 1px solid #1e1e1e;
}
.auth-tab {
  flex: 1;
  padding: 9px;
  border: none;
  background: transparent;
  color: #555;
  font-size: 0.88rem;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.auth-tab.active {
  background: #1e1e1e;
  color: #e0e0e0;
}
.auth-form { display: flex; flex-direction: column; gap: 0; }
.login-btn {
  width: 100%;
  padding: 13px;
  margin: 10px 0 4px;
  border-radius: 10px;
  background: #e8e8e8;
  border: none;
  color: #080808;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s;
}
.login-btn:hover:not(:disabled) { background: #ffffff; }
.login-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.auth-message {
  min-height: 18px;
  font-size: 12.5px;
  color: #888;
  text-align: center;
  padding: 4px 0;
}

/* ── Admin modal ── */
.admin-modal {
  max-width: 90%;
  width: 800px;
  max-height: 80vh;
  overflow-y: auto;
  background: #0f0f0f;
  border-radius: 24px;
  padding: 24px;
  border: 1px solid #1e1e1e;
}
.admin-modal h3 {
  font-size: 1.3rem;
  margin-bottom: 16px;
  font-weight: 500;
  color: #e0e0e0;
}
.admin-content { margin: 16px 0; }
.crew-card {
  background: #080808;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
  border-left: 3px solid #333;
  border: 1px solid #1a1a1a;
  border-left: 3px solid #333;
}
.crew-name {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 8px;
  color: #e0e0e0;
}
.active-session {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #0d0d0d;
  padding: 8px 12px;
  border-radius: 10px;
  margin: 8px 0;
  font-size: 0.88rem;
  border: 1px solid #1e1e1e;
  color: #b0b0b0;
}
.active-session.active-now {
  border-color: #252010;
  background: #0f0e08;
  color: #d0d0d0;
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot.on  { background: #888; }
.status-dot.off { background: #333; border: 1px solid #444; }
.session-list {
  margin-top: 10px;
  padding-left: 4px;
  font-size: 0.83rem;
}
.session-list strong { color: #555; font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; }
.session-item {
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px solid #161616;
}
.session-type { font-weight: 500; color: #c0c0c0; }
.session-time { color: #555; }

/* ── Print ── */
@media print {
  body { background: white; }
  .btn-row, .status-bar, .top-metrics, .grid2, .rest-meta, .law { display: none; }
  .app { background: white; color: black; padding: 0; margin: 0; max-width: 100%; border: none; }
  .rest-card, .log-card { border: 1px solid #ccc; background: white; color: black; }
}
