:root {
  --bg: #0f172a;
  --bg-soft: #111c34;
  --surface: #1e293b;
  --surface-2: #2a3a55;
  --border: #334155;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --primary: #3b82f6;
  --primary-dark: #1e3a8a;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #06b6d4;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(0,0,0,0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.view { min-height: 100vh; padding: 16px; max-width: 1100px; margin: 0 auto; }
.hidden { display: none !important; }
.muted { color: var(--text-muted); margin-left: 8px; }
.error { color: var(--danger); min-height: 1.2em; margin: 8px 0 0; font-size: 14px; }

/* LOGIN */
#view-login {
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
  background: radial-gradient(circle at 30% 20%, #1e3a8a33, transparent 50%),
              radial-gradient(circle at 70% 80%, #3b82f622, transparent 50%),
              var(--bg);
}
.login-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 28px; width: 100%; max-width: 380px; box-shadow: var(--shadow);
}
.brand { text-align: center; margin-bottom: 20px; }
.brand-logo {
  width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex; align-items: center; justify-content: center; font-weight: 700;
  color: white; font-size: 24px;
}
.brand-logo::before { content: "L"; }
.brand h1 { margin: 0; font-size: 22px; }
.brand-sub { color: var(--text-muted); margin: 4px 0 0; font-size: 14px; }

.tabs { display: flex; gap: 4px; background: var(--bg-soft); padding: 4px;
  border-radius: var(--radius); margin-bottom: 16px; }
.tabs.scroll { overflow-x: auto; }
.tab {
  flex: 1; padding: 10px 14px; background: transparent; color: var(--text-muted);
  border: none; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 14px;
  white-space: nowrap;
}
.tab.active { background: var(--primary); color: white; }
.tab:not(.active):hover { background: var(--surface-2); color: var(--text); }

.login-form, form.card {
  display: flex; flex-direction: column; gap: 12px;
}
label {
  display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-muted);
  font-weight: 500;
}
input, select, textarea {
  padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg-soft); color: var(--text); font-size: 15px; font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--primary); border-color: transparent;
}

/* BUTTONS */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 16px; border: none; border-radius: 8px; cursor: pointer;
  font-weight: 600; font-size: 14px; transition: opacity 0.15s, transform 0.05s;
  background: var(--surface-2); color: var(--text);
}
.btn:hover { opacity: 0.9; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: white; }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-success { background: var(--success); color: white; }
.btn-warning { background: var(--warning); color: #1a1a1a; }
.btn-info { background: var(--info); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-big { padding: 16px 20px; font-size: 16px; }

/* TOPBAR */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0; margin-bottom: 12px;
}
.topbar strong { font-size: 16px; }

/* STATUS */
.status-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; text-align: center; margin-bottom: 20px;
}
.status-label { color: var(--text-muted); font-size: 13px; text-transform: uppercase; letter-spacing: 1px; }
.status-value { font-size: 28px; font-weight: 700; margin: 8px 0; }
.status-value.in { color: var(--success); }
.status-value.pause { color: var(--warning); }
.status-value.resume { color: var(--success); }
.status-value.out { color: var(--text-muted); }
.status-timer { font-size: 42px; font-family: ui-monospace, Menlo, monospace;
  font-variant-numeric: tabular-nums; color: var(--text); }
.status-sub { color: var(--text-muted); font-size: 13px; margin-top: 6px; min-height: 1em; }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
@media (min-width: 480px) { .actions { grid-template-columns: repeat(4, 1fr); } }

/* LISTS / CARDS */
.list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.list li {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 14px; display: flex; justify-content: space-between; align-items: center;
  gap: 8px; font-size: 14px;
}
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; margin-bottom: 16px;
}
.card h3 { margin-top: 0; }

h3 { font-size: 16px; margin: 16px 0 8px; }

/* TABLE */
.table-wrap { overflow-x: auto; background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 560px; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.table th { background: var(--bg-soft); color: var(--text-muted); font-weight: 600; }
.table tr:last-child td { border-bottom: none; }

/* FILTERS */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; align-items: flex-end; }
.filters label { font-size: 12px; min-width: 140px; }
.filters .btn { margin-top: 18px; }

/* LIVE GRID */
.live-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.live-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; display: flex; flex-direction: column; gap: 6px;
}
.live-card .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.live-card.in .dot, .live-card.resume .dot { background: var(--success); }
.live-card.pause .dot { background: var(--warning); }
.live-card.out .dot { background: var(--text-muted); }

/* CALENDAR */
.calendar-header { display: flex; justify-content: center; align-items: center; gap: 16px; margin-bottom: 12px; }
.calendar {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
  background: var(--surface); padding: 8px; border-radius: var(--radius);
  border: 1px solid var(--border);
}
.cal-cell {
  min-height: 80px; padding: 6px; background: var(--bg-soft); border-radius: 6px;
  display: flex; flex-direction: column; gap: 3px; font-size: 12px;
}
.cal-cell.other-month { opacity: 0.35; }
.cal-cell.today { outline: 2px solid var(--primary); }
.cal-cell .day-num { font-weight: 700; color: var(--text); }
.cal-cell .chip { font-size: 10px; padding: 2px 6px; border-radius: 4px; }
.chip { display: inline-block; padding: 3px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.chip-shift { background: var(--primary); color: white; }
.chip-leave { background: var(--warning); color: #1a1a1a; }
.chip-holiday { background: var(--danger); color: white; }
.legend { display: flex; gap: 8px; margin-top: 12px; justify-content: center; flex-wrap: wrap; }
.cal-head { text-align: center; font-size: 11px; color: var(--text-muted);
  text-transform: uppercase; padding: 4px 0; }

/* TOAST */
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  padding: 12px 18px; border-radius: 8px; box-shadow: var(--shadow); z-index: 1000;
  max-width: 90vw; font-size: 14px;
}
.toast.ok { border-color: var(--success); }
.toast.err { border-color: var(--danger); }

/* Mobile tweaks */
@media (max-width: 480px) {
  .view { padding: 12px; }
  .status-timer { font-size: 36px; }
  .cal-cell { min-height: 56px; font-size: 11px; }
}
