/* ============================================================
   RPM Planner — dark industrial theme
   ============================================================ */

/* === Variables ============================================ */
:root {
  /* Dark industrial theme (default) */
  --bg:          #0f1011;
  --bg-gradient: #0f1011;
  --surface-1:   #1a1c1e;
  --surface-2:   #222527;
  --surface-3:   #2a2d31;
  --border-1:    #333740;
  --border-2:    #3d424a;
  --gold:        #e8c547;
  --gold-dim:    #7a6820;
  --teal:        #2ec4b6;
  --blue:        #4a9eff;
  --blue-dim:    #1e3f6a;
  --amber:       #e8a030;
  --coral:       #e07060;
  --green:       #4ac47a;
  --danger:      #e05a5a;
  --text-1:      #eceef0;
  --text-2:      #8c9199;
  --text-3:      #585e68;
  --header-shadow: none;
  --card-shadow:   none;
  --radius:      6px;
  --radius-lg:   10px;
  --pill-w:      112px;
  --header-h:    56px;
}

/* Light theme overrides — :root[...] beats plain :root in specificity */
:root[data-theme="light"] {
  --bg:          #f0ece4;
  --bg-gradient: #e6e0d6;
  --surface-1:   #faf8f5;
  --surface-2:   #f4f1ec;
  --surface-3:   #edeae4;
  --border-1:    #d8d3ca;
  --border-2:    #c8c2b8;
  --gold:        #b8860b;
  --gold-dim:    #d4a843;
  --teal:        #0e9a8e;
  --blue:        #2b7fd4;
  --blue-dim:    #cce0f5;
  --amber:       #c07820;
  --coral:       #c05040;
  --green:       #2a8a50;
  --danger:      #c04040;
  --text-1:      #1e1c18;
  --text-2:      #5a5650;
  --text-3:      #8a8580;
  --header-shadow: 0 1px 4px rgba(0,0,0,0.08);
  --card-shadow:   0 1px 4px rgba(0,0,0,0.06);
}

/* === Reset ================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  background: linear-gradient(145deg, var(--bg) 0%, var(--bg-gradient) 100%);
  background-attachment: fixed;
  color: var(--text-1);
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100%;
  transition: background 0.3s, color 0.3s;
}

/* === Typography =========================================== */
h1, h2, h3 { font-family: 'DM Serif Display', serif; font-weight: 400; }
.mono { font-family: 'DM Mono', monospace; }

/* === Scrollbar ============================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* === Header =============================================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: var(--header-h);
  background: var(--surface-1);
  border-bottom: 1px solid var(--border-1);
  box-shadow: var(--header-shadow);
  gap: 16px;
}

.app-logo {
  font-family: 'DM Serif Display', serif;
  font-size: 22px;
  letter-spacing: 0.08em;
  color: var(--gold);
  user-select: none;
}

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

.user-display {
  color: var(--text-2);
  font-size: 13px;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logout-form { display: flex; }

.theme-select {
  appearance: none;
  background: transparent;
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  color: var(--text-2);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  padding: 7px 12px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  outline: none;
  line-height: 1;
}
.theme-select:hover {
  background: var(--surface-3);
  border-color: var(--text-3);
  color: var(--text-1);
}
.theme-select:focus { border-color: var(--gold); }

/* === Buttons ============================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
  text-decoration: none;
}

.btn.btn-primary {
  background: var(--gold);
  color: #000;
  border-color: var(--gold);
}
.btn.btn-primary:hover { background: #f0d060; }

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border-color: var(--border-2);
}
.btn-ghost:hover { background: var(--surface-3); color: var(--text-1); }

.btn-export {
  display: flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  color: var(--text-3);
  border-color: var(--border-1);
  font-size: 11px;
  letter-spacing: 0.04em;
  padding: 0 8px;
  text-decoration: none;
}
.btn-export:hover { color: var(--text-1); border-color: var(--border-2); background: var(--surface-2); }
.export-icon { width: 13px; height: 13px; flex-shrink: 0; }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}
.btn-danger:hover { background: rgba(224,90,90,0.12); }

/* === Board ================================================ */
.board {
  padding: 24px;
  max-width: 1400px;
  margin: 0 auto;
}

/* === Ungrouped area ======================================= */
.ungrouped-area {
  margin-bottom: 24px;
  background: var(--surface-1);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--card-shadow);
}

.ungrouped-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-1);
  background: var(--surface-2);
}

.ungrouped-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}

/* === Groups grid ========================================== */
.groups-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

@media (max-width: 1000px) {
  .groups-grid { grid-template-columns: 1fr; }
}

/* === Group card =========================================== */
.group-card {
  background: var(--surface-1);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: border-color 0.15s;
  box-shadow: var(--card-shadow);
}

.group-card:hover { border-color: var(--border-2); }

/* Coloured left border accent */
.group-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent-color, var(--gold));
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}

/* Accent colour cycling — dark theme */
.group-card[data-accent="0"]  { --accent-color: #e8c547; }
.group-card[data-accent="1"]  { --accent-color: #4a9eff; }
.group-card[data-accent="2"]  { --accent-color: #4ac47a; }
.group-card[data-accent="3"]  { --accent-color: #e07060; }
.group-card[data-accent="4"]  { --accent-color: #c47ae0; }
.group-card[data-accent="5"]  { --accent-color: #e8a030; }
.group-card[data-accent="6"]  { --accent-color: #4ae0d0; }
.group-card[data-accent="7"]  { --accent-color: #e04a8a; }

/* Accent colour cycling — light theme (richer/deeper tones) */
:root:root[data-theme="light"] .group-card[data-accent="0"]  { --accent-color: #b8860b; }
:root[data-theme="light"] .group-card[data-accent="1"]  { --accent-color: #2b7fd4; }
:root[data-theme="light"] .group-card[data-accent="2"]  { --accent-color: #2a8a50; }
:root[data-theme="light"] .group-card[data-accent="3"]  { --accent-color: #c05040; }
:root[data-theme="light"] .group-card[data-accent="4"]  { --accent-color: #9040c0; }
:root[data-theme="light"] .group-card[data-accent="5"]  { --accent-color: #c07820; }
:root[data-theme="light"] .group-card[data-accent="6"]  { --accent-color: #1a9090; }
:root[data-theme="light"] .group-card[data-accent="7"]  { --accent-color: #c03070; }

.group-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 14px 14px 18px;
  border-bottom: 1px solid var(--border-1);
  cursor: grab;
  user-select: none;
  position: relative;
}

.group-header:active { cursor: grabbing; }

.group-fields { flex: 1; min-width: 0; }

.field-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 3px;
}

.group-outcome {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-1);
  margin-bottom: 10px;
  line-height: 1.4;
}

.group-outcome:empty::after {
  content: 'No outcome set';
  color: var(--text-3);
  font-style: italic;
}

.group-purpose-rendered {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.6;
  min-height: 1em;
}

.group-purpose-rendered:empty::after {
  content: 'No purpose set';
  color: var(--text-3);
  font-style: italic;
}

/* Markdown content inside purpose */
.group-purpose-rendered p  { margin: 0 0 0.5em; }
.group-purpose-rendered p:last-child { margin-bottom: 0; }
.group-purpose-rendered ul,
.group-purpose-rendered ol { padding-left: 1.4em; margin: 0 0 0.5em; }
.group-purpose-rendered h1,
.group-purpose-rendered h2,
.group-purpose-rendered h3 {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 0.3em;
  color: var(--text-1);
}
.group-purpose-rendered a { color: var(--blue); text-decoration: none; }
.group-purpose-rendered a:hover { text-decoration: underline; }
.group-purpose-rendered strong { color: var(--text-1); font-weight: 600; }
.group-purpose-rendered em { color: var(--text-2); }
.group-purpose-rendered code {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  background: var(--surface-3);
  padding: 1px 4px;
  border-radius: 3px;
}

.group-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--border-1);
  display: flex;
  align-items: center;
}

/* === Task list (drop zone) ================================ */
.task-list {
  flex: 1;
  padding: 6px 8px;
  min-height: 48px;
  position: relative;
}

.task-list-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  color: var(--text-3);
  font-size: 12px;
  pointer-events: none;
}

/* === Task card ============================================ */
.task-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 8px 4px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  margin-bottom: 2px;
  cursor: default;
  position: relative;
  transition: background 0.12s, border-color 0.12s;
  min-width: 0;
}

.task-card:hover {
  background: var(--surface-2);
  border-color: var(--border-1);
}

.task-card:hover .edit-btn { opacity: 1; }
.task-card:hover .task-name { padding-right: 28px; }

/* Drag handle */
.drag-handle {
  flex-shrink: 0;
  width: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  cursor: grab;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.12s;
  line-height: 1;
}

.task-card:hover .drag-handle { opacity: 1; }
.drag-handle:active { cursor: grabbing; }

/* Pill */
.task-pill {
  flex-shrink: 0;
  width: var(--pill-w);
  display: flex;
  align-items: center;
  background: var(--surface-3);
  border: 1px solid var(--border-1);
  border-radius: 4px;
  overflow: hidden;
  height: 24px;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
}

.task-pill.pill-hidden {
  background: transparent;
}

.pill-half {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 3px;
  padding: 0 5px;
  height: 100%;
  overflow: hidden;
}

.pill-half.pill-duration { color: var(--blue); }
.pill-half.pill-priority { color: var(--gold); justify-content: flex-start; }
.pill-half.pill-dim { color: var(--text-3); opacity: 0.45; }

.pill-sep {
  width: 1px;
  height: 14px;
  background: var(--border-2);
  flex-shrink: 0;
}

/* Task name */
.task-name {
  flex: 1;
  font-size: 13.5px;
  color: var(--text-1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.task-asterisk {
  color: var(--gold);
  font-weight: 700;
  font-size: 15px;
}


/* Status badge */
.status-badge {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  margin-left: auto;
}

.status-new       { display: none; }
.status-underway  { color: var(--blue); }
.status-onhold    { color: var(--amber); }
.status-delayed   { color: var(--coral); }
.status-unimportant { color: var(--text-3); opacity: 0.55; }
.status-complete  { color: var(--green); }
.status-scheduled { color: var(--teal); }

/* Edit button */
.edit-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--surface-3);
  border: 1px solid var(--border-1);
  border-radius: 4px;
  color: var(--text-2);
  cursor: pointer;
  font-size: 12px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.12s, background 0.12s;
  padding: 0;
}

.edit-btn:hover { background: var(--border-1); color: var(--text-1); }

/* Group edit button */
.group-edit-btn {
  position: static;
  top: auto;
  right: auto;
  transform: none;
  flex-shrink: 0;
  margin-top: 2px;
}

.group-header:hover .group-edit-btn { opacity: 1; }

/* Add task button */
.add-task-btn {
  background: transparent;
  border: 1px dashed var(--border-2);
  border-radius: var(--radius);
  color: var(--text-3);
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  padding: 5px 12px;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  width: 100%;
}

.add-task-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(232,197,71,0.05);
}

/* === Drag & drop visual feedback ========================== */
.task-card.dragging {
  opacity: 0.35;
  border-color: var(--border-2);
  background: var(--surface-2);
}

.group-card.dragging {
  opacity: 0.35;
}

/* Collapse group cards to header-only while a group is being dragged */
.board.groups-collapsing .group-card .task-list,
.board.groups-collapsing .group-card .group-footer {
  display: none;
}
.board.groups-collapsing .group-card {
  transition: none;
}

.drop-indicator {
  height: 2px;
  background: var(--gold);
  border-radius: 2px;
  margin: 1px 0;
  pointer-events: none;
  box-shadow: 0 0 6px rgba(232,197,71,0.5);
}

.task-list.drag-over {
  background: rgba(232,197,71,0.03);
  border-radius: var(--radius);
  outline: 1px dashed var(--border-2);
}

.groups-grid.drag-over-group {
  outline: none;
}

/* === Modals =============================================== */
/* Ensure [hidden] beats any display:flex rules on overlays  */
[hidden] { display: none !important; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 24px;
  backdrop-filter: blur(2px);
}

.modal-panel {
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 440px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 48px);
  overflow: hidden;
}

.modal-panel-lg { max-width: 560px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-1);
  flex-shrink: 0;
}

.modal-title {
  font-family: 'DM Serif Display', serif;
  font-size: 18px;
  color: var(--text-1);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  font-size: 20px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
  padding: 0;
}

.modal-close:hover { color: var(--text-1); background: var(--surface-3); }

.modal-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--border-1);
  flex-shrink: 0;
}

.modal-footer-right {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

/* === Forms ================================================ */
.form-group { display: flex; flex-direction: column; gap: 5px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.form-row.form-row-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

/* Checkbox column inside form-row */
.form-group-checkbox {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
/* Full-width input-style checkbox box */
.checkbox-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border-1);
  border-radius: var(--radius);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
}
.checkbox-wrap:hover {
  border-color: var(--gold);
}
.checkbox-wrap input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.checkbox-label-text {
  font-size: 13px;
  color: var(--text-2);
}
.checkbox-custom {
  width: 18px;
  height: 18px;
  border: 1px solid var(--border-2);
  border-radius: 3px;
  background: var(--surface-1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
}
.checkbox-wrap input[type="checkbox"]:checked ~ .checkbox-custom {
  background: var(--gold);
  border-color: var(--gold);
}
.checkbox-wrap input[type="checkbox"]:checked ~ .checkbox-custom::after {
  content: '';
  display: block;
  width: 4px;
  height: 8px;
  border: 2px solid #000;
  border-top: none;
  border-left: none;
  transform: rotate(45deg) translateY(-1px);
}
.checkbox-wrap:hover .checkbox-custom {
  border-color: var(--gold);
}
.checkbox-wrap input[type="checkbox"]:checked ~ .checkbox-label-text {
  color: var(--text-1);
}

.form-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-3);
}

.form-label-hint {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-3);
  opacity: 0.7;
}

.required { color: var(--danger); }
.field-note { font-size: 11.5px; color: var(--text-3); font-weight: 400; }

.form-input {
  background: var(--surface-3);
  border: 1px solid var(--border-1);
  border-radius: var(--radius);
  color: var(--text-1);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  padding: 8px 10px;
  width: 100%;
  transition: border-color 0.15s;
  outline: none;
}

.form-input:focus { border-color: var(--gold); }

.form-textarea {
  resize: vertical;
  min-height: 60px;
  line-height: 1.5;
}

.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238c9199' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px; cursor: pointer; }

.char-counter {
  font-size: 11px;
  color: var(--text-3);
  text-align: right;
  font-family: 'DM Mono', monospace;
}

/* Hide number input spinners */
.no-spin::-webkit-inner-spin-button,
.no-spin::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.no-spin { -moz-appearance: textfield; }

/* === Markdown editor ====================================== */
.md-editor {
  border: 1px solid var(--border-1);
  border-radius: var(--radius);
  overflow: hidden;
}

.md-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  background: var(--surface-1);
  border-bottom: 1px solid var(--border-1);
  flex-wrap: wrap;
}

.md-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--text-2);
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 500;
  padding: 3px 10px;
  transition: background 0.12s, color 0.12s;
}

.md-btn:hover,
.md-btn[aria-pressed="true"] {
  background: var(--surface-3);
  color: var(--text-1);
  border-color: var(--border-1);
}

.md-toolbar-sep {
  width: 1px;
  height: 18px;
  background: var(--border-1);
  margin: 0 4px;
  flex-shrink: 0;
}

.md-tool {
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--text-2);
  cursor: pointer;
  font-size: 12px;
  padding: 3px 7px;
  transition: background 0.12s, color 0.12s;
}

.md-tool:hover { background: var(--surface-3); color: var(--text-1); }

.md-write-pane .form-input {
  border: none;
  border-radius: 0;
  background: var(--surface-3);
}

.md-write-pane .form-input:focus { border: none; box-shadow: none; }

.md-write-pane .char-counter { padding: 2px 8px 6px; background: var(--surface-3); }

.md-preview-pane {
  padding: 10px 12px;
  min-height: 80px;
  background: var(--surface-3);
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.6;
}

.md-preview-pane p { margin: 0 0 0.5em; }
.md-preview-pane p:last-child { margin-bottom: 0; }
.md-preview-pane ul, .md-preview-pane ol { padding-left: 1.4em; margin: 0 0 0.5em; }
.md-preview-pane h1, .md-preview-pane h2, .md-preview-pane h3 {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 0.3em;
  color: var(--text-1);
}
.md-preview-pane a { color: var(--blue); }
.md-preview-pane strong { color: var(--text-1); font-weight: 600; }
.md-preview-pane code { font-family: 'DM Mono', monospace; font-size: 12px; background: var(--surface-2); padding: 1px 4px; border-radius: 3px; }

/* === Toasts =============================================== */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--surface-3);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  color: var(--text-1);
  font-size: 13px;
  padding: 10px 16px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  min-width: 200px;
  max-width: 340px;
  animation: toast-in 0.2s ease;
  pointer-events: auto;
}

.toast-error { border-color: var(--danger); }
.toast-success { border-color: var(--green); }

.toast.toast-out { animation: toast-out 0.2s ease forwards; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(8px); }
}

/* === Login page =========================================== */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(232,197,71,0.07), transparent);
}

.login-container {
  width: 100%;
  max-width: 400px;
  padding: 24px;
}

.login-card {
  background: var(--surface-1);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
  min-width: 320px;
}
:root[data-theme="light"] .login-card {
  box-shadow: 0 4px 24px rgba(0,0,0,0.12), 0 1px 4px rgba(0,0,0,0.08);
  border-color: var(--border-2);
}

.login-logo {
  font-family: 'DM Serif Display', serif;
  font-size: 40px;
  letter-spacing: 0.1em;
  color: var(--gold);
  margin-bottom: 6px;
}

.login-tagline {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-1);
  margin-bottom: 8px;
}

.login-sub {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.5;
}

.login-divider {
  height: 1px;
  background: var(--border-1);
  margin: 28px 0;
}

.login-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-buttons form { display: contents; }

.btn-provider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border-2);
  background: var(--surface-2);
  color: var(--text-1);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

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

/* ============================================================
   Public / informational pages
   ============================================================ */

/* === Navigation links in header ========================== */
.app-logo-link {
  text-decoration: none;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  padding: 0 16px;
}

.nav-link {
  color: var(--text-2);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: var(--radius);
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}

.nav-link:hover { color: var(--text-1); background: var(--surface-3); }
.nav-link.active { color: var(--gold); }

@media (max-width: 720px) {
  .header-nav { display: none; }
}

@media (max-width: 480px) {
  /* Narrower pill — no icons, tighter padding */
  :root { --pill-w: 76px; }

  .task-pill { font-size: 10px; }

  .pill-half { padding: 0 3px; }

  /* Hide the clock and star Unicode characters, keep the value */
  .pill-icon { display: none; }

  /* Tighter task card padding to give task name more room */
  .task-card { gap: 4px; padding: 8px 4px 8px 2px; }
}

/* === Public page layout ================================== */
.pub-main {
  min-height: calc(100vh - var(--header-h) - 120px);
}

.pub-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
}

.pub-container-narrow {
  max-width: 720px;
}

.pub-page-content {
  padding-top: 40px;
  padding-bottom: 60px;
}

.pub-section {
  padding: 56px 0;
}

.pub-section-alt {
  background: var(--surface-1);
  border-top: 1px solid var(--border-1);
  border-bottom: 1px solid var(--border-1);
}

.pub-link {
  color: var(--gold);
  text-decoration: none;
}
.pub-link:hover { text-decoration: underline; }

/* === Hero section (home page) ============================ */
.hero {
  padding: 72px 0 64px;
  text-align: center;
}

.hero-inner { display: flex; flex-direction: column; align-items: center; }

.hero-card {
  background: var(--surface-1);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-lg);
  padding: 48px 40px 40px;
  max-width: 600px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
}
:root[data-theme="light"] .hero-card {
  box-shadow: 0 4px 24px rgba(0,0,0,0.12), 0 1px 4px rgba(0,0,0,0.08);
  border-color: var(--border-2);
}

.hero-title {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(32px, 6vw, 56px);
  color: var(--text-1);
  margin-bottom: 14px;
  line-height: 1.15;
}

.hero-subtitle {
  font-size: clamp(16px, 2.5vw, 20px);
  color: var(--gold);
  font-weight: 500;
  margin-bottom: 16px;
}

.hero-desc {
  font-size: 16px;
  color: var(--text-2);
  max-width: 580px;
  line-height: 1.7;
  margin-bottom: 36px;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }

.btn-provider-hero {
  font-size: 16px;
  padding: 14px 24px;
  border-radius: var(--radius);
}

/* === Feature grid (home page) ============================ */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.feature-card {
  background: var(--surface-2);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  text-align: center;
}

.feature-icon {
  font-size: 28px;
  margin-bottom: 12px;
}

.feature-card h3 {
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 8px;
}

.feature-card p {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.6;
}

/* === RPM Pillars (home page) ============================= */
.rpm-pillars {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 24px 0;
}

.rpm-pillar {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border-1);
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.5;
}

.pillar-letter {
  font-family: 'DM Serif Display', serif;
  font-size: 24px;
  color: var(--gold);
  flex-shrink: 0;
  width: 28px;
  line-height: 1.2;
}

/* === Small page hero (informational pages) =============== */
.page-hero-sm {
  border-bottom: 1px solid var(--border-1);
  padding-bottom: 28px;
  margin-bottom: 40px;
}

.page-hero-sm h1 {
  font-size: clamp(26px, 5vw, 40px);
  color: var(--text-1);
  margin-bottom: 8px;
}

.page-hero-sm p {
  font-size: 16px;
  color: var(--text-2);
}

/* === Content sections ==================================== */
.content-section {
  margin-bottom: 48px;
}

.content-section h2 {
  font-size: 24px;
  color: var(--text-1);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-1);
}

.content-section h3 {
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-1);
  margin: 20px 0 8px;
}

.content-section p {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.8;
  margin-bottom: 12px;
}

.content-section ul,
.content-section ol {
  padding-left: 1.6em;
  margin-bottom: 12px;
}

.content-section li {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.8;
  margin-bottom: 4px;
}

.content-section a { color: var(--gold); text-decoration: none; }
.content-section a:hover { text-decoration: underline; }
.content-section strong { color: var(--text-1); font-weight: 600; }

/* === Table of contents =================================== */
.toc {
  background: var(--surface-2);
  border: 1px solid var(--border-1);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 40px;
  display: inline-block;
  min-width: 240px;
}

.toc-heading {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 10px !important;
}

.toc ul { padding-left: 1.2em; margin: 0 !important; }
.toc li { margin-bottom: 6px !important; }
.toc a { color: var(--text-2); font-size: 13px; text-decoration: none; }
.toc a:hover { color: var(--gold); }

/* === Info box ============================================= */
.info-box {
  background: var(--surface-2);
  border: 1px solid var(--border-1);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.6;
  margin: 16px 0;
}

.info-box strong { color: var(--text-1); }
.info-box a { color: var(--gold); }

/* === Step blocks (How to Use page) ======================= */
.step-list {
  padding-left: 1.6em;
  margin-bottom: 16px;
}
.step-list li {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.8;
  margin-bottom: 8px;
}

.component-block {
  display: flex;
  gap: 20px;
  margin-bottom: 28px;
  align-items: flex-start;
}

.component-number {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  background: var(--gold);
  color: #0f1011;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'DM Serif Display', serif;
  font-size: 18px;
  margin-top: 2px;
}

:root[data-theme="light"] .component-number { color: #fff; }

.component-body { flex: 1; }
.component-body h3 { margin-top: 4px !important; }
.component-sub {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 400;
  color: var(--text-3);
}

.step-block {
  background: var(--surface-2);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 16px;
}

.step-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
}

.step-num {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  white-space: nowrap;
}

.step-header h3 { margin: 0 !important; }

.example {
  font-size: 13px !important;
  color: var(--text-3) !important;
  border-left: 2px solid var(--border-2);
  padding-left: 12px;
  margin-top: 10px !important;
}

.tips-list { list-style: none; padding: 0 !important; }
.tips-list li {
  padding: 10px 14px;
  border-left: 2px solid var(--border-1);
  margin-bottom: 8px !important;
}

.cta-box {
  background: var(--surface-2);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  margin-top: 32px;
}

.cta-box p {
  font-size: 16px !important;
  color: var(--text-1) !important;
  margin-bottom: 16px !important;
}

/* === FAQ list ============================================= */
.faq-list { display: flex; flex-direction: column; gap: 0; }

.faq-item {
  border-bottom: 1px solid var(--border-1);
  padding: 20px 0;
}

.faq-item:first-child { border-top: 1px solid var(--border-1); }

.faq-question {
  font-family: 'DM Sans', sans-serif !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  color: var(--text-1) !important;
  margin: 0 0 8px !important;
  border: none !important;
  padding: 0 !important;
}

.faq-answer {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.7;
  margin: 0 !important;
}

/* === Enquiry form ========================================= */
.enquiry-form { max-width: 600px; }

/* Honeypot — visually hidden, not accessible to real users */
.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.enq-textarea { min-height: 140px; }

.form-actions { margin-top: 8px; }

.btn-lg { padding: 10px 24px; font-size: 15px; }

.form-success {
  background: rgba(74,196,122,0.1);
  border: 1px solid var(--green);
  border-radius: var(--radius);
  color: var(--green);
  padding: 14px 18px;
  margin-bottom: 24px;
  font-size: 14px;
}

.form-error {
  background: rgba(224,90,90,0.08);
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  color: var(--danger);
  padding: 14px 18px;
  margin-bottom: 24px;
  font-size: 14px;
}

/* === Login page (now uses public layout) ================= */
.login-page-wrap {
  display: flex;
  justify-content: center;
  padding: 48px 24px;
}

/* === Footer =============================================== */
.site-footer {
  background: var(--surface-1);
  border-top: 1px solid var(--border-1);
  padding: 32px 0 24px;
  margin-top: 40px;
}

.footer-disclaimer {
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.7;
  max-width: 700px;
  margin-bottom: 16px;
}

.footer-disclaimer a { color: var(--text-3); text-decoration: underline; }
.footer-disclaimer a:hover { color: var(--text-2); }

.footer-links {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.footer-links a {
  font-size: 12px;
  color: var(--text-3);
  text-decoration: none;
}

.footer-links a:hover { color: var(--text-2); }

.footer-sep { color: var(--text-3); font-size: 12px; }

.footer-copy {
  font-size: 11px;
  color: var(--text-3);
}

.provider-icon { width: 20px; height: 20px; flex-shrink: 0; }
