/* ========================================
   Working Time — Velocity Design System
   ======================================== */

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

/* --- Design Tokens --- */
:root {
  /* Tipografia */
  --font-display: 'Red Hat Display', 'Figtree', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-sans: 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;

  /* Escala tipografica (ratio 1.333) */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.333rem;
  --text-xl: 1.777rem;
  --text-2xl: 2.369rem;
  --text-3xl: 3.157rem;
  --text-4xl: 4.209rem;

  /* Espacamento (4pt scale) */
  --space-2: 0.125rem;
  --space-4: 0.25rem;
  --space-6: 0.375rem;
  --space-8: 0.5rem;
  --space-12: 0.75rem;
  --space-16: 1rem;
  --space-20: 1.25rem;
  --space-24: 1.5rem;
  --space-32: 2rem;
  --space-40: 2.5rem;
  --space-48: 3rem;
  --space-64: 4rem;

  /* Primaria: coral energetico */
  --primary: #E8613C;
  --primary: oklch(0.65 0.20 30);
  --primary-hover: #D04A25;
  --primary-hover: oklch(0.58 0.22 30);
  --primary-subtle: #FEF0EC;
  --primary-subtle: oklch(0.95 0.04 30);
  --primary-muted: #F5C4B3;
  --primary-muted: oklch(0.85 0.08 30);

  /* Secundaria: teal eletrico */
  --secondary: #2BA8A0;
  --secondary: oklch(0.72 0.14 190);
  --secondary-hover: #1E8B84;
  --secondary-hover: oklch(0.65 0.16 190);
  --secondary-subtle: #ECFBFA;
  --secondary-subtle: oklch(0.95 0.03 190);

  /* Semanticas */
  --success: #2D9B5A;
  --success: oklch(0.72 0.17 152);
  --success-subtle: #ECFAEF;
  --success-subtle: oklch(0.95 0.04 152);
  --warning: #D4A017;
  --warning: oklch(0.80 0.16 80);
  --warning-subtle: #FDF8E8;
  --warning-subtle: oklch(0.95 0.04 80);
  --danger: #D94830;
  --danger: oklch(0.63 0.21 25);
  --danger-hover: #BF3520;
  --danger-hover: oklch(0.56 0.23 25);
  --danger-subtle: #FEECEB;
  --danger-subtle: oklch(0.95 0.04 25);

  /* Neutrals quentes (hue 45) */
  --bg-primary: #FDFCFB;
  --bg-primary: oklch(0.99 0.005 45);
  --bg-secondary: #F5F3F0;
  --bg-secondary: oklch(0.96 0.008 45);
  --bg-tertiary: #EDEBE6;
  --bg-tertiary: oklch(0.93 0.01 45);
  --bg-elevated: #FFFFFF;
  --bg-elevated: oklch(1.00 0.00 45);

  --text-primary: #1A1814;
  --text-primary: oklch(0.18 0.02 45);
  --text-secondary: #6B6357;
  --text-secondary: oklch(0.45 0.02 45);
  --text-tertiary: #948C7E;
  --text-tertiary: oklch(0.62 0.015 45);

  --border: #E3E0DA;
  --border: oklch(0.90 0.01 45);
  --border-subtle: #EDEBE6;
  --border-subtle: oklch(0.93 0.008 45);

  /* Sombras quentes */
  --shadow-sm: 0 1px 2px rgba(26, 24, 20, 0.06);
  --shadow: 0 2px 8px rgba(26, 24, 20, 0.08), 0 1px 2px rgba(26, 24, 20, 0.04);
  --shadow-lg: 0 8px 24px rgba(26, 24, 20, 0.12), 0 2px 6px rgba(26, 24, 20, 0.06);
  --shadow-focus: 0 0 0 3px rgba(232, 97, 60, 0.25);

  /* Raios */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  /* Layout */
  --nav-height: 64px;
  --header-height: 52px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);

  /* Easing */
  --ease-out: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

/* --- Dark Mode --- */
/* Auto: segue sistema (quando nao tem .light forcado) */
@media (prefers-color-scheme: dark) {
  :root:not(.light) {
    --primary: #F08060;
    --primary: oklch(0.72 0.18 30);
    --primary-hover: #F5A08A;
    --primary-hover: oklch(0.78 0.20 30);
    --primary-subtle: #3D2420;
    --primary-subtle: oklch(0.25 0.06 30);
    --primary-muted: #5C3530;
    --primary-muted: oklch(0.35 0.08 30);

    --secondary: #5CC8C0;
    --secondary: oklch(0.78 0.12 190);
    --secondary-hover: #80D8D2;
    --secondary-hover: oklch(0.83 0.14 190);
    --secondary-subtle: #1C3533;
    --secondary-subtle: oklch(0.22 0.04 190);

    --success: #5CC88A;
    --success: oklch(0.78 0.15 152);
    --success-subtle: #1C3524;
    --success-subtle: oklch(0.22 0.05 152);
    --warning: #D4B840;
    --warning: oklch(0.82 0.14 80);
    --warning-subtle: #352E1C;
    --warning-subtle: oklch(0.22 0.04 80);
    --danger: #F08060;
    --danger: oklch(0.72 0.19 25);
    --danger-hover: #F5A08A;
    --danger-hover: oklch(0.78 0.21 25);
    --danger-subtle: #3D2020;
    --danger-subtle: oklch(0.22 0.05 25);

    --bg-primary: #1A1816;
    --bg-primary: oklch(0.15 0.01 45);
    --bg-secondary: #242220;
    --bg-secondary: oklch(0.19 0.012 45);
    --bg-tertiary: #33302C;
    --bg-tertiary: oklch(0.24 0.015 45);
    --bg-elevated: #2A2826;
    --bg-elevated: oklch(0.21 0.013 45);

    --text-primary: #F0EDE8;
    --text-primary: oklch(0.93 0.008 45);
    --text-secondary: #A09888;
    --text-secondary: oklch(0.68 0.015 45);
    --text-tertiary: #706858;
    --text-tertiary: oklch(0.50 0.012 45);

    --border: #403C36;
    --border: oklch(0.28 0.015 45);
    --border-subtle: #33302C;
    --border-subtle: oklch(0.24 0.012 45);

    --shadow-sm: 0 1px 2px rgba(10, 8, 6, 0.3);
    --shadow: 0 2px 8px rgba(10, 8, 6, 0.35);
    --shadow-lg: 0 8px 24px rgba(10, 8, 6, 0.5);
    --shadow-focus: 0 0 0 3px rgba(240, 128, 96, 0.3);
  }
}

/* Manual: classe .dark força dark mode */
:root.dark {
  --primary: #F08060;
  --primary: oklch(0.72 0.18 30);
  --primary-hover: #F5A08A;
  --primary-hover: oklch(0.78 0.20 30);
  --primary-subtle: #3D2420;
  --primary-subtle: oklch(0.25 0.06 30);
  --primary-muted: #5C3530;
  --primary-muted: oklch(0.35 0.08 30);
  --secondary: #5CC8C0;
  --secondary: oklch(0.78 0.12 190);
  --secondary-hover: #80D8D2;
  --secondary-hover: oklch(0.83 0.14 190);
  --secondary-subtle: #1C3533;
  --secondary-subtle: oklch(0.22 0.04 190);
  --success: #5CC88A;
  --success: oklch(0.78 0.15 152);
  --success-subtle: #1C3524;
  --success-subtle: oklch(0.22 0.05 152);
  --warning: #D4B840;
  --warning: oklch(0.82 0.14 80);
  --warning-subtle: #352E1C;
  --warning-subtle: oklch(0.22 0.04 80);
  --danger: #F08060;
  --danger: oklch(0.72 0.19 25);
  --danger-hover: #F5A08A;
  --danger-hover: oklch(0.78 0.21 25);
  --danger-subtle: #3D2020;
  --danger-subtle: oklch(0.22 0.05 25);
  --bg-primary: #1A1816;
  --bg-primary: oklch(0.15 0.01 45);
  --bg-secondary: #242220;
  --bg-secondary: oklch(0.19 0.012 45);
  --bg-tertiary: #33302C;
  --bg-tertiary: oklch(0.24 0.015 45);
  --bg-elevated: #2A2826;
  --bg-elevated: oklch(0.21 0.013 45);
  --text-primary: #F0EDE8;
  --text-primary: oklch(0.93 0.008 45);
  --text-secondary: #A09888;
  --text-secondary: oklch(0.68 0.015 45);
  --text-tertiary: #706858;
  --text-tertiary: oklch(0.50 0.012 45);
  --border: #403C36;
  --border: oklch(0.28 0.015 45);
  --border-subtle: #33302C;
  --border-subtle: oklch(0.24 0.012 45);
  --shadow-sm: 0 1px 2px rgba(10, 8, 6, 0.3);
  --shadow: 0 2px 8px rgba(10, 8, 6, 0.35);
  --shadow-lg: 0 8px 24px rgba(10, 8, 6, 0.5);
  --shadow-focus: 0 0 0 3px rgba(240, 128, 96, 0.3);
}

/* --- Base --- */
html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.5;
  background: var(--bg-primary);
  color: var(--text-primary);
  height: 100%;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#app {
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* --- Header --- */
#app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-12) var(--space-16);
  padding-top: calc(var(--space-12) + var(--safe-top));
  height: calc(var(--header-height) + var(--safe-top));
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.app-title {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.sync-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  transition: background 0.3s;
}

.sync-indicator.offline {
  background: var(--text-tertiary);
}

.sync-indicator.syncing {
  background: var(--warning);
  animation: pulse 1s ease-in-out infinite;
}

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

/* --- App Shell --- */
#app-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
}

#app-main {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: var(--space-16);
  padding-bottom: calc(var(--space-16) + var(--nav-height) + var(--safe-bottom));
}

/* --- Navegacao (bottom tab bar) --- */
#app-nav {
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding-bottom: var(--safe-bottom);
  height: calc(var(--nav-height) + var(--safe-bottom));
  background: rgba(253, 252, 251, 0.85);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-subtle);
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
}

@media (prefers-color-scheme: dark) {
  :root:not(.light) #app-nav {
    background: rgba(26, 24, 22, 0.85);
  }
}
:root.dark #app-nav {
  background: rgba(26, 24, 22, 0.85);
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-8) var(--space-12);
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

.nav-btn.active {
  color: var(--primary);
}

.nav-btn.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 3px;
  background: var(--primary);
  border-radius: 0 0 3px 3px;
  animation: navIndicator 0.25s var(--ease-spring);
}

@keyframes navIndicator {
  from { transform: translateX(-50%) scaleX(0); }
  to { transform: translateX(-50%) scaleX(1); }
}

.nav-btn svg {
  width: 22px;
  height: 22px;
}

/* --- Views --- */
.view {
  animation: viewEnter 0.2s var(--ease-out);
}

.view[hidden] {
  display: none !important;
}

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

/* --- Login --- */
.login-container {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  height: 100%;
  padding: var(--space-32);
  gap: var(--space-24);
}

.login-brand {
  display: flex;
  flex-direction: column;
  gap: 0;
  line-height: 0.9;
}

.login-brand-top {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: var(--text-4xl);
  letter-spacing: -0.04em;
  color: var(--text-primary);
}

.login-brand-bottom {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: var(--text-4xl);
  letter-spacing: -0.04em;
  color: var(--primary);
}

/* Compatibilidade com login antigo (login-logo, login-title) */
.login-logo {
  display: none;
}

.login-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.login-subtitle {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  max-width: 340px;
  line-height: 1.5;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-12);
  width: 100%;
  max-width: 360px;
}

.login-form input {
  width: 100%;
  padding: var(--space-12) var(--space-16);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: var(--text-base);
  font-family: var(--font-sans);
  background: var(--bg-secondary);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.login-form input:focus {
  border-color: var(--primary);
  box-shadow: var(--shadow-focus);
}

.login-message {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  min-height: 20px;
}

.login-message.error {
  color: var(--danger);
}

.login-message.success {
  color: var(--success);
}

.login-toggle {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  cursor: pointer;
  text-decoration: none;
  transition: color 0.2s;
}

.login-toggle:hover {
  color: var(--primary);
}

/* --- Botoes --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-8);
  padding: var(--space-12) var(--space-20);
  border: none;
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: background 0.2s, transform 0.15s var(--ease-spring), box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
}

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

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

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

.btn-danger {
  background: var(--danger);
  color: #fff;
}

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

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: var(--space-8) var(--space-12);
}

.btn-ghost:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.btn-sm {
  padding: var(--space-8) var(--space-12);
  font-size: var(--text-xs);
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* --- Project Picker (horizontal pills) --- */
.project-picker {
  display: flex;
  gap: var(--space-8);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding-bottom: var(--space-4);
  margin-bottom: var(--space-20);
}

.project-picker::-webkit-scrollbar {
  display: none;
}

.project-btn {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  padding: var(--space-8) var(--space-16);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: var(--text-xs);
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
  flex-shrink: 0;
}

.project-btn .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.project-btn.active {
  border-color: var(--project-color, var(--primary));
  background: var(--project-bg, var(--primary-subtle));
  color: var(--text-primary);
}

/* --- Timer --- */
.timer-display {
  text-align: center;
  padding: var(--space-40) 0 var(--space-24);
  position: relative;
}

.timer-time {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: baseline;
  position: relative;
}

.timer-time.running {
  color: var(--primary);
}

/* Digitos separados para animacao */
.timer-digit {
  display: inline-block;
  min-width: 0.6em;
  text-align: center;
}

.timer-sep {
  display: inline-block;
  opacity: 1;
  margin: 0 0.02em;
}

.timer-time.running .timer-sep {
  animation: blink 1s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

/* Barra escaner sob os digitos quando running */
.timer-time.running::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 0;
  width: 30%;
  height: 2px;
  background: var(--primary);
  border-radius: 1px;
  animation: scan 2s ease-in-out infinite;
}

@keyframes scan {
  0% { transform: translateX(0); opacity: 0.4; }
  50% { transform: translateX(233%); opacity: 1; }
  100% { transform: translateX(0); opacity: 0.4; }
}

.timer-description {
  margin-top: var(--space-16);
}

.timer-description input {
  width: 100%;
  padding: var(--space-12) var(--space-16);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  background: var(--bg-secondary);
  color: var(--text-primary);
  outline: none;
  text-align: center;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.timer-description input:focus {
  border-color: var(--primary);
  box-shadow: var(--shadow-focus);
}

.timer-description input::placeholder {
  color: var(--text-tertiary);
}

.timer-actions {
  display: flex;
  justify-content: center;
  gap: var(--space-12);
  margin-top: var(--space-20);
}

.btn-start {
  background: var(--primary);
  color: #fff;
  min-width: 200px;
  padding: var(--space-16) var(--space-32);
  font-size: var(--text-base);
  font-weight: 700;
  border-radius: var(--radius-full);
  font-family: var(--font-display);
  letter-spacing: -0.01em;
}

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

.btn-stop {
  background: var(--danger);
  color: #fff;
  min-width: 200px;
  padding: var(--space-16) var(--space-32);
  font-size: var(--text-base);
  font-weight: 700;
  border-radius: var(--radius-full);
  font-family: var(--font-display);
  letter-spacing: -0.01em;
}

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

/* --- Entrada Manual --- */
.manual-toggle {
  text-align: center;
  margin-top: var(--space-12);
}

.manual-toggle a {
  color: var(--text-tertiary);
  font-size: var(--text-xs);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s;
}

.manual-toggle a:hover {
  color: var(--primary);
}

.manual-form {
  margin-top: var(--space-16);
  padding: var(--space-16);
  background: var(--bg-secondary);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.manual-form[hidden] {
  display: none;
}

.form-row {
  display: flex;
  gap: var(--space-12);
  margin-bottom: var(--space-12);
}

.form-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.form-group label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.form-group input,
.form-group select {
  padding: var(--space-8) var(--space-12);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--primary);
  box-shadow: var(--shadow-focus);
}

/* --- Secao (separador com titulo) --- */
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: var(--space-32);
  margin-bottom: var(--space-12);
}

.section-title {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* --- Lista de Entradas (Timeline) --- */
.entries-list {
  display: flex;
  flex-direction: column;
  position: relative;
  padding-left: var(--space-24);
}

/* Linha vertical da timeline */
.entries-list::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 7px;
  width: 2px;
  background: var(--border);
  border-radius: 1px;
}

.entry-row {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  padding: var(--space-8) 0;
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.15s;
  position: relative;
  cursor: pointer;
  animation: entrySlideIn 0.2s var(--ease-out) backwards;
}

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

/* Stagger de entrada */
.entry-row:nth-child(1) { animation-delay: 0ms; }
.entry-row:nth-child(2) { animation-delay: 40ms; }
.entry-row:nth-child(3) { animation-delay: 80ms; }
.entry-row:nth-child(4) { animation-delay: 120ms; }
.entry-row:nth-child(5) { animation-delay: 160ms; }
.entry-row:nth-child(6) { animation-delay: 200ms; }
.entry-row:nth-child(7) { animation-delay: 240ms; }
.entry-row:nth-child(8) { animation-delay: 280ms; }

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

.entry-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  position: absolute;
  left: calc(-1 * var(--space-24) + 2px);
  box-shadow: 0 0 0 3px var(--bg-primary);
}

.entry-info {
  flex: 1;
  min-width: 0;
}

.entry-desc {
  font-size: var(--text-sm);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-desc.empty {
  color: var(--text-tertiary);
  font-style: italic;
}

.entry-time {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: var(--space-2);
}

.entry-duration {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  flex-shrink: 0;
}

.entry-actions {
  display: flex;
  gap: var(--space-4);
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s;
}

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

.entry-actions button {
  padding: var(--space-4);
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  line-height: 0;
  transition: color 0.15s, background 0.15s;
}

.entry-actions button:hover {
  background: var(--bg-tertiary);
  color: var(--danger);
}

/* --- Day Group (historico) --- */
.day-group {
  margin-bottom: var(--space-24);
}

.day-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: var(--space-8) 0;
  margin-bottom: var(--space-8);
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-primary);
}

.day-date {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 700;
}

.day-total {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--primary);
}

/* --- Month Picker --- */
.month-picker {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-16);
  margin-bottom: var(--space-20);
}

.month-picker button {
  padding: var(--space-8);
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  cursor: pointer;
  line-height: 0;
  transition: background 0.15s, border-color 0.15s;
}

.month-picker button:hover {
  background: var(--bg-tertiary);
  border-color: var(--text-tertiary);
}

.month-label {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  min-width: 180px;
  text-align: center;
  letter-spacing: -0.02em;
}

/* --- Filtros de Projeto --- */
.project-filters {
  display: flex;
  gap: var(--space-8);
  margin-bottom: var(--space-16);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
}

.project-filters::-webkit-scrollbar {
  display: none;
}

.filter-btn {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  padding: var(--space-6) var(--space-12);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-family: var(--font-sans);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
  scroll-snap-align: start;
}

.filter-btn.active {
  border-color: var(--project-color, var(--primary));
  background: var(--project-bg, var(--primary-subtle));
  color: var(--text-primary);
  font-weight: 600;
}

.filter-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* --- Cards de Relatorio --- */
.report-cards {
  display: flex;
  gap: var(--space-12);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding-bottom: var(--space-4);
  margin-bottom: var(--space-24);
}

.report-cards::-webkit-scrollbar {
  display: none;
}

.report-card {
  padding: var(--space-16);
  background: var(--bg-secondary);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  min-width: 160px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

/* Indicador de cor no topo do card (substitui border-left banido) */
.report-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--project-color, var(--primary));
  border-radius: 3px 3px 0 0;
}

.report-card-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--space-6);
}

.report-card-value {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.report-card-sub {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: var(--space-4);
}

/* --- Barras de Grafico --- */
.chart-bars {
  display: flex;
  flex-direction: column;
  gap: var(--space-12);
  margin-bottom: var(--space-24);
}

.chart-row {
  display: flex;
  align-items: center;
  gap: var(--space-12);
}

.chart-label {
  font-size: var(--text-xs);
  font-weight: 600;
  min-width: 90px;
  text-align: right;
  color: var(--text-secondary);
}

.chart-bar-container {
  flex: 1;
  height: 28px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.chart-bar {
  height: 100%;
  border-radius: var(--radius-sm);
  transition: width 0.6s var(--ease-out);
  display: flex;
  align-items: center;
  padding-left: var(--space-8);
  width: 0;
}

.chart-bar-value {
  font-size: var(--text-xs);
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}

/* --- Settings --- */
.settings-section {
  margin-bottom: var(--space-32);
}

.settings-section-title {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-12);
}

.project-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.project-item {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  padding: var(--space-12) var(--space-16);
  background: var(--bg-secondary);
  border-radius: var(--radius);
  border: 1px solid var(--border-subtle);
  transition: border-color 0.15s;
}

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

.project-item .dot {
  width: 4px;
  height: 24px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.project-item-info {
  flex: 1;
  min-width: 0;
}

.project-item-name {
  font-size: var(--text-sm);
  font-weight: 600;
}

.project-item-role {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

/* Acoes aparecem no hover */
.project-item .btn-ghost {
  opacity: 0.4;
  transition: opacity 0.15s;
}

.project-item:hover .btn-ghost {
  opacity: 1;
}

/* --- Modal / Dialog --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 24, 20, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: var(--space-24);
  animation: overlayIn 0.15s var(--ease-out);
}

@media (prefers-color-scheme: dark) {
  :root:not(.light) .modal-overlay {
    background: rgba(10, 8, 6, 0.6);
  }
}
:root.dark .modal-overlay {
  background: rgba(10, 8, 6, 0.6);
}

@keyframes overlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  padding: var(--space-24);
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.2s var(--ease-spring);
}

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

.modal-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  margin-bottom: var(--space-16);
  letter-spacing: -0.02em;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-8);
  margin-top: var(--space-20);
}

/* --- Toast --- */
.toast {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--safe-bottom) + var(--space-16));
  left: 50%;
  transform: translateX(-50%);
  padding: var(--space-8) var(--space-20);
  background: var(--text-primary);
  color: var(--bg-primary);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 500;
  z-index: 300;
  animation: toastIn 0.3s var(--ease-spring), toastOut 0.3s ease-in 2.7s forwards;
  pointer-events: none;
  box-shadow: var(--shadow-lg);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(12px) scale(0.9); }
  to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* --- Estado Vazio --- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-48) var(--space-20);
  text-align: center;
  gap: var(--space-8);
}

.empty-icon {
  font-size: var(--text-2xl);
  line-height: 1;
  opacity: 0.3;
}

.empty-title {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-secondary);
}

.empty-desc {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  max-width: 280px;
  line-height: 1.5;
}

/* --- Wizard --- */
.wizard {
  max-width: 480px;
  margin: 0 auto;
  padding: var(--space-24) 0;
}

.wizard-step {
  margin-bottom: var(--space-24);
}

.wizard-step-number {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-8);
}

.wizard-step-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  margin-bottom: var(--space-16);
  letter-spacing: -0.02em;
}

/* --- Utilitarios --- */
.text-center { text-align: center; }
.text-secondary { color: var(--text-secondary); }
.mt-8 { margin-top: var(--space-8); }
.mt-16 { margin-top: var(--space-16); }
.mb-8 { margin-bottom: var(--space-8); }
.mb-16 { margin-bottom: var(--space-16); }
.gap-8 { gap: var(--space-8); }

/* --- Responsivo --- */
@media (min-width: 768px) {
  #app-main {
    max-width: 640px;
    margin: 0 auto;
    padding-left: var(--space-24);
    padding-right: var(--space-24);
  }

  .timer-time {
    font-size: var(--text-3xl);
  }

  .report-cards {
    flex-wrap: wrap;
  }

  .report-card {
    min-width: 0;
    flex: 1 1 140px;
  }
}

/* --- Scrollbar (desktop) --- */
@media (pointer: fine) {
  #app-main::-webkit-scrollbar {
    width: 6px;
  }

  #app-main::-webkit-scrollbar-track {
    background: transparent;
  }

  #app-main::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
  }

  #app-main::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
  }
}

/* --- Focus Visible --- */
:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

button:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

input:focus-visible {
  outline: none;
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
