:root,
[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-hover: #f0f1f6;
  --border: #e3e5ec;
  --text: #1a1d24;
  --text-dim: #5b6373;
  --text-faint: #9098a6;
  --accent: #6647e6;
  --accent-hover: #5638d5;
  --danger: #dc2626;
  --success: #16a34a;
  --bg-gradient-1: rgba(102, 71, 230, 0.08);
  --bg-gradient-2: rgba(22, 163, 74, 0.05);
  --sand: #d99853;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1115;
  --surface: #181b22;
  --surface-hover: #1f232c;
  --border: #2a2f3a;
  --text: #e6e8ee;
  --text-dim: #8b92a5;
  --text-faint: #5a6173;
  --accent: #7c5cff;
  --accent-hover: #9277ff;
  --danger: #ff6b6b;
  --success: #4ade80;
  --bg-gradient-1: rgba(124, 92, 255, 0.12);
  --bg-gradient-2: rgba(74, 222, 128, 0.06);
  --sand: #e6b673;
}

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

[hidden] {
  display: none !important;
}

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  background-image:
    radial-gradient(circle at 15% 0%, var(--bg-gradient-1), transparent 45%),
    radial-gradient(circle at 85% 100%, var(--bg-gradient-2), transparent 45%);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 3rem 1rem;
  -webkit-font-smoothing: antialiased;
}

.container {
  width: 100%;
  max-width: 800px;
}

.header {
  margin-bottom: 2rem;
}

.header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  padding-top: 0.5rem;
}

.user-email {
  color: var(--text-dim);
  font-size: 0.85rem;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logout-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 0.4rem 0.75rem;
  border-radius: 7px;
  font-size: 0.825rem;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.logout-btn:hover {
  color: var(--text);
  border-color: #353b48;
  background: var(--surface);
}

h1 {
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}

h1.brand {
  margin: 0 0 0.4rem;
  line-height: 0;
}

.brand-logo {
  height: 3rem;
  width: auto;
  display: block;
  border-radius: 10px;
}

@media (max-width: 480px) {
  .brand-logo {
    height: 2.25rem;
    border-radius: 7px;
  }
}

.auth-brand {
  display: inline-block;
  margin-bottom: 0.85rem;
  line-height: 0;
}

.brand-logo-small {
  height: 2.5rem;
  width: 2.5rem;
  display: block;
  border-radius: 8px;
}

@media (max-width: 480px) {
  .brand-logo-small {
    height: 2.25rem;
    width: 2.25rem;
    border-radius: 7px;
  }
}

.subtitle {
  color: var(--text-dim);
  font-size: 0.95rem;
}

.daily-quote {
  position: relative;
  margin: 0 0 1.5rem;
  padding: 0.85rem 1.1rem 0.85rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.quote-shuffle {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  width: 1.85rem;
  height: 1.85rem;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-dim);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.quote-shuffle:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--surface-hover);
}

.quote-shuffle:disabled {
  opacity: 0.5;
  cursor: wait;
}

.quote-text {
  margin: 0;
  padding-right: 2.5rem;
  font-style: italic;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.4;
}

.quote-author {
  color: var(--text-dim);
  font-size: 0.8rem;
  font-style: normal;
  align-self: flex-end;
}

.todo-form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.todo-form input[type="text"] {
  flex: 1;
  min-width: 0;
  padding: 0.85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.95rem;
  color: var(--text);
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s;
}

.due-date-input {
  padding: 0.85rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.9rem;
  color: var(--text);
  font-family: inherit;
  color-scheme: dark;
  transition: border-color 0.15s, background 0.15s;
  min-width: 220px;
}

.due-date-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface-hover);
}

.date-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.date-wrap .due-date-input {
  width: 100%;
}

.date-placeholder {
  position: absolute;
  left: 0.85rem;
  right: 2rem; /* leave the native calendar icon clickable */
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  font-size: 0.9rem;
  pointer-events: none;
  background: var(--surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recurrence-select {
  padding: 0.85rem 2rem 0.85rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.9rem;
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='%238b92a5' d='M6 8 0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  background-size: 10px 7px;
  min-width: 10rem;
}

.recurrence-select:focus {
  outline: none;
  border-color: var(--accent);
  background-color: var(--surface-hover);
}

.todo-form input::placeholder {
  color: var(--text-faint);
}

.todo-form input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface-hover);
}

.todo-form button {
  padding: 0.85rem 1.5rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
  font-family: inherit;
}

.todo-form button:hover {
  background: var(--accent-hover);
}

.todo-form button:active {
  transform: scale(0.97);
}

.stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  padding: 0 0.25rem;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.stats .count {
  color: var(--text);
  font-weight: 500;
}

.filters {
  display: flex;
  gap: 0.25rem;
  padding: 0.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 1rem;
}

.filter-tab {
  flex: 1;
  padding: 0.55rem 0.75rem;
  background: transparent;
  border: none;
  border-radius: 7px;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-dim);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.filter-tab:hover {
  color: var(--text);
}

.filter-tab.is-active {
  background: var(--surface-hover);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.filter-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.1rem;
  margin-left: 0.4rem;
  padding: 0 0.4rem;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 0.7rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  border-radius: 999px;
  line-height: 1;
}

.filter-tab.is-active .filter-count {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.filter-dropdown {
  position: relative;
  flex: 1;
  display: flex;
}

.filter-when-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  width: 100%;
}

.when-caret {
  font-size: 0.7rem;
  color: var(--text-faint);
}

.filter-when-toggle.is-active .when-caret {
  color: var(--text);
}

.filter-when-menu {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 50%;
  transform: translateX(-50%);
  min-width: 11rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
  z-index: 60;
  padding: 0.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.filter-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.75rem;
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.875rem;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}

.filter-menu-item:hover {
  background: var(--surface-hover);
}

.list-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0 0 1rem;
}

.list-control {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--text-dim);
}

.list-control-label {
  white-space: nowrap;
}

.list-control-select {
  padding: 0.45rem 2rem 0.45rem 0.65rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 0.82rem;
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='%238b92a5' d='M6 8 0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.55rem center;
  background-size: 9px 6px;
}

.list-control-select:focus {
  outline: none;
  border-color: var(--accent);
}

.todos-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1rem;
}

.todos-toolbar .primary-btn {
  padding: 0.65rem 1.1rem;
  font-size: 0.9rem;
}

.add-todo-dialog {
  max-width: 28rem;
  width: calc(100vw - 2rem);
}

.todo-form-dialog {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.todo-form-dialog .field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.todo-form-dialog input[type="text"],
.todo-form-dialog input[type="date"],
.todo-form-dialog select {
  width: 100%;
  padding: 0.7rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  min-width: 0;
}

.todo-form-dialog input:focus,
.todo-form-dialog select:focus {
  outline: none;
  border-color: var(--accent);
}

.field-hint-inline {
  color: var(--text-faint);
  font-weight: 400;
  font-size: 0.75rem;
  margin-left: 0.25rem;
}

.shopping-form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.shopping-form input[type="text"] {
  flex: 1;
  min-width: 0;
  padding: 0.85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.95rem;
  color: var(--text);
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s;
}

.shopping-form input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface-hover);
}

.shopping-form button {
  padding: 0.85rem 1.25rem;
  background: var(--accent);
  border: 0;
  border-radius: 10px;
  color: #ffffff;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.shopping-form button:hover {
  background: var(--accent-hover);
}

.shopping-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  padding: 0 0.25rem;
}

.shopping-count {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.shopping-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.shopping-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 0.5rem;
  transition: opacity 0.15s, background 0.15s;
}

.shopping-item .title {
  flex: 1;
  min-width: 0;
  color: var(--text);
  font-size: 0.95rem;
  word-break: break-word;
}

.shopping-item.completed {
  opacity: 0.55;
}

.shopping-item.completed .title {
  text-decoration: line-through;
  color: var(--text-faint);
}

.shopping-item.is-dragging {
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  opacity: 0.95;
}

.todo-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.todo-list:empty + .empty-state.filter-empty {
  display: block;
}

.todo-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  border-radius: 10px;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
  animation: slideIn 0.2s ease-out;
}

.todo-item.has-category {
  border-left-color: var(--category-color);
}

.category-tag {
  display: inline-flex;
  align-items: center;
  margin-left: 0.4rem;
  padding: 0.1rem 0.5rem 0.1rem 0.45rem;
  background: color-mix(in srgb, var(--category-color) 18%, transparent);
  color: var(--category-color);
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 4px;
  vertical-align: middle;
}

.category-tag::before {
  content: '';
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  background: var(--category-color);
  border-radius: 50%;
  margin-right: 0.4rem;
}

.todo-item.completed .category-tag {
  opacity: 0.5;
}

.todo-item:hover {
  background: var(--surface-hover);
  border-color: #353b48;
}

.todo-checkbox {
  appearance: none;
  width: 1.25rem;
  height: 1.25rem;
  border: 1.5px solid var(--text-faint);
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  transition: border-color 0.15s, background 0.15s;
}

.todo-checkbox:hover {
  border-color: var(--accent);
}

.todo-checkbox:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.todo-checkbox:checked::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 1px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.todo-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.todo-item .title {
  font-size: 0.95rem;
  line-height: 1.4;
  transition: color 0.2s, text-decoration-color 0.2s;
  word-break: break-word;
}

.todo-item.completed .title {
  text-decoration: line-through;
  text-decoration-color: var(--text-faint);
  color: var(--text-faint);
}

.due-date {
  font-size: 0.75rem;
  color: var(--text-faint);
  font-weight: 500;
  letter-spacing: 0.01em;
}

.done-date {
  display: inline-flex;
  align-items: center;
  margin-left: 0.4rem;
  padding: 0.1rem 0.45rem;
  background: color-mix(in srgb, var(--success) 14%, transparent);
  color: var(--success);
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 4px;
  vertical-align: middle;
  letter-spacing: 0.02em;
}

.recurrence-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  margin-left: 0.4rem;
  padding: 0.1rem 0.45rem;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 4px;
  vertical-align: middle;
  letter-spacing: 0.02em;
  text-transform: none;
}

.todo-item.completed .recurrence-tag {
  opacity: 0.5;
}

.priority-tag {
  display: inline-flex;
  align-items: center;
  margin-left: 0.4rem;
  padding: 0.1rem 0.45rem;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 4px;
  vertical-align: middle;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.priority-tag.priority-low {
  background: color-mix(in srgb, #6b7280 22%, transparent);
  color: #9ca3af;
}
.priority-tag.priority-medium {
  background: color-mix(in srgb, #facc15 22%, transparent);
  color: #eab308;
}
.priority-tag.priority-high {
  background: color-mix(in srgb, #fb923c 24%, transparent);
  color: #f97316;
}
.priority-tag.priority-urgent {
  background: color-mix(in srgb, var(--danger) 25%, transparent);
  color: var(--danger);
}

.drag-handle {
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  margin-right: 0.25rem;
  background: transparent;
  border: 0;
  color: var(--text-faint);
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  touch-action: none;
  opacity: 0.55;
  transition: opacity 0.15s, background 0.15s;
}

.drag-handle:hover {
  opacity: 1;
  background: var(--surface-hover);
}

.todo-item.is-dragging {
  cursor: grabbing;
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  border-radius: 10px;
  opacity: 0.95;
}

.todo-item.is-dragging .drag-handle {
  cursor: grabbing;
}

.todo-placeholder {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border: 1px dashed var(--border);
  border-radius: 8px;
  margin: 0.25rem 0;
  list-style: none;
}

.edit-btn {
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  background: transparent;
  border: 0;
  color: var(--text-faint);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  opacity: 0.55;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
}

.edit-btn:hover {
  opacity: 1;
  background: var(--surface-hover);
  color: var(--accent);
}

@media (max-width: 480px) {
  .edit-btn {
    opacity: 1;
    width: 2.25rem;
    height: 2.25rem;
  }
}

.edit-dialog {
  max-width: 28rem;
  width: calc(100vw - 2rem);
}

.edit-dialog .field {
  margin-bottom: 0.85rem;
}

.edit-dialog select,
.edit-dialog input[type="text"],
.edit-dialog input[type="date"] {
  width: 100%;
  padding: 0.65rem 0.8rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
}

.edit-dialog .toggle-row {
  margin: 0.5rem 0 0.85rem;
}

.todo-item.completed .priority-tag {
  opacity: 0.4;
}

.priority-select {
  padding: 0.85rem 2rem 0.85rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.9rem;
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='%238b92a5' d='M6 8 0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  background-size: 10px 7px;
  min-width: 9rem;
}

.priority-select:focus {
  outline: none;
  border-color: var(--accent);
  background-color: var(--surface-hover);
}

.due-date.is-overdue {
  color: var(--danger);
}

.todo-item.overdue {
  border-color: rgba(255, 107, 107, 0.35);
  background: rgba(255, 107, 107, 0.05);
}

.todo-item.overdue:hover {
  border-color: rgba(255, 107, 107, 0.55);
  background: rgba(255, 107, 107, 0.08);
}

.todo-item.completed .due-date {
  color: var(--text-faint);
}

.delete-btn {
  background: transparent;
  border: none;
  color: var(--text-faint);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.35rem 0.55rem;
  border-radius: 6px;
  line-height: 1;
  transition: color 0.15s, background 0.15s;
  opacity: 0;
}

.todo-item:hover .delete-btn,
.todo-item:focus-within .delete-btn {
  opacity: 1;
}

.delete-btn:hover {
  color: var(--danger);
  background: rgba(255, 107, 107, 0.1);
}

.empty-state {
  text-align: center;
  color: var(--text-faint);
  padding: 3rem 1rem;
  font-size: 0.95rem;
}

.empty-state .icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  opacity: 0.4;
}

.confirm-dialog {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.75rem;
  max-width: 400px;
  width: calc(100% - 2rem);
  color: var(--text);
  font-family: inherit;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.confirm-dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
}

.dialog-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.dialog-body {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
  word-break: break-word;
}

.dialog-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.dialog-btn {
  padding: 0.55rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.dialog-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.dialog-btn.done {
  border-color: rgba(74, 222, 128, 0.4);
  color: var(--success);
}

.dialog-btn.done:hover {
  background: rgba(74, 222, 128, 0.12);
  color: var(--success);
}

.dialog-btn.delete {
  border-color: rgba(255, 107, 107, 0.5);
  color: var(--danger);
}

.dialog-btn.delete:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.dialog-btn[hidden] {
  display: none;
}

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

.back-link {
  display: inline-block;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.875rem;
  margin-bottom: 0.75rem;
  transition: color 0.15s;
}

.back-link:hover {
  color: var(--text);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.card-body {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  line-height: 1.5;
}

.card .auth-form {
  margin-top: 1rem;
}

.danger-card {
  border-color: rgba(255, 107, 107, 0.3);
}

.danger-card .card-title {
  color: var(--danger);
}

.danger-btn {
  padding: 0.75rem 1rem;
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(255, 107, 107, 0.5);
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  margin-top: 0.25rem;
}

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

.danger-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.form-success {
  background: rgba(74, 222, 128, 0.1);
  border: 1px solid rgba(74, 222, 128, 0.3);
  color: var(--success);
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  font-size: 0.85rem;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  user-select: none;
  margin-bottom: 0.5rem;
}

.toggle-row input[type="checkbox"] {
  appearance: none;
  width: 2.5rem;
  height: 1.4rem;
  background: var(--border);
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}

.toggle-row input[type="checkbox"]::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 1rem;
  height: 1rem;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle-row input[type="checkbox"]:checked {
  background: var(--accent);
}

.toggle-row input[type="checkbox"]:checked::after {
  transform: translateX(1.1rem);
}

.toggle-row input[type="checkbox"]:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.toggle-label {
  font-size: 0.9rem;
  color: var(--text);
}

.toggle-row.is-disabled .toggle-label,
.toggle-row.is-disabled input[type="checkbox"] {
  opacity: 0.55;
  cursor: not-allowed;
}

.coming-soon-pill {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.1rem 0.5rem;
  background: color-mix(in srgb, var(--text-dim) 18%, transparent);
  color: var(--text-dim);
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: 4px;
  vertical-align: middle;
  white-space: nowrap;
}

.theme-picker {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.theme-option {
  flex: 1;
  min-width: 6rem;
  position: relative;
  cursor: pointer;
}

.theme-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.theme-option-label {
  display: block;
  text-align: center;
  padding: 0.7rem 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--text-dim);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.theme-option input[type="radio"]:checked + .theme-option-label {
  border-color: var(--accent);
  color: var(--text);
  background: var(--surface-hover);
}

.theme-option input[type="radio"]:focus-visible + .theme-option-label {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.view-tabs {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.view-tab {
  background: transparent;
  border: 0;
  color: var(--text-dim);
  font-size: 0.95rem;
  font-family: inherit;
  padding: 0.6rem 0.9rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}

.view-tab:hover {
  color: var(--text);
}

.view-tab.is-active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.tool-display {
  font-family: 'SFMono-Regular', ui-monospace, 'Menlo', monospace;
  font-size: 3rem;
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.04em;
  color: var(--text);
  padding: 1rem 0;
  font-variant-numeric: tabular-nums;
  transition: color 0.2s;
}

.tool-display.is-finished {
  color: var(--accent);
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.tool-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.tool-actions .primary-btn,
.tool-actions .secondary-btn {
  flex: 1;
}

.secondary-btn {
  padding: 0.75rem 1rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.secondary-btn:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--accent);
}

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

.timer-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.5rem 0 1rem;
}

.preset-btn {
  flex: 1;
  min-width: 4.5rem;
  padding: 0.5rem 0.6rem;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 6px;
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.preset-btn:hover {
  color: var(--text);
  border-color: var(--accent);
}

.timer-set {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.timer-set.is-locked {
  opacity: 0.5;
}

.time-field {
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
}

.time-field input[type="number"] {
  width: 3.5rem;
  padding: 0.55rem 0.45rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: 'SFMono-Regular', ui-monospace, 'Menlo', monospace;
  font-size: 1rem;
  text-align: center;
  -moz-appearance: textfield;
}

.time-field input[type="number"]::-webkit-outer-spin-button,
.time-field input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.time-field input[type="number"]:focus {
  outline: none;
  border-color: var(--accent);
}

.time-field input[type="number"]:disabled {
  background: var(--bg);
  cursor: not-allowed;
}

.time-field span {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.time-sep {
  color: var(--text-dim);
  font-weight: 600;
  font-family: 'SFMono-Regular', ui-monospace, 'Menlo', monospace;
}

.tool-hint {
  margin-top: 0.85rem;
  color: var(--text-faint);
  font-size: 0.8rem;
  text-align: center;
}

.time-row {
  display: flex;
  gap: 1rem;
  align-items: stretch;
}

.time-row .timer-card {
  flex: 1;
  min-width: 0;
}

.sandbox-card {
  flex: 0 0 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.hourglass {
  width: 100%;
  max-width: 110px;
  height: auto;
  display: block;
}

.hg-frame {
  fill: none;
  stroke: var(--border);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sand {
  fill: var(--sand);
}

.sand-peak {
  fill: var(--sand);
}

.hg-stream {
  stroke: var(--sand);
  stroke-width: 1.1;
  stroke-linecap: round;
  opacity: 0;
  transition: opacity 0.2s;
}

.hourglass.is-running .hg-stream {
  opacity: 0.85;
  stroke-dasharray: 1.4 2.2;
  animation: sand-fall 0.5s linear infinite;
}

@keyframes sand-fall {
  from { stroke-dashoffset: 0; }
  to { stroke-dashoffset: -3.6; }
}


@media (max-width: 520px) {
  .time-row {
    flex-direction: column;
  }
  .sandbox-card {
    flex: 0 0 auto;
  }
  .hourglass {
    max-width: 90px;
  }
}

.sketch-card {
  padding: 1rem;
}

.sketch-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-bottom: 0.85rem;
  align-items: center;
}

.sketch-tools {
  display: flex;
  gap: 0.3rem;
}

.tool-btn {
  padding: 0.5rem 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

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

.tool-btn.is-active {
  border-color: var(--accent);
  color: var(--text);
  background: var(--surface-hover);
}

.sketch-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.sketch-field input[type="color"] {
  width: 2.6rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}

.sketch-field input[type="range"] {
  width: 9rem;
}

.sketch-actions {
  margin-left: auto;
  display: flex;
  gap: 0.4rem;
}

.sketch-canvas-wrap {
  width: 100%;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

#sketch-canvas {
  width: 100%;
  height: auto;
  display: block;
  touch-action: none;
  cursor: crosshair;
}

@media (max-width: 520px) {
  .sketch-actions {
    margin-left: 0;
    width: 100%;
    justify-content: stretch;
  }
  .sketch-actions .secondary-btn {
    flex: 1;
  }
}

.run-mini {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  border-top: 1px solid var(--border);
  padding: 0.45rem 1rem;
}

.run-mini-row {
  max-width: 880px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.run-mini-row + .run-mini-row {
  margin-top: 0.35rem;
  padding-top: 0.35rem;
  border-top: 1px solid var(--border);
}

.run-mini-icon {
  font-size: 1.1rem;
}

.run-mini-label {
  font-size: 0.78rem;
  color: var(--text-dim);
  flex-shrink: 0;
}

.run-mini-time {
  font-family: 'SFMono-Regular', ui-monospace, 'Menlo', monospace;
  font-size: 1rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  margin-left: auto;
  letter-spacing: 0.04em;
}

.run-mini-btn {
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 0;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, background 0.15s, color 0.15s, transform 0.05s;
}

.run-mini-btn:hover,
.run-mini-btn:focus-visible {
  border-color: var(--accent);
  background: var(--surface-hover);
  outline: none;
}

.run-mini-btn:active {
  transform: scale(0.94);
}

.run-mini-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.run-mini-btn[data-state="paused"] {
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 50%, var(--border));
  background: color-mix(in srgb, var(--success) 10%, transparent);
}

.run-mini-btn[data-state="paused"]:hover {
  background: color-mix(in srgb, var(--success) 20%, transparent);
  border-color: var(--success);
}

.run-mini-btn[data-state="running"] {
  color: var(--accent);
}

@media (max-width: 480px) {
  .run-mini-btn {
    width: 2.75rem;
    height: 2.75rem;
  }
}

.focus-ticker {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  border-top: 1px solid var(--border);
  padding: 0.6rem 1rem;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.18);
}

.focus-ticker-inner {
  max-width: 880px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.focus-ticker .focus-tracks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.focus-track {
  padding: 0.4rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 999px;
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.focus-track:hover {
  color: var(--text);
}

.focus-track.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.focus-ticker-controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-left: auto;
}

.focus-volume {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-dim);
  font-size: 0.75rem;
}

.focus-volume input[type="range"] {
  width: 6.5rem;
}

.focus-volume-label {
  min-width: 2.2rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.fm-stop-btn {
  padding: 0.35rem 0.7rem;
  font-size: 0.85rem;
  line-height: 1;
}

.focus-now-playing {
  flex-basis: 100%;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-faint);
  min-height: 1em;
}

.focus-now-playing:empty {
  display: none;
}

.notif-wrap {
  position: relative;
}

.notif-btn {
  position: relative;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.notif-btn:hover {
  color: var(--text);
  border-color: var(--accent);
  background: var(--surface-hover);
}

.notif-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 1.05rem;
  height: 1.05rem;
  padding: 0 4px;
  background: var(--danger);
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg);
  line-height: 1;
}

.notif-panel {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  width: 22rem;
  max-width: calc(100vw - 2rem);
  max-height: 70vh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
  z-index: 100;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.notif-panel-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.notif-close-btn {
  width: 2rem;
  height: 2rem;
  padding: 0;
  background: transparent;
  border: 0;
  color: var(--text-dim);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.notif-close-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.notif-backdrop {
  display: none;
}

.link-btn {
  background: transparent;
  border: 0;
  color: var(--accent);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}

.link-btn:hover {
  text-decoration: underline;
}

.notif-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
}

.notif-item {
  position: relative;
  padding: 0.75rem 2.6rem 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}

.notif-delete-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  background: transparent;
  border: 0;
  color: var(--text-faint);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
}

.notif-delete-btn:hover,
.notif-delete-btn:focus-visible {
  opacity: 1;
  background: var(--surface-hover);
  color: var(--danger);
  outline: none;
}

@media (max-width: 520px) {
  .notif-delete-btn {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.4rem;
    opacity: 1;
  }
  .notif-item {
    padding-right: 3.25rem;
  }
}

.notif-item:last-child {
  border-bottom: 0;
}

.notif-item:hover {
  background: var(--surface-hover);
}

.notif-item.is-unread {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-left: 3px solid var(--accent);
  padding-left: calc(1rem - 3px);
}

.notif-title {
  font-weight: 600;
  margin-bottom: 0.2rem;
  font-size: 0.9rem;
}

.notif-body {
  font-size: 0.85rem;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.notif-item.is-unread .notif-body {
  color: var(--text);
}

.notif-item:not(.is-unread) .notif-body {
  color: var(--text-dim);
}

.notif-time {
  font-size: 0.7rem;
  color: var(--text-faint);
  margin-top: 0.35rem;
}

.notif-empty {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--text-faint);
  font-size: 0.85rem;
}

.admin-card {
  border-left: 3px solid var(--accent);
}

.admin-tag {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.1rem 0.45rem;
  background: var(--accent);
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  border-radius: 4px;
  vertical-align: middle;
  letter-spacing: 0.04em;
}

.admin-pill {
  display: inline-block;
  margin-left: 0.3rem;
  padding: 0.05rem 0.35rem;
  background: var(--accent);
  color: #ffffff;
  font-size: 0.6rem;
  font-weight: 600;
  border-radius: 4px;
  vertical-align: middle;
}

.radio-group {
  display: flex;
  gap: 1.25rem;
  font-size: 0.9rem;
  color: var(--text);
}

.radio-group label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
}

.user-checklist {
  margin-top: 0.5rem;
  max-height: 12rem;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
}

.user-checklist label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--text);
}

.admin-user-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 18rem;
  overflow-y: auto;
}

.admin-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.875rem;
}

.admin-user-email {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.admin-reset-btn {
  flex-shrink: 0;
  padding: 0.4rem 0.7rem;
  font-size: 0.8rem;
}

.temp-password-row {
  display: flex;
  gap: 0.5rem;
  margin: 0.5rem 0 0.75rem;
}

.temp-password-row input {
  flex: 1;
  padding: 0.65rem 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: 'SFMono-Regular', ui-monospace, 'Menlo', monospace;
  font-size: 1rem;
  letter-spacing: 0.06em;
}

.admin-container {
  max-width: 1100px;
}

.dashboard-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
}

#dashboard-search {
  flex: 1;
  min-width: 14rem;
  padding: 0.6rem 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
}

#dashboard-search:focus {
  outline: none;
  border-color: var(--accent);
}

.dashboard-filter {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--text-dim);
}

.dashboard-filter select {
  padding: 0.55rem 1.8rem 0.55rem 0.7rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='%238b92a5' d='M6 8 0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.55rem center;
  background-size: 9px 6px;
}

.dashboard-summary {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-left: auto;
}

.dashboard-table-wrap {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.dashboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  background: var(--bg);
}

.dashboard-table th,
.dashboard-table td {
  padding: 0.65rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.dashboard-table th {
  background: var(--surface);
  color: var(--text-dim);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  position: sticky;
  top: 0;
}

.dashboard-table th.sortable {
  cursor: pointer;
  user-select: none;
}

.dashboard-table th.sortable:hover {
  color: var(--text);
}

.dashboard-table th.is-sorted {
  color: var(--accent);
}

.dashboard-table .sort-indicator {
  display: inline-block;
  margin-left: 0.3rem;
  font-size: 0.65rem;
  vertical-align: middle;
}

.dashboard-table td.num,
.dashboard-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.dashboard-table tbody tr:hover {
  background: var(--surface-hover);
}

.dashboard-table .muted {
  color: var(--text-faint);
}

.dashboard-empty {
  text-align: center;
  padding: 2rem;
  color: var(--text-dim);
}

.dashboard-error {
  padding: 0.85rem 1rem;
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent);
  color: var(--danger);
  border-radius: 8px;
}

.category-list {
  list-style: none;
  padding: 0;
  margin: 0 0 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.category-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.55rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.category-row-color {
  width: 2.25rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
}

.category-row-name {
  flex: 1;
  min-width: 0;
  padding: 0.45rem 0.65rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
}

.category-row-name:focus {
  outline: none;
  border-color: var(--accent);
}

.category-row-save {
  padding: 0.3rem 0.5rem;
  font-size: 0.78rem;
}

.category-row-del {
  width: 1.85rem;
  height: 1.85rem;
  padding: 0;
  background: transparent;
  border: 0;
  color: var(--text-faint);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.category-row-del:hover {
  background: color-mix(in srgb, var(--danger) 16%, transparent);
  color: var(--danger);
}

.category-add {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.category-add input[type="text"] {
  flex: 1;
  min-width: 10rem;
  padding: 0.55rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
}

.category-add input[type="color"] {
  width: 2.5rem;
  height: 2rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.category-add .primary-btn {
  padding: 0.55rem 1rem;
  font-size: 0.85rem;
}

.dialog-hint {
  color: var(--text-dim);
  font-size: 0.82rem;
  margin-top: 0.25rem;
}

#admin-notif-form textarea {
  width: 100%;
  padding: 0.7rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  resize: vertical;
}

#admin-notif-form textarea:focus {
  outline: none;
  border-color: var(--accent);
}

body:has(.focus-ticker) {
  padding-bottom: 0;
}

.focus-ticker-spacer {
  width: 100%;
  height: 10rem;
}

@media (max-width: 520px) {
  .focus-ticker-inner {
    gap: 0.5rem;
  }
  .focus-ticker-controls {
    margin-left: 0;
    width: 100%;
    justify-content: space-between;
  }
  body:has(.focus-ticker) {
    padding-bottom: 0;
  }
  .focus-ticker-spacer {
    height: 14rem;
  }
}

.auth-body {
  align-items: center;
  padding: 1.5rem;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 2.25rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.auth-header {
  margin-bottom: 1.75rem;
  text-align: center;
}

.auth-header h1 {
  font-size: 1.75rem;
  margin-bottom: 0.4rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.field-label {
  font-size: 0.825rem;
  font-weight: 500;
  color: var(--text-dim);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
}

.field-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.75rem;
  font-weight: 500;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
}

.field-link:hover {
  text-decoration: underline;
}

.field input {
  padding: 0.75rem 0.9rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  color: var(--text);
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s;
}

.field input:focus {
  outline: none;
  border-color: var(--accent);
}

.field-hint {
  font-size: 0.75rem;
  color: var(--text-faint);
}

.form-error {
  background: rgba(255, 107, 107, 0.1);
  border: 1px solid rgba(255, 107, 107, 0.3);
  color: var(--danger);
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  font-size: 0.85rem;
}

.primary-btn {
  padding: 0.85rem 1rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
  margin-top: 0.25rem;
}

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

.primary-btn:active:not(:disabled) {
  transform: scale(0.99);
}

.primary-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.auth-switch {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-dim);
}

.auth-switch a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.auth-switch a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

@media (max-width: 480px) {
  body {
    padding: 1.5rem 1rem;
  }
  h1 {
    font-size: 1.75rem;
  }
  .delete-btn {
    opacity: 1;
  }
  .header-row {
    flex-direction: column;
    align-items: stretch;
  }
  .user-menu {
    padding-top: 0;
    justify-content: flex-end;
    gap: 0.5rem;
    flex-wrap: wrap;
  }
  .user-email {
    display: none;
  }
  .logout-btn {
    padding: 0.4rem 0.6rem;
    font-size: 0.78rem;
  }
  .auth-card {
    padding: 1.75rem 1.25rem;
  }
  .todo-form {
    flex-direction: column;
    align-items: stretch;
  }
  .todo-form > * {
    flex: 0 0 auto;
    width: 100%;
    min-width: 0;
  }
  .notif-panel {
    position: fixed;
    top: 1rem;
    left: 1rem;
    right: 1rem;
    width: auto;
    max-width: none;
    max-height: calc(100vh - 2rem);
    z-index: 110;
  }
  .notif-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 100;
  }
  .notif-backdrop[hidden] {
    display: none;
  }
  .notif-close-btn {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.75rem;
  }
  .view-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .view-tabs::-webkit-scrollbar {
    display: none;
  }
  .view-tab {
    flex: 0 0 auto;
    white-space: nowrap;
  }
  .sketch-toolbar {
    gap: 0.6rem;
  }
  .sketch-actions {
    width: 100%;
    margin-left: 0;
  }
  .sketch-actions .secondary-btn {
    flex: 1;
  }
  .sandbox-card {
    padding: 0.5rem;
  }
  .tool-display {
    font-size: 2.25rem;
  }
}
