/*
 * Marco visual de accounts: tokens del diseño de Tasks v2 (tasks/web/src/style.css),
 * la barra de arriba de las páginas con sesión (public/shell.js) y los componentes
 * comunes (botones, campos, tarjetas, avisos, chips, diálogos y la pantalla de acceso).
 * Contraste AA: el texto secundario usa --ink-3 (5,7:1 sobre blanco), el texto melón
 * sobre blanco usa --melon-ink y los botones melón llevan texto --rind.
 */

@font-face { font-family: "Poppins"; font-style: normal; font-weight: 600; font-display: swap; src: url("/fonts/Poppins-SemiBold.ttf") format("truetype"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 700; font-display: swap; src: url("/fonts/Poppins-Bold.ttf") format("truetype"); }
@font-face { font-family: "Open Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/OpenSans-Regular.ttf") format("truetype"); }
@font-face { font-family: "Open Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("/fonts/OpenSans-SemiBold.ttf") format("truetype"); }
@font-face { font-family: "Open Sans"; font-style: normal; font-weight: 700; font-display: swap; src: url("/fonts/OpenSans-Bold.ttf") format("truetype"); }

:root {
  --font-sans: "Open Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Poppins", "Open Sans", system-ui, sans-serif;

  --melon: #a0c64f;
  --melon-hover: #7ca238;
  --melon-soft: #eff6e2;
  --melon-ink: #4a6812;
  --rind: #002c2b;
  --rind-2: #0b3a37;
  --rind-3: #164a46;
  --rind-deep: #001f1e;

  --ink: #081c15;
  --ink-2: #34453d;
  --ink-3: #5b6b63;
  --ink-4: #8a978f;
  --line: #e5eae4;
  --line-2: #d6ded5;
  --field: #bccdc2;
  --row: #eef1ed;
  --canvas: #f6f8f5;
  --surface: #ffffff;
  --seg: #eff2ee;

  --danger: #c2372c;
  --danger-soft: #fdeceb;
  --warn: #8a5300;
  --warn-soft: #fdf1e4;
  --info: #2f6dbb;
  --info-soft: #e9f1fb;

  --shadow-card: 0 1px 2px rgba(8, 28, 21, 0.04), 0 0 0 1px rgba(8, 28, 21, 0.02);
  --shadow-pop: 0 14px 36px rgba(0, 30, 25, 0.16), 0 2px 6px rgba(0, 30, 25, 0.08);
  --radius: 14px;
  --page: 1080px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-display); color: var(--ink); letter-spacing: -0.01em; }
a { color: var(--melon-ink); font-weight: 600; text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--melon-hover); outline-offset: 2px; }
img, svg { display: block; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -48px; z-index: 50; background: var(--surface); color: var(--ink); padding: 8px 12px; border-radius: 10px; box-shadow: var(--shadow-pop); }
.skip:focus { top: 10px; }
.muted { color: var(--ink-3); }

/* ------------------------------------------------------------ Barra de arriba */
.topbar { background: var(--rind); color: #fff; position: sticky; top: 0; z-index: 20; }
.topbar-in {
  max-width: var(--page); margin: 0 auto; padding: 0 24px; height: 60px;
  display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "brand nav tools"; align-items: center; gap: 0 28px;
}
.brand { grid-area: brand; display: inline-flex; align-items: center; gap: 10px; color: #fff; font-family: var(--font-display); font-weight: 600; font-size: 17px; letter-spacing: -0.01em; white-space: nowrap; }
.brand .brand-name + .brand-app { margin-left: -4px; }
.brand:hover { text-decoration: none; }
.brand img { width: 30px; height: 30px; }
.brand .brand-app { color: var(--melon); }
.mainnav { grid-area: nav; display: flex; align-items: stretch; gap: 4px; height: 100%; }
.mainnav a {
  position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 0 12px;
  color: rgba(255, 255, 255, 0.8); font-weight: 600; font-size: 14px;
}
.mainnav a svg { width: 18px; height: 18px; opacity: 0.85; }
.mainnav a:hover { color: #fff; text-decoration: none; background: rgba(255, 255, 255, 0.06); }
.mainnav a[aria-current="page"] { color: #fff; }
.mainnav a[aria-current="page"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--melon); }
.mainnav a:focus-visible { outline-offset: -4px; border-radius: 10px; }
.tools { grid-area: tools; display: flex; align-items: center; gap: 8px; color: #fff; }
.acct { position: relative; }
.acct-btn {
  all: unset; box-sizing: border-box; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 999px; cursor: pointer;
}
.acct-btn:hover .avatar, .acct-btn[aria-expanded="true"] .avatar { box-shadow: 0 0 0 3px rgba(160, 198, 79, 0.45); }
.acct-btn:focus-visible { outline: 2px solid var(--melon); outline-offset: 1px; }
.acct-panel {
  position: absolute; right: -4px; top: calc(100% + 10px); width: 288px; max-width: calc(100vw - 16px); z-index: 30;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-pop);
  padding: 8px; animation: pop-in 0.15s ease-out;
}
.acct-who { display: flex; gap: 12px; align-items: center; padding: 10px 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; min-width: 0; }
.acct-who > div { min-width: 0; }
.acct-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-mail { color: var(--ink-3); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-panel .chip { margin-top: 6px; }
.menu-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; color: var(--ink); font-weight: 600; font-size: 13.5px; }
.menu-item svg { width: 18px; height: 18px; color: var(--ink-3); }
.menu-item:hover, .menu-item:focus-visible { background: var(--canvas); text-decoration: none; }
@keyframes pop-in { from { opacity: 0; transform: translateY(-6px) scale(0.98); } }

@media (max-width: 760px) {
  .topbar-in { height: auto; padding: 0 16px; grid-template-columns: 1fr auto; grid-template-areas: "brand tools" "nav nav"; gap: 0 12px; }
  .brand { height: 56px; font-size: 16px; }
  .mainnav { height: 46px; margin: 0 -16px; padding: 0 8px; border-top: 1px solid rgba(255, 255, 255, 0.08); }
  .mainnav a { flex: 1 1 0; justify-content: center; padding: 0 6px; font-size: 13.5px; }
}
@media (max-width: 420px) { .mainnav a svg { display: none; } }
@media (max-width: 340px) {
  .brand .brand-name { display: none; }
}

/* ------------------------------------------------------------ Página */
.page { max-width: var(--page); margin: 0 auto; padding: 32px 24px 72px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin-bottom: 24px; }
.page-head h1 { font-size: 28px; line-height: 1.2; margin: 0 0 6px; font-weight: 600; }
.lead { color: var(--ink-3); margin: 0; max-width: 680px; font-size: 14.5px; }
.crumb { margin: 0 0 14px; font-size: 13.5px; }
.crumb a { display: inline-flex; align-items: center; gap: 6px; }
.crumb svg { width: 16px; height: 16px; }
.section-title { font-family: var(--font-display); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-3); margin: 32px 0 12px; display: flex; align-items: center; gap: 8px; }
.section-title .count { font-family: var(--font-sans); background: var(--seg); color: var(--ink-2); border-radius: 999px; padding: 0 8px; font-size: 12px; letter-spacing: 0; }
@media (max-width: 760px) {
  .page { padding: 22px 16px 56px; }
  .page-head h1 { font-size: 24px; }
}

/* ------------------------------------------------------------ Tarjetas */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-card); padding: 20px; }
.card + .card { margin-top: 16px; }
.card h2 { font-size: 17px; font-weight: 600; margin: 0; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 14px; }
.card-head h2 { flex: 1 1 auto; }
.card-sub { color: var(--ink-3); font-size: 13.5px; margin: 4px 0 0; }
.empty { text-align: center; padding: 36px 20px; }
.empty img { width: 56px; height: 56px; margin: 0 auto 14px; }
.empty h2 { font-size: 18px; margin: 0 0 6px; }
.empty p { color: var(--ink-3); margin: 0 auto 18px; max-width: 460px; }

/* ------------------------------------------------------------ Botones y campos */
button, input, select { font: inherit; color: inherit; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font-weight: 600; font-size: 13.5px; line-height: 1;
  cursor: pointer; white-space: nowrap; text-decoration: none; transition: background-color 0.15s, border-color 0.15s;
}
.btn svg { width: 17px; height: 17px; flex: none; }
.btn:hover { background: var(--canvas); border-color: var(--field); text-decoration: none; }
.btn.primary { background: var(--melon); border-color: var(--melon); color: var(--rind); }
.btn.primary:hover { background: var(--melon-hover); border-color: var(--melon-hover); }
.btn.danger { color: var(--danger); border-color: #efc4c0; }
.btn.danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn.danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger-solid:hover { background: #a92e24; border-color: #a92e24; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); padding: 0 10px; }
.btn.ghost:hover { background: var(--seg); }
.btn.ghost.danger { color: var(--danger); }
.btn.ghost.danger:hover { background: var(--danger-soft); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn.ghost.sm { padding: 0 8px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.btn.primary:disabled:hover { background: var(--melon); }
.btn:disabled:hover { background: var(--surface); }
.btn.primary:disabled:hover { background: var(--melon); }
.input, .select {
  height: 38px; border: 1px solid var(--field); border-radius: 10px; background: var(--surface); color: var(--ink); padding: 0 12px; font-size: 14px; max-width: 100%; min-width: 0;
}
.select { padding-right: 30px; appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%2334453d' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 8 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; background-size: 16px; }
.select.sm { height: 32px; font-size: 13px; padding-left: 10px; border-radius: 9px; }
.input::placeholder { color: var(--ink-3); opacity: 0.85; }
.input:focus, .select:focus { outline: none; border-color: var(--melon-hover); box-shadow: 0 0 0 3px rgba(160, 198, 79, 0.28); }
.input:disabled, .select:disabled { background: var(--canvas); color: var(--ink-3); cursor: not-allowed; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > span, .field-label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.note { color: var(--ink-3); font-size: 13px; margin: 10px 0 0; }

/* ------------------------------------------------------------ Chips, avatares e íconos */
.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; border-radius: 999px; padding: 0 9px;
  font-size: 12px; font-weight: 600; background: var(--seg); color: var(--ink-2); white-space: nowrap; line-height: 1;
}
.chip.owner { background: var(--rind); color: #fff; }
.chip.admin { background: var(--melon-soft); color: var(--melon-ink); }
.chip.ok { background: var(--melon-soft); color: var(--melon-ink); }
.chip.ok::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--melon-hover); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.info { background: var(--info-soft); color: var(--info); }
.chip.bad { background: var(--danger-soft); color: var(--danger); }
.chip.me { background: var(--info-soft); color: var(--info); }
.avatar {
  display: inline-grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 999px;
  background: var(--rind-3); color: #fff; font-family: var(--font-display); font-weight: 600; font-size: 13px; letter-spacing: 0.02em; user-select: none;
}
.avatar.lg { width: 44px; height: 44px; font-size: 15px; }
.avatar.sm { width: 30px; height: 30px; font-size: 11.5px; }
.avatar.square { border-radius: 12px; }
.avatar.pending { background: var(--surface); color: var(--ink-3); border: 1.5px dashed var(--field); }
.picon { display: inline-grid; place-items: center; flex: none; }
.picon svg, .picon img { width: 100%; height: 100%; }
.r { fill: var(--rind); }
.p { fill: var(--melon); }

/* ------------------------------------------------------------ Avisos */
.flash, .banner { display: flex; align-items: flex-start; gap: 10px 14px; flex-wrap: wrap; border-radius: 12px; padding: 12px 14px; margin: 0 0 18px; font-size: 13.5px; border: 1px solid transparent; }
.flash:empty { display: none; }
.flash > span, .banner > p { flex: 1 1 260px; margin: 0; }
.flash.ok { background: var(--melon-soft); color: var(--rind); border-color: #d8e9b8; }
.flash.err { background: var(--danger-soft); color: #9e2b22; border-color: #f4cfcb; }
.flash.info { background: var(--info-soft); color: #24548f; border-color: #cfe0f4; }
.flash:not(.ok):not(.err):not(.info) { display: none; }
.flash .btn { height: 32px; }
.banner.warn { background: var(--warn-soft); color: #6b4200; border-color: #f2dcc0; }
.banner .btn { height: 32px; }

/* ------------------------------------------------------------ Diálogos */
dialog.dlg {
  width: 440px; max-width: calc(100vw - 32px); border: 0; border-radius: 18px; padding: 0; color: var(--ink);
  background: var(--surface); box-shadow: var(--shadow-pop);
}
dialog.dlg[open] { animation: pop-in 0.15s ease-out; }
dialog.dlg::backdrop { background: rgba(0, 31, 30, 0.45); }
.dlg form { padding: 22px 22px 18px; }
.dlg h2 { font-size: 18px; font-weight: 600; margin: 0 0 8px; }
.dlg p { margin: 0 0 12px; color: var(--ink-2); }
.dlg .field { margin: 6px 0 4px; }
.dlg .input { width: 100%; }
.dlg-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 18px; }

/* ------------------------------------------------------------ Pantallas de acceso (login, contraseña) */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(320px, 440px) minmax(0, 1fr); }
.auth-side {
  background: var(--rind); color: #fff; padding: 40px 44px; display: flex; flex-direction: column; gap: 28px;
  background-image: radial-gradient(circle at 110% 110%, rgba(160, 198, 79, 0.22), transparent 55%), radial-gradient(circle at -20% -10%, rgba(160, 198, 79, 0.08), transparent 50%);
}
.auth-side .brand { font-size: 19px; }
.auth-side h2 { color: #fff; font-size: 30px; line-height: 1.2; font-weight: 600; margin: auto 0 0; max-width: 340px; }
.auth-side p { margin: 0; color: rgba(255, 255, 255, 0.8); font-size: 15px; max-width: 340px; }
.auth-apps { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 auto; padding: 0; list-style: none; }
.auth-apps li { border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 600; color: #fff; }
.auth-apps li::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--melon); margin-right: 8px; vertical-align: 1px; }
.auth-main { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 26px; font-weight: 600; margin: 0 0 6px; line-height: 1.2; }
.auth-card .sub { color: var(--ink-3); margin: 0 0 22px; font-size: 14.5px; }
.auth-card .field { margin-top: 14px; }
.auth-card .input { width: 100%; height: 42px; }
.auth-card .btn.block { width: 100%; height: 44px; margin-top: 22px; font-size: 14.5px; }
.auth-card .msg { font-size: 13.5px; margin-top: 14px; min-height: 20px; }
.auth-card .msg:empty { min-height: 0; margin-top: 0; }
.auth-card .msg.err, .auth-card .err { color: var(--danger); }
.auth-card .msg.ok { color: var(--melon-ink); }
.auth-foot { text-align: center; color: var(--ink-3); font-size: 13.5px; margin: 22px 0 0; }
.linkbtn { all: unset; color: var(--melon-ink); font-weight: 600; cursor: pointer; }
.linkbtn:hover { text-decoration: underline; }
.linkbtn:focus-visible { outline: 2px solid var(--melon-hover); outline-offset: 2px; border-radius: 4px; }
.auth-card .note { margin: 0 0 16px; padding: 10px 12px; border-radius: 10px; background: var(--melon-soft); color: var(--rind); font-size: 13.5px; }
.auth-card .note.bad { background: var(--danger-soft); color: #9e2b22; }
.social { display: grid; gap: 10px; }
.social a { display: flex; align-items: center; justify-content: center; gap: 10px; height: 42px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); color: var(--ink); font-weight: 600; font-size: 14px; }
.social a:hover { background: var(--canvas); border-color: var(--field); text-decoration: none; }
.divider { display: flex; align-items: center; gap: 12px; margin: 20px 0 4px; color: var(--ink-3); font-size: 12.5px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.forgot { margin: 8px 0 0; text-align: right; font-size: 13px; }
@media (max-width: 860px) {
  .auth { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .auth-side { padding: 0 16px; height: 56px; flex-direction: row; align-items: center; background-image: none; }
  .auth-side > :not(.brand) { display: none; }
  .auth-main { place-items: start center; padding: 28px 16px 48px; }
  .auth-card h1 { font-size: 23px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
