/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* PorPartidaDoble brand tokens -- see docs/brand/README.md (tokens.css has the Tailwind version) */
:root {
  --noche: #0B1020;
  --niebla: #F4F5FA;
  --hilo: #6B7499;       /* graphics only, never text */
  --bruma: #4A5170;      /* secondary text */
  --linea: #DDE0EC;
  --libro: #0B7A5E;      /* brand green */
  --libro-osc: #0A6B53;  /* hover, small green text */
  --libro-claro: #3DD6A5; /* brand green on Noche */
  --tinte: #E3F3EC;
  --aviso: #8A5300;  --aviso-bg: #FFF1D6;
  --error: #B3261E;  --error-bg: #FDE8E6;
  --espera-bg: #E9EBF4;

  --font-display: "Sora", ui-sans-serif, system-ui, sans-serif;
  --font-sans: "Figtree", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "DM Mono", ui-monospace, Menlo, monospace;
}

html { background: var(--niebla); color: var(--noche); font-family: var(--font-sans); }
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -0.02em; }
.num, .mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; width: 100%; box-sizing: border-box; max-width: 40rem; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
a { color: var(--libro-osc); }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .75rem 1rem; background: var(--noche); color: var(--niebla); }
.topbar .brand { display: inline-flex; align-items: center; gap: .5rem; color: var(--niebla); text-decoration: none; font-family: var(--font-display); font-weight: 600; }
.topbar nav { display: flex; align-items: center; gap: .75rem; font-size: .9rem; }
.topbar .muted { color: var(--linea); }
.topbar form { margin: 0; }
button.link { background: none; border: 0; padding: 0; color: var(--libro-claro); font: inherit; cursor: pointer; text-decoration: underline; }
.muted { color: var(--bruma); }
.alert-text { color: var(--error); }
.flash { padding: .6rem .8rem; border-radius: .4rem; list-style: none; }
p.flash { display: flex; align-items: flex-start; gap: .6rem; }
p.flash .icon { margin-top: .1rem; }
.flash.notice { background: var(--tinte); color: var(--libro-osc); }
.flash.alert { background: var(--error-bg); color: var(--error); }
.cards { list-style: none; padding: 0; display: grid; gap: .5rem; }
.cards li { display: flex; justify-content: space-between; padding: .75rem 1rem; background: white; border: 1px solid var(--linea); border-radius: .5rem; }
form p { display: grid; gap: .25rem; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], textarea { box-sizing: border-box; width: 100%; padding: .5rem .6rem; border: 1px solid var(--linea); border-radius: .4rem; font: inherit; }
input[type=submit] { padding: .5rem 1rem; border: 0; border-radius: .4rem; background: var(--libro); color: white; font: inherit; cursor: pointer; }
input[type=submit]:hover { background: var(--libro-osc); }

.topbar a.link { color: var(--libro-claro); }
a.button { display: inline-block; padding: .45rem 1rem; border-radius: .4rem; background: var(--libro); color: white; text-decoration: none; font-weight: 500; }
a.button:hover { background: var(--libro-osc); }
.topbar a.button { padding: .3rem .8rem; background: var(--libro-claro); color: var(--noche); }
.hero { padding: 2rem 0 1rem; }
.hero h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); line-height: 1.15; margin: 0 0 1rem; }
.hero .lead { font-size: 1.15rem; color: var(--bruma); max-width: 36rem; }
.hero .actions { display: flex; align-items: center; gap: 1.25rem; margin-top: 1.5rem; }
.features { list-style: none; padding: 0; display: grid; gap: .75rem; }
.features li { display: flex; gap: 1rem; padding: 1rem 1.25rem; background: white; border: 1px solid var(--linea); border-radius: .5rem; }
.feature-icon { flex-shrink: 0; display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: .6rem; background: var(--tinte); color: var(--libro); }
.feature-icon .icon { width: 1.4rem; height: 1.4rem; }
.icon.big-icon { width: 3rem; height: 3rem; color: var(--libro); }
.features h3 { margin: 0 0 .25rem; font-size: 1.05rem; }
.features p { margin: 0; }

table { width: 100%; border-collapse: collapse; background: white; border: 1px solid var(--linea); border-radius: .5rem; font-size: .95rem; }
th, td { padding: .5rem .6rem; text-align: left; border-bottom: 1px solid var(--linea); }
th { font-weight: 600; color: var(--bruma); }
.right { text-align: right; }
dl { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; }
dt { color: var(--bruma); }
dd { margin: 0; }
select, table.lines input { padding: .5rem .6rem; border: 1px solid var(--linea); border-radius: .4rem; font: inherit; width: 100%; box-sizing: border-box; }
select { width: auto; max-width: 100%; }
table.lines td { padding: .3rem; }
.badge { display: inline-block; padding: .1rem .5rem; border-radius: 1rem; font-size: .85rem; background: var(--espera-bg); color: var(--bruma); }
.badge.accepted { background: var(--tinte); color: var(--libro-osc); }
.badge.rejected, .badge.error { background: var(--error-bg); color: var(--error); }
.badge.voided { background: var(--aviso-bg); color: var(--aviso); }
.badge.beta { background: transparent; border: 1px dashed currentColor; }
main:has(table) { max-width: 52rem; }
table.accounts td { padding: .25rem .6rem; }
table.accounts .level-3 { padding-left: 1.4rem; }
table.accounts .level-4 { padding-left: 2.2rem; }
table.accounts .level-5 { padding-left: 3rem; }
table.accounts .level-6 { padding-left: 3.8rem; }
table.accounts .level-2 { font-weight: 600; }
table.journal tr.entry th { text-align: left; font-weight: 600; background: var(--espera-bg); }
table.journal tr.entry .actions { float: right; font-weight: normal; }
table.journal td.credit { padding-left: 2rem; }
/* Lines of the journal entry form: the account on top, then debe, haber and exchange rate. */
.entry-line { display: grid; grid-template-columns: 1fr 1fr 5.5rem auto; gap: .4rem; align-items: center; margin: 0 0 .75rem; padding: 0; border: 0; }
.entry-line select { grid-column: 1 / -1; }

/* Footer, legal pages and the public forms (contact, Libro de Reclamaciones) */
.site-footer { background: var(--noche); color: var(--linea); font-size: .9rem; }
.site-footer a { color: var(--libro-claro); }
.site-footer-inner { max-width: 52rem; margin: 0 auto; padding: 2rem 1rem 1rem; display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
.site-footer p { margin: 0 0 .25rem; }
.site-footer nav { display: flex; flex-direction: column; gap: .4rem; }
.site-footer nav a { display: inline-flex; align-items: center; gap: .5rem; }
.site-footer nav .icon { width: 1rem; height: 1rem; }
.footer-brand { display: flex; align-items: center; gap: .5rem; font-family: var(--font-display); font-weight: 600; color: var(--niebla); }
.footer-tagline, .footer-company { color: var(--linea); }
.footer-company strong { color: var(--niebla); }
.site-footer .footer-copy { max-width: 52rem; margin: 0 auto; padding: 1rem; box-sizing: border-box; border-top: 1px solid var(--bruma); color: var(--linea); }

.legal h1 { margin-top: 0; }
.legal h2 { font-size: 1.1rem; margin: 1.75rem 0 .5rem; }
.legal li { margin-bottom: .35rem; }
.draft-notice { padding: .75rem 1rem; border-radius: .4rem; background: var(--aviso-bg); color: var(--aviso); }
.issuer-note { margin: 1rem 0; padding: .75rem 1rem; border-radius: .4rem; background: var(--tinte); color: var(--libro-osc); font-size: .95rem; }
.onboarding-reminder { padding: .6rem .8rem; border-radius: .4rem; background: var(--aviso-bg); color: var(--aviso); }

.onboarding { margin: 1.25rem 0; padding: 1rem 1.25rem; background: white; border: 1px solid var(--linea); border-radius: .5rem; }
.onboarding h2 { margin-top: 0; }
.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: .75rem; }
.checklist li { display: flex; gap: .6rem; align-items: flex-start; }
.checklist li > .icon { margin-top: .1rem; color: var(--bruma); }
.checklist li.done > .icon { color: var(--libro); }
.checklist li.done strong { font-weight: 500; color: var(--bruma); }
.checklist p { margin: .25rem 0 0; }
.checklist form { margin-top: .4rem; }
button.secondary, .checklist button { padding: .4rem .9rem; border: 1px solid var(--libro); border-radius: .4rem; background: white; color: var(--libro); font: inherit; cursor: pointer; }
button.secondary:hover, .checklist button:hover { background: var(--tinte); }
mark.placeholder { padding: 0 .25rem; border-radius: .25rem; background: var(--aviso-bg); color: var(--aviso); }

.form-card { display: grid; gap: 1.25rem; padding: 1.25rem; background: white; border: 1px solid var(--linea); border-radius: .5rem; }
.form-card fieldset { display: grid; gap: .25rem; margin: 0; padding: 0; border: 0; }
.form-card legend { padding: 0; margin-bottom: .75rem; font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; }
.form-card label, .form-card .label { font-weight: 500; display: block; }
.form-card .hint { font-size: .9rem; color: var(--bruma); }
.form-card .choice { display: flex; gap: .5rem; align-items: flex-start; font-weight: 400; }
.form-card .choice input { margin-top: .25rem; }
.form-card .field-row { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); }
.hp { position: absolute; left: -9999px; }
.centered { text-align: center; padding-top: 2rem; }

/* App shell: side menu (layouts/_sidebar) next to the page, and the slide-in drawer (layouts/_drawer). */
.shell { flex: 1; display: flex; }
.content { flex: 1; min-width: 0; }
.topbar { position: relative; z-index: 20; }
.icon { width: 1.25rem; height: 1.25rem; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.sidebar .icon { color: var(--bruma); }
.sidebar a[aria-current=page] .icon { color: var(--libro); }
.tab-bar { display: none; }
.menu-button { display: none; background: none; border: 0; color: var(--niebla); line-height: 1; cursor: pointer; padding: 0 .25rem; }
.menu-button .icon { width: 1.5rem; height: 1.5rem; }
.topbar:has(.menu-button) { justify-content: flex-start; }
.topbar:has(.menu-button) nav { margin-left: auto; }
.sidebar { width: 14rem; flex-shrink: 0; box-sizing: border-box; padding: 1rem; background: white; border-right: 1px solid var(--linea); }
.sidebar nav { display: grid; gap: .15rem; position: sticky; top: 1rem; }
.sidebar a { display: flex; align-items: center; gap: .6rem; padding: .4rem .6rem; border-radius: .4rem; color: var(--noche); text-decoration: none; }
.sidebar a:hover { background: var(--niebla); }
.sidebar a[aria-current=page] { background: var(--tinte); color: var(--libro-osc); font-weight: 600; }
.sidebar-heading { margin: 1rem .6rem .25rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--bruma); overflow-wrap: anywhere; }
.drawer { position: fixed; inset: 0 0 0 auto; margin: 0; width: 100%; max-width: 34rem; height: 100%; max-height: none; box-sizing: border-box; padding: 0; border: 0; background: var(--niebla); box-shadow: -8px 0 24px rgb(11 16 32 / .2); flex-direction: column; }
.drawer[open] { display: flex; animation: drawer-in .2s ease-out; }
.drawer::backdrop { background: rgb(11 16 32 / .4); }
html:has(.drawer[open]) { overflow: hidden; }
.drawer-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .75rem 1.25rem; border-bottom: 1px solid var(--linea); background: white; font-size: .9rem; }
.drawer-body { display: block; flex: 1; min-height: 0; overflow-y: auto; padding: 1.25rem; }
.drawer-body h1 { margin-top: 0; font-size: 1.4rem; }
.icon-button { background: none; border: 0; font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--bruma); }
@keyframes drawer-in { from { transform: translateX(100%); } to { transform: translateX(0); } }
@media (max-width: 47.99rem) {
  .menu-button { display: block; }
  .has-tab-bar .menu-button { display: none; }
  .has-tab-bar { padding-bottom: 4rem; }
  .tab-bar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; padding-bottom: env(safe-area-inset-bottom); background: white; border-top: 1px solid var(--linea); }
  .tab-bar a, .tab-bar button { display: flex; flex-direction: column; align-items: center; gap: .15rem; padding: .5rem .25rem; background: none; border: 0; font: inherit; font-size: .7rem; color: var(--bruma); text-decoration: none; cursor: pointer; }
  .tab-bar a[aria-current=page] { color: var(--libro); font-weight: 600; }
  .tab-bar .icon { width: 1.5rem; height: 1.5rem; }
  .topbar nav .muted, .topbar nav .admin-link { display: none; }
  .topbar nav button.link { white-space: nowrap; }
  .sidebar { position: fixed; z-index: 10; top: 0; bottom: 0; left: 0; padding-top: 4rem; transform: translateX(-100%); visibility: hidden; transition: transform .2s, visibility .2s; }
  .sidebar-open .sidebar { transform: translateX(0); visibility: visible; box-shadow: 8px 0 24px rgb(11 16 32 / .2); }
}

/* Registros de ventas y de compras */
.period-nav { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; margin: 1rem 0; }
.period-nav strong { min-width: 8rem; text-align: center; text-transform: capitalize; }
.period-nav .button { margin-left: auto; }
tfoot th { background: var(--tinte); color: inherit; }
.nowrap { white-space: nowrap; }
form.inline { display: inline; }
