:root {
  color-scheme: light dark;
  --bg: #f5f6fb;
  --content-bg: #ffffff;
  --sidebar-bg: #0f172a;
  --sidebar-text: #e2e8f0;
  --sidebar-muted: #94a3b8;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #ef4444;
  --text: #0f172a;
  --text-secondary: #475569;
  --border: #e2e8f0;
  --shadow: 0 20px 45px rgba(15, 23, 42, 0.1);
}

[data-theme="dark"] {
  --bg: #1e293b;
  --content-bg: #334155;
  --text: #f1f5f9;
  --text-secondary: #cbd5e1;
  --border: #475569;
  --shadow: 0 20px 45px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .filter-btn {
  background: #475569;
  color: #cbd5e1;
}

[data-theme="dark"] .filter-btn.active {
  background: #334155;
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .toggle-btn {
  background: rgba(148, 163, 184, 0.3);
  color: var(--text);
}

[data-theme="dark"] .btn-secondary {
  background: rgba(148, 163, 184, 0.2);
  color: #e2e8f0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "SF Pro Display", "Inter", "Noto Sans JP", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app-shell {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

.sidebar {
  width: 260px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 24px;
  gap: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
  transition: transform 0.3s ease;
  z-index: 2;
}

.sidebar.collapsed {
  transform: translateX(-100%);
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-icon {
  background: transparent;
  border: none;
  color: inherit;
  font-size: 20px;
  cursor: pointer;
}

#btn-sidebar-open {
  display: none;
}

#btn-sidebar-open.top-open {
  margin-bottom: 16px;
}

#btn-sidebar-close {
  display: none;
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-title {
  font-size: 20px;
  font-weight: 700;
}

.brand-sub {
  font-size: 12px;
  color: var(--sidebar-muted);
}

.sidebar-actions {
  display: flex;
}

.sidebar-nav-header {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sidebar-muted);
  margin-bottom: 8px;
}

.sidebar-nav-item {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: inherit;
  font-size: 15px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  margin-bottom: 6px;
  transition: background 0.2s ease;
}

.sidebar-nav-item.active,
.sidebar-nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-section {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 18px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sidebar-section-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.sidebar-section-count {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.35);
  color: var(--sidebar-text);
}

.sidebar-section-empty {
  font-size: 13px;
  color: var(--sidebar-muted);
}

.sidebar-snoozed-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-snoozed-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: rgba(15, 23, 42, 0.25);
  border-radius: 12px;
  padding: 10px 12px;
}

.snoozed-item-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.snoozed-item-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--sidebar-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.snoozed-item-until {
  font-size: 12px;
  color: var(--sidebar-muted);
}

.snoozed-item-actions .btn {
  border-radius: 999px;
}

.snoozed-item-actions {
  display: flex;
  align-items: center;
}

.btn-small {
  padding: 6px 14px;
  font-size: 13px;
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.user-info button {
  white-space: nowrap;
}

.content {
  flex: 1;
  padding: 32px 40px 48px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.content:has(.settings-card) {
  align-items: center;
}

.content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.content-header-main h1 {
  margin: 0;
  font-size: 32px;
}

.content-subtitle {
  margin: 4px 0 0;
  color: var(--text-secondary);
}

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

.card {
  background: var(--content-bg);
  border-radius: 18px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.card-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.card h2 {
  margin: 0;
  font-size: 22px;
}

.toggle-btn {
  border: none;
  background: rgba(148, 163, 184, 0.2);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: 12px;
  font-size: 20px;
  cursor: pointer;
}

#todo-form-card .card-body,
#recurring-task-form-card .card-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#todo-form-card.collapsed .card-body,
#recurring-task-form-card.collapsed .card-body {
  display: none;
}

#todo-form-card.collapsed .card-header,
#recurring-task-form-card.collapsed .card-header {
  margin-bottom: 0;
}

.todo-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 2px;
}

.form-group label:not(:has(input[type="checkbox"])) {
  display: block;
}

input[type="text"],
input[type="date"],
input[type="time"],
input[type="number"],
input[type="email"],
input[type="password"],
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-size: 15px;
  font-family: inherit;
  background: var(--content-bg);
  color: var(--text);
  resize: vertical;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="text"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

input[type="text"]:disabled,
input[type="date"]:disabled,
input[type="time"]:disabled,
input[type="number"]:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: var(--bg);
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23475569' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

[data-theme="dark"] select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23cbd5e1' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary);
  margin: 0;
}

input[type="checkbox"]:not(.weekday-selector input[type="checkbox"]) {
  margin-right: 8px;
}

.form-group label:has(input[type="checkbox"]) {
  display: flex;
  align-items: center;
  font-weight: 500;
  cursor: pointer;
}

small {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

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

.form-actions .btn {
  min-width: 100px;
}

.form-actions .btn-secondary {
  background: rgba(148, 163, 184, 0.15);
  color: var(--text);
}

.form-actions .btn-secondary:hover {
  background: rgba(148, 163, 184, 0.25);
}

.todos-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.todos-card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.todos-card-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.todo-count {
  font-size: 14px;
  color: var(--text-secondary);
}

.metrics-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.metrics-card-subtitle {
  margin: 6px 0 0;
  color: var(--text-secondary);
  font-size: 14px;
}

.metrics-intervals {
  display: inline-flex;
  gap: 8px;
  padding: 4px;
  border-radius: 999px;
  background: #eef2ff;
}

.metrics-interval-btn {
  border: none;
  background: transparent;
  color: #475569;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.metrics-interval-btn.active {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.15);
}

.metrics-summary {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.metrics-summary-item {
  flex: 1;
  min-width: 140px;
  background: rgba(37, 99, 235, 0.06);
  border-radius: 16px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.metrics-summary-label {
  font-size: 13px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.metrics-summary-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
}

.metrics-chart-wrapper {
  margin-top: 20px;
}

.metrics-message {
  text-align: center;
  color: var(--text-secondary);
  padding: 24px 0;
  font-size: 14px;
}

.metrics-chart {
  min-height: 200px;
  display: flex;
  align-items: flex-end;
  gap: 12px;
  overflow-x: auto;
  padding: 12px 4px 8px;
  border-bottom: 1px solid var(--border);
}

.metrics-chart.is-loading {
  opacity: 0.4;
}

.metrics-bar-group {
  min-width: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.metrics-bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 160px;
  width: 100%;
  justify-content: center;
}

.metrics-bar {
  width: 14px;
  border-radius: 6px 6px 0 0;
  background: rgba(37, 99, 235, 0.35);
  transition: height 0.2s ease;
}

.metrics-bar.created {
  background: rgba(37, 99, 235, 0.8);
}

.metrics-bar.completed {
  background: rgba(16, 185, 129, 0.8);
}

.metrics-label {
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
  white-space: nowrap;
}

.metrics-legend {
  display: flex;
  align-items: center;
  gap: 24px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 12px;
  flex-wrap: wrap;
}

.metrics-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  margin-right: 6px;
}

.metrics-dot.created {
  background: rgba(37, 99, 235, 0.8);
}

.metrics-dot.completed {
  background: rgba(16, 185, 129, 0.8);
}

[data-theme="dark"] .metrics-intervals {
  background: rgba(148, 163, 184, 0.2);
}

[data-theme="dark"] .metrics-summary-item {
  background: rgba(37, 99, 235, 0.18);
}

.recurring-view-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
}

.view-toggle-btn {
  padding: 6px 18px;
  font-size: 14px;
}

.view-toggle-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.25);
}

.todo-filters {
  display: inline-flex;
  gap: 8px;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 999px;
}

.filter-btn {
  border: none;
  background: transparent;
  color: #475569;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.filter-btn.active {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
}

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

.empty-state {
  text-align: center;
  padding: 32px;
  border: 2px dashed var(--border);
  border-radius: 16px;
  color: var(--text-secondary);
}

.todo-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.reservation-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.reservation-item {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  background: var(--content-bg);
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.05);
}

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

.reservation-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.reservation-status {
  font-size: 13px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #0f172a;
}

.reservation-status.status-pending {
  background: rgba(59, 130, 246, 0.15);
  color: #2563eb;
}

.reservation-status.status-processing {
  background: rgba(248, 191, 73, 0.2);
  color: #b45309;
}

.reservation-status.status-completed {
  background: rgba(16, 185, 129, 0.2);
  color: #047857;
}

.reservation-status.status-cancelled {
  background: rgba(148, 163, 184, 0.2);
  color: #475569;
}

.reservation-status.status-failed {
  background: rgba(239, 68, 68, 0.18);
  color: #b91c1c;
}

.reservation-description {
  margin: 8px 0 12px;
  color: var(--text-secondary);
  white-space: pre-line;
}

.reservation-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 16px;
  font-size: 14px;
  color: var(--text-secondary);
}

.reservation-meta dt {
  font-weight: 600;
}

.reservation-meta dd {
  margin: 0;
}

.reservation-error {
  margin-top: 12px;
  color: var(--danger);
  font-weight: 600;
  font-size: 14px;
}

.reservation-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.todo-item {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
}

.todo-item.dragging {
  opacity: 0.85;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.todo-item.drag-over {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.08);
}

.todo-item.drag-disabled {
  cursor: default;
}

.todo-list.is-dragging .todo-item:not(.dragging) {
  opacity: 0.95;
}

.todo-handle {
  font-size: 18px;
  color: var(--text-secondary);
  cursor: grab;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  margin-right: 4px;
}

.todo-item.dragging .todo-handle {
  cursor: grabbing;
  color: var(--primary);
}

.todo-item.drag-disabled .todo-handle {
  cursor: not-allowed;
  opacity: 0.4;
}

.todo-item.completed {
  opacity: 0.7;
}

.todo-body {
  flex: 1;
}

.todo-title {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 6px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: background 0.2s ease;
}

.todo-title:hover {
  background: rgba(148, 163, 184, 0.1);
}

.todo-description {
  color: var(--text-secondary);
  font-size: 14px;
  white-space: pre-line;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: background 0.2s ease;
  min-height: 20px;
}

.todo-description:hover {
  background: rgba(148, 163, 184, 0.1);
}

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

.todo-type-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 12px;
  background: rgba(37, 99, 235, 0.15);
  color: var(--primary);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.todo-type-badge:hover {
  background: rgba(37, 99, 235, 0.25);
}

.todo-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.todo-label-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 10px;
  background: rgba(148, 163, 184, 0.25);
  color: var(--text-secondary);
  font-size: 11px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.todo-label-badge:hover {
  background: rgba(148, 163, 184, 0.4);
  color: var(--text);
}

.todo-body.editing .todo-title,
.todo-body.editing .todo-description {
  cursor: default;
}

.todo-body.editing .todo-title:hover,
.todo-body.editing .todo-description:hover {
  background: transparent;
}

.todo-edit-input,
.todo-edit-textarea {
  width: 100%;
  border: 2px solid var(--primary);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: inherit;
  font-family: inherit;
  background: var(--content-bg);
  color: var(--text);
  resize: vertical;
}

.todo-edit-input {
  font-weight: 600;
  margin-bottom: 6px;
}

.todo-edit-textarea {
  min-height: 60px;
  font-size: 14px;
}

.todo-edit-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.todo-edit-actions .btn {
  padding: 6px 16px;
  font-size: 14px;
}

.todo-advanced-filters {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.filter-field {
  min-width: 160px;
}

.filter-field label,
.filter-field .filter-field-label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.filter-field select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 14px;
  background: var(--content-bg);
  color: var(--text);
}

.label-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.label-chip {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 12px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.label-chip.active {
  background: rgba(37, 99, 235, 0.12);
  color: var(--primary);
  border-color: var(--primary);
}

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

.todo-actions {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  position: relative;
}

.status-toggle-wrapper {
  display: flex;
  align-items: center;
}

.status-toggle {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
  cursor: pointer;
}

.status-toggle-input {
  opacity: 0;
  width: 0;
  height: 0;
}

.status-toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: 0.3s;
  border-radius: 28px;
}

.status-toggle-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.status-toggle-input:checked + .status-toggle-slider {
  background-color: var(--primary);
}

.status-toggle-input:checked + .status-toggle-slider:before {
  transform: translateX(22px);
}

.status-toggle-input:focus + .status-toggle-slider {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.status-toggle-input:disabled + .status-toggle-slider {
  opacity: 0.5;
  cursor: not-allowed;
}

/* モーダル */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

body.reservation-modal-open,
body.recurring-modal-open {
  overflow: hidden;
}

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

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: var(--content-bg);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 480px;
  width: 90%;
  max-height: 90vh;
  overflow: auto;
  z-index: 1001;
}

.modal-content.modal-lg {
  max-width: 720px;
}

.modal-header {
  padding: 24px 28px 16px;
  border-bottom: 1px solid var(--border);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: transparent;
  border: none;
  font-size: 22px;
  color: var(--text);
  cursor: pointer;
}

.modal-close:hover {
  color: var(--primary);
}

.modal-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.modal-body {
  padding: 24px 28px;
}

.modal-body p {
  margin: 0 0 12px 0;
  font-size: 15px;
  color: var(--text);
  line-height: 1.6;
}

.modal-warning {
  color: var(--danger) !important;
  font-weight: 600;
  font-size: 14px !important;
}

.modal-footer {
  padding: 16px 28px 24px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  border-top: 1px solid var(--border);
}

.modal-footer .btn {
  min-width: 100px;
}

.todo-actions .btn-icon {
  width: 32px;
  height: 32px;
  font-size: 16px;
}

.btn-icon.snooze {
  background: rgba(250, 204, 21, 0.2);
  color: #facc15;
}

.btn-icon.snooze:hover:not(:disabled) {
  background: rgba(250, 204, 21, 0.3);
}

.snooze-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--content-bg);
  color: var(--text);
  border-radius: 12px;
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.25);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 180px;
  z-index: 5;
}

.snooze-menu button {
  border: none;
  background: transparent;
  text-align: left;
  padding: 8px;
  border-radius: 8px;
  font-size: 14px;
  color: inherit;
  cursor: pointer;
  transition: background 0.2s ease;
}

.snooze-menu button:hover {
  background: rgba(37, 99, 235, 0.12);
}

.snooze-menu-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.todo-checkbox {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: border 0.2s ease, background 0.2s ease;
}

.todo-checkbox input {
  display: none;
}

.todo-checkbox span {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  display: inline-block;
  background: transparent;
  position: relative;
}

.todo-checkbox input:checked + span {
  background: var(--primary);
}

.btn {
  border: none;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  padding: 10px 22px;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.25);
}

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

.btn-secondary {
  background: rgba(148, 163, 184, 0.2);
  color: #1e293b;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 10px 20px rgba(239, 68, 68, 0.25);
}

.btn-icon {
  border: none;
  background: rgba(148, 163, 184, 0.2);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: 12px;
  font-size: 18px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

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

.btn-icon.delete {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

.btn-icon.delete:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.18);
}

.btn-icon.edit {
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary);
}

.btn-icon.edit:hover:not(:disabled) {
  background: rgba(37, 99, 235, 0.18);
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

.login-overlay {
  text-align: center;
}

.settings-card {
  max-width: 600px;
  width: 100%;
}

.settings-header {
  margin-bottom: 24px;
}

.settings-title-wrapper {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.settings-icon {
  font-size: 32px;
  line-height: 1;
}

.settings-title {
  margin: 0 0 8px 0;
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
}

.settings-subtitle {
  margin: 0;
  font-size: 15px;
  color: var(--text-secondary);
}

.theme-options {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
}

.theme-option {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 140px;
}

.theme-option:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.theme-option.active {
  border-color: #6366f1;
  background: rgba(99, 102, 241, 0.1);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

[data-theme="dark"] .theme-option {
  background: #475569;
  border-color: #64748b;
}

[data-theme="dark"] .theme-option.active {
  background: rgba(99, 102, 241, 0.2);
  border-color: #818cf8;
}

.theme-icon {
  font-size: 48px;
  line-height: 1;
}

.theme-label {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.theme-description {
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary);
  text-align: center;
}

.weekday-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}

.weekday-selector label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  transition: all 0.2s;
}

.weekday-selector label:hover {
  background: var(--content-bg);
  border-color: var(--primary);
}

.weekday-selector input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
}

.weekday-selector label:has(input[type="checkbox"]:checked) {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.weekday-selector label:has(input[type="checkbox"]:checked) input[type="checkbox"] {
  accent-color: white;
}

.todo-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.todo-meta-item {
  padding: 4px 10px;
  background: var(--bg);
  border-radius: 6px;
  font-weight: 500;
}

[data-theme="dark"] .todo-meta-item {
  background: #475569;
}

.todo-next-run {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

.todo-next-run .next-run-icon {
  font-size: 16px;
}

#interval-unit,
#todo-interval-unit {
  margin-left: 8px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
}

.form-group:has(#interval-unit),
.form-group:has(#todo-interval-unit) {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.form-group:has(#interval-unit) label,
.form-group:has(#todo-interval-unit) label {
  margin-bottom: 0;
}

.form-group:has(#interval-unit) input[type="number"],
.form-group:has(#todo-interval-unit) input[type="number"] {
  width: auto;
  min-width: 80px;
  flex: 0 0 auto;
}

@media (max-width: 960px) {
  .sidebar {
    position: fixed;
    height: 100%;
    transform: translateX(-100%);
  }

  .sidebar:not(.collapsed) {
    transform: translateX(0);
  }

  #btn-sidebar-open {
    display: inline-flex;
  }

  #btn-sidebar-close {
    display: inline-flex;
  }

  .content {
    padding: 24px;
  }

  .content-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 640px) {
  .card {
    padding: 22px;
  }

  .todo-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .todo-actions {
    flex-direction: row;
    width: 100%;
    justify-content: flex-end;
  }

  .content-header-main h1 {
    font-size: 26px;
  }
}
