/* ── Stripe Design System — CRM ────────────────────────────────────────────── */

/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }


:root {
  /* Primary */
  --purple:       #533afd;
  --purple-hover: #4434d4;
  --purple-deep:  #2e2b8c;
  --purple-light: #b9b9f9;
  --purple-bg:    rgba(83,58,253,0.05);

  /* Neutrals */
  --heading:      #061b31;
  --label:        #273951;
  --body:         #64748d;
  --bg:           #f6f9fc;
  --surface:      #ffffff;
  --border:       #e5edf5;

  /* Status */
  --success:      #15be53;
  --success-text: #108c3d;
  --danger:       #ea2261;
  --danger-text:  #c41950;
  --warn:         #9b6829;
  --warn-bg:      #fef7e0;

  /* Shadows (Stripe signature blue-tinted) */
  --shadow-sm:    0 1px 3px rgba(50,50,93,0.12), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md:    0 4px 12px rgba(50,50,93,0.1), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg:    0 15px 35px rgba(50,50,93,0.1), 0 5px 15px rgba(0,0,0,0.06);
  --shadow-xl:    0 30px 45px -30px rgba(50,50,93,0.25), 0 18px 36px -18px rgba(0,0,0,0.1);

  /* Brand dark */
  --brand-dark:   #1c1e54;
  --dark-navy:    #0d253d;

  /* Geometry */
  --radius:       6px;
  --radius-sm:    4px;
  --radius-lg:    8px;
  --nav-w:        240px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: var(--heading);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--purple); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  font-family: 'SFMono-Regular', 'Consolas', 'Liberation Mono', monospace;
  font-size: 12px;
  background: var(--bg);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

/* ── Page header ──────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.page-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--heading);
  letter-spacing: -0.4px;
}
.page-subtitle {
  font-size: 14px;
  color: var(--body);
  margin-top: 4px;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .15s;
  font-family: inherit;
  line-height: 1;
}
.btn-primary {
  background: var(--purple);
  color: #fff;
  border-color: var(--purple);
  box-shadow: 0 1px 2px rgba(50,50,93,0.1), 0 1px 1px rgba(0,0,0,0.06);
}
.btn-primary:hover {
  background: var(--purple-hover);
  border-color: var(--purple-hover);
  text-decoration: none;
  color: #fff;
  box-shadow: 0 2px 4px rgba(50,50,93,0.15), 0 1px 2px rgba(0,0,0,0.08);
}
.btn-secondary {
  background: var(--surface);
  color: var(--heading);
  border-color: var(--border);
  box-shadow: 0 1px 2px rgba(50,50,93,0.08), 0 1px 1px rgba(0,0,0,0.04);
}
.btn-secondary:hover {
  background: var(--bg);
  text-decoration: none;
  box-shadow: 0 2px 4px rgba(50,50,93,0.1), 0 1px 2px rgba(0,0,0,0.06);
}
.btn-danger {
  background: #fff;
  color: var(--danger);
  border-color: rgba(234,34,97,0.3);
}
.btn-danger:hover {
  background: rgba(234,34,97,0.05);
  text-decoration: none;
  color: var(--danger-text);
}
.btn-ghost {
  background: transparent;
  color: var(--purple);
  border-color: var(--purple-light);
}
.btn-ghost:hover {
  background: var(--purple-bg);
  text-decoration: none;
}
.btn-sm { padding: 5px 10px; font-size: 13px; }

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-body { padding: 20px; }
.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 13px;
  color: var(--label);
  letter-spacing: 0.01em;
}

/* ── Tables ───────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--body);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
td {
  padding: 12px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-size: 14px;
  color: var(--heading);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(83,58,253,0.02); }
td.muted, td .muted { color: var(--body); }

/* ── Forms ────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
label {
  display: block;
  font-weight: 500;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--label);
}
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=search], select, textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  color: var(--heading);
  transition: border-color .15s, box-shadow .15s;
  box-shadow: 0 1px 2px rgba(50,50,93,0.06);
}
input::placeholder, textarea::placeholder {
  color: var(--body);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(83,58,253,0.12), 0 1px 2px rgba(50,50,93,0.06);
}
textarea { resize: vertical; min-height: 120px; }
.form-hint { font-size: 12px; color: var(--body); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

input[type=checkbox] {
  accent-color: var(--purple);
  width: 16px;
  height: 16px;
}

/* ── Alerts ───────────────────────────────────────────────────────────────── */
.alert {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 13.5px;
  font-weight: 400;
}
.alert-error {
  background: rgba(234,34,97,0.06);
  color: var(--danger-text);
  border: 1px solid rgba(234,34,97,0.15);
}
.alert-success {
  background: rgba(21,190,83,0.08);
  color: var(--success-text);
  border: 1px solid rgba(21,190,83,0.2);
}
.alert-warn {
  background: var(--warn-bg);
  color: var(--warn);
  border: 1px solid rgba(155,104,41,0.2);
}

/* ── Login page ───────────────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}
.login-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 380px;
  box-shadow: var(--shadow-lg);
}
.login-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
  text-align: center;
  color: var(--heading);
  letter-spacing: -0.3px;
}
.login-subtitle {
  font-size: 14px;
  color: var(--body);
  text-align: center;
  margin-bottom: 24px;
}

/* Horizontal text navigation; CRM colours, active state and spacing. */
.shell { max-width: 1400px; margin: 0 auto; }
.header { display: flex; align-items: center; gap: 24px; padding: 16px 40px; background: var(--surface); border-bottom: 1px solid var(--border); }
.nav-logo { font-weight: 600; font-size: 15px; color: var(--heading); letter-spacing: -0.3px; white-space: nowrap; }
.nav-links { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.nav-links a { padding: 8px 12px; color: var(--label); border-radius: var(--radius); font-size: 13.5px; font-weight: 400; transition: all .15s; }
.nav-links a:hover { background: var(--bg); color: var(--heading); text-decoration: none; }
.nav-links a.active { background: var(--purple-bg); color: var(--purple); font-weight: 500; }
.switch-user { margin-left: auto; flex-shrink: 0; }
main { padding: 32px 40px; }
.date-actions { display: flex; gap: 8px; }
.page-title a { color: var(--heading); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack label { margin-bottom: 0; }
label > input:not([type=checkbox]), label > select, label > textarea { display: block; margin-top: 6px; }
input:not([type]), input[type=date] { width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 14px; font-family: inherit; color: var(--heading); background: var(--surface); box-shadow: 0 1px 2px rgba(50,50,93,0.06); }
button, input, select, textarea { font-family: inherit; }
:focus-visible { outline: 2px solid var(--purple); outline-offset: 3px; }
.btn { justify-content: center; }
.bilingual .btn { flex-direction: column; gap: 0; }
.btn-block { width: 100%; }
.align-start { align-self: flex-start; }
.mt-16 { margin-top: 16px; }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.task { display: flex; align-items: center; gap: 12px; padding: 12px; border-bottom: 1px solid var(--border); }
.task:last-child { border-bottom: 0; }
.task:hover { background: rgba(83,58,253,0.02); }
.task-copy { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.task h3 { font-size: 14px; font-weight: 500; line-height: 1.5; }
.note, .uk { font-size: 12px; color: var(--body); }
.uk { display: block; font-weight: 400; margin-top: 4px; line-height: 1.4; }
.note { white-space: pre-wrap; margin-top: 4px; }
.check { display: block; position: relative; width: 18px; height: 18px; padding: 0; border: 1px solid var(--body); border-radius: 3px; background: var(--surface); cursor: pointer; }
.check[aria-checked=true] { background: var(--purple); border-color: var(--purple); }
.check[aria-checked=true]::after { content: ''; position: absolute; left: 5px; top: 2px; width: 5px; height: 9px; border: solid white; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.check:disabled { cursor: default; opacity: .6; }
.is-done h3 { text-decoration: line-through; color: var(--body); }
.empty-state { text-align: center; padding: 32px 24px; color: var(--body); }
.add-task { margin-top: 24px; }
.entry-row { display: flex; align-items: center; gap: 8px; }
.entry-row input { flex: 1; min-width: 0; }
.dashboard { display: flex; flex-direction: column; gap: 24px; }
.dashboard > section { scroll-margin-top: 16px; }
.task-entry { display: grid; grid-template-columns: minmax(0, 1fr) 200px auto; gap: 16px; align-items: end; }
.task-entry label { margin-bottom: 0; }
.quantity-stepper { display: flex; align-items: center; gap: 4px; }
.quantity-stepper input[type=number] { width: 64px; padding: 8px 4px; text-align: center; }
.quantity-stepper .btn { min-width: 36px; padding: 8px; }
.week-grid { display: grid; gap: 12px; align-items: start; }
.week-days-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.week-days-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.week-days-7 { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.week-day { min-width: 0; overflow-wrap: anywhere; }
.week-day .card-header { padding: 12px; font-size: 14px; }
.week-day time { display: block; font-weight: 400; margin-top: 8px; }
.week-day .task { align-items: flex-start; gap: 8px; }
.week-day .check { margin-top: 3px; }
.week-day .empty-state { padding: 20px 8px; }
.week-day.is-today { border-color: var(--purple); }
.week-day.is-today .card-header { background: var(--purple-bg); color: var(--purple); }
.day-options { border: 0; display: flex; flex-wrap: wrap; gap: 16px; }
.day-options legend { color: var(--label); font-size: 13px; font-weight: 500; margin-bottom: 12px; }
.options { display: flex; gap: 16px; }
.option { display: inline-flex; align-items: center; gap: 8px; }
.auth-screen main { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-box { max-width: 100%; }
@media (max-width: 1100px) {
  .header { padding: 16px 24px; gap: 16px; }
  .nav-links a { padding: 8px; }
  main { padding: 24px; }
}
@media (max-width: 768px) {
  .week-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .task-entry { grid-template-columns: 1fr; }
  #compra .task { flex-wrap: wrap; }
  .header { flex-wrap: wrap; padding: 16px; }
  .nav-links { order: 3; width: 100%; }
  main { padding: 24px 16px; }
  .admin-grid, .form-row { grid-template-columns: 1fr; }
  .page-header { flex-wrap: wrap; gap: 12px; }
  .page-title { font-size: 18px; }
  .login-box { padding: 28px 20px; }
  .day-options { gap: 12px; }
}
