*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #0d0f14;
  --bg2:      #12151e;
  --card:     #181c27;
  --border:   #2a2f45;
  --text:     #e8eaf0;
  --muted:    #8b93b0;
  --accent:   #f5c518;
  --green:    #22c55e;
  --red:      #ef4444;
  --blue:     #3b82f6;
  --radius:   12px;
  --shadow:   0 4px 24px rgba(0,0,0,.4);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  min-height: 100dvh;
}

.hidden { display: none !important; }

/* ── Screens ── */
.screen { min-height: 100dvh; }

/* ── Login ── */
#loginScreen {
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 0%, #1a1f35 0%, var(--bg) 70%);
}

.login-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 48px 40px;
  text-align: center;
  max-width: 400px;
  width: 90%;
  box-shadow: var(--shadow);
}

.login-card .logo { font-size: 52px; margin-bottom: 12px; }
.login-card h1 { font-size: 28px; font-weight: 700; margin-bottom: 6px; }
.login-card .subtitle { color: var(--muted); margin-bottom: 32px; }

.btn-google {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  color: #222;
  border-radius: 8px;
  padding: 12px 24px;
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  transition: opacity .15s;
}
.btn-google:hover { opacity: .9; }

.error { color: var(--red); margin-top: 16px; font-size: 13px; }

/* ── Header ── */
.app-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  height: 56px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.logo-sm { font-size: 22px; }
.app-title { font-weight: 700; font-size: 16px; }

.tab-nav { display: flex; gap: 4px; flex: 1; justify-content: center; }

.tab {
  background: none;
  border: none;
  color: var(--muted);
  padding: 6px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background .15s, color .15s;
}
.tab:hover { background: var(--border); color: var(--text); }
.tab.active { background: var(--border); color: var(--accent); }

.header-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border); }
.user-name { font-size: 13px; color: var(--muted); max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.btn-link {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  transition: border-color .15s, color .15s;
}
.btn-link:hover { border-color: var(--red); color: var(--red); }

/* ── Main content ── */
.tab-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── Status card ── */
.main-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}

.status-section { margin-bottom: 24px; }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 18px;
  font-weight: 700;
  padding: 6px 16px;
  border-radius: 99px;
  margin-bottom: 8px;
}
.status-badge.in  { background: rgba(34,197,94,.15);  color: var(--green); border: 1px solid rgba(34,197,94,.3); }
.status-badge.out { background: rgba(239,68,68,.1);  color: var(--red);  border: 1px solid rgba(239,68,68,.25); }

.last-action { color: var(--muted); font-size: 13px; }

/* ── Check-in form ── */
.project-row, .note-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

label { font-size: 12px; color: var(--muted); font-weight: 500; }

select, input[type="text"], input[type="date"] {
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 14px;
  width: 100%;
  outline: none;
  transition: border-color .15s;
}
select:focus, input:focus { border-color: var(--accent); }
select option { background: var(--bg2); }

.action-btns { display: flex; gap: 12px; margin-top: 20px; }

.btn {
  border: none;
  border-radius: 9px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
}
.btn:hover { opacity: .88; }
.btn:active { transform: scale(.97); }

.btn-big { flex: 1; padding: 14px; font-size: 16px; border-radius: 10px; }
.btn-green { background: var(--green); color: #fff; }
.btn-red   { background: var(--red);   color: #fff; }
.btn-blue  { background: var(--blue);  color: #fff; }
.btn-gray  { background: var(--border); color: var(--text); }

/* ── History ── */
.history-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
}

.history-card h2 { font-size: 15px; font-weight: 600; margin-bottom: 14px; color: var(--muted); }

.record-list { display: flex; flex-direction: column; gap: 8px; }

.record-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg2);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.rec-type {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 99px;
  min-width: 60px;
  text-align: center;
}
.rec-type.in  { background: rgba(34,197,94,.15); color: var(--green); }
.rec-type.out { background: rgba(239,68,68,.1);  color: var(--red); }

.rec-time  { font-weight: 600; min-width: 54px; }
.rec-proj  { color: var(--muted); font-size: 12px; flex: 1; }
.rec-note  { color: var(--muted); font-size: 12px; font-style: italic; }

.empty-state { color: var(--muted); text-align: center; padding: 24px; font-size: 13px; }

/* ── Admin ── */
.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 10px;
}

.admin-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.a-tab {
  background: none;
  border: 1px solid transparent;
  color: var(--muted);
  padding: 6px 14px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all .15s;
}
.a-tab:hover  { background: var(--border); color: var(--text); }
.a-tab.active { background: var(--border); color: var(--accent); border-color: rgba(245,197,24,.3); }

.date-picker { max-width: 160px; padding: 6px 10px; }

#tab-admin .atab-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 16px;
}

/* ── Tables ── */
.admin-table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }

th {
  text-align: left;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(42,47,69,.6);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,.02); }

.user-cell { display: flex; align-items: center; gap: 10px; }
.av-sm { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.badge-role {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  text-transform: uppercase;
}
.badge-role.admin { background: rgba(245,197,24,.15); color: var(--accent); }
.badge-role.user  { background: var(--border); color: var(--muted); }

.time-in  { color: var(--green); font-weight: 600; }
.time-out { color: var(--red);   font-weight: 600; }

/* ── Add project ── */
.add-project-row {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}
.add-project-row input { flex: 1; }
.add-project-row .btn { flex-shrink: 0; }

/* ── Toggle switch ── */
.toggle {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 99px;
  cursor: pointer;
  transition: background .2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  left: 3px;
  top: 3px;
  background: var(--muted);
  border-radius: 50%;
  transition: transform .2s, background .2s;
}
.toggle input:checked + .toggle-slider { background: rgba(34,197,94,.3); }
.toggle input:checked + .toggle-slider::before { transform: translateX(16px); background: var(--green); }

/* ── Responsive ── */
@media (max-width: 600px) {
  .tab-nav { gap: 2px; }
  .tab { padding: 5px 10px; font-size: 13px; }
  .user-name { display: none; }
  .main-card { padding: 18px; }
  .action-btns { flex-direction: column; }
}
