:root {
  --bg: #0b0f19;
  --bg-card: rgba(22, 30, 49, 0.75);
  --bg-card-hover: rgba(30, 41, 69, 0.95);
  --border: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(56, 189, 248, 0.5);
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --accent: #38bdf8;
  --accent-glow: rgba(56, 189, 248, 0.25);
  --green: #10b981;
  --purple: #a855f7;
  --red: #f43f5e;
  --amber: #eab308;
  --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Plus Jakarta Sans", -apple-system, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  background-image: 
    radial-gradient(at 0% 0%, rgba(56, 189, 248, 0.1) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(168, 85, 247, 0.08) 0px, transparent 50%);
  background-attachment: fixed;
}

.app-layout {
  max-width: 1440px;
  margin: 0 auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  gap: 1.25rem;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.back-home {
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  text-decoration: none;
  transition: all 0.2s;
}
.back-home:hover {
  color: var(--accent);
  background: rgba(56, 189, 248, 0.1);
  border-color: var(--accent);
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #0284c7, #38bdf8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.brand-text h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.badge-sub {
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 600;
}

.header-center {
  text-align: center;
}
.clock {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #fff;
}
.today-date {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: capitalize;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s;
  text-decoration: none;
}
.btn-primary {
  background: #0284c7;
  color: #fff;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
}
.btn-primary:hover {
  background: #0369a1;
  transform: translateY(-1px);
}
.btn-voice {
  background: linear-gradient(135deg, #8b5cf6, #d946ef);
  color: #fff;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.35);
  animation: pulse-glow 3s infinite;
}
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 4px 12px rgba(139, 92, 246, 0.35); }
  50% { box-shadow: 0 4px 20px rgba(217, 70, 239, 0.6); }
}
.btn-glass {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border);
  color: var(--text);
}
.btn-glass:hover {
  background: rgba(255, 255, 255, 0.1);
}
.btn-danger {
  background: rgba(244, 63, 94, 0.2);
  border-color: var(--red);
  color: #ff809b;
}
.btn-danger:hover {
  background: var(--red);
  color: #fff;
}
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.8rem; }
.btn-icon {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
}
.btn-icon:hover { background: rgba(255, 255, 255, 0.12); color: var(--accent); }

/* Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.view-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-left: 0.5rem;
  text-transform: capitalize;
}

.view-switcher {
  display: flex;
  background: rgba(0, 0, 0, 0.3);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.view-btn {
  padding: 0.4rem 0.9rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.view-btn.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.category-filters {
  display: flex;
  gap: 0.4rem;
}
.cat-pill {
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s;
}
.cat-pill.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.dot.work { background: var(--accent); box-shadow: 0 0 6px var(--accent); }
.dot.home { background: var(--green); box-shadow: 0 0 6px var(--green); }
.dot.personal { background: var(--purple); box-shadow: 0 0 6px var(--purple); }
.count {
  font-size: 0.72rem;
  padding: 1px 6px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
}

/* Main Content Views */
.main-content {
  flex: 1;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.hidden { display: none !important; }

/* Month View */
.month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  flex: 1;
  border-collapse: collapse;
}
.month-header {
  padding: 0.75rem 0.5rem;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
}
.month-cell {
  min-height: 110px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  cursor: pointer;
  transition: background 0.15s;
}
.month-cell:hover {
  background: rgba(255, 255, 255, 0.02);
}
.month-cell.other-month {
  opacity: 0.35;
}
.month-cell.today {
  background: rgba(56, 189, 248, 0.05);
}
.cell-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.cell-day-num {
  font-size: 0.85rem;
  font-weight: 700;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.today .cell-day-num {
  background: var(--accent);
  color: #0b0f19;
}
.event-badge {
  font-size: 0.72rem;
  padding: 3px 6px;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s;
}
.event-badge:hover { transform: scale(1.02); }
.event-badge.work { background: rgba(56, 189, 248, 0.2); border-left: 3px solid var(--accent); color: #bae6fd; }
.event-badge.home { background: rgba(16, 185, 129, 0.2); border-left: 3px solid var(--green); color: #a7f3d0; }
.event-badge.personal { background: rgba(168, 85, 247, 0.2); border-left: 3px solid var(--purple); color: #e9d5ff; }
.event-badge.completed { opacity: 0.5; text-decoration: line-through; }

/* List View */
.list-container {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  overflow-y: auto;
}
.list-group-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.4rem;
}
.task-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.2rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: all 0.2s;
}
.task-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
}
.task-checkbox {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--accent);
}
.task-info { flex: 1; }
.task-name { font-size: 0.95rem; font-weight: 600; }
.task-card.completed .task-name { text-decoration: line-through; opacity: 0.5; }
.task-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}
.task-actions { display: flex; gap: 0.4rem; }

/* Week & Day Views (Timeline) */
.timeline-grid {
  display: flex;
  flex: 1;
  overflow-y: auto;
  max-height: calc(100vh - 230px);
}
.timeline-hours {
  width: 60px;
  border-right: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
}
.timeline-hour-cell {
  height: 50px;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 0.2rem 0.4rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.timeline-days {
  display: flex;
  flex: 1;
}
.timeline-day-col {
  flex: 1;
  border-right: 1px solid var(--border);
  position: relative;
}
.timeline-day-header {
  text-align: center;
  padding: 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
}
.timeline-slot {
  height: 50px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  cursor: pointer;
}
.timeline-slot:hover { background: rgba(255, 255, 255, 0.03); }
.timeline-event-card {
  position: absolute;
  left: 4px;
  right: 4px;
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 0.75rem;
  font-weight: 600;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  z-index: 2;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  padding: 1rem;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.modal-card {
  background: #111827;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  width: 100%;
  max-width: 540px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #fff;
}
.btn-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}
.btn-close:hover { color: #fff; }
.modal-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.modal-footer {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
}

/* Forms */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
input[type="text"], input[type="datetime-local"], select, textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: #fff;
  font-family: inherit;
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.2s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
}
.checkbox-group {
  justify-content: center;
  padding-top: 1.4rem;
}
.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

/* Voice Modal Specifics */
.text-center { text-align: center; }
.voice-hint {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.voice-mic-container {
  position: relative;
  width: 100px;
  height: 100px;
  margin: 1.5rem auto 1rem;
}
.mic-circle {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: linear-gradient(135deg, #8b5cf6, #ec4899);
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(139, 92, 246, 0.5);
  position: relative;
  z-index: 2;
  transition: transform 0.2s;
}
.mic-circle:hover { transform: scale(1.05); }
.mic-circle.recording {
  background: #f43f5e;
  box-shadow: 0 0 30px rgba(244, 63, 94, 0.8);
  animation: pulse-record 1s infinite alternate;
}
@keyframes pulse-record {
  0% { transform: scale(1); }
  100% { transform: scale(1.08); }
}
.voice-status {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}
.voice-result-box {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  text-align: left;
  margin-top: 1rem;
}
.result-label { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; }
.recognized-text { font-size: 0.95rem; font-style: italic; margin: 0.3rem 0 0.8rem; color: #fff; }
.ai-extracted-card {
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 8px;
  padding: 0.75rem;
}

/* Sync & TG Guides */
.sync-url-box {
  background: rgba(0, 0, 0, 0.3);
  padding: 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.copy-input {
  display: flex;
  gap: 0.5rem;
}
.sync-guides {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.guide-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem;
}
.guide-item h4 { font-size: 0.9rem; color: #fff; margin-bottom: 0.3rem; }
.guide-item p { font-size: 0.8rem; color: var(--text-muted); line-height: 1.4; }
.tg-instructions ol {
  padding-left: 1.25rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
}
.tg-instructions pre {
  background: #000;
  padding: 0.5rem;
  border-radius: 6px;
  margin: 0.4rem 0;
  color: var(--accent);
}
.tg-status-box {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}

@media (max-width: 768px) {
  .app-layout { padding: 0.75rem; }
  .hide-mobile { display: none; }
  .form-row { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .view-switcher { justify-content: center; }
  .category-filters { overflow-x: auto; padding-bottom: 4px; }
}
