@font-face {
  font-family: "Oswald";
  src: url("/assets/fonts/oswald.ttf") format("truetype");
  font-weight: 200 700;
  font-display: swap;
}

:root {
  --bg: #000;
  --fg: #fff;
  --muted: rgba(255, 255, 255, 0.52);
  --faint: rgba(255, 255, 255, 0.32);
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.75);
  --brand: #e44532;
  --pad: clamp(18px, 4vw, 56px);
  --nav-h: 72px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: "Oswald", sans-serif;
  font-weight: 300;
  min-height: 100vh;
  min-height: 100svh;
}
img { max-width: 100%; display: block; }
button, input, select { font-family: inherit; }
a { color: inherit; }

.bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: var(--nav-h);
  padding: 12px var(--pad);
  background: rgba(0, 0, 0, 0.9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  min-width: 0;
}
.brand img { height: 36px; width: auto; }
.brand span {
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.bar-end { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
.who {
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.text-btn, .back {
  background: none;
  border: 0;
  color: var(--fg);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 12px;
  cursor: pointer;
  text-decoration: none;
  padding: 0;
}
.text-btn:hover, .back:hover { color: var(--brand); }

.wrap { width: min(1120px, 100%); margin: 0 auto; padding: 28px var(--pad) 80px; }
.eyebrow {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--brand);
}
h1 {
  margin: 0;
  font-weight: 500;
  font-size: clamp(36px, 6vw, 64px);
  letter-spacing: 0.04em;
  line-height: 0.95;
}
.lead { margin: 12px 0 0; color: var(--muted); font-size: 18px; letter-spacing: 0.03em; max-width: 36em; }

.flash {
  margin: 18px 0 0;
  color: #fff;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 13px;
}

.areas {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 28px;
}
.area {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  text-decoration: none;
  min-height: 112px;
}
.area:hover, .area:focus-visible { border-color: #fff; outline: none; }
.area img { width: 74px; height: 96px; object-fit: cover; background: #111; }
.area h2 { margin: 0 0 8px; font-size: 22px; font-weight: 500; letter-spacing: 0.04em; }
.area p { margin: 0; color: var(--muted); font-size: 14px; letter-spacing: 0.03em; line-height: 1.4; }

.switch {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 22px 0 8px;
  padding-bottom: 6px;
}
.chip {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 12px;
  padding: 8px 12px;
}
.chip.is-on, .chip:hover { color: #fff; border-color: #fff; }

.head-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-top: 18px;
}
.person { display: flex; align-items: center; gap: 16px; }
.person img { width: 64px; height: 80px; object-fit: cover; background: #111; }
.kicker { margin: 0 0 4px; color: var(--muted); letter-spacing: 0.2em; text-transform: uppercase; font-size: 11px; }
.person h1 { font-size: clamp(32px, 5vw, 52px); }

.stats { display: flex; flex-wrap: wrap; gap: 18px 28px; margin-top: 18px; }
.stat { min-width: 90px; }
.stat b { display: block; font-size: 28px; font-weight: 500; letter-spacing: 0.04em; }
.stat span { color: var(--muted); letter-spacing: 0.16em; text-transform: uppercase; font-size: 11px; }

.block { margin-top: 42px; }
.block h2 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}
.month {
  margin: 22px 0 0;
  color: var(--faint);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 12px;
}
.date, .file {
  display: grid;
  grid-template-columns: 110px 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.date-day { font-size: 28px; letter-spacing: 0.04em; font-weight: 500; line-height: 1; }
.date-rest { color: var(--muted); font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; }
.date h3, .file h3 { margin: 0; font-size: 20px; font-weight: 400; letter-spacing: 0.03em; }
.meta { margin: 4px 0 0; color: var(--muted); font-size: 15px; }
.side { display: flex; align-items: center; gap: 12px; justify-content: flex-end; }
.pill {
  border: 1px solid var(--line-strong);
  padding: 5px 8px;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.pill.opcion { color: var(--muted); border-color: var(--line); }
.pill.bloqueada { color: var(--brand); border-color: var(--brand); }

.empty { margin: 14px 0 0; color: var(--muted); font-size: 16px; }
.past { margin-top: 28px; }
.past h2 { color: var(--faint); }

.composer {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px 18px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field-wide { grid-column: 1 / -2; }
.field label {
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}
.field input, .field select {
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.28);
  color: #fff;
  padding: 10px 0;
  font-size: 16px;
  border-radius: 0;
}
.field input:focus, .field select:focus { outline: none; border-bottom-color: #fff; }
.field select option { background: #111; }
.field input[type="file"] { border-bottom: 0; padding-top: 6px; font-size: 13px; }
input[type="date"] { color-scheme: dark; }
.composer .btn { align-self: end; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover, .btn:focus-visible { background: #fff; color: #000; outline: none; }
.linkish {
  background: none;
  border: 0;
  color: var(--faint);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 11px;
  cursor: pointer;
  padding: 0;
}
.linkish:hover { color: var(--brand); }

.login-body { min-height: 100vh; display: grid; place-items: center; }
.login { width: min(460px, calc(100% - 36px)); padding: 48px 0 64px; }
.login-logo img { height: 48px; width: auto; margin-bottom: 28px; }
.stack { display: grid; gap: 16px; margin-top: 28px; }
.stack .btn { justify-self: start; margin-top: 6px; }
.error { color: var(--brand); letter-spacing: 0.06em; min-height: 1.2em; }

.login .back { display: inline-block; margin-top: 22px; }


/* Language switch (EN/ES) */
.lang-switch { display: flex; align-items: center; gap: 2px; }
.lang-link {
  font-size: 12px;
  letter-spacing: 0.16em;
  text-decoration: none;
  color: var(--faint);
  padding: 4px 6px;
}
.lang-link.is-on { color: #fff; }
.lang-link:hover { color: var(--brand); }
.login-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }

.note { margin: 14px 0 0; color: var(--muted); font-size: 14px; letter-spacing: 0.03em; line-height: 1.45; }
.faint { color: var(--faint) !important; }
.flash-error { color: var(--brand); }
.invite-email { margin: 14px 0 0; font-size: 18px; letter-spacing: 0.04em; word-break: break-all; }

/* Accounts (agency only) */
.accounts { margin-top: 28px; border-top: 1px solid var(--line); }
.account { padding: 18px 0; border-bottom: 1px solid var(--line); }
.account-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.account-head h3 { margin: 0; font-size: 22px; font-weight: 500; letter-spacing: 0.04em; }
.account-actions { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin-top: 12px; }
.account-email { display: flex; align-items: flex-end; gap: 14px; flex: 1 1 360px; }
.account-email .field { flex: 1 1 auto; }
.account-buttons { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.btn-small { padding: 10px 18px; font-size: 11px; letter-spacing: 0.18em; }
.btn[disabled] { opacity: 0.35; cursor: not-allowed; background: transparent; color: #fff; }
.invite-box { margin-top: 16px; padding: 14px; border: 1px solid var(--brand); }
.invite-box p { margin: 0 0 10px; font-size: 15px; line-height: 1.45; }
.invite-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.invite-row input {
  flex: 1 1 320px;
  min-width: 0;
  background: #111;
  border: 1px solid var(--line);
  color: #fff;
  padding: 10px;
  font-size: 13px;
  font-family: ui-monospace, Menlo, monospace;
}

@media (max-width: 800px) {
  .brand span, .who { display: none; }
  .bar { flex-wrap: wrap; }
  .bar-end { flex-wrap: wrap; gap: 10px 14px; }
  .account-email { flex-direction: column; align-items: stretch; }
  .composer { grid-template-columns: 1fr 1fr; }
  .field-wide { grid-column: 1 / -1; }
  .date, .file { grid-template-columns: 1fr; gap: 6px; }
  .side { justify-content: flex-start; }
  .head-row { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 520px) {
  .composer { grid-template-columns: 1fr; }
  .composer .btn, .stack .btn { width: 100%; }
}

/* CRM */
.text-btn.is-on { color: var(--brand); }
.head-links { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tabs {
  display: flex;
  gap: 0;
  overflow-x: auto;
  margin-top: 26px;
  border-bottom: 1px solid var(--line);
}
.tab {
  flex: 0 0 auto;
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 12px 16px 11px;
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab b { font-weight: 500; font-size: 12px; color: var(--faint); letter-spacing: 0.06em; }
.tab:hover { color: #fff; }
.tab.is-on { color: #fff; border-bottom-color: var(--brand); }
.tab.is-on b { color: var(--brand); }
.crm-tools {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
  flex-wrap: wrap;
  margin-top: 20px;
}
.crm-search { display: flex; align-items: flex-end; gap: 14px; flex: 1 1 380px; }
.crm-search .field { flex: 1 1 auto; }
.crm-search input[type="search"]::-webkit-search-cancel-button { filter: invert(1); }
.crm-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-ghost { border-color: var(--line); color: var(--muted); }
.crm-list { margin-top: 18px; }
.crm-table-wrap { overflow-x: auto; border-top: 1px solid var(--line); }
.crm-table { width: 100%; border-collapse: collapse; font-size: 15px; letter-spacing: 0.02em; }
.crm-table th {
  text-align: left;
  font-weight: 400;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 12px 12px 10px 0;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.crm-table td { padding: 14px 12px 14px 0; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
.crm-table td.strong { color: #fff; font-weight: 400; }
.crm-table td a { text-decoration: none; border-bottom: 1px solid var(--line); }
.crm-table td a:hover { color: var(--brand); border-color: var(--brand); }
.crm-table tbody tr:hover td { background: rgba(255, 255, 255, 0.03); }
.row-actions { white-space: nowrap; text-align: right; padding-right: 0 !important; }
.row-actions form { display: inline; margin-left: 14px; }
.row-actions a.linkish { border: 0; text-decoration: none; }
.crm-composer { grid-template-columns: repeat(4, 1fr); }
.field-span2 { grid-column: span 2; }
.crm-form-end { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.crm-form-end .note { margin: 0; }
.crm-form-buttons { display: flex; align-items: center; gap: 22px; }
.crm-editor h2 { scroll-margin-top: calc(var(--nav-h) + 20px); }
#crm-form, #crm-list, .crm-table tr { scroll-margin-top: calc(var(--nav-h) + 20px); }

@media (max-width: 800px) {
  .crm-composer { grid-template-columns: 1fr 1fr; }
  .crm-table thead { display: none; }
  .crm-table, .crm-table tbody, .crm-table tr, .crm-table td { display: block; width: 100%; }
  .crm-table tr { padding: 12px 0; border-bottom: 1px solid var(--line); }
  .crm-table td { border: 0; padding: 3px 0; display: grid; grid-template-columns: 120px 1fr; gap: 10px; }
  .crm-table td::before { content: attr(data-label); color: var(--faint); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; padding-top: 3px; }
  .crm-table td.row-actions { display: flex; justify-content: flex-start; padding-top: 8px; }
  .crm-table td.row-actions::before { content: none; }
  .row-actions form { margin-left: 18px; }
}
@media (max-width: 520px) {
  .crm-composer { grid-template-columns: 1fr; }
  .field-span2 { grid-column: auto; }
  .crm-search { flex-direction: column; align-items: stretch; }
}
