@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

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

/* ================================================================
   LIGHT MODE (default)
   ================================================================ */
:root {
  --primary: #000000;
  --primary-hover: #1a1a1a;
  --primary-light: #f0f0f0;
  --primary-glow: rgba(0, 0, 0, 0.08);
  --accent: #2563eb;
  --accent-light: #dbeafe;
  --success: #059669;
  --success-light: #d1fae5;
  --success-dark: #065f46;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --danger-dark: #991b1b;
  --warning-bg: #fef3c7;
  --warning-border: #f59e0b;
  --warning-text: #92400e;

  --bg-page: #f5f5f7;
  --bg-card: #ffffff;
  --bg-input: #f9fafb;
  --bg-topbar: #ffffff;
  --border: #e5e7eb;
  --border-input: #d1d5db;
  --text-primary: #0a0a0a;
  --text-secondary: #4b5563;
  --text-muted: #9ca3af;
  --text-faint: #d1d5db;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 4px 16px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.10);
  --radius: 12px;

  --login-bg: linear-gradient(160deg, #0a0a0a 0%, #1a1a1a 40%, #111111 100%);
  --login-form-bg: #ffffff;
  --login-form-border: #e5e7eb;
  --login-text: #ffffff;
  --login-muted: #6b7280;
}

/* ================================================================
   DARK MODE
   ================================================================ */
[data-theme="dark"] {
  --primary: #ffffff;
  --primary-hover: #e5e5e5;
  --primary-light: #1f1f1f;
  --primary-glow: rgba(255, 255, 255, 0.08);
  --accent: #3b82f6;
  --accent-light: #1e3a5f;
  --success: #34d399;
  --success-light: #064e3b;
  --success-dark: #a7f3d0;
  --danger: #f87171;
  --danger-light: #450a0a;
  --danger-dark: #fca5a5;
  --warning-bg: #422006;
  --warning-border: #b45309;
  --warning-text: #fbbf24;

  --bg-page: #0a0a0a;
  --bg-card: #141414;
  --bg-input: #1a1a1a;
  --bg-topbar: #111111;
  --border: #262626;
  --border-input: #333333;
  --text-primary: #f5f5f5;
  --text-secondary: #a3a3a3;
  --text-muted: #6b6b6b;
  --text-faint: #404040;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.5);

  --login-bg: linear-gradient(160deg, #000000 0%, #0a0a0a 40%, #050505 100%);
  --login-form-bg: #141414;
  --login-form-border: #262626;
  --login-text: #f5f5f5;
  --login-muted: #737373;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg-page);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s, color 0.3s;
}

.container {
  max-width: 520px;
  margin: 0 auto;
  padding: 40px 24px;
}

/* ================================================================
   THEME TOGGLE
   ================================================================ */
.theme-toggle {
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s;
  font-size: 16px;
}

.theme-toggle:hover {
  background: var(--primary-light);
  border-color: var(--text-muted);
}

/* ================================================================
   LOGIN PAGE
   ================================================================ */
.login-page {
  background: var(--login-bg);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100%;
  max-width: 460px;
  padding: 40px 24px;
}

.logo {
  margin-bottom: 8px;
}

.logo-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 12px;
}

.logo-do {
  font-size: 32px;
  font-weight: 900;
  color: #fff;
  letter-spacing: -1px;
  line-height: 1;
}

.logo-divider {
  width: 2px;
  height: 28px;
  background: #444;
  border-radius: 1px;
}

.logo-product {
  font-size: 20px;
  font-weight: 300;
  color: #fff;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.logo h1 {
  font-size: 28px;
  font-weight: 800;
  text-align: center;
  color: var(--login-text);
  letter-spacing: -0.5px;
}

.logo h1 .dot {
  color: var(--accent);
}

.tagline {
  text-align: center;
  color: var(--login-muted);
  margin-top: 6px;
  margin-bottom: 32px;
  font-size: 14px;
  font-weight: 400;
}

.login-form {
  width: 100%;
  background: var(--login-form-bg);
  padding: 36px 32px 32px;
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--login-form-border);
}

.form-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.form-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 28px;
}

/* ================================================================
   FORM FIELDS
   ================================================================ */
.field-group {
  margin-bottom: 20px;
}

.field-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}

.field-group input[type="text"],
.field-group input[type="password"],
.field-group input[type="email"] {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border-input);
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-input);
  transition: all 0.2s;
}

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

.field-group input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.checkbox-group input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.checkbox-group label {
  margin-bottom: 0;
  font-weight: 400;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
}

.form-footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.forgot-link {
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.forgot-link:hover {
  text-decoration: underline;
}

.security-notice {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 24px;
  font-size: 14px;
  color: var(--warning-text);
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.5;
}

.security-notice .notice-icon {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

.error-msg {
  margin-top: 16px;
  padding: 12px 16px;
  background: var(--danger-light);
  color: var(--danger);
  border-radius: 10px;
  font-size: 14px;
  text-align: center;
  width: 100%;
  font-weight: 500;
}

.footer-text {
  margin-top: 28px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

.footer-text a {
  color: inherit;
  text-decoration: none;
}

.footer-org {
  font-weight: 700;
  color: var(--text-secondary);
}

.login-page .footer-text { color: #555; }
.login-page .footer-org { color: #888; }
.login-page .footer-text a { color: #888; }

/* ================================================================
   BUTTONS
   ================================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  width: 100%;
  background: var(--primary);
  color: var(--bg-card);
  padding: 13px 24px;
  font-size: 15px;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-small {
  padding: 7px 16px;
  font-size: 13px;
  border-radius: 8px;
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-secondary);
}

.btn-outline:hover {
  background: var(--primary-light);
  border-color: var(--text-muted);
}

/* ================================================================
   TOP BAR
   ================================================================ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: 64px;
  background: var(--bg-topbar);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: background 0.3s, border 0.3s;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-do {
  font-size: 18px;
  font-weight: 900;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.topbar-sep {
  width: 1.5px;
  height: 20px;
  background: var(--border);
  border-radius: 1px;
}

.topbar-product {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.topbar h2 {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.topbar h2 .dot { color: var(--accent); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-avatar {
  width: 34px;
  height: 34px;
  background: var(--primary);
  color: var(--bg-card);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
}

.user-info { text-align: right; }

.user-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  display: block;
  line-height: 1.2;
}

.user-company {
  font-size: 12px;
  color: var(--text-muted);
  display: block;
}

/* ================================================================
   DASHBOARD
   ================================================================ */
.dashboard-body {
  background: var(--bg-page);
  min-height: calc(100vh - 64px);
  transition: background 0.3s;
}

.dashboard-container {
  max-width: 600px;
  padding-top: 36px;
  padding-bottom: 60px;
  text-align: center;
}

.greeting { margin-bottom: 8px; }

.greeting-text {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

.greeting-sub {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* --- Clock display --- */
.clock-display { margin-bottom: 36px; }

.current-time {
  font-size: 56px;
  font-weight: 300;
  color: var(--text-primary);
  letter-spacing: 3px;
  font-variant-numeric: tabular-nums;
}

.current-date {
  font-size: 15px;
  color: var(--text-secondary);
  margin-top: 6px;
  font-weight: 400;
}

/* --- Status card --- */
.status-card {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 28px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 24px;
  transition: background 0.3s, border 0.3s;
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.status-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 600;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-in {
  background: var(--success-light);
  color: var(--success-dark);
}

.status-in .status-dot {
  background: var(--success);
  box-shadow: 0 0 6px rgba(5, 150, 105, 0.5);
  animation: pulse 2s infinite;
}

.status-out {
  background: var(--primary-light);
  color: var(--text-secondary);
}

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

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* --- Punch buttons --- */
.punch-buttons { margin-top: 4px; }

.btn-clock {
  padding: 18px 56px;
  font-size: 18px;
  border-radius: 14px;
  min-width: 220px;
  letter-spacing: 0.5px;
  position: relative;
  overflow: hidden;
}

.btn-clock-in {
  background: #059669;
  color: #fff;
  box-shadow: 0 4px 16px rgba(5, 150, 105, 0.35);
}

.btn-clock-in:hover {
  background: #047857;
  box-shadow: 0 6px 20px rgba(5, 150, 105, 0.45);
  transform: translateY(-1px);
}

.btn-clock-out {
  background: #dc2626;
  color: #fff;
  box-shadow: 0 4px 16px rgba(220, 38, 38, 0.35);
}

.btn-clock-out:hover {
  background: #b91c1c;
  box-shadow: 0 6px 20px rgba(220, 38, 38, 0.45);
  transform: translateY(-1px);
}

.btn-clock:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.btn-clock:active { transform: scale(0.97) !important; }

.punch-message {
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  margin-top: 20px;
  margin-bottom: 0;
  display: inline-block;
}

.punch-message.success {
  background: var(--success-light);
  color: var(--success-dark);
}

.punch-message.warning {
  background: var(--warning-bg);
  color: var(--warning-text);
}

/* --- Stats row --- */
.stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  text-align: center;
  transition: background 0.3s, border 0.3s;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.stat-value.accent { color: var(--accent); }

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  margin-top: 6px;
}

/* --- Time card --- */
.timecard-section {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  margin-bottom: 24px;
  text-align: left;
  transition: background 0.3s, border 0.3s;
}

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

.timecard-header h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.timecard-date {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

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

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

.timecard-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-secondary);
}

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

.punch-type {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.punch-type .punch-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.punch-type.type-in .punch-dot { background: var(--success); }
.punch-type.type-out .punch-dot { background: var(--danger); }

.empty-row td {
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
  padding: 24px 12px;
}

/* --- Dashboard footer --- */
.dashboard-footer {
  text-align: center;
  padding: 20px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

.dashboard-footer .footer-org {
  font-weight: 700;
  color: var(--text-secondary);
}

.dashboard-footer a {
  color: var(--text-muted);
  text-decoration: none;
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 640px) {
  .current-time { font-size: 40px; }
  .stats-row { grid-template-columns: 1fr; gap: 12px; }
  .btn-clock { min-width: 180px; padding: 16px 40px; }
  .topbar { padding: 0 16px; }
  .container { padding: 24px 16px; }
  .logo-mark { gap: 8px; }
  .logo-do { font-size: 26px; }
  .logo-product { font-size: 16px; }
}
