:root {
  --bg-base: #0f1219;
  --bg-surface: #161b26;
  --bg-surface-2: #1c2333;
  --bg-surface-3: #242d3f;
  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.10);
  --brand-primary: #3b82f6;
  --brand-primary-15: rgba(59, 130, 246, 0.15);
  --brand-secondary: #8b5cf6;
  --txt-primary: #e2e8f0;
  --txt-secondary: #94a3b8;
  --txt-muted: #64748b;
  --success: #22c55e;
  --success-15: rgba(34, 197, 94, 0.15);
  --warning: #eab308;
  --warning-15: rgba(234, 179, 8, 0.15);
  --danger: #ef4444;
  --danger-15: rgba(239, 68, 68, 0.15);
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-base);
  color: var(--txt-primary);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--brand-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}

.header-accent {
  height: 2px;
  background: linear-gradient(90deg, var(--brand-primary), var(--brand-secondary), var(--brand-primary));
  background-size: 200% 100%;
  animation: accent-drift 8s ease-in-out infinite;
}

@keyframes accent-drift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  position: relative;
}

.header-title {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.header-nav {
  display: flex;
  gap: 0.25rem;
}

.nav-link {
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--txt-secondary);
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid transparent;
}

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

.nav-link.active {
  color: var(--brand-primary);
  background: var(--brand-primary-15);
  border-color: rgba(59, 130, 246, 0.2);
}

.header-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8125rem;
  color: var(--txt-secondary);
}

.btn-logout {
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--txt-secondary);
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-logout:hover {
  color: var(--txt-primary);
  border-color: var(--border-hover);
}

/* Main layout */
.app-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* Page sections */
.page-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  letter-spacing: -0.02em;
}

/* Cards */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.card + .card { margin-top: 0.75rem; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid var(--border);
  background: var(--bg-surface-2);
  color: var(--txt-primary);
}

.btn:hover {
  background: var(--bg-surface-3);
  border-color: var(--border-hover);
}

.btn-primary {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #fff;
}

.btn-primary:hover {
  background: #2563eb;
  border-color: #2563eb;
}

.btn-danger {
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.2);
  background: var(--danger-15);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.35);
}

.btn-sm {
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
}

.btn-icon {
  padding: 0.35rem;
  line-height: 1;
}

/* Forms */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--txt-secondary);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.55rem 0.75rem;
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--txt-primary);
  font-size: 0.875rem;
  font-family: inherit;
  transition: border-color 0.15s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 2px var(--brand-primary-15);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

.form-textarea {
  resize: vertical;
  min-height: 4rem;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  align-items: end;
}

.form-error {
  font-size: 0.75rem;
  color: var(--danger);
  margin-top: 0.25rem;
}

/* Entry form inline */
.entry-form {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.entry-form-title {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--txt-primary);
}

.entry-form-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

/* Entry list (legacy — kept for suggestions display) */
.entry-item {
  display: grid;
  grid-template-columns: 90px 60px 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s;
}

.entry-item:hover {
  border-color: var(--border-hover);
}

.entry-item + .entry-item { margin-top: 0.35rem; }

.entry-date {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--txt-secondary);
  font-variant-numeric: tabular-nums;
}

.entry-hours {
  font-size: 0.875rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.entry-details {
  min-width: 0;
}

.entry-meta {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.entry-description {
  font-size: 0.8125rem;
  color: var(--txt-secondary);
  margin-top: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.entry-actions {
  display: flex;
  gap: 0.3rem;
  opacity: 0;
  transition: opacity 0.15s;
}

.entry-item:hover .entry-actions {
  opacity: 1;
}

/* ── Day-grouped entries ── */

.day-group {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.day-group + .day-group {
  margin-top: 0.5rem;
}

.day-group-empty {
  background: transparent;
  border-color: transparent;
}

.day-group-empty .day-header {
  background: transparent;
  border-bottom: none;
  border-left: 3px dashed var(--border-hover);
  opacity: 0.5;
  padding: 0.3rem 1rem;
  border-radius: var(--radius);
}

.day-group-empty .day-header:hover {
  opacity: 0.8;
}

.day-group-empty .day-header-label {
  color: var(--txt-muted);
  font-size: 0.75rem;
}

.day-group-empty .day-header-add {
  opacity: 0;
}

.day-group-empty .day-header:hover .day-header-add {
  opacity: 1;
}

.day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  background: var(--bg-surface-2);
  border-bottom: 1px solid var(--border);
  border-left: 3px solid var(--brand-primary);
  border-radius: var(--radius) var(--radius) 0 0;
}

.day-header-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--txt-secondary);
  letter-spacing: -0.01em;
}

.day-header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.day-header-total {
  font-size: 0.8125rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--txt-primary);
}

.day-header-add {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--txt-muted);
  font-size: 0.875rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  opacity: 0;
}

.day-header:hover .day-header-add {
  opacity: 1;
}

.day-header-add:hover {
  color: var(--brand-primary);
  border-color: var(--brand-primary);
  background: var(--brand-primary-15);
}

/* Entry row (compact, within a day group) */

.entry-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 1rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
  min-height: 34px;
}

.entry-row:last-child {
  border-bottom: none;
}

.entry-row:hover {
  background: rgba(255, 255, 255, 0.02);
}

/* Entry cells — click to edit */

.entry-cell {
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.1s;
  padding: 0.15rem 0.3rem;
  margin: -0.15rem -0.3rem;
}

.entry-cell:hover {
  background: rgba(255, 255, 255, 0.06);
}

.entry-cell-hours {
  font-size: 0.8125rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  min-width: 50px;
  flex-shrink: 0;
}

.entry-cell-badge {
  flex-shrink: 0;
  cursor: pointer;
}

.entry-cell-badge:hover {
  filter: brightness(1.2);
}

.entry-cell-desc {
  flex: 1;
  min-width: 0;
  font-size: 0.8125rem;
  color: var(--txt-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.entry-cell-editing {
  background: transparent !important;
  padding: 0;
  margin: 0;
  filter: none !important;
}

/* Delete button */

.entry-row-delete {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--txt-muted);
  font-size: 1rem;
  cursor: pointer;
  border-radius: 4px;
  opacity: 0;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.entry-row:hover .entry-row-delete {
  opacity: 1;
}

.entry-row-delete:hover {
  color: var(--danger);
  background: var(--danger-15);
}

/* Inline inputs (for editing cells and new-entry row) */

.inline-input {
  background: var(--bg-base);
  border: 1px solid var(--brand-primary);
  border-radius: 4px;
  color: var(--txt-primary);
  font-size: 0.8125rem;
  font-family: inherit;
  padding: 0.2rem 0.4rem;
  outline: none;
  box-shadow: 0 0 0 2px var(--brand-primary-15);
}

.inline-input::-webkit-inner-spin-button,
.inline-input::-webkit-outer-spin-button {
  opacity: 0.3;
}

.inline-input-hours {
  width: 60px;
}

.inline-input-desc {
  width: 100%;
}

.inline-input-date {
  width: 130px;
}

.inline-select {
  background: var(--bg-base);
  border: 1px solid var(--brand-primary);
  border-radius: 4px;
  color: var(--txt-primary);
  font-size: 0.75rem;
  font-family: inherit;
  padding: 0.15rem 0.3rem;
  outline: none;
  box-shadow: 0 0 0 2px var(--brand-primary-15);
  appearance: auto;
}

.inline-select-new {
  max-width: 140px;
}

/* New entry row */

.new-entry-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--bg-surface);
  border: 2px solid var(--brand-primary);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  box-shadow: 0 0 0 3px var(--brand-primary-15);
}

.new-entry-row .inline-input,
.new-entry-row .inline-select {
  border-color: var(--border);
  box-shadow: none;
}

.new-entry-row .inline-input:focus,
.new-entry-row .inline-select:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 2px var(--brand-primary-15);
}

.inline-input-new-desc {
  flex: 1;
  min-width: 0;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--txt-primary);
  font-size: 0.8125rem;
  font-family: inherit;
  padding: 0.2rem 0.4rem;
  outline: none;
}

.inline-input-new-desc:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 2px var(--brand-primary-15);
}

.new-entry-save,
.new-entry-cancel {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  transition: all 0.15s;
}

.new-entry-save {
  color: var(--success);
  border-color: rgba(34, 197, 94, 0.3);
}

.new-entry-save:hover {
  background: var(--success-15);
}

.new-entry-cancel {
  color: var(--txt-muted);
}

.new-entry-cancel:hover {
  color: var(--danger);
  background: var(--danger-15);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 100px;
  font-size: 0.6875rem;
  font-weight: 600;
}

.badge-category {
  background: var(--brand-primary-15);
  color: var(--brand-primary);
}

.badge-firm {
  background: rgba(139, 92, 246, 0.15);
  color: var(--brand-secondary);
}

/* Login page */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
}

.login-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 380px;
}

.login-title {
  font-size: 1.25rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 0.35rem;
}

.login-subtitle {
  font-size: 0.8125rem;
  color: var(--txt-secondary);
  text-align: center;
  margin-bottom: 1.5rem;
}

/* Toast notifications */
#toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  padding: 0.75rem 1rem;
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  animation: slide-in 0.3s ease-out;
  max-width: 320px;
  pointer-events: auto;
}

.toast-success { border-left: 3px solid var(--success); }
.toast-error { border-left: 3px solid var(--danger); }

@keyframes slide-in {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--txt-muted);
  font-size: 0.875rem;
}

.empty-state-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
  opacity: 0.5;
}

/* Loading */
.skeleton {
  background: linear-gradient(90deg, var(--bg-surface-2), var(--bg-surface-3), var(--bg-surface-2));
  background-size: 200% 100%;
  animation: shimmer 1.8s ease-in-out infinite;
  border-radius: var(--radius-sm);
  height: 1rem;
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* Confirm dialog */
.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dialog {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  max-width: 380px;
  width: 90%;
}

.dialog-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.dialog-text {
  font-size: 0.8125rem;
  color: var(--txt-secondary);
  margin-bottom: 1.25rem;
}

.dialog-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

/* Date quick picker — inline with label */
.date-quick-btns {
  display: inline-flex;
  gap: 0.2rem;
  margin-left: 0.4rem;
  vertical-align: middle;
}

.date-btn {
  font-size: 0.625rem;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  color: var(--txt-secondary);
  cursor: pointer;
  transition: all 0.15s;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
}

.date-btn:hover {
  color: var(--txt-primary);
  border-color: var(--border-hover);
}

.date-btn-active {
  background: var(--brand-primary-15);
  color: var(--brand-primary);
  border-color: rgba(59, 130, 246, 0.3);
}

/* Hamburger button — hidden on desktop */
.btn-hamburger {
  display: none;
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--txt-primary);
  font-size: 1.25rem;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  line-height: 1;
}

/* Responsive */
@media (max-width: 640px) {
  .entry-item {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }
  .entry-actions { opacity: 1; }
  .entry-row {
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0.5rem 0.75rem;
  }
  .entry-cell-desc {
    flex-basis: 100%;
    order: 10;
  }
  .entry-row-delete {
    opacity: 1;
  }
  .day-header-add {
    opacity: 1;
  }
  .new-entry-row {
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0.5rem 0.75rem;
  }
  .inline-input-new-desc {
    flex-basis: 100%;
    order: 10;
  }
  .btn-hamburger { display: block; }
  .header-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 0.5rem;
    gap: 0.15rem;
  }
  .header-nav.nav-open {
    display: flex;
  }
  .form-row { grid-template-columns: 1fr; }
}

/* Summary table */
.summary-table {
  width: 100%;
  border-collapse: collapse;
}

.summary-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--txt-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface-2);
}

.summary-table th:last-child,
.summary-table td:last-child {
  text-align: right;
}

.summary-table td {
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  border-bottom: 1px solid var(--border);
}

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

.summary-table .total-row td {
  font-weight: 600;
  border-top: 2px solid var(--border-hover);
  padding-top: 0.65rem;
}

/* Monthly header + controls */
.monthly-header {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.monthly-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.monthly-filters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.monthly-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.75rem;
}

/* Period picker (month/week navigation) */
.period-picker {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.period-label {
  font-size: 0.875rem;
  font-weight: 500;
  min-width: 160px;
  text-align: center;
}

/* Multi-select dropdown */
.multi-select-wrapper {
  position: relative;
}

.multi-select-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--txt-secondary);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  max-width: 220px;
}

.multi-select-trigger span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.multi-select-trigger:hover {
  border-color: var(--border-hover);
  color: var(--txt-primary);
}

.multi-select-trigger svg {
  flex-shrink: 0;
  opacity: 0.5;
}

.multi-select-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 60;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius);
  padding: 0.35rem;
  min-width: 180px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.multi-select-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  cursor: pointer;
  transition: background 0.1s;
  white-space: nowrap;
}

.multi-select-option:hover {
  background: var(--bg-surface-3);
}

.multi-select-option input[type=checkbox] {
  accent-color: var(--brand-primary);
  width: 14px;
  height: 14px;
  cursor: pointer;
  flex-shrink: 0;
}

/* Admin list */
.admin-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.admin-item:last-child { border-bottom: none; }

.admin-item-name {
  font-size: 0.8125rem;
  font-weight: 500;
}

.admin-item-inactive {
  color: var(--txt-muted);
  text-decoration: line-through;
}

/* ── Dashboard ── */
.dashboard-greeting {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 1.25rem;
}

.dashboard-greeting span {
  color: var(--txt-secondary);
  font-weight: 400;
  font-size: 0.875rem;
  display: block;
  margin-top: 0.15rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: border-color 0.15s;
}

.stat-card:hover {
  border-color: var(--border-hover);
}

.stat-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-card-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.stat-card-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--txt-muted);
}

.stat-card-value {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.stat-card-sub {
  font-size: 0.75rem;
  color: var(--txt-secondary);
}

.stat-card-sub .up {
  color: var(--success);
  font-weight: 600;
}

.stat-card-sub .down {
  color: var(--danger);
  font-weight: 600;
}

/* Progress ring */
.ring-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.ring-wrap {
  position: relative;
  width: 90px;
  height: 90px;
  flex-shrink: 0;
}

.ring-wrap svg {
  transform: rotate(-90deg);
  width: 90px;
  height: 90px;
}

.ring-bg {
  fill: none;
  stroke: var(--bg-surface-3);
  stroke-width: 7;
}

.ring-fg {
  fill: none;
  stroke: var(--brand-primary);
  stroke-width: 7;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.8s ease;
}

.ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.ring-label small {
  font-size: 0.6rem;
  font-weight: 500;
  color: var(--txt-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.ring-details {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.ring-details-label {
  font-size: 0.75rem;
  color: var(--txt-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ring-details-value {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.ring-details-sub {
  font-size: 0.75rem;
  color: var(--txt-secondary);
}

/* Streak */
.streak-value {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
}

.streak-flame {
  font-size: 1.5rem;
  animation: flame-pulse 2s ease-in-out infinite;
}

@keyframes flame-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.08); }
}

/* Heatmap */
.heatmap-card {
  grid-column: 1 / -1;
}

.heatmap-grid {
  display: grid;
  grid-template-rows: repeat(7, 1fr);
  grid-auto-flow: column;
  gap: 3px;
}

.heatmap-cell {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  background: var(--bg-surface-3);
  transition: background 0.15s;
}

.heatmap-cell[data-level="1"] { background: rgba(59, 130, 246, 0.25); }
.heatmap-cell[data-level="2"] { background: rgba(59, 130, 246, 0.5); }
.heatmap-cell[data-level="3"] { background: rgba(59, 130, 246, 0.75); }
.heatmap-cell[data-level="4"] { background: var(--brand-primary); }

.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.5rem;
  font-size: 0.625rem;
  color: var(--txt-muted);
}

.heatmap-legend-cell {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

/* Category bars */
.cat-bar-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.cat-bar-label {
  font-size: 0.75rem;
  font-weight: 500;
  width: 120px;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--txt-secondary);
}

.cat-bar-track {
  flex: 1;
  height: 8px;
  background: var(--bg-surface-3);
  border-radius: 4px;
  overflow: hidden;
}

.cat-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--brand-primary);
  transition: width 0.6s ease;
}

.cat-bar-value {
  font-size: 0.75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  width: 42px;
  text-align: right;
  flex-shrink: 0;
}

/* ── Gamified Leaderboard ── */

.lb-card {
  grid-column: 1 / -1;
}

.lb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.lb-tabs {
  display: flex;
  gap: 0.2rem;
  padding: 0.2rem;
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.lb-tab {
  padding: 0.3rem 0.75rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--txt-muted);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.lb-tab:hover {
  color: var(--txt-secondary);
  background: var(--bg-surface-3);
}

.lb-tab.active {
  color: var(--brand-primary);
  background: var(--brand-primary-15);
  border-color: rgba(59, 130, 246, 0.2);
}

/* Podium */
.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem 0 0;
  margin-bottom: 1.25rem;
}

.podium-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  flex: 1;
  max-width: 140px;
  opacity: 0;
  animation: podium-rise 0.5s ease forwards;
}

.podium-col:nth-child(1) { animation-delay: 0.2s; }
.podium-col:nth-child(2) { animation-delay: 0.05s; }
.podium-col:nth-child(3) { animation-delay: 0.35s; }

@keyframes podium-rise {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.podium-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  color: var(--txt-primary);
  background: var(--bg-surface-3);
  border: 2px solid var(--border-hover);
  position: relative;
  flex-shrink: 0;
}

.podium-col-1st .podium-avatar {
  width: 56px;
  height: 56px;
  font-size: 1.25rem;
  border-color: #f5a623;
  box-shadow: 0 0 16px rgba(245, 166, 35, 0.25), 0 0 32px rgba(245, 166, 35, 0.1);
  animation: gold-glow 2.5s ease-in-out infinite;
}

@keyframes gold-glow {
  0%, 100% { box-shadow: 0 0 16px rgba(245, 166, 35, 0.25), 0 0 32px rgba(245, 166, 35, 0.1); }
  50% { box-shadow: 0 0 20px rgba(245, 166, 35, 0.35), 0 0 40px rgba(245, 166, 35, 0.15); }
}

.podium-col-2nd .podium-avatar {
  border-color: #a0aabe;
  box-shadow: 0 0 12px rgba(160, 170, 190, 0.15);
}

.podium-col-3rd .podium-avatar {
  border-color: #cd7f32;
  box-shadow: 0 0 12px rgba(205, 127, 50, 0.15);
}

.podium-medal {
  font-size: 1.1rem;
  line-height: 1;
  margin-top: -0.15rem;
}

.podium-name {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--txt-primary);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.podium-hours {
  font-size: 1.1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--txt-primary);
}

.podium-col-1st .podium-hours {
  font-size: 1.35rem;
  color: #f5a623;
}

.podium-trend {
  font-size: 0.6875rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.15rem;
}

.podium-pedestal {
  width: 100%;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  border-bottom: none;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  margin-top: 0.25rem;
}

.podium-col-1st .podium-pedestal { height: 56px; background: linear-gradient(180deg, rgba(245, 166, 35, 0.08), transparent); border-color: rgba(245, 166, 35, 0.15); }
.podium-col-2nd .podium-pedestal { height: 40px; background: linear-gradient(180deg, rgba(160, 170, 190, 0.06), transparent); border-color: rgba(160, 170, 190, 0.12); }
.podium-col-3rd .podium-pedestal { height: 28px; background: linear-gradient(180deg, rgba(205, 127, 50, 0.06), transparent); border-color: rgba(205, 127, 50, 0.12); }

/* Ranked rows (#4+) */
.lb-rows {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.lb-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.5rem;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  transition: background 0.15s;
  opacity: 0;
  animation: lb-row-in 0.35s ease forwards;
}

.lb-row:last-child { border-bottom: none; }
.lb-row:hover { background: rgba(255, 255, 255, 0.02); }

.lb-row-me {
  background: var(--brand-primary-15);
  border-color: rgba(59, 130, 246, 0.12);
}

.lb-row-me:hover {
  background: rgba(59, 130, 246, 0.18);
}

@keyframes lb-row-in {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: translateX(0); }
}

.lb-row-rank {
  font-size: 0.75rem;
  font-weight: 700;
  width: 22px;
  text-align: center;
  color: var(--txt-muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.lb-row-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--txt-secondary);
  background: var(--bg-surface-3);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.lb-row-name {
  font-size: 0.8125rem;
  font-weight: 500;
  width: 100px;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-row-bar-wrap {
  flex: 1;
  height: 7px;
  background: var(--bg-surface-3);
  border-radius: 4px;
  overflow: hidden;
}

.lb-row-bar {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--brand-primary), var(--brand-secondary));
  width: 0;
  animation: lb-bar-fill 0.6s ease forwards;
}

@keyframes lb-bar-fill {
  to { width: var(--bar-pct); }
}

.lb-row-hours {
  font-size: 0.8125rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  width: 48px;
  text-align: right;
  flex-shrink: 0;
}

.lb-trend-up { color: var(--success); }
.lb-trend-down { color: var(--danger); }
.lb-trend-flat { color: var(--txt-muted); }

.lb-row-trend {
  font-size: 0.6875rem;
  font-weight: 600;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}

/* Empty state for leaderboard */
.lb-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--txt-muted);
  font-size: 0.8125rem;
}

/* Responsive */
@media (max-width: 640px) {
  .podium { gap: 0.3rem; padding: 0.5rem 0 0; }
  .podium-col { max-width: 110px; }
  .podium-col-1st .podium-avatar { width: 46px; height: 46px; font-size: 1.1rem; }
  .podium-avatar { width: 38px; height: 38px; font-size: 0.875rem; }
  .podium-hours { font-size: 0.95rem; }
  .podium-col-1st .podium-hours { font-size: 1.1rem; }
  .podium-col-1st .podium-pedestal { height: 44px; }
  .podium-col-2nd .podium-pedestal { height: 32px; }
  .podium-col-3rd .podium-pedestal { height: 22px; }
  .lb-row-name { width: 80px; }
  .lb-header { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
}

.dashboard-section-title {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--txt-muted);
  margin-bottom: 0.75rem;
}

/* Quick action button */
.btn-quick-action {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--brand-primary);
  background: var(--brand-primary-15);
  border: 1px solid rgba(59, 130, 246, 0.2);
  cursor: pointer;
  transition: all 0.15s;
  margin-top: 0.35rem;
}

.btn-quick-action:hover {
  background: rgba(59, 130, 246, 0.25);
  border-color: rgba(59, 130, 246, 0.35);
}

@media (max-width: 640px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .heatmap-cell {
    width: 10px;
    height: 10px;
  }
  .cat-bar-label { width: 80px; }
}

@media (min-width: 641px) and (max-width: 900px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Sub-tabs (pill bar inside pages) */
.sub-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1.25rem;
  padding: 0.25rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: fit-content;
}

.sub-tab {
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--txt-secondary);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
}

.sub-tab:hover {
  color: var(--txt-primary);
  background: var(--bg-surface-2);
}

.sub-tab.active {
  color: var(--brand-primary);
  background: var(--brand-primary-15);
  border-color: rgba(59, 130, 246, 0.2);
}

/* Footer branding */
.app-footer {
  position: fixed;
  bottom: 0;
  right: 0;
  padding: 0.5rem 1rem;
  font-size: 0.6875rem;
  color: var(--txt-muted);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  z-index: 10;
  pointer-events: none;
  background: var(--bg-primary);
}

/* Prevent content from hiding behind fixed footer */
.app-main {
  padding-bottom: 2.5rem;
}

.footer-cyan { color: #1bbde8; }
.footer-name { color: var(--txt-primary); font-weight: 600; }
.footer-violet { color: #7c4dff; }
.footer-version { opacity: 0.6; }

/* Utility */
.hidden { display: none !important; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.mb-1 { margin-bottom: 0.75rem; }
.mt-1 { margin-top: 0.75rem; }
