:root {
  --color-primary: #ce0f69;
  --color-secondary-teal: #009ca6;
  --color-secondary-purple: #68478d;
  --color-tertiary-gold: #ffb81c;
  --color-tertiary-black: #000000;
}

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

/* Several elements below set `display` via a class of equal specificity
   to the UA [hidden] rule, which would otherwise silently win by source
   order and keep them visible while "hidden". Force it explicitly. */
[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 24px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #f4f5f7;
  color: var(--color-tertiary-black);
}

a {
  color: inherit;
}

/* ---------------------------------------------------------------------
   App shell / nav
   --------------------------------------------------------------------- */

.app-shell {
  width: 100%;
  max-width: 1100px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.app-shell.narrow {
  max-width: 720px;
}

.nav-bar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #ffffff;
  border-radius: 16px;
  padding: 14px 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.nav-brand {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-primary);
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-email {
  font-size: 0.8rem;
  color: #6b7280;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-logout {
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: #6b7280;
  background: none;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 7px 12px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.nav-logout:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
}

/* ---------------------------------------------------------------------
   Cards
   --------------------------------------------------------------------- */

.card {
  width: 100%;
  background: #ffffff;
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
}

.card.accent {
  border-top: 6px solid transparent;
  border-image: linear-gradient(
    90deg,
    var(--color-primary),
    var(--color-secondary-teal),
    var(--color-secondary-purple),
    var(--color-tertiary-gold)
  );
  border-image-slice: 1;
}

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

.page-title {
  margin-bottom: 4px;
}

h1 {
  font-size: 1.5rem;
  margin-bottom: 4px;
}

h2 {
  font-size: 1.1rem;
}

.subtitle {
  font-size: 0.9rem;
  color: #6b7280;
  line-height: 1.4;
}

.status {
  font-size: 0.9rem;
  color: #6b7280;
  text-align: center;
  padding: 40px 0;
}

.status.error {
  color: var(--color-primary);
}

/* ---------------------------------------------------------------------
   Buttons
   --------------------------------------------------------------------- */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 22px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: #ffffff;
  background: var(--color-primary);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: box-shadow 0.15s ease;
  text-decoration: none;
}

.btn-primary:hover {
  box-shadow: 0 0 0 3px rgba(206, 15, 105, 0.12);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: default;
  box-shadow: none;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 20px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-tertiary-black);
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s ease;
  text-decoration: none;
}

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

.btn-secondary:disabled {
  opacity: 0.6;
  cursor: default;
}

.btn-text {
  display: inline-block;
  padding: 6px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: #6b7280;
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.15s ease;
  text-decoration: none;
}

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

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  font-size: 0.95rem;
  color: #6b7280;
  background: #f9fafb;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.btn-icon:hover {
  background: rgba(206, 15, 105, 0.1);
  color: var(--color-primary);
}

.btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.header-actions {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

/* ---------------------------------------------------------------------
   Forms
   --------------------------------------------------------------------- */

.input-group {
  margin-bottom: 20px;
}

.input-group:last-child {
  margin-bottom: 0;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: #374151;
}

.field-hint {
  font-size: 0.78rem;
  color: #6b7280;
  margin-top: 6px;
  line-height: 1.4;
}

.text-input,
.text-select,
textarea.text-input {
  display: block;
  width: 100%;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--color-tertiary-black);
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea.text-input {
  resize: vertical;
  min-height: 44px;
  line-height: 1.4;
}

.text-input:focus,
.text-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(206, 15, 105, 0.12);
}

.text-select {
  cursor: pointer;
}

.text-input:disabled,
.text-select:disabled {
  background: #f4f5f7;
  color: #9ca3af;
  cursor: not-allowed;
}

.form-error {
  margin-top: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-primary);
}

.form-success {
  margin-top: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-secondary-teal);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------------------------------------------------------------------
   Auth gate
   --------------------------------------------------------------------- */

.auth-landing {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  margin: 40px auto;
}

.hero-copy {
  width: 100%;
  max-width: 480px;
  text-align: center;
}

.hero-copy h1 {
  font-size: 1.8rem;
  margin-bottom: 10px;
}

.hero-tagline {
  font-size: 1rem;
  color: #6b7280;
  line-height: 1.5;
  margin-bottom: 22px;
}

.hero-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}

.hero-features li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.9rem;
  color: #374151;
  line-height: 1.4;
}

.hero-features li::before {
  content: "✓";
  flex-shrink: 0;
  color: var(--color-secondary-teal);
  font-weight: 700;
}

.auth-shell {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}

/* ---------------------------------------------------------------------
   Goal number badge (shared by focus and rest rows)
   --------------------------------------------------------------------- */

.goal-number {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #f4f5f7;
  color: #6b7280;
  font-size: 0.75rem;
  font-weight: 700;
}

.goal-row-focus .goal-number {
  background: rgba(206, 15, 105, 0.1);
  color: var(--color-primary);
}

/* ---------------------------------------------------------------------
   Unified goal list — focus zone (top 5) + rest zone, one draggable set
   --------------------------------------------------------------------- */

.zone-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
  margin: 20px 0 8px;
}

.zone-label:first-child {
  margin-top: 0;
}

.zone-label-focus {
  color: var(--color-primary);
}

.goal-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 8px;
}

.goal-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid #f0f1f3;
  border-radius: 12px;
  background: #ffffff;
}

.goal-row-focus {
  border-color: rgba(206, 15, 105, 0.25);
  background: linear-gradient(0deg, #fff, #fff), linear-gradient(90deg, rgba(206, 15, 105, 0.05), rgba(255, 255, 255, 0));
  background-clip: padding-box, border-box;
}

.goal-row.sortable-ghost {
  opacity: 0.4;
}

.goal-row.sortable-drag {
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

.drag-handle {
  flex-shrink: 0;
  cursor: grab;
  color: #d1d5db;
  font-size: 1rem;
  line-height: 1.6;
  touch-action: none;
}

.drag-handle:active {
  cursor: grabbing;
}

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

.goal-text-wrap {
  flex: 1;
  min-width: 0;
}

.goal-text {
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.4;
  cursor: text;
  padding: 2px 0;
}

.goal-text-static {
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.4;
}

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

.goal-edit-form .btn-row {
  gap: 8px;
}

.goal-row-actions {
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  gap: 4px;
}

/* Open focus slot: a goal was retired or unmarked and nothing was
   auto-promoted to replace it — by design. Drag something up instead. */

.goal-row-empty {
  border-style: dashed;
  border-color: #d1d5db;
  align-items: center;
  gap: 12px;
}

.goal-row-empty-label {
  font-size: 0.85rem;
  color: #9ca3af;
}

.next-step {
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid #f0f1f3;
}

.next-step-question {
  font-size: 0.78rem;
  font-weight: 600;
  color: #6b7280;
  line-height: 1.4;
  margin-bottom: 10px;
}

.next-step-current {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  background: #f9fafb;
  border-radius: 10px;
  padding: 10px 12px;
}

.step-text {
  font-size: 0.88rem;
  line-height: 1.4;
  padding-top: 4px;
}

.step-actions {
  flex-shrink: 0;
  display: flex;
  gap: 6px;
}

.step-done-btn {
  padding: 8px 14px;
  font-size: 0.82rem;
}

.step-cancel-btn {
  font-size: 0.8rem;
  color: #9ca3af;
}

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

.next-step-form {
  display: flex;
  gap: 8px;
}

.next-step-form .text-input {
  padding: 10px 12px;
  font-size: 0.88rem;
}

.step-history {
  margin-top: 4px;
}

.step-history summary {
  list-style: none;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  color: #6b7280;
  padding: 4px 0;
}

.step-history summary:hover {
  color: var(--color-tertiary-black);
}

.step-history summary::-webkit-details-marker {
  display: none;
}

.history-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  padding-left: 2px;
}

.history-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 0.83rem;
  line-height: 1.4;
}

.history-item::before {
  content: "✓";
  flex-shrink: 0;
  color: var(--color-secondary-teal);
  font-weight: 700;
}

.history-date {
  flex-shrink: 0;
  color: #9ca3af;
  font-size: 0.75rem;
}

.history-empty {
  font-size: 0.8rem;
  color: #9ca3af;
  margin-top: 8px;
}

.add-goal-row {
  display: flex;
  gap: 8px;
  padding: 12px 4px 0;
  margin-top: 4px;
}

.add-goal-row .text-input {
  padding: 10px 12px;
  font-size: 0.9rem;
}

/* ---------------------------------------------------------------------
   History (achieved / not needed)
   --------------------------------------------------------------------- */

.history-goal-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.history-goal-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid #f0f1f3;
}

.history-goal-row:last-child {
  border-bottom: none;
}

.history-resolved-date {
  font-size: 0.75rem;
  color: #9ca3af;
  margin-top: 2px;
}

/* ---------------------------------------------------------------------
   Misc
   --------------------------------------------------------------------- */

.powered-by a {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #6b7280;
  font-size: 0.85rem;
  transition: color 0.15s ease;
}

.powered-by a:hover {
  color: var(--color-tertiary-black);
}

.powered-by-logo {
  width: 20px;
  height: 20px;
  border-radius: 5px;
}

.powered-by strong {
  color: var(--color-primary);
  font-weight: 700;
}
