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

:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-secondary: #f9f9fb;
  --surface-hover: #f0f0f2;
  --border: rgba(0, 0, 0, 0.06);
  --border-strong: rgba(0, 0, 0, 0.12);
  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #aeaeb2;
  --accent: #0071e3;
  --accent-hover: #0077ED;
  --accent-light: rgba(0, 113, 227, 0.08);
  --danger: #ff3b30;
  --danger-light: rgba(255, 59, 48, 0.08);
  --warning: #ff9500;
  --success: #34c759;
  --success-light: rgba(52, 199, 89, 0.08);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --transition: 0.2s cubic-bezier(0.25, 0.1, 0.25, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-secondary: #2c2c2e;
    --surface-hover: #3a3a3c;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.15);
    --text: #f5f5f7;
    --text-secondary: #98989d;
    --text-tertiary: #636366;
    --accent: #0a84ff;
    --accent-hover: #409cff;
    --accent-light: rgba(10, 132, 255, 0.12);
    --danger-light: rgba(255, 69, 58, 0.12);
    --success-light: rgba(48, 209, 88, 0.12);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.4);
  }
}

html {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}

/* ========== LOGIN ========== */
.login-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background: var(--bg);
}

.login-card {
  width: 100%;
  max-width: 360px;
  text-align: center;
}

.logo {
  font-size: 42px;
  font-weight: 700;
  letter-spacing: -1.5px;
  color: var(--text);
  margin-bottom: 6px;
}

.tagline {
  color: var(--text-tertiary);
  font-size: 15px;
  font-weight: 400;
  margin-bottom: 40px;
  letter-spacing: -0.2px;
}

#login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ========== INPUTS ========== */
input, textarea, select {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
  padding: 12px 16px;
  font-size: 17px;
  font-family: inherit;
  width: 100%;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
}

input:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

input::placeholder, textarea::placeholder {
  color: var(--text-tertiary);
}

textarea {
  resize: vertical;
  min-height: 180px;
  line-height: 1.5;
}

input[type="date"] {
  color: var(--text);
}

input[type="checkbox"] {
  width: 22px;
  height: 22px;
  min-width: 22px;
  border-radius: 6px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ========== BUTTONS ========== */
button, .btn {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: 12px 24px;
  font-size: 17px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
  min-height: 48px;
  text-align: center;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  letter-spacing: -0.2px;
}

button:hover, .btn:hover {
  background: var(--accent-hover);
  transform: scale(1.01);
}

button:active, .btn:active {
  transform: scale(0.98);
}

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

button.secondary {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
}

button.secondary:hover {
  background: var(--surface-hover);
}

button.ghost {
  background: transparent;
  color: var(--accent);
  padding: 8px 12px;
  min-height: 36px;
  font-size: 15px;
}

button.ghost:hover {
  background: var(--accent-light);
}

button.danger-ghost {
  background: transparent;
  color: var(--danger);
  padding: 8px 12px;
  min-height: 36px;
  font-size: 15px;
}

button.danger-ghost:hover {
  background: var(--danger-light);
}

button.small {
  padding: 8px 16px;
  font-size: 15px;
  min-height: 36px;
  border-radius: var(--radius-sm);
}

button.icon-btn {
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
  font-size: 18px;
}

/* ========== ERRORS ========== */
.error {
  color: var(--danger);
  font-size: 14px;
  text-align: center;
}

.hidden {
  display: none !important;
}

/* ========== APP SHELL ========== */
.app {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 20px;
  padding-bottom: calc(24px + var(--safe-bottom));
  min-height: 100vh;
}

/* ========== HEADER ========== */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  padding: 8px 0;
}

.header h1 {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

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

/* ========== SEARCH ========== */
.search-input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px 12px 40px;
  font-size: 17px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23aeaeb2' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 14px center;
  box-shadow: var(--shadow-sm);
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* ========== MEETING CARDS ========== */
.meeting-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.meeting-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  cursor: pointer;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
  box-shadow: var(--shadow-sm);
}

.meeting-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.meeting-card:active {
  transform: scale(0.99);
}

.meeting-card h3 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 6px;
  letter-spacing: -0.2px;
}

.meeting-card .meta {
  color: var(--text-secondary);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.meeting-card .meta .separator {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text-tertiary);
}

.meeting-card .todo-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--accent-light);
  color: var(--accent);
}

.meeting-card .todo-badge.complete {
  background: var(--success-light);
  color: var(--success);
}

/* ========== SECTIONS ========== */
.section {
  margin-bottom: 28px;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.section-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.section-icon.blue { background: var(--accent-light); }
.section-icon.green { background: var(--success-light); }
.section-icon.orange { background: rgba(255, 149, 0, 0.1); }
.section-icon.purple { background: rgba(175, 82, 222, 0.1); }
.section-icon.red { background: var(--danger-light); }

.section h2 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary);
}

.section-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
}

.section-content p {
  font-size: 15px;
  line-height: 1.65;
  color: var(--text);
}

.section-content ul {
  list-style: none;
  padding: 0;
}

.section-content li {
  font-size: 15px;
  line-height: 1.55;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.section-content li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.section-content li:first-child {
  padding-top: 0;
}

/* ========== ATTENDEES ========== */
.attendee-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.attendee-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-secondary);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.attendee-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ========== TODOS ========== */
.todo-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.todo-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}

.todo-item:hover {
  box-shadow: var(--shadow);
}

.todo-item.done {
  opacity: 0.45;
}

.todo-item.done .todo-desc {
  text-decoration: line-through;
}

.todo-content {
  flex: 1;
  min-width: 0;
}

.todo-desc {
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 6px;
  line-height: 1.4;
  letter-spacing: -0.1px;
}

.todo-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.todo-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--text-secondary);
}

.todo-meta-icon {
  font-size: 12px;
  opacity: 0.6;
}

/* ========== PAGE TITLE ========== */
.page-title-bar {
  margin-bottom: 24px;
}

.page-title-bar h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin-bottom: 4px;
}

.page-title-bar .page-date {
  font-size: 15px;
  color: var(--text-secondary);
}

.page-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

/* ========== BACK LINK ========== */
.back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--accent);
  text-decoration: none;
  font-size: 17px;
  font-weight: 400;
  margin-bottom: 12px;
  -webkit-tap-highlight-color: transparent;
  transition: opacity var(--transition);
}

.back:hover {
  opacity: 0.7;
}

/* ========== EDIT FORM ========== */
.edit-group {
  margin-bottom: 20px;
}

.edit-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.edit-todo {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
}

.edit-todo .edit-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.edit-todo .edit-row:last-child {
  margin-bottom: 0;
}

.edit-todo input {
  padding: 10px 12px;
  font-size: 15px;
  border-radius: var(--radius-sm);
}

/* ========== LOADING ========== */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  text-align: center;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-bottom: 16px;
}

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

.loading p {
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 500;
}

/* ========== EMPTY STATE ========== */
.empty {
  text-align: center;
  padding: 80px 24px;
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.3;
}

.empty h3 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

.empty p {
  color: var(--text-secondary);
  font-size: 15px;
  margin-bottom: 24px;
  max-width: 260px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.5;
}

/* ========== INSTALL BANNER ========== */
.install-banner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 20px;
  font-size: 14px;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}

/* ========== BUTTON GROUP ========== */
.btn-group {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.btn-group button {
  flex: 1;
}

/* ========== DIVIDER ========== */
.divider {
  height: 1px;
  background: var(--border);
  margin: 24px 0;
}

/* ========== FADE IN ANIMATION ========== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.3s ease-out;
}

/* ========== STATS BAR ========== */
.stats-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
}

.stat-card {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
}

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

/* ========== PROCESSING OVERLAY ========== */
.processing-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.2s ease-out;
}

.processing-card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 40px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  max-width: 300px;
  width: 90%;
}

.processing-card .spinner {
  margin: 0 auto 16px;
}

.processing-card h3 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 6px;
}

.processing-card p {
  font-size: 14px;
  color: var(--text-secondary);
}
