:root {
  --bg: #0f172a;
  --card: #1e293b;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --green: #16a34a;
  --green-hover: #15803d;
  --red: #dc2626;
  --red-hover: #b91c1c;
  --blue: #2563eb;
  --orange: #f97316;
  --orange-hover: #ea580c;
  --orange-bright: #ff7a18;
  --border: #334155;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--bg); color: var(--text);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}
body { padding: env(safe-area-inset-top) 1rem env(safe-area-inset-bottom); }

.container { max-width: 480px; margin: 0 auto; padding: 1.5rem 0; }
.container-wide { max-width: 1100px; margin: 0 auto; padding: 1.5rem 0; }

.brand-logo { display: block; max-width: 200px; height: auto; margin: 0.5rem auto 1.5rem; }
.brand-logo-sm { display: block; height: 32px; width: auto; }
.brand-logo-lg { display: block; max-width: 260px; height: auto; margin: 0 auto 1rem; }

h1 { font-size: 1.6rem; margin: 0 0 0.5rem; }
h2 { font-size: 1.1rem; margin: 1.5rem 0 0.75rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
p.muted { color: var(--muted); margin: 0.25rem 0 1.25rem; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 0.35rem; }
input, select {
  width: 100%;
  background: #0b1220;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
  font-size: 1rem;
  margin-bottom: 0.9rem;
}
input:focus, select:focus { outline: 2px solid var(--blue); border-color: var(--blue); }

button {
  cursor: pointer;
  border: 0;
  border-radius: 12px;
  padding: 0.85rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  color: white;
  transition: background 0.15s, transform 0.05s;
}
button:active { transform: scale(0.98); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--blue); width: 100%; }
.btn-primary:hover { background: #1d4ed8; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: #0b1220; color: var(--text); }

.clock-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1rem; }
.clock-btn {
  min-height: 180px;
  font-size: 1.35rem;
  border-radius: 20px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.4rem;
}
.clock-btn small { font-size: 0.85rem; font-weight: 500; opacity: 0.85; }
.clock-btn.green  { background: var(--green); }
.clock-btn.green:hover  { background: var(--green-hover); }
.clock-btn.red    { background: var(--red); }
.clock-btn.red:hover    { background: var(--red-hover); }
.clock-btn.orange { background: var(--orange-bright); box-shadow: 0 0 0 0 rgba(255,122,24,0.7); }
.clock-btn.orange:hover { background: var(--orange-hover); }
.clock-btn.orange.pulsing { animation: pulse-orange 1.6s infinite; }
.clock-btn.disabled-look { background: #334155; cursor: not-allowed; }

@keyframes pulse-orange {
  0%   { box-shadow: 0 0 0 0 rgba(255,122,24,0.55); }
  70%  { box-shadow: 0 0 0 14px rgba(255,122,24,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,122,24,0); }
}

.pill.paused { background: rgba(255,122,24,0.2); color: #fb923c; }

.pause-warning {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  background: rgba(255,122,24,0.15);
  border: 1px solid var(--orange);
  color: #fdba74;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: center;
}
.pause-warning.critical {
  background: rgba(220,38,38,0.18);
  border-color: var(--red);
  color: #fca5a5;
  animation: pulse-warn 1.4s infinite;
}
@keyframes pulse-warn {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.7; }
}

.pause-bars { display: inline-flex; gap: 6px; align-items: center; justify-content: center; }
.pause-bars span { display: inline-block; width: 10px; height: 36px; background: white; border-radius: 3px; }

.totals-row { display: flex; justify-content: space-between; gap: 0.5rem; margin-top: 0.75rem; font-size: 0.9rem; }
.totals-row .totals-item { flex: 1; background: #0b1220; border: 1px solid var(--border); border-radius: 10px; padding: 0.55rem 0.75rem; }
.totals-row .totals-item .label { color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; }
.totals-row .totals-item .value { font-size: 1.05rem; font-weight: 600; margin-top: 0.15rem; }
.totals-row .totals-item.warn .value { color: var(--orange); }
.totals-row .totals-item.ok .value { color: #4ade80; }

.toast {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%);
  background: #0b1220; border: 1px solid var(--border); color: var(--text);
  padding: 0.7rem 1rem; border-radius: 10px; font-size: 0.9rem;
  opacity: 0; transition: opacity 0.2s; pointer-events: none; z-index: 50;
}
.toast.show { opacity: 1; }
.toast.error { border-color: var(--red); }
.toast.ok { border-color: var(--green); }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { padding: 0.55rem 0.5rem; border-bottom: 1px solid var(--border); text-align: left; }
th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; }
tr:hover td { background: #0b1220; }

.row { display: flex; gap: 0.75rem; align-items: end; flex-wrap: wrap; }
.row > div { flex: 1; min-width: 140px; }

.pill { display: inline-block; padding: 0.15rem 0.55rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.pill.in { background: rgba(22, 163, 74, 0.2); color: #4ade80; }
.pill.out { background: rgba(220, 38, 38, 0.2); color: #f87171; }

.ok-text { color: #4ade80; font-weight: 600; }
.warn-text { color: var(--orange); font-weight: 600; }

.header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1rem;
}
.header h1 { font-size: 1.3rem; }
.header .user { color: var(--muted); font-size: 0.9rem; }

.auth-tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; border-bottom: 1px solid var(--border); }
.auth-tab {
  background: transparent; color: var(--muted); border: 0;
  border-bottom: 2px solid transparent;
  padding: 0.6rem 0.9rem; font-weight: 600; font-size: 0.95rem;
  border-radius: 0; cursor: pointer;
}
.auth-tab.active { color: var(--text); border-bottom-color: var(--blue); }
.auth-tab:hover:not(.active) { color: var(--text); }

.link-btn {
  background: transparent; color: var(--muted); border: 0;
  padding: 0.5rem 0; margin-top: 0.5rem; width: 100%;
  font-size: 0.9rem; font-weight: 500; text-decoration: underline;
  cursor: pointer;
}
.link-btn:hover { color: var(--text); }

.badge {
  display: inline-block; min-width: 18px; padding: 0 6px;
  background: var(--orange); color: white;
  border-radius: 999px; font-size: 0.7rem; font-weight: 700;
  margin-left: 0.4rem; line-height: 18px; text-align: center;
}

.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 1rem;
}
.modal[hidden] { display: none; }
.modal-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 16px; padding: 1.5rem;
  max-width: 540px; width: 100%;
}

.today-list { list-style: none; padding: 0; margin: 0.5rem 0 0; }
.today-list li { padding: 0.4rem 0; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; }
.today-list li:last-child { border-bottom: 0; }

@media (max-width: 480px) {
  .clock-grid { grid-template-columns: 1fr; }
  .clock-btn { min-height: 140px; }
}
