/* Secure Share: minimal design. Padlock mark, one teal primary, system fonts.
   Light tokens on :root, dark tokens on :root[data-theme='dark'] and (without a stored choice) via prefers-color-scheme. */

/* ---- Tokens: theme-independent ------------------------------------------ */
:root {
  --font-sans: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --space-4: 4px;
  --space-8: 8px;
  --space-12: 12px;
  --space-16: 16px;
  --space-20: 20px;
  --space-24: 24px;
  --space-32: 32px;
  --space-48: 48px;

  --radius-control: 10px;
  --radius-card: 14px;
  --radius-nav: 8px;
  --radius-full: 9999px;

  /* One width for the whole app (top bar and every page). */
  --content: 1040px;
  --gutter: 16px;

  --shadow-card: 0 1px 2px rgba(15, 28, 33, 0.04);
  --ease: ease-out;
}

/* ---- Tokens: light ------------------------------------------------------ */
:root {
  --bg: #f7f9fa;
  --surface: #ffffff;
  --subtle: #f1f5f6;
  --line: #e2e8eb;
  --line-strong: #cbd5da;
  --ink: #0f1c21;
  --muted: #51616a;
  --primary: #0f766e;
  --primary-hover: #0b5f58;
  --on-primary: #ffffff;
  --primary-wash: #e6f4f1;
  --primary-ink: #0f766e;
  --warn: #8a4b0f;
  --warn-bg: #fff6e5;
  --danger: #b42318;
  --danger-bg: #fef1f0;
  --focus: #0f766e;
  color-scheme: light;
}

/* ---- Tokens: dark (explicit toggle) -------------------------------------- */
/* Near-neutral graphite with a cool hint, and a calmer teal than a neon turquoise. */
:root[data-theme='dark'] {
  --bg: #0f1214;
  --surface: #171b1e;
  --subtle: #1d2226;
  --line: #272d32;
  --line-strong: #3f474e;
  --ink: #e7ebed;
  --muted: #9ba5ac;
  --primary: #3bae9e;
  --primary-hover: #4fc2b1;
  --on-primary: #06201c;
  --primary-wash: #152a27;
  --primary-ink: #6ccbbb;
  --warn: #e6b06c;
  --warn-bg: #2a2217;
  --danger: #ee8579;
  --danger-bg: #2d1a19;
  --focus: #6ccbbb;
  --shadow-card: none;
  color-scheme: dark;
}

/* ---- Tokens: dark (system, no stored choice) ------------------------------ */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0f1214;
    --surface: #171b1e;
    --subtle: #1d2226;
    --line: #272d32;
    --line-strong: #3f474e;
    --ink: #e7ebed;
    --muted: #9ba5ac;
    --primary: #3bae9e;
    --primary-hover: #4fc2b1;
    --on-primary: #06201c;
    --primary-wash: #152a27;
    --primary-ink: #6ccbbb;
    --warn: #e6b06c;
    --warn-bg: #2a2217;
    --danger: #ee8579;
    --danger-bg: #2d1a19;
    --focus: #6ccbbb;
    --shadow-card: none;
    color-scheme: dark;
  }
}

/* ---- Base ------------------------------------------------------------------ */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.55 var(--font-sans);
  -webkit-text-size-adjust: 100%;
}

::selection {
  background: var(--primary-wash);
}

p {
  margin: 0;
}

strong {
  font-weight: 600;
}

h2,
h3 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.01em;
}

h2 {
  font-size: 17px;
  line-height: 1.3;
}

[hidden] {
  display: none !important;
}

.mono {
  font-family: var(--font-mono);
}

.muted {
  color: var(--muted);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---- Icons (line icons from /assets, tinted with the current colour) ------------ */
.icon {
  display: inline-block;
  flex: none;
  width: 16px;
  height: 16px;
  background-color: currentColor;
  -webkit-mask: center / contain no-repeat;
  mask: center / contain no-repeat;
}

.icon--lock {
  -webkit-mask-image: url('/assets/icon-lock.svg');
  mask-image: url('/assets/icon-lock.svg');
}

/* ---- Top bar and logo lockup ------------------------------------------------ */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-12);
  width: 100%;
  max-width: var(--content);
  min-height: 60px;
  margin: 0 auto;
  padding: var(--space-8) var(--gutter);
}

.lockup {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  margin: 0;
  color: var(--ink);
  font: 600 16px/1.2 var(--font-sans);
  letter-spacing: -0.01em;
}

/* The padlock mark: body takes the primary, the keyhole the surface (works in dark mode). */
.logo {
  display: block;
  flex: none;
}

.logo-shackle {
  fill: none;
  stroke: var(--primary);
  stroke-width: 2.6;
  stroke-linecap: round;
}

.logo-body {
  fill: var(--primary);
}

.logo-key {
  fill: var(--surface);
}

.topbar-end,
.user {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  min-width: 0;
}

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

/* ---- Page layout -------------------------------------------------------------- */
.page {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-24);
  width: 100%;
  max-width: var(--content);
  margin: 0 auto;
  padding: var(--space-32) var(--gutter) var(--space-48);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-16);
}

.foot {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
  padding: var(--space-16) var(--gutter) var(--space-24);
  text-align: center;
}

.foot .powered {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-8);
  font-size: 12px;
}

/* The official file is white; as a mask it takes the muted colour of the current theme. */
.group-logo {
  display: inline-block;
  width: 110px;
  aspect-ratio: 317.2 / 108.2;
  background-color: var(--muted);
  -webkit-mask: url('/assets/educa-edtech-group.svg') center / contain no-repeat;
  mask: url('/assets/educa-edtech-group.svg') center / contain no-repeat;
}

/* ---- Buttons ------------------------------------------------------------------
   .cl-pill is the base (secondary) button; modifiers pick the variant and size. */
.cl-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-8);
  height: 40px;
  padding: 0 var(--space-16);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  background: var(--surface);
  color: var(--ink);
  font: 500 14.5px/1 var(--font-sans);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color 0.15s var(--ease),
    border-color 0.15s var(--ease),
    color 0.15s var(--ease),
    transform 0.1s var(--ease);
}

.cl-pill--primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}

.cl-pill--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

.cl-pill--danger {
  background: transparent;
  border-color: transparent;
  color: var(--danger);
}

.cl-pill--sm {
  height: 32px;
  padding: 0 var(--space-12);
  font-size: 13.5px;
}

.cl-pill--lg {
  height: 46px;
  padding: 0 20px;
  font-size: 15px;
}

.cl-pill:active:not(:disabled) {
  transform: scale(0.98);
}

.cl-pill:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pill-icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cl-icon-btn {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition:
    background-color 0.15s var(--ease),
    transform 0.1s var(--ease);
}

.cl-icon-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.cl-icon-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.cl-icon-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cl-icon-btn--sm {
  width: 30px;
  height: 30px;
}

.cl-icon-btn--sm svg {
  width: 16px;
  height: 16px;
}

/* Moon in light, sun in dark. */
.cl-icon-btn .icon-sun {
  display: none;
}

:root[data-theme='dark'] .cl-icon-btn .icon-moon {
  display: none;
}

:root[data-theme='dark'] .cl-icon-btn .icon-sun {
  display: block;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .cl-icon-btn .icon-moon {
    display: none;
  }

  :root:not([data-theme='light']) .cl-icon-btn .icon-sun {
    display: block;
  }
}

@media (hover: hover) and (pointer: fine) {
  .cl-pill:hover:not(:disabled) {
    background: var(--subtle);
  }

  .cl-pill--primary:hover:not(:disabled) {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
  }

  .cl-pill--ghost:hover:not(:disabled) {
    color: var(--ink);
  }

  .cl-pill--danger:hover:not(:disabled) {
    background: var(--danger-bg);
  }

  .cl-icon-btn:hover:not(:disabled) {
    background: var(--subtle);
  }
}

.cl-pill:focus-visible,
.cl-icon-btn:focus-visible,
.seg-btn:focus-visible,
.cl-nav a:focus-visible,
.side-lockup:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* ---- Card and headings -------------------------------------------------------------- */
.cl-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: var(--space-24);
  box-shadow: var(--shadow-card);
}

.page-title {
  font-size: 22px;
  line-height: 1.25;
}

/* ---- Text roles -------------------------------------------------------------------- */
.cl-caption {
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

/* "End-to-end encrypted" cue shown on the cards where a secret or a credential is handled. */
.e2e-badge {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 6px;
  padding: 3px 10px 3px 8px;
  border-radius: var(--radius-full);
  background: var(--primary-wash);
  color: var(--primary-ink);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.4;
}

.e2e-badge .icon {
  width: 14px;
  height: 14px;
}

/* ---- Alerts ------------------------------------------------------------------------
   Plain alert = warning; role=alert = error; --ok = info/success. A 16px line icon sits at the start. */
.cl-alert {
  position: relative;
  display: block;
  padding: var(--space-12) var(--space-16) var(--space-12) 44px;
  border-radius: var(--radius-control);
  background: var(--warn-bg);
  color: var(--warn);
  font-size: 14px;
  line-height: 1.5;
}

.cl-alert::before {
  content: '';
  position: absolute;
  left: var(--space-16);
  top: 14px;
  width: 16px;
  height: 16px;
  background-color: currentColor;
  -webkit-mask: url('/assets/icon-alert.svg') center / contain no-repeat;
  mask: url('/assets/icon-alert.svg') center / contain no-repeat;
}

.cl-alert[role='alert'] {
  background: var(--danger-bg);
  color: var(--danger);
}

.cl-alert--ok,
.cl-alert--ok[role='alert'] {
  background: var(--primary-wash);
  color: var(--primary-ink);
}

.cl-alert--ok::before {
  -webkit-mask-image: url('/assets/icon-check.svg');
  mask-image: url('/assets/icon-check.svg');
}

/* ---- Badges and state chips ---------------------------------------------------------- */
.cl-nav-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: var(--radius-full);
  background: var(--subtle);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
}

.cl-nav-badge--accent {
  background: var(--primary-wash);
  color: var(--primary-ink);
}

.state {
  display: inline-block;
  align-self: flex-start;
  padding: 1px 10px;
  border-radius: var(--radius-full);
  background: var(--subtle);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.6;
}

.state--active,
.state--admin {
  background: var(--primary-wash);
  color: var(--primary-ink);
}

.state--invited {
  background: var(--warn-bg);
  color: var(--warn);
}

.state-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
}

/* ---- Fields --------------------------------------------------------------------------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

label,
.field-label {
  display: block;
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
}

textarea,
input,
select {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  background: var(--surface);
  color: var(--ink);
  font: 400 16px/1.4 var(--font-sans); /* 16px so mobile browsers do not zoom on focus */
  transition:
    border-color 0.15s var(--ease),
    box-shadow 0.15s var(--ease);
}

textarea.mono,
input.mono {
  font-family: var(--font-mono);
  font-size: 15px;
}

textarea {
  height: auto;
  min-height: 144px;
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.5;
}

select {
  width: min(100%, 260px);
  padding-right: 36px;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 19px) 50%,
    calc(100% - 14px) 50%;
  background-size:
    5px 5px,
    5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}

input::placeholder {
  color: var(--muted);
  opacity: 0.8;
}

input[readonly] {
  background: var(--subtle);
}

textarea:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-wash);
}

@media (hover: hover) and (pointer: fine) {
  textarea:hover:not(:focus-visible),
  input:hover:not(:focus-visible),
  select:hover:not(:focus-visible) {
    border-color: var(--muted);
  }
}

/* Link and passphrase fields carry a small padlock. */
.input-lock {
  position: relative;
  flex: 1;
  min-width: 0;
}

.input-lock .icon {
  position: absolute;
  left: 12px;
  top: 50%;
  translate: 0 -50%;
  color: var(--primary-ink);
  pointer-events: none;
}

.input-lock input {
  padding-left: 36px;
}

.copy {
  display: flex;
  gap: var(--space-8);
}

.copy > input {
  flex: 1;
  min-width: 0;
}

.copy .cl-pill {
  flex: none;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-12);
}

/* A checkbox row inside a field. */
label.check {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  min-height: 42px;
  font-size: 15px;
  font-weight: 400;
  cursor: pointer;
}

label.check input {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  accent-color: var(--primary);
}

/* ---- Masked preview ---------------------------------------------------------------------- */
.mask {
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--subtle);
  font-size: 15px;
  overflow-wrap: anywhere;
  user-select: none;
}

/* ---- Board: card with a header, rows and a footer ---------------------------------------------- */
.board {
  padding: 0;
  overflow: hidden;
}

.board-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-12);
  padding: var(--space-16) var(--space-20);
}

.board-pad {
  padding: var(--space-16) var(--space-20);
  border-top: 1px solid var(--line);
}

.board-empty {
  padding: var(--space-16) var(--space-20);
  border-top: 1px solid var(--line);
}

.board-foot {
  padding: var(--space-12) var(--space-20);
  border-top: 1px solid var(--line);
}

.board-cols,
.secrets li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px auto;
  align-items: center;
  column-gap: var(--space-12);
  padding: var(--space-12) var(--space-20);
}

.board-cols {
  background: var(--subtle);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.3;
}

.board-cols span:nth-child(2) {
  text-align: right;
}

.board-cols span:nth-child(3) {
  /* mirrors the Revoke button so the columns line up */
  min-width: 78px;
}

.secrets {
  margin: 0;
  padding: 0;
  list-style: none;
}

.secrets li {
  border-bottom: 1px solid var(--line);
}

.secrets li:last-child {
  border-bottom: 0;
}

.row-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.row-title {
  overflow: hidden;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-title.placeholder {
  color: var(--muted);
  font-weight: 400;
}

.row-time {
  text-align: right;
  font: 500 13px/1.4 var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ---- Workspace: main task on the left, context on the right ---------------------------------- */
.workspace {
  display: grid;
  gap: var(--space-24);
  align-items: start;
}

.workspace-main {
  display: flex;
  flex-direction: column;
  gap: var(--space-24);
  min-width: 0;
}

@media (min-width: 900px) {
  .workspace {
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    gap: var(--space-32);
  }
}

/* ---- Welcome (signed out) ------------------------------------------------------------------ */
.welcome {
  display: grid;
  gap: var(--space-32);
  padding-top: var(--space-16);
}

.welcome-intro {
  display: flex;
  flex-direction: column;
  gap: var(--space-16);
}

.welcome-title {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
  text-wrap: balance;
}

.welcome-title em {
  font-style: normal;
  color: var(--primary-ink);
}

.welcome-lead {
  max-width: 34em;
  color: var(--muted);
  font-size: 16px;
}

.welcome-cta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-12);
}

.login-form {
  width: 100%;
  max-width: 420px;
}

/* "Entrar" and "Iniciar sesión con Microsoft" side by side, wrapping on narrow screens. */
.login-actions {
  align-items: center;
}

/* Tally: three rules of every secret, as figures with a label, separated by hairlines. */
.tally {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: var(--space-8) 0 0;
  border-top: 1px solid var(--line);
}

.tally > div {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
  gap: var(--space-4);
  padding: var(--space-16) var(--space-12) 0 0;
}

.tally > div + div {
  padding-left: var(--space-16);
  border-left: 1px solid var(--line);
}

.tally dd {
  margin: 0;
  font: 600 22px/1.2 var(--font-sans);
  font-variant-numeric: tabular-nums;
}

.tally dt {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

/* How it works: a numbered list in a subtle card. */
.steps {
  margin: 0;
  padding: var(--space-8) var(--space-20);
  list-style: none;
  background: var(--subtle);
  box-shadow: none;
}

.step {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: var(--space-12);
  padding: var(--space-16) 0;
}

.step + .step {
  border-top: 1px solid var(--line);
}

.step-num {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary-wash);
  color: var(--primary-ink);
  font: 600 12px/1 var(--font-sans);
  font-variant-numeric: tabular-nums;
}

.step-title {
  margin: 2px 0 var(--space-4);
  font-size: 15px;
  line-height: 1.35;
}

.step-text {
  color: var(--muted);
  font-size: 14px;
}

@media (min-width: 820px) {
  .welcome {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: var(--space-48);
    align-items: start;
    padding-top: var(--space-32);
  }

  .welcome-title {
    font-size: 34px;
  }
}

/* ---- Admin: page head, controls, KPIs, chart -------------------------------------------------- */
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-12);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-12);
}

.seg {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  background: var(--surface);
}

.seg-btn {
  height: 30px;
  padding: 0 var(--space-12);
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font: 500 13.5px/1 var(--font-sans);
  cursor: pointer;
  transition:
    background-color 0.15s var(--ease),
    color 0.15s var(--ease);
}

.seg-btn[aria-pressed='true'] {
  background: var(--primary-wash);
  color: var(--primary-ink);
  font-weight: 600;
}

@media (hover: hover) and (pointer: fine) {
  .seg-btn[aria-pressed='false']:hover {
    background: var(--subtle);
    color: var(--ink);
  }
}

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-12);
}

.app-kpi {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: var(--space-16);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.kpi-label {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.kpi-value {
  font: 600 26px/1.2 var(--font-sans);
  font-variant-numeric: tabular-nums;
}

.kpi-hint:empty {
  display: none;
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-12);
}

.legend {
  display: flex;
  gap: var(--space-16);
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 13px;
}

.legend li {
  display: flex;
  align-items: center;
  gap: 6px;
}

.swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.swatch--created,
.chart-bar--created {
  fill: var(--primary);
  background: var(--primary);
}

.swatch--opened,
.chart-bar--opened {
  fill: var(--muted);
  background: var(--muted);
}

.chart {
  overflow: hidden;
}

.chart-svg {
  display: block;
  max-width: 100%;
}

.chart-grid {
  stroke: var(--line);
  stroke-width: 1;
}

.chart-axis {
  fill: var(--muted);
  font: 400 11px var(--font-sans);
}

/* ---- Tables ------------------------------------------------------------------------------- */
.table-wrap {
  overflow-x: auto;
  border-top: 1px solid var(--line);
}

.cl-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.cl-table th,
.cl-table td {
  padding: var(--space-12) var(--space-20);
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

.cl-table tbody tr:last-child td {
  border-bottom: 0;
}

.cl-table th {
  background: var(--subtle);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.3;
}

.cl-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.cl-table .cell-user {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cl-table td .mono {
  font-size: 13px;
}

.cl-table td.cell-actions {
  width: 1%;
  text-align: right;
}

.cell-stack {
  display: flex;
  flex-direction: column;
}

.cell-name {
  font-weight: 600;
}

.cell-email {
  overflow-wrap: anywhere;
}

.ev {
  font-weight: 500;
}

.ev--warn {
  color: var(--warn);
}

.row-actions {
  display: inline-flex;
  gap: 6px;
}

/* Second click needed to delete: the button widens and says "Confirmar". */
.cl-icon-btn.is-confirming {
  width: auto;
  padding: 0 var(--space-12);
  border-color: var(--danger);
  background: var(--danger-bg);
  color: var(--danger);
  font: 500 13px/1 var(--font-sans);
}

.action--delete:not(.is-confirming) {
  color: var(--danger);
}

/* ---- Admin: filter bars, pager and external accounts form ----------------------------------------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-16);
  padding: var(--space-16) var(--space-20);
  border-top: 1px solid var(--line);
}

.toolbar-grow {
  flex: 1 1 240px;
  min-width: 0;
}

.toolbar .seg {
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}

.toolbar .seg-btn {
  flex: none;
}

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-12);
}

.pager-btns {
  display: flex;
  gap: var(--space-8);
}

.acc-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: var(--space-16);
  align-items: end;
}

/* In the rail the total would squeeze "Cuentas externas"; the page shows it. Only pending invitations stay. */
#nav-accounts-total {
  display: none;
}

/* ---- Admin: sidebar menu and layout ------------------------------------------------------------ */
.admin-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: var(--space-24);
  align-items: start;
}

.admin-main {
  display: flex;
  flex-direction: column;
  gap: var(--space-24);
  min-width: 0;
}

.cl-side {
  position: sticky;
  top: var(--space-24);
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
  padding: var(--space-16) var(--space-8);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}

.cl-side-title {
  padding: 0 12px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
}

.cl-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cl-nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-8);
  padding: 7px 12px;
  border-radius: var(--radius-nav);
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.3;
  text-decoration: none;
}

.cl-nav a[aria-current='page'] {
  background: var(--primary-wash);
  color: var(--primary-ink);
  font-weight: 600;
}

@media (hover: hover) and (pointer: fine) {
  .cl-nav a:not([aria-current='page']):hover {
    background: var(--subtle);
  }
}

.cl-nav-sep {
  width: 100%;
  height: 0;
  margin: 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.nav-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-badges {
  display: inline-flex;
  flex: none;
  gap: var(--space-4);
}

/* On the selected item the grey badge would blend into the selection background. */
.cl-nav a[aria-current='page'] .cl-nav-badge:not(.cl-nav-badge--accent) {
  background: var(--surface);
}

.side-lockup {
  display: none;
}

/* Wide screens: the sidebar is a fixed rail glued to the left edge, full height. The top bar, page and footer
   shift right by its width and keep the app's fixed content width. */
@media (min-width: 760px) {
  .admin-app {
    --rail: 240px;
    padding-left: var(--rail);
  }

  .admin-app .cl-side {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 10;
    width: var(--rail);
    gap: var(--space-12);
    padding: var(--space-20) var(--space-12) var(--space-24);
    overflow-y: auto;
    border: 0;
    border-right: 1px solid var(--line);
    border-radius: 0;
  }

  .admin-app .side-lockup {
    display: flex;
    align-items: center;
    gap: var(--space-8);
    padding: 0 12px var(--space-16);
    margin-bottom: var(--space-4);
    border-bottom: 1px solid var(--line);
    color: var(--ink);
    font: 600 16px/1.2 var(--font-sans);
    letter-spacing: -0.01em;
    text-decoration: none;
  }

  /* The lockup moves into the rail; the top bar keeps only the user, logout and theme controls. */
  .admin-app .topbar .lockup {
    display: none;
  }

  .admin-app .topbar-inner {
    justify-content: flex-end;
  }

  .admin-app .admin-layout {
    display: block;
  }
}

/* Below 760px the sidebar becomes a scrolling row above the page. */
@media (max-width: 759px) {
  .admin-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-16);
  }

  .cl-side {
    position: static;
    flex-direction: row;
    align-items: center;
    gap: var(--space-4);
    padding: 6px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .cl-side-title {
    display: none;
  }

  .cl-nav {
    flex: none;
    flex-direction: row;
    gap: var(--space-4);
  }

  .cl-nav a {
    flex: none;
    white-space: nowrap;
  }

  .cl-nav-sep {
    flex: none;
    width: 0;
    height: 20px;
    margin: 0 var(--space-4);
    border-top: 0;
    border-left: 1px solid var(--line);
  }

  .toolbar {
    padding-left: var(--space-16);
    padding-right: var(--space-16);
  }
}

/* ---- Small screens ----------------------------------------------------------------------------- */
@media (max-width: 520px) {
  .tally dd {
    font-size: 20px;
  }

  .tally > div + div {
    padding-left: var(--space-12);
  }

  .user-name {
    display: none;
  }

  .cl-card {
    padding: var(--space-20);
  }

  .board {
    padding: 0;
  }

  .board-cols,
  .secrets li {
    grid-template-columns: minmax(0, 1fr) 56px auto;
    padding-left: var(--space-16);
    padding-right: var(--space-16);
  }

  .board-head,
  .board-pad,
  .board-empty,
  .board-foot {
    padding-left: var(--space-16);
    padding-right: var(--space-16);
  }

  .board-cols span:nth-child(3) {
    min-width: 70px;
  }

  /* Small screens: logo and theme toggle share the first row; the signed-in links go on a second row. */
  .topbar-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    row-gap: var(--space-4);
  }

  .topbar-end {
    display: contents;
  }

  #theme-toggle {
    grid-column: 2;
    grid-row: 1;
  }

  .user {
    grid-column: 1 / -1;
    grid-row: 2;
    flex-wrap: nowrap;
    gap: var(--space-8);
    margin-left: calc(var(--space-12) * -1);
  }

  .cl-table th,
  .cl-table td {
    padding-left: var(--space-16);
    padding-right: var(--space-16);
  }
}

@media (prefers-reduced-motion: reduce) {
  .cl-pill,
  .cl-icon-btn,
  .seg-btn,
  textarea,
  input,
  select {
    transition: none;
  }

  .cl-pill:active:not(:disabled),
  .cl-icon-btn:active:not(:disabled) {
    transform: none;
  }
}

/* ---- Access requests ------------------------------------------------------------------------- */
/* Text-style button ("Solicitar acceso"): a link that does something instead of navigating. */
.cl-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--primary-ink);
  font: 500 14.5px/1.4 var(--font-sans);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.cl-link:hover {
  text-decoration-thickness: 2px;
}

.cl-link:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
  border-radius: 2px;
}

.state--approved {
  background: var(--primary-wash);
  color: var(--primary-ink);
}
