/* ========================================================================
   base.css — wspólna struktura i zmienne dla wszystkich 20 motywów.
   Motywy nadpisują zmienne CSS i ewentualnie dodają własne reguły.
   ======================================================================== */

:root {
  --bg: #fafafa;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-hover: #f4f4f4;
  --text: #1a1a1a;
  --text-muted: #6b6b6b;
  --border: #e3e3e3;
  --border-strong: #c7c7c7;
  --accent: #5b67ca;
  --accent-text: #ffffff;
  --danger: #d62b2b;
  --ok: #1f8a4f;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
  --shadow: 0 4px 14px rgba(0,0,0,0.07);
  --shadow-lg: 0 12px 30px rgba(0,0,0,0.12);

  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'Crimson Pro', Georgia, 'Times New Roman', serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Menlo, Consolas, monospace;
  --font-display: 'Inter', sans-serif;
  --font-handwriting: 'Caveat', cursive;

  --topbar-h: 56px;
  --terminal-z: 9999;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
}
body { overflow-x: hidden; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button { font-family: inherit; font-size: inherit; cursor: pointer; }

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: var(--text);
}

code, pre {
  font-family: var(--font-mono);
  font-size: 0.92em;
}
pre {
  background: var(--surface-hover);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
}
code { background: var(--surface-hover); padding: 1px 4px; border-radius: 3px; }
pre code { background: none; padding: 0; }

/* === TOPBAR === */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  height: var(--topbar-h);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}
.topbar__left, .topbar__center, .topbar__right { display: flex; align-items: center; gap: 12px; }
.topbar__right { justify-content: flex-end; }
.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
  letter-spacing: -0.02em;
}
.brand:hover { text-decoration: none; }
.brand__dot { color: var(--accent); }
.topbar__nav { display: flex; gap: 4px; margin-left: 12px; }
.nav-link {
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.92rem;
}
.nav-link:hover { background: var(--surface-hover); color: var(--text); text-decoration: none; }
.topbar__date {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  color: var(--text);
}
.topbar__shortcuts { display: flex; gap: 6px; }
.chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 0.82rem;
  color: var(--text-muted);
  transition: 0.15s;
}
.chip:hover { background: var(--surface-hover); color: var(--text); }
.user-email { color: var(--text-muted); font-size: 0.86rem; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logout-form { margin: 0; }

/* === BUTTONS === */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  font-weight: 500;
  font-size: 0.9rem;
  background: var(--surface);
  color: var(--text);
  transition: 0.15s;
}
.btn:hover { background: var(--surface-hover); }
.btn--primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn--primary:hover { filter: brightness(0.95); background: var(--accent); }
.btn--ghost { background: transparent; border-color: var(--border); }
.btn--ghost:hover { background: var(--surface-hover); }
.btn--block { width: 100%; }

/* === MAIN === */
.main { padding: 24px; max-width: 1600px; margin: 0 auto; }

/* === Universal hidden override (HTML hidden attr beats display:flex) === */
[hidden] { display: none !important; }

/* === TASKS PAGE (/tasks) — w stylu Google Tasks === */
.gtasks {
  max-width: 620px;
  margin: 0 auto;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 6px 18px;
  box-shadow: var(--shadow-sm);
}
.gtasks__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 6px 18px 14px;
  border-bottom: 1px solid var(--border);
}
.gtasks__title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  margin: 0;
  font-weight: 600;
}
.gtasks__counter {
  font-size: 0.82rem;
  color: var(--text-muted);
}
.gtasks__section { margin-top: 14px; }
.gtasks__section-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 10px 16px 4px;
  margin: 0;
}
.gtasks__section-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}
.gtasks__section-count {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 400;
}
.gtasks__list {
  list-style: none;
  padding: 6px 0;
  margin: 0;
}
.gtask {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  transition: background 0.1s;
}
.gtask:hover { background: var(--surface-hover); }
.gtask--empty { padding: 18px 16px; }
.gtask__circle {
  width: 22px;
  height: 22px;
  margin-top: 1px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: 0.12s;
}
.gtask__circle:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.gtask__circle-dot {
  width: 0;
  height: 0;
  border-radius: 50%;
  background: var(--accent);
  transition: 0.12s;
}
.gtask__circle:hover .gtask__circle-dot {
  width: 10px;
  height: 10px;
}
.gtask__circle--checked {
  background: var(--accent);
  border-color: var(--accent);
}
.gtask__check {
  color: var(--accent-text);
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1;
}
.gtask__body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.gtask__text {
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.4;
  word-wrap: break-word;
}
.gtask__text--muted { color: var(--text-muted); font-style: italic; }
.gtask--done .gtask__text {
  text-decoration: line-through;
  color: var(--text-muted);
}
.gtask__meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-decoration: none;
  align-self: flex-start;
}
.gtask__meta:hover { color: var(--accent); text-decoration: underline; }

.gtasks__done {
  margin-top: 14px;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}
.gtasks__done-summary {
  padding: 8px 16px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  list-style: none;
  display: flex; align-items: center; gap: 8px;
}
.gtasks__done-summary::-webkit-details-marker { display: none; }
.gtasks__done-summary::before {
  content: "▸";
  display: inline-block;
  transition: transform 0.12s;
  font-size: 0.7rem;
}
.gtasks__done[open] .gtasks__done-summary::before { transform: rotate(90deg); }
.gtasks__done-count {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 0 7px;
  border-radius: 999px;
  font-size: 0.74rem;
}

/* === TERMINAL PAGE (dedykowana strona /terminal) === */
.terminal-page { max-width: 1100px; margin: 0 auto; }
.terminal-page__head { margin: 0 0 12px; display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.terminal-page__title { font-family: var(--font-display); font-size: 1.4rem; margin: 0; }
.terminal-page__hint { color: var(--text-muted); font-size: 0.88rem; margin: 0; }
.terminal-page__hint a { color: var(--accent); text-decoration: none; }
.terminal-page__hint code, .terminal-page__hint kbd {
  background: var(--surface); padding: 1px 6px; border-radius: 3px;
  border: 1px solid var(--border); font-family: var(--font-mono); font-size: 0.82rem;
}
.terminal.terminal--inline {
  position: relative !important;
  width: 100% !important;
  height: calc(100vh - var(--topbar-h) - 120px) !important;
  min-height: 420px;
  right: auto; bottom: auto;
  margin: 0;
  animation: none;
  transform: none;
  box-shadow: var(--shadow-sm);
}

/* === EDITOR TOOLBAR (sticky, pojawia się gdy preview ma focus) === */
.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  position: sticky;
  top: calc(var(--topbar-h) + 6px);
  z-index: 5;

  /* Collapsed by default — nie zajmuje miejsca dopóki preview nie dostanie focus */
  padding: 0 6px;
  margin: 0;
  max-height: 0;
  overflow: hidden;
  border-width: 0;
  opacity: 0;
  pointer-events: none;
  transition: max-height 0.18s ease, padding 0.18s ease, margin 0.18s ease,
              border-width 0.12s, opacity 0.14s;
}
.editor-shell.is-editing .editor-toolbar {
  max-height: 200px;
  padding: 6px;
  margin-bottom: 8px;
  border-width: 1px;
  opacity: 1;
  pointer-events: auto;
}
.editor-toolbar__btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text);
  cursor: pointer;
  min-width: 30px;
  line-height: 1.2;
  transition: 0.12s;
}
.editor-toolbar__btn:hover { background: var(--surface-hover); color: var(--accent); border-color: var(--accent); }
.editor-toolbar__btn--bold { font-weight: 700; }
.editor-toolbar__btn--italic { font-style: italic; }
.editor-toolbar__btn--strike { text-decoration: line-through; }
.editor-toolbar__sep {
  width: 1px;
  background: var(--border);
  margin: 2px 2px;
}

/* === TASK LIST (checkboxes in markdown) === */
.markdown ul:has(> li.task-list-item) { list-style: none; padding-left: 0; margin-left: 0; }
.markdown li.task-list-item {
  list-style: none;
  padding-left: 0;
  margin-left: 0;
  padding: 4px 0;
  display: flex;
  align-items: center;
  gap: 4px;
}
.markdown li.task-list-item input[type="checkbox"] {
  width: 22px;
  height: 22px;
  margin: 0 10px 0 2px;
  flex-shrink: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.markdown li.task-list-item input[type="checkbox"]:checked ~ * { color: var(--text-muted); text-decoration: line-through; }

/* === TIMELINE (next 30 days) === */
.timeline {
  margin: 0 0 18px 0;
  width: 100%;
}
.timeline__track {
  display: grid;
  grid-template-columns: repeat(30, minmax(0, 1fr));
  gap: 4px;
  padding: 4px 0 8px;
}
.timeline__day {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 8px 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
  font-size: 0.78rem;
  line-height: 1.1;
  transition: 0.15s;
}
.timeline__day:hover {
  background: var(--surface-hover);
  transform: translateY(-1px);
}
.timeline__wd {
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 2px;
}
.timeline__num {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
}
.timeline__day--weekend .timeline__wd { color: var(--accent); }
.timeline__day--today {
  border-color: var(--accent);
}
.timeline__day--center {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}
.timeline__day--center .timeline__wd { color: var(--accent-text); opacity: 0.85; }

/* === DASHBOARD 3 COLUMNS === */
.dashboard__cards {
  display: grid;
  grid-template-columns: 1fr 1.1fr 1fr;
  gap: 18px;
  align-items: stretch;
  min-height: calc(100vh - var(--topbar-h) - 48px);
}
.day-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  min-height: 70vh;
  position: relative;
  box-shadow: var(--shadow-sm);
}
.day-card--today { border-color: var(--accent); box-shadow: var(--shadow); }
.day-card__header { display: flex; align-items: baseline; gap: 8px; margin-bottom: 14px; }
.day-card__label {
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}
.day-card__title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0;
  flex: 1;
}
.day-card__expand {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 1.1rem;
  padding: 0 4px;
}
.day-card__expand:hover { color: var(--accent); text-decoration: none; }

.day-card__body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 0;
}
.editor-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  min-height: 0;
}
.editor {
  width: 100%;
  flex: 1;
  min-height: 240px;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.55;
  resize: none;
  color: var(--text);
}
.editor:focus { outline: 2px solid var(--accent); outline-offset: -2px; border-color: transparent; }
.editor--full { min-height: 60vh; }

.preview {
  flex: 1;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: auto;
  font-size: 0.94rem;
  cursor: text;
  outline: none;
}
.preview:hover { border-color: var(--border-strong); }
.preview:focus { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: -2px; }
.preview:empty::before { content: 'Kliknij, aby zacząć pisać…'; color: var(--text-muted); font-style: italic; }

.editor-shell__toggle {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 2;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px 9px;
  font-size: 0.78rem;
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0;
  transition: 0.12s;
}
.editor-shell:hover .editor-shell__toggle,
.editor-shell.is-editing .editor-shell__toggle { opacity: 1; }
.editor-shell__toggle:hover { color: var(--accent); border-color: var(--accent); }

.day-card__status {
  font-size: 0.78rem;
  color: var(--text-muted);
  min-height: 1.2em;
}
.day-card__status--saving { color: var(--text-muted); }
.day-card__status--saved { color: var(--ok); }
.day-card__status--error { color: var(--danger); }

/* === MARKDOWN RENDERED === */
.markdown h1, .markdown h2, .markdown h3, .markdown h4, .markdown h5, .markdown h6 { margin: 0.7em 0 0.3em; line-height: 1.2; }
.markdown h1 { font-size: 1.5rem; }
.markdown h2 { font-size: 1.25rem; }
.markdown h3 { font-size: 1.08rem; }
.markdown p { margin: 0.4em 0; }
.markdown ul, .markdown ol { padding-left: 1.4em; margin: 0.3em 0; }
.markdown li { margin: 0.15em 0; }
.markdown blockquote {
  border-left: 3px solid var(--border-strong);
  margin: 0.5em 0;
  padding: 0.1em 0 0.1em 0.9em;
  color: var(--text-muted);
  font-style: italic;
}
.markdown table { border-collapse: collapse; margin: 0.5em 0; }
.markdown th, .markdown td { border: 1px solid var(--border); padding: 4px 8px; }
.markdown hr { border: 0; border-top: 1px solid var(--border); margin: 1em 0; }
.markdown input[type="checkbox"] { margin-right: 6px; }

/* === AUTH === */
.auth-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background: linear-gradient(160deg, var(--bg), var(--surface));
}
.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 38px 32px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.auth-title { font-family: var(--font-display); font-size: 1.6rem; margin: 0 0 4px; letter-spacing: -0.02em; }
.auth-subtitle { color: var(--text-muted); margin: 0 0 24px; font-size: 0.95rem; }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-footer { margin-top: 18px; text-align: center; color: var(--text-muted); font-size: 0.9rem; }
.auth-demo { margin-top: 18px; padding: 10px 14px; background: var(--surface-hover); border-radius: var(--radius-sm); font-size: 0.84rem; color: var(--text-muted); text-align: center; }
.auth-demo code { background: var(--surface); }
.field { display: flex; flex-direction: column; gap: 4px; }
.field__label { font-size: 0.8rem; font-weight: 500; color: var(--text-muted); }
.field input {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  background: var(--surface);
}
.field input:focus { outline: 2px solid var(--accent); outline-offset: -2px; border-color: transparent; }

.alert { padding: 10px 14px; border-radius: var(--radius-sm); font-size: 0.9rem; margin-bottom: 12px; }
.alert--error { background: rgba(214,43,43,0.12); color: var(--danger); border: 1px solid rgba(214,43,43,0.3); }

/* === SINGLE VIEWS === */
.single { max-width: 980px; margin: 0 auto; }
.single__nav {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px;
}
.single__title { font-family: var(--font-display); font-size: 1.5rem; margin: 0; flex: 1; text-align: center; }
.day-card--single { min-height: 70vh; }

/* === NOTEBOOKS LIST === */
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.page-header h1 { font-family: var(--font-display); margin: 0; font-size: 1.6rem; letter-spacing: -0.02em; }
.notebook-grid {
  list-style: none; padding: 0; margin: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px;
}
.notebook-tile { }
.notebook-tile__link {
  display: flex; flex-direction: column; gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  color: var(--text);
  transition: 0.15s;
  text-decoration: none;
  min-height: 130px;
}
.notebook-tile__link:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); text-decoration: none; }
.notebook-tile__hash { color: var(--accent); font-family: var(--font-mono); font-size: 1.1rem; }
.notebook-tile__name { font-weight: 600; font-size: 1.05rem; }
.notebook-tile__slug { color: var(--text-muted); font-family: var(--font-mono); font-size: 0.78rem; }
.notebook-tile__updated { color: var(--text-muted); font-size: 0.76rem; margin-top: auto; }
.empty-state { padding: 48px 24px; text-align: center; color: var(--text-muted); }
.muted { color: var(--text-muted); }

/* === DIALOG === */
dialog.dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  width: min(92vw, 420px);
}
dialog.dialog::backdrop { background: rgba(0,0,0,0.45); backdrop-filter: blur(2px); }
.dialog__form { display: flex; flex-direction: column; gap: 14px; }
.dialog__actions { display: flex; gap: 8px; justify-content: flex-end; }

/* === SETTINGS === */
.settings-page { max-width: 1000px; margin: 0 auto; }
.settings-section { margin-bottom: 28px; }
.settings-section__title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}
.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 520px;
}
.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.settings-row__label { color: var(--text-muted); font-size: 0.88rem; }
.settings-row__value { color: var(--text); font-weight: 500; }
.settings-form { display: flex; flex-direction: column; gap: 10px; }
.settings-form__title { font-size: 0.95rem; margin: 0 0 4px; font-weight: 600; }
.settings-field { display: flex; flex-direction: column; gap: 4px; font-size: 0.88rem; }
.settings-field input {
  padding: 7px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--text);
}
.settings-field input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.settings-msg {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}
.settings-msg--ok { background: color-mix(in srgb, var(--ok, #2a8) 12%, transparent); color: var(--ok, #2a8); }
.settings-msg--error { background: color-mix(in srgb, var(--danger, #d43) 12%, transparent); color: var(--danger, #d43); }

.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.theme-card {
  position: relative;
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  transition: 0.18s;
}
.theme-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.theme-card__preview {
  height: 130px;
  background: var(--p1, #fff);
  color: var(--p2, #000);
  padding: 12px;
  display: flex; flex-direction: column; gap: 8px;
}
.theme-card__topbar { display: flex; gap: 4px; height: 8px; }
.theme-card__topbar span { display: block; width: 28px; height: 4px; background: var(--p2); opacity: 0.4; border-radius: 2px; }
.theme-card__cards { display: grid; grid-template-columns: 1fr 1.2fr 1fr; gap: 6px; flex: 1; }
.theme-card__card { background: var(--p2); opacity: 0.08; border-radius: 3px; }
.theme-card__card--center { background: var(--p3); opacity: 0.5; }
.theme-card__meta { padding: 12px 14px 14px; }
.theme-card__id { font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-muted); display: block; }
.theme-card__name { font-weight: 600; font-size: 1rem; display: block; margin-top: 2px; }
.theme-card__tagline { font-size: 0.78rem; color: var(--text-muted); display: block; margin-top: 4px; }
.theme-card__active-badge {
  position: absolute; top: 10px; right: 10px;
  background: var(--accent); color: var(--accent-text);
  font-size: 0.7rem; padding: 2px 8px; border-radius: 999px;
  display: none;
}
.theme-card--active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(91,103,202,0.3); }
.theme-card--active .theme-card__active-badge { display: inline-block; }

/* === TERMINAL === */
.terminal-toggle {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: var(--terminal-z);
  background: var(--text);
  color: var(--bg);
  border: none;
  border-radius: 999px;
  width: 56px; height: 56px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  box-shadow: var(--shadow-lg);
  transition: 0.15s;
}
.terminal-toggle:hover { transform: scale(1.05); }

.terminal {
  position: fixed;
  right: 22px;
  bottom: 92px;
  z-index: var(--terminal-z);
  width: min(92vw, 640px);
  height: min(70vh, 540px);
  display: flex; flex-direction: column;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transform-origin: bottom right;
  animation: terminalIn 0.16s ease-out;
}
@keyframes terminalIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.terminal__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px;
  background: var(--surface-hover);
  border-bottom: 1px solid var(--border);
  font-size: 0.84rem;
  color: var(--text-muted);
}
.terminal__title kbd {
  background: var(--surface); padding: 1px 5px; border-radius: 3px; border: 1px solid var(--border);
  font-family: var(--font-mono); font-size: 0.78rem;
}
.terminal__close {
  background: transparent; border: none; color: var(--text-muted); font-size: 1.4rem; line-height: 1; padding: 0 6px;
}
.terminal__close:hover { color: var(--text); }
.terminal__output {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
}
.terminal__line { padding: 2px 0; white-space: pre-wrap; }
.terminal__line--cmd { color: var(--accent); }
.terminal__line--ok { color: var(--ok); }
.terminal__line--err { color: var(--danger); }
.terminal__line--info { color: var(--text-muted); font-style: italic; }
.terminal__cmd-prompt { color: var(--text-muted); margin-right: 4px; }

.terminal__input-wrap {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
}
.terminal__prompt { color: var(--accent); font-weight: 700; }
.terminal__input-shell { position: relative; flex: 1; }
.terminal__input {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.92rem;
  padding: 4px 0;
  position: relative;
  z-index: 2;
}
.terminal__input:focus { outline: none; }
.terminal__ghost {
  position: absolute;
  left: 0; top: 0; padding: 4px 0;
  pointer-events: none;
  color: var(--text-muted);
  opacity: 0.45;
  font-family: var(--font-mono);
  font-size: 0.92rem;
  z-index: 1;
  white-space: pre;
}

.terminal__suggestions {
  list-style: none; margin: 0; padding: 0;
  position: absolute;
  bottom: 56px; left: 12px; right: 12px;
  max-height: 220px; overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  z-index: calc(var(--terminal-z) + 1);
}
.terminal__suggestion {
  padding: 8px 12px;
  cursor: pointer;
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 2fr;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--border);
}
.terminal__suggestion:last-child { border-bottom: none; }
.terminal__suggestion--active, .terminal__suggestion:hover { background: var(--surface-hover); }
.terminal__suggestion-label { font-family: var(--font-mono); font-weight: 600; color: var(--accent); }
.terminal__suggestion-desc { color: var(--text-muted); font-size: 0.84rem; }

/* === ERROR PAGE === */
.error-page { text-align: center; padding: 80px 24px; }
.error-page h1 { font-size: 5rem; margin: 0; font-family: var(--font-display); color: var(--accent); }

@media (max-width: 1024px) {
  .dashboard__cards { grid-template-columns: 1fr; gap: 14px; }
  .day-card { min-height: auto; }
  .topbar { grid-template-columns: 1fr; height: auto; padding: 8px 16px; gap: 8px; }
  .topbar__center, .topbar__right { justify-content: flex-start; }
}

@media (max-width: 720px) {
  /* mobile: pokazuj tylko środkową (wybraną) kartę */
  .dashboard__cards { grid-template-columns: 1fr; gap: 10px; }
  .dashboard__cards .day-card--yesterday,
  .dashboard__cards .day-card--tomorrow { display: none; }

  .main { padding: 10px; max-width: 100%; }
  .topbar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    height: auto;
    padding: 6px 10px;
    gap: 6px;
  }
  .topbar__left { flex-wrap: wrap; gap: 6px; justify-content: space-between; }
  .topbar__nav { margin-left: 0; gap: 0; flex: 1; justify-content: flex-end; flex-wrap: wrap; }
  .nav-link { padding: 5px 8px; font-size: 0.82rem; }
  .topbar__center {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: center;
  }
  .topbar__date { min-width: 0; width: 100%; }
  .topbar__shortcuts { gap: 4px; }
  .topbar__shortcuts .chip { padding: 4px 8px; font-size: 0.78rem; }
  .topbar__right { justify-content: flex-end; }
  .user-email { display: none; }

  .timeline {
    margin: 0 0 10px;
    overflow-x: auto;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }
  .timeline__track {
    display: flex;
    grid-template-columns: none;
    gap: 4px;
    padding: 2px 0 6px;
    min-width: max-content;
  }
  .timeline__day { min-width: 42px; padding: 5px 3px; }
  .timeline__wd { font-size: 0.6rem; }
  .timeline__num { font-size: 0.95rem; }

  .day-card { padding: 12px; min-height: auto; border-radius: 10px; }
  .day-card__header { flex-wrap: wrap; gap: 4px; margin-bottom: 10px; }
  .day-card__title { font-size: 1rem; }
  .day-card__label { font-size: 0.65rem; }
  .preview { padding: 10px 12px; font-size: 0.92rem; }
  .editor { font-size: 0.95rem; padding: 10px 12px; }

  .editor-toolbar {
    top: 4px;
    gap: 3px;
  }
  .editor-toolbar__btn {
    padding: 4px 6px;
    font-size: 0.78rem;
    min-width: 26px;
  }

  /* Floatujący terminal: na mobile mamy /terminal w nav → ukryj toggle */
  .terminal-toggle { display: none; }
  .terminal {
    left: 8px !important; right: 8px !important;
    bottom: 8px !important;
    width: auto !important;
    max-width: none !important;
    height: min(80vh, 540px) !important;
  }
  .terminal-page__head { flex-direction: column; align-items: flex-start; gap: 4px; }
  .terminal.terminal--inline {
    height: calc(100vh - 220px) !important;
    min-height: 320px;
  }

  /* /tasks i /settings — mniej paddingu */
  .gtasks { padding: 10px 4px 14px; border-radius: 10px; }
  .gtasks__header { padding: 6px 12px 10px; }
  .gtask { padding: 8px 12px; }
  .settings-page { padding: 0; }
  .settings-card { padding: 12px; }
}

@media (max-width: 420px) {
  .timeline__day { min-width: 38px; }
  .timeline__num { font-size: 0.9rem; }
  .day-card__title { font-size: 0.95rem; }
  .editor-toolbar__btn { padding: 4px 5px; font-size: 0.74rem; min-width: 24px; }
  .nav-link { padding: 4px 6px; font-size: 0.78rem; }
}
