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

:root {
  /* Theme-independent tokens */
  --radius: 12px;
  --radius-sm: 8px;
  --primary: #0d9488;
  --primary-dark: #0f766e;
  --primary-light: #2dd4bf;
  --success: #4ade80;
  --warning: #fbbf24;
  --danger: #f87171;
  --voice-highlight-glow: rgba(45, 212, 191, 0.5);
  --white: #ffffff;
  --text-dark: #1a1a2e;
  /* Spacing scale */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  /* Typography scale */
  --font-size-body: 1rem;
  --font-size-label: 0.85rem;
  --font-size-heading: 1.2rem;
  --font-size-display: 1.8rem;
}

/* Light theme (default) */
:root, [data-theme="light"] {
  --bg: #f5f5f7;
  --bg-card: #ffffff;
  --bg-input: #f0f0f5;
  --text: #1a1a2e;
  --text-muted: #64748b;
  --border: #d1d5db;
  --shadow: 0 4px 20px rgba(0,0,0,0.08);
}

/* Dark theme */
[data-theme="dark"] {
  --bg: #0f0f1a;
  --bg-card: #1a1a2e;
  --bg-input: #16213e;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --border: #2d2d44;
  --shadow: 0 4px 20px rgba(0,0,0,0.3);
}

/* System preference detection (when no manual override) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f0f1a;
    --bg-card: #1a1a2e;
    --bg-input: #16213e;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --border: #2d2d44;
    --shadow: 0 4px 20px rgba(0,0,0,0.3);
  }
}

:focus-visible {
  outline: 2px solid var(--primary-light);
  outline-offset: 2px;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s, color 0.3s;
}

/* ===== App Shell ===== */
#app {
  max-width: 600px;
  margin: 0 auto;
  padding: 0 16px 100px;
}

.app-header {
  text-align: center;
  padding: 24px 0 8px;
}

.app-header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 2px;
}

/* ===== Tab Navigation ===== */
.tab-nav {
  display: flex;
  gap: 4px;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 4px;
  position: sticky;
  top: 0;
  z-index: 100;
  margin-bottom: 20px;
  border: 1px solid var(--border);
}

.tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 12px;
  min-height: 44px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.tab-btn.active {
  background: var(--primary);
  color: var(--white);
}

.tab-btn:not(.active):hover {
  color: var(--text);
  background: rgba(13, 148, 136, 0.1);
}

/* ===== Tab Content ===== */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

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

/* ===== Form Card ===== */
.form-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  border: 1px solid var(--border);
}

.form-card h2 {
  font-size: 1.2rem;
  margin-bottom: 4px;
}

.auto-datetime {
  color: var(--primary-light);
  font-size: 0.85rem;
  margin-bottom: 20px;
  font-weight: 500;
}

/* ===== Form Groups ===== */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

textarea, select, input[type="text"], input[type="month"] {
  width: 100%;
  padding: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  resize: vertical;
}

textarea:focus-visible, select:focus-visible, input:focus-visible {
  border-color: var(--primary);
  outline: 2px solid var(--primary-light);
  outline-offset: 2px;
}

select {
  cursor: pointer;
  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 12px center;
  padding-right: 36px;
  min-height: 44px;
}

/* ===== Severity Slider ===== */
.severity-slider {
  padding: 8px 0;
}

input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 8px;
  background: linear-gradient(to right, var(--success), var(--warning), var(--danger));
  border-radius: 4px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  background: var(--white);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

input[type="range"]::-moz-range-thumb {
  width: 24px;
  height: 24px;
  background: var(--white);
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.severity-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.severity-current {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
}

.severity-color-low { color: var(--success); }
.severity-color-med { color: var(--warning); }
.severity-color-high { color: var(--danger); }

/* ===== Chip Groups ===== */
.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 10px 16px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
}

.chip:hover {
  border-color: var(--primary);
  color: var(--text);
}

.chip.selected {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--white);
}

/* Voice-selected chip highlight */
.chip.voice-selected {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--white);
  box-shadow: 0 0 0 3px var(--voice-highlight-glow);
}

@media (prefers-reduced-motion: no-preference) {
  .chip.voice-selected {
    animation: voiceSelect 400ms ease-out forwards;
  }
}

@keyframes voiceSelect {
  0%   { transform: scale(1);    box-shadow: 0 0 0 0   var(--voice-highlight-glow); }
  40%  { transform: scale(1.08); box-shadow: 0 0 0 6px var(--voice-highlight-glow); }
  100% { transform: scale(1);    box-shadow: 0 0 0 3px var(--voice-highlight-glow); }
}

/* ===== Voice Input ===== */
.voice-input-group {
  position: relative;
}

.voice-input-group textarea {
  padding-right: 48px;
}

.voice-btn {
  position: absolute;
  right: 8px;
  top: 8px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: var(--white);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.voice-btn:hover {
  background: var(--primary-dark);
  transform: scale(1.05);
}

.voice-btn.recording {
  background: var(--danger);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(248,113,113,0.4); }
  50% { box-shadow: 0 0 0 10px rgba(248,113,113,0); }
}

/* ===== Voice Indicator ===== */
.voice-indicator {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 200;
  box-shadow: var(--shadow);
}

.voice-pulse {
  width: 12px;
  height: 12px;
  background: var(--danger);
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

.btn-voice-stop {
  padding: 4px 12px;
  background: var(--danger);
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8rem;
}

/* ===== Primary Button ===== */
.btn-primary {
  width: 100%;
  padding: 14px;
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
}

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

.btn-secondary {
  padding: 8px 16px;
  min-height: 44px;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  cursor: pointer;
}

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

/* ===== Toast ===== */
.toast-container {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: 90%;
  max-width: 400px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--success);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: var(--success);
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
  box-shadow: var(--shadow);
}

.toast-error {
  border-color: var(--danger);
  color: var(--danger);
}

.toast-undo {
  border-color: var(--text-muted);
  color: var(--text);
  animation: toastSlideIn 0.3s ease;
  justify-content: space-between;
}

.toast-undo .undo-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  min-height: 36px;
}

.toast-undo .undo-btn:hover {
  background: var(--bg-input);
}

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

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

/* ===== Loading Spinner ===== */
.loading-spinner {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px 16px;
}

.loading-spinner::after {
  content: '';
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== Empty State Card ===== */
.empty-state-card {
  text-align: center;
  padding: 40px 16px;
  color: var(--text-muted);
}

.empty-state-card svg {
  margin-bottom: 12px;
  opacity: 0.6;
}

.empty-state-card p {
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.empty-state-hint {
  font-size: 0.8rem;
  opacity: 0.7;
}

/* ===== History ===== */
.history-controls {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  align-items: center;
}

.month-picker {
  flex: 1;
  min-height: 44px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-entry-wrapper {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
}

.history-entry-delete-bg {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  background: var(--danger);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 24px;
  color: #fff;
  font-weight: 600;
  font-size: 0.85rem;
  gap: 8px;
  pointer-events: none;
}

.history-entry-delete-bg svg {
  flex-shrink: 0;
}

.history-entry {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  z-index: 1;
  touch-action: pan-y;
}

.history-entry.swiping {
  transition: none;
}

.history-entry.swiped {
  transform: translateX(-100%);
}

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

.history-entry-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.history-date {
  font-weight: 600;
  font-size: 0.9rem;
}

.history-severity {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--white);
}

.severity-low { background: var(--success); }
.severity-med { background: var(--warning); color: var(--text-dark); }
.severity-high { background: var(--danger); }

.history-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}

.history-tag {
  font-size: 0.75rem;
  padding: 2px 8px;
  background: var(--bg-input);
  border-radius: 10px;
  color: var(--text-muted);
}

.history-detail {
  display: none;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.history-detail.expanded {
  display: block;
}

.history-detail p {
  margin-bottom: 6px;
}

.history-detail strong {
  color: var(--text);
}

.history-entry-actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.btn-delete {
  padding: 10px 16px;
  min-height: 44px;
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  cursor: pointer;
}

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

/* ===== Dashboard ===== */
.dashboard-controls {
  margin-bottom: 16px;
}

.dashboard-controls select {
  max-width: 200px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}

.stat-number {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary-light);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.chart-card h3 {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.chart-card canvas {
  max-height: 250px;
}

.patterns-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.patterns-card h3 {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.pattern-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

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

.pattern-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(13, 148, 136, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1rem;
}

.pattern-text {
  font-size: 0.85rem;
  line-height: 1.4;
}

.pattern-text strong {
  color: var(--primary-light);
}

.trigger-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
}

.trigger-label {
  min-width: 100px;
  font-size: 0.85rem;
  text-align: right;
}

.trigger-bar-fill {
  flex: 1;
  height: 24px;
  background: var(--bg-input);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.trigger-bar-inner {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.5s ease;
  display: flex;
  align-items: center;
  padding-left: 8px;
  font-size: 0.7rem;
  color: var(--white);
  font-weight: 600;
  min-width: fit-content;
}

/* ===== Auth Screen ===== */
#auth-screen {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 80dvh;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 24px;
  width: 100%;
  max-width: 380px;
  text-align: center;
}

.auth-title {
  font-size: 2.2rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 4px;
}

.auth-card .tagline {
  margin-bottom: 28px;
}

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

.auth-card input[type="text"],
.auth-card input[type="password"] {
  width: 100%;
  padding: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.95rem;
}

.auth-toggle {
  width: 100%;
  margin-top: 8px;
}

.auth-error {
  color: var(--danger);
  font-size: 0.85rem;
  margin-bottom: 8px;
  text-align: center;
}

input[aria-invalid="true"] {
  border-color: var(--danger);
}

/* ===== Theme Toggle ===== */
.btn-theme-toggle {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  padding: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  min-width: 44px;
  min-height: 44px;
  justify-content: center;
}

.btn-theme-toggle:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ===== Header Row ===== */
.header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.btn-logout {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  padding: 8px;
  min-width: 44px;
  min-height: 44px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

/* ===== Theme Transitions ===== */
.form-card, .stat-card, .chart-card, .patterns-card, .auth-card, .tab-nav, .history-entry, .toast, .install-banner {
  transition: background-color 0.3s, border-color 0.3s, color 0.3s;
}

/* ===== Utilities ===== */
.hidden {
  display: none !important;
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 32px 16px;
  font-size: 0.9rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  background: var(--primary);
  color: var(--white);
  padding: 12px 24px;
  z-index: 1000;
  font-weight: 600;
  border-radius: 0 0 var(--radius-sm) 0;
  text-decoration: none;
}

.skip-link:focus {
  top: 0;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

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

/* ===== Feedback Tab ===== */
.feedback-counter {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: right;
  margin-top: 4px;
}

.feedback-counter.counter-warning {
  color: var(--warning);
}

.feedback-counter.counter-danger {
  color: var(--danger);
}

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

.btn-primary[disabled]:hover {
  transform: none;
}

/* ===== Micro-animations (motion-gated) ===== */
@media (prefers-reduced-motion: no-preference) {
  .tab-btn,
  .chip,
  .voice-btn,
  .btn-primary,
  .btn-secondary,
  .btn-delete,
  .btn-theme-toggle,
  .btn-logout {
    transition: all 0.2s ease;
  }

  .history-entry {
    transition: border-color 0.2s ease;
  }

  textarea, select, input[type="text"], input[type="month"] {
    transition: border-color 0.2s ease;
  }

  .severity-current {
    transition: color 0.2s ease;
  }

  .btn-primary:active {
    transform: scale(0.98);
  }

  .tab-content.active {
    animation: fadeIn 0.25s ease;
  }

  .toast {
    animation: toastSlideIn 0.3s ease, toastSlideOut 0.3s ease 2.7s forwards;
  }
}

/* ===== PWA Install Banner ===== */
.install-banner {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 600px;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 150;
}

.install-banner-content {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.install-banner-icon {
  color: var(--primary);
  flex-shrink: 0;
}

.install-banner-label {
  font-size: 0.85rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ios-install-text {
  font-size: 0.85rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.ios-share-icon {
  color: var(--primary);
  vertical-align: middle;
  flex-shrink: 0;
}

.install-banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: 12px;
}

.btn-install {
  padding: 8px 16px;
  min-height: 36px;
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

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

.btn-install-dismiss {
  width: 36px;
  height: 36px;
  min-width: 36px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}

.btn-install-dismiss:hover {
  color: var(--text);
}

/* ===== Mobile tweaks ===== */
@media (max-width: 400px) {
  #app {
    padding: 0 12px 100px;
  }

  .form-card {
    padding: 16px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .stat-number {
    font-size: 1.6rem;
  }

  .history-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .history-controls .month-picker {
    width: 100%;
  }

  .trigger-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .trigger-label {
    min-width: unset;
    text-align: left;
  }

  .dashboard-controls select {
    max-width: 100%;
    width: 100%;
  }
}
