/* Shared tokens, controls and dialogs. Feature layouts live in design.css / notes.css. */
:root {
  color-scheme: light;
  --bg: #f7f7f4;
  --surface: #fff;
  --text: #252d36;
  --muted: #65707c;
  --line: #dfe3e5;
  --soft: #f0f2f2;
  --brand: #315ed3;
  --brand-soft: #edf2ff;
  --button: var(--brand);
  --button-text: #fff;
  --danger: #aa3030;
  --shadow: 0 18px 70px #15203024;
  font:
    16px/1.5 -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #191c20;
  --surface: #22262b;
  --text: #eef0f2;
  --muted: #a4adb8;
  --line: #3a414a;
  --soft: #2b3035;
  --brand: #a3beff;
  --brand-soft: #2a3854;
  --button-text: #152444;
  --danger: #ffaaa6;
  --shadow: 0 18px 70px #0006;
}
[data-theme="warm"] {
  --bg: #f5efe5;
  --surface: #fffaf3;
  --text: #393128;
  --muted: #76634f;
  --line: #e2d7c7;
  --soft: #efe5d5;
  --brand: #845128;
  --brand-soft: #f3e3ce;
}
[data-theme="ocean"] {
  --bg: #eef4f8;
  --surface: #fafdff;
  --text: #20394c;
  --muted: #526d7e;
  --line: #d4e2eb;
  --soft: #e4eef5;
  --brand: #206883;
  --brand-soft: #dceef4;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}
[hidden] {
  display: none !important;
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  background: none;
  border: 0;
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
a {
  color: var(--brand);
}
button,
input,
textarea,
select,
a {
  -webkit-tap-highlight-color: transparent;
}
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
}
h1,
h2,
h3,
p {
  margin: 0 0 16px;
}
h2 {
  font-size: 23px;
  line-height: 1.3;
  font-weight: 600;
}
h3 {
  font-size: 17px;
  font-weight: 600;
}
p {
  overflow-wrap: anywhere;
}
.icon {
  width: 20px;
  height: 20px;
  flex: none;
  vertical-align: middle;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.muted {
  color: var(--muted);
}
.danger,
.form-error {
  color: var(--danger);
}
.form-error:empty {
  display: none;
}
.primary,
.secondary {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 500;
}
.primary {
  background: var(--button);
  color: var(--button-text);
}
.secondary {
  background: var(--soft);
  border: 1px solid var(--line);
}
.text-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--brand);
  font-size: 13px;
  padding: 9px 0;
}
.icon-button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  color: var(--muted);
  flex: none;
}
.icon-button:hover {
  background: var(--soft);
}
.simple-label {
  display: none;
}
label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin: 14px 0;
}
input:not([type="checkbox"]):not([type="radio"]),
textarea,
select {
  display: block;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  padding: 11px 12px;
  color: var(--text);
  margin-top: 6px;
  font-size: 16px;
}
textarea {
  resize: vertical;
  line-height: 1.55;
}
input[type="checkbox"],
input[type="radio"] {
  width: 20px;
  height: 20px;
  accent-color: var(--brand);
  flex-shrink: 0;
  margin: 0;
}
fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 16px 0;
  padding: 14px;
  min-width: 0;
}
legend {
  font-size: 13px;
  color: var(--muted);
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.form-grid > label {
  min-width: 0;
}
.eyebrow {
  font-size: 11px;
  letter-spacing: 1.3px;
  color: var(--brand);
  padding-right: 36px;
}
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
}
.editor-bottom,
.settings-actions,
.phone-list-actions,
.snooze-options {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.settings-actions {
  margin-top: 24px;
}
.settings-card {
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
.settings-card > button {
  margin: 5px 6px 5px 0;
}
.settings-card > p {
  font-size: 13px;
}
.settings-group {
  border: 1px solid var(--line);
  border-radius: 10px;
  margin: 16px 0;
}
.settings-group > summary {
  padding: 15px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
}
.settings-group > .settings-card,
.schedule-fields {
  padding: 0 16px 16px;
}
.appearance-options,
.theme-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.choice-card,
.theme-choice {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  margin: 0;
  min-width: 0;
}
.choice-card small {
  display: block;
  margin-top: 4px;
  font-size: 12px;
}
.choice-card b {
  color: var(--text);
  font-weight: 500;
}
.theme-choice {
  flex-wrap: wrap;
}
.theme-swatch {
  display: grid;
  place-items: center;
  flex-basis: 100%;
  border-radius: 6px;
  height: 44px;
  background: var(--soft);
  color: var(--text);
}
.theme-swatch[data-swatch="light"] {
  background: #f7f7f4;
  color: #252d36;
}
.theme-swatch[data-swatch="dark"] {
  background: #191c20;
  color: #eef0f2;
}
.theme-swatch[data-swatch="warm"] {
  background: #f5efe5;
  color: #393128;
}
.theme-swatch[data-swatch="ocean"] {
  background: #eef4f8;
  color: #20394c;
}
.language-select {
  width: auto;
  max-width: 140px;
  padding: 8px 10px;
  min-height: 40px;
  font-size: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
  font-size: 27px;
  font-weight: 600;
  letter-spacing: -1px;
}
.brand img {
  width: 28px;
  height: 28px;
}
.brand .icon {
  color: var(--brand);
  width: 24px;
  height: 24px;
}
.auth-page {
  max-width: 650px;
  margin: 0 auto;
  padding: 28px 20px;
}
.auth-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 60px;
  gap: 20px;
}
.auth-card {
  max-width: 440px;
  margin: auto;
  background: var(--surface);
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 16px;
}
.auth-card h1 {
  font-family: Georgia, serif;
  font-weight: 400;
  font-size: 34px;
  letter-spacing: -1px;
}
.auth-card > p {
  color: var(--muted);
  font-size: 14px;
}
.auth-card form > .primary {
  width: 100%;
  margin-top: 10px;
}
.auth-card > .text-button {
  margin-top: 16px;
}
dialog {
  position: fixed;
  inset: 0;
  margin: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 32px;
  background: var(--surface);
  color: var(--text);
  width: min(600px, calc(100% - 32px));
  max-height: 90dvh;
  overflow: auto;
  box-shadow: var(--shadow);
}
dialog::backdrop {
  background: #101a2b55;
}
.modal-close {
  position: absolute;
  right: 12px;
  top: 12px;
}
dialog h2 {
  padding-right: 32px;
}
html:has(dialog[open]) {
  overflow: hidden;
}
dialog.task-panel {
  inset: 0;
  margin: auto;
  border-radius: 16px;
  width: min(600px, calc(100% - 32px));
  height: min(800px, calc(100dvh - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  overflow: hidden;
}
#planner-form {
  height: 100%;
  display: flex;
  flex-direction: column;
}
.editor-header {
  flex: none;
  padding: 24px 26px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.editor-header h2 {
  margin: 6px 0 0;
}
dialog.task-panel > .modal-close {
  z-index: 1;
  background: var(--surface);
}
.editor-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 20px 26px 22px;
}
.editor-scroll input[name="title"] {
  font-size: 20px;
}
.editor-scroll .form-error {
  font-size: 14px;
}
#planner-form > .modal-actions {
  flex: none;
  margin: 0;
  padding: 16px 26px max(16px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.step-edit {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 8px 0;
}
.step-edit input[type="text"] {
  margin: 0;
}
.step-edit .remove-step {
  flex: none;
}
.update-entry {
  border-left: 2px solid var(--line);
  padding: 0 0 12px 14px;
  margin-bottom: 12px;
}
.update-entry time {
  font-size: 12px;
  color: var(--muted);
}
.update-entry p {
  white-space: pre-wrap;
  margin-top: 6px;
  font-size: 14px;
}
.linked-action {
  display: flex;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.linked-action span:nth-child(2) {
  flex: 1;
}
.project-actions {
  margin: 20px 0;
}
.manage-list-row,
.account-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.manage-list-row > span {
  flex: 1;
  min-width: 80px;
}
.account-row > div {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.conflict-item label {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.conflict-item pre {
  flex-basis: 100%;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 12px;
  max-height: 220px;
  overflow: auto;
}
.phone-list-picker > button {
  display: flex;
  gap: 12px;
  align-items: center;
  text-align: left;
  width: 100%;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}
.phone-list-picker > button > span:nth-child(2) {
  flex: 1;
  overflow-wrap: anywhere;
}
.phone-list-picker {
  margin: 24px 0;
}
#toast {
  position: fixed;
  bottom: max(24px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  background: var(--text);
  color: var(--surface);
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 14px;
  max-width: calc(100% - 32px);
  width: max-content;
  opacity: 0;
  pointer-events: none;
}
#toast.visible {
  opacity: 1;
  pointer-events: auto;
}
.toast-undo {
  color: inherit;
  text-decoration: underline;
  margin-left: 12px;
  padding: 4px;
}
.recovery-preview {
  display: grid;
  gap: 8px;
  padding: 16px;
  background: var(--soft);
  border-radius: 10px;
}
.recovery-list {
  padding: 0;
  list-style: none;
}
.recovery-list li {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.recovery-list button {
  margin-right: 12px;
}
html[data-text-size="large"] {
  font-size: 18px;
}
html[data-text-size="large"] input,
html[data-text-size="large"] textarea,
html[data-text-size="large"] select,
html[data-text-size="large"] .primary,
html[data-text-size="large"] .secondary {
  font-size: 18px;
}
html[data-mode="simple"] .simple-label {
  display: inline;
}
html[data-mode="simple"] .pin {
  display: none;
}
@media (max-width: 700px) {
  dialog.task-panel {
    width: calc(100% - 24px);
    height: min(
      800px,
      calc(
        100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom)
      )
    );
    max-height: calc(
      100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom)
    );
  }
  .editor-header {
    padding: 20px 20px 16px;
  }
  .editor-scroll {
    padding: 18px 20px;
  }
  #planner-form > .modal-actions {
    padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  }
  .modal-actions > .primary {
    flex: 1;
  }
  dialog.phone-sheet {
    inset: auto 0 0;
    margin: 0;
    width: 100%;
    border-radius: 22px 22px 0 0;
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
  }
  #toast {
    bottom: calc(92px + env(safe-area-inset-bottom));
  }
  .language-code {
    display: none;
  }
  .auth-header {
    margin-bottom: 32px;
  }
  .auth-card {
    padding: 24px;
  }
  .form-grid {
    gap: 10px;
  }
  html[data-text-size="large"] .form-grid,
  html[data-mode="simple"] .form-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 380px) {
  .form-grid,
  .appearance-options {
    grid-template-columns: 1fr;
  }
  .auth-header {
    flex-wrap: wrap;
  }
  .theme-choice {
    padding: 10px;
  }
  .auth-card {
    padding: 20px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
