/* ============================================================
   styles.css — Premium dark glassmorphism theme
   ============================================================ */

/* ── CSS Custom Properties ─────────────────────────────────── */
:root {
  /* Background */
  --bg-base:       #0a0a14;
  --bg-surface:    rgba(255, 255, 255, 0.04);
  --bg-glass:      rgba(255, 255, 255, 0.06);
  --bg-glass-hover:rgba(255, 255, 255, 0.10);

  /* Accent gradient */
  --accent-1:      #7c3aed;   /* violet */
  --accent-2:      #06b6d4;   /* cyan   */
  --accent-gradient: linear-gradient(135deg, var(--accent-1), var(--accent-2));

  /* Text */
  --text-primary:  #f0f0f5;
  --text-secondary:#9ca3af;
  --text-muted:    #6b7280;

  /* Semantic */
  --green:         #34d399;
  --green-glow:    rgba(52, 211, 153, 0.25);
  --amber:         #fbbf24;
  --amber-bg:      rgba(251, 191, 36, 0.10);
  --red:           #f87171;
  --red-bg:        rgba(248, 113, 113, 0.10);
  --purple:        #a78bfa;
  --purple-bg:     rgba(167, 139, 250, 0.12);

  /* Border */
  --border:        rgba(255, 255, 255, 0.08);
  --border-focus:  rgba(124, 58, 237, 0.5);

  /* Radius */
  --radius-sm:     8px;
  --radius-md:     12px;
  --radius-lg:     16px;
  --radius-xl:     24px;

  /* Shadow */
  --shadow-sm:     0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md:     0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-glow:   0 0 30px rgba(124, 58, 237, 0.15);

  /* Font */
  --font:          'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Transition */
  --ease:          cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Subtle animated background gradient */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(124, 58, 237, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(6, 182, 212, 0.06) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

.hidden { display: none !important; }

/* ── Glass Card ────────────────────────────────────────────── */
.glass-card {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 24px;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.glass-card:hover {
  box-shadow: var(--shadow-md), var(--shadow-glow);
}

/* ── Fade-in animation ─────────────────────────────────────── */
.fade-in {
  animation: fadeInUp 0.5s var(--ease) both;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Navigation ────────────────────────────────────────────── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0 24px;
}

.glass-nav {
  background: rgba(10, 10, 20, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.nav-brand {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s, background 0.2s;
  border: none;
  background: none;
  cursor: pointer;
  font-family: var(--font);
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-glass-hover);
  text-decoration: none;
}

.nav-link.active {
  color: var(--text-primary);
  background: var(--bg-glass);
}

.nav-logout {
  color: var(--red);
}
.nav-logout:hover {
  background: var(--red-bg);
  color: var(--red);
}

/* ── Page Content ──────────────────────────────────────────── */
.page-content {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

.container {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.page-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-top: 4px;
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.9rem;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s var(--ease);
  padding: 10px 20px;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: 0 2px 12px rgba(124, 58, 237, 0.3);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(124, 58, 237, 0.45);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #f87171);
  color: #fff;
  box-shadow: 0 2px 12px rgba(239, 68, 68, 0.3);
}
.btn-danger:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.45);
}

.btn-warning {
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
  color: #1a1a2e;
  font-weight: 700;
}
.btn-warning:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.3);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--bg-glass-hover);
  color: var(--text-primary);
}

.btn-full { width: 100%; }
.btn-lg   { padding: 14px 32px; font-size: 1rem; border-radius: var(--radius-md); }
.btn-sm   { padding: 8px 14px; font-size: 0.8rem; }

/* ── Form Inputs ───────────────────────────────────────────── */
input[type="email"],
input[type="password"],
input[type="text"],
input[type="date"],
input[type="datetime-local"],
select {
  width: 100%;
  padding: 12px 16px;
  font-family: var(--font);
  font-size: 0.9rem;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

input::placeholder {
  color: var(--text-muted);
}

/* White calendar / clock picker icon on all date inputs */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
  filter: invert(1) brightness(1.2);
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.15s;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover,
input[type="time"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

.input-sm {
  width: auto;
  padding: 8px 12px;
  font-size: 0.8rem;
}

.input-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239ca3af' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-group {
  margin-bottom: 16px;
}

/* ── Auth Page ─────────────────────────────────────────────── */
.page-auth {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.auth-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
}

/* Decorative orbs */
.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
}
.bg-orb--1 {
  width: 400px; height: 400px;
  background: rgba(124, 58, 237, 0.15);
  top: -100px; left: -100px;
  animation: orbFloat 8s ease-in-out infinite alternate;
}
.bg-orb--2 {
  width: 300px; height: 300px;
  background: rgba(6, 182, 212, 0.12);
  bottom: -50px; right: -50px;
  animation: orbFloat 10s ease-in-out infinite alternate-reverse;
}
.bg-orb--3 {
  width: 200px; height: 200px;
  background: rgba(167, 139, 250, 0.1);
  top: 40%; left: 60%;
  animation: orbFloat 12s ease-in-out infinite alternate;
}

@keyframes orbFloat {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(30px, -20px) scale(1.1); }
}

.auth-card {
  text-align: center;
  padding: 40px 32px;
}

.auth-logo {
  font-size: 3rem;
  margin-bottom: 8px;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.05); }
}

.auth-title {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 4px;
}

.auth-subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 24px;
}

/* Auth tabs */
.auth-tabs {
  display: flex;
  position: relative;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 24px;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  border-radius: 6px;
  transition: color 0.2s;
  z-index: 1;
}

.auth-tab.active {
  color: var(--text-primary);
}

.auth-tab-indicator {
  position: absolute;
  top: 4px;
  left: 4px;
  width: calc(50% - 4px);
  height: calc(100% - 8px);
  background: var(--bg-glass-hover);
  border-radius: 6px;
  transition: transform 0.3s var(--ease);
}

.auth-form {
  text-align: left;
}

.auth-message {
  margin-top: 16px;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
  padding: 0;
  transition: all 0.2s;
}
.auth-message.error {
  color: var(--red);
  background: var(--red-bg);
  padding: 10px 14px;
}
.auth-message.success {
  color: var(--green);
  background: var(--green-glow);
  padding: 10px 14px;
}

/* ── Dashboard ─────────────────────────────────────────────── */
.greeting h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.greeting-date {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 2px;
}

/* Warning banner */
.warning-banner {
  background: var(--amber-bg);
  border: 1px solid rgba(251, 191, 36, 0.25);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  animation: fadeInUp 0.4s var(--ease) both;
}

.warning-icon {
  font-size: 1.5rem;
  line-height: 1;
  flex-shrink: 0;
}

.warning-text {
  color: var(--amber);
  font-weight: 500;
  font-size: 0.9rem;
  margin-bottom: 10px;
}

.warning-action {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.warning-action label {
  color: var(--text-secondary);
  margin-bottom: 0;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.8rem;
}

/* Status card */
.status-card {
  text-align: center;
  padding: 40px 24px;
}

.status-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 16px;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background 0.3s;
}

.status-dot.clocked-in {
  background: var(--green);
  box-shadow: 0 0 12px var(--green-glow);
  animation: dotPulse 2s ease-in-out infinite;
}

.status-dot.clocked-out {
  background: var(--text-muted);
}

@keyframes dotPulse {
  0%, 100% { box-shadow: 0 0 8px var(--green-glow); }
  50%      { box-shadow: 0 0 20px var(--green-glow), 0 0 40px rgba(52, 211, 153, 0.1); }
}

.status-label {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.status-timer {
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.status-since {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 24px;
}

/* Summary card */
.summary-card {
  padding: 24px;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.75rem;
}

.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.summary-item {
  text-align: center;
}

.summary-value {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.summary-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ── History / Tables ──────────────────────────────────────── */
.total-card {
  padding: 24px;
}

.total-inner {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  text-align: center;
}

.total-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.total-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
}

.table-card {
  padding: 0;
  overflow: hidden;
}

.table-responsive {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead {
  background: rgba(255, 255, 255, 0.03);
}

.data-table th {
  padding: 14px 16px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 16px;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}

.data-table tbody tr {
  transition: background 0.15s;
}

.data-table tbody tr:hover {
  background: var(--bg-glass-hover);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.row-open {
  background: var(--amber-bg) !important;
}

.table-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 32px 16px !important;
}

.text-muted { color: var(--text-muted); }

/* ── Badges ────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 999px;
  white-space: nowrap;
}

.badge-green {
  background: var(--green-glow);
  color: var(--green);
}

.badge-muted {
  background: var(--bg-surface);
  color: var(--text-muted);
}

.badge-purple {
  background: var(--purple-bg);
  color: var(--purple);
  margin-left: 6px;
}

.open-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--amber);
  font-weight: 600;
  font-size: 0.8rem;
}

/* ── Admin ─────────────────────────────────────────────────── */
.admin-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-surface);
  padding: 4px;
  border-radius: var(--radius-sm);
  width: fit-content;
}

.admin-tab {
  padding: 10px 20px;
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
}

.admin-tab.active {
  color: var(--text-primary);
  background: var(--bg-glass-hover);
}

.admin-tab:hover:not(.active) {
  color: var(--text-primary);
}

.filter-bar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 20px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-group label {
  margin-bottom: 0;
}

.sortable {
  cursor: pointer;
  user-select: none;
}
.sortable:hover {
  color: var(--text-secondary);
}

.clickable-row {
  cursor: pointer;
}

.user-name-cell {
  display: flex;
  align-items: center;
}

.user-detail {
  animation: fadeInUp 0.3s var(--ease) both;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.detail-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
}

.management-card {
  max-width: 500px;
}

.card-desc {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 16px;
}

.promote-form {
  display: flex;
  gap: 8px;
  align-items: center;
}

.promote-form select {
  flex: 1;
}

.promote-message {
  margin-top: 12px;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
}
.promote-message.error   { color: var(--red);   }
.promote-message.success { color: var(--green); }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
  .nav-inner {
    flex-direction: column;
    height: auto;
    padding: 12px 0;
    gap: 8px;
  }

  .nav-links {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }

  .status-timer {
    font-size: 2.25rem;
  }

  .total-inner {
    grid-template-columns: repeat(3, 1fr);
  }

  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .promote-form {
    flex-direction: column;
  }

  .admin-tabs {
    width: 100%;
  }

  .admin-tab {
    flex: 1;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .page-content {
    padding: 16px 12px 48px;
  }

  .glass-card {
    padding: 16px;
  }

  .auth-card {
    padding: 28px 20px;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  .data-table th,
  .data-table td {
    padding: 10px 10px;
    font-size: 0.8rem;
  }
}

/* ── Entry Form ─────────────────────────────────────────────── */
.entry-form-card { }

.entry-form-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.entry-form-hint strong {
  color: var(--text-secondary);
}

.entry-message {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 14px;
  transition: opacity 0.3s;
}
.entry-message.success {
  background: var(--green-glow);
  color: var(--green);
}
.entry-message.error {
  background: var(--red-bg);
  color: var(--red);
}

/* ── Punch Toggle ───────────────────────────────────────────── */
.punch-toggle {
  display: flex;
  gap: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px;
  width: 100%;
}

.punch-toggle-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: calc(var(--radius-md) - 4px);
  cursor: pointer;
  transition: all 0.25s var(--ease);
}

.punch-toggle-btn .punch-icon {
  font-size: 1rem;
  transition: transform 0.2s var(--ease);
}

.punch-toggle-btn:hover:not(.active) {
  color: var(--text-secondary);
  background: var(--bg-glass);
}

.punch-toggle-btn.active {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: 0 2px 12px rgba(124, 58, 237, 0.35);
}

.punch-toggle-btn.active .punch-icon {
  transform: scale(1.2);
}

/* Punch-out active uses a teal/cyan tint */
#btn-punch-out.active {
  background: linear-gradient(135deg, #06b6d4, #0891b2);
  box-shadow: 0 2px 12px rgba(6, 182, 212, 0.35);
}

/* ── Row Actions ────────────────────────────────────────────── */
.row-actions {
  display: flex;
  gap: 6px;
  white-space: nowrap;
}

.btn-delete {
  color: var(--red) !important;
  border-color: rgba(248, 113, 113, 0.25) !important;
}

.btn-delete:hover:not(:disabled) {
  background: var(--red-bg) !important;
  border-color: rgba(248, 113, 113, 0.5) !important;
}

/* ── Edit Modal ─────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0);
  backdrop-filter: blur(0px);
  transition: background 0.25s var(--ease), backdrop-filter 0.25s var(--ease);
}

.modal-overlay.open {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
}

.modal-box {
  width: 100%;
  max-width: 500px;
  padding: 0;
  overflow: hidden;           /* prevents inputs overflowing the rounded box */
  box-sizing: border-box;
  transform: translateY(24px) scale(0.97);
  opacity: 0;
  transition: transform 0.25s var(--ease), opacity 0.25s var(--ease);
}

.modal-overlay.open .modal-box {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}

.modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
  font-family: var(--font);
}

.modal-close:hover {
  color: var(--text-primary);
  background: var(--bg-glass-hover);
}

.modal-body {
  padding: 20px 24px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 24px 20px;
}

.entry-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Grid children must not overflow their column */
.entry-form-grid > * {
  min-width: 0;
}

@media (max-width: 480px) {
  .entry-form-grid {
    grid-template-columns: 1fr;
  }
  .punch-toggle-btn {
    padding: 10px 12px;
    font-size: 0.85rem;
  }
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .modal-box {
    max-width: 100%;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }
}

/* ── History Day-Group Layout ───────────────────────────────── */
.history-day-card {
  padding: 0;
  overflow: hidden;
}

.history-day-list {
  display: flex;
  flex-direction: column;
}

.history-day-group {
  border-bottom: 1px solid var(--border);
  animation: fadeInUp 0.3s var(--ease) both;
}

.history-day-group:last-child {
  border-bottom: none;
}

/* Date header row */
.history-day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 10px;
  background: rgba(255, 255, 255, 0.025);
  border-bottom: 1px solid var(--border);
}

.history-day-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.history-day-duration {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent-2);
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.2);
  border-radius: 999px;
  padding: 2px 10px;
}

/* Two-column body */
.history-day-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.history-col {
  padding: 12px 20px 16px;
}

.history-col--in {
  border-right: 1px solid var(--border);
}

.history-col-head {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.history-col--in  .history-col-head { color: #a78bfa; } /* violet */
.history-col--out .history-col-head { color: #34d399; } /* green  */

/* Individual time chips */
.history-time-item {
  display: inline-flex;
  align-items: center;
  font-size: 0.92rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  margin: 3px 0;
  width: fit-content;
}

.history-time-item--in {
  color: #c4b5fd;
  background: rgba(124, 58, 237, 0.12);
  border: 1px solid rgba(124, 58, 237, 0.2);
}

.history-time-item--out {
  color: #6ee7b7;
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.2);
}

/* Missing entry badge */
.history-missing {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--red);
  background: var(--red-bg);
  border: 1px solid rgba(248, 113, 113, 0.25);
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  margin-top: 2px;
}

.history-missing-icon {
  font-size: 0.9rem;
}

/* Scroll sentinel */
.history-sentinel {
  height: 1px;
  margin: 16px 0;
}

/* Responsive: stack columns on small screens */
@media (max-width: 560px) {
  .history-day-cols {
    grid-template-columns: 1fr;
  }
  .history-col--in {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}


