/* NOCTURNO FACTURACIÓN | Marca oficial v3
   Estas reglas son visuales: no afectan Supabase ni los modelos de factura. */
:root{
  --nf-forest:#083D32;
  --nf-deep:#032B24;
  --nf-forest-light:#135644;
  --nf-gold:#D6AD62;
  --nf-gold-light:#EDD39C;
  --nf-ivory:#FFF9EC;
  --nf-paper:#F8F3E8;
  --nf-ink:#17352F;
  --nf-muted:#67786F;
  --nf-line:#E7DDCC;
  --nf-shadow:0 15px 44px rgba(24,42,30,.075);
}
body{color:var(--nf-ink);background:var(--nf-paper);font-family:'DM Sans',Arial,sans-serif}
button,input,textarea,select{font-family:inherit}
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{outline:3px solid var(--nf-gold)!important;outline-offset:3px}
/* ---------- Portal de acceso ---------- */
.portal-shell{max-width:1320px;padding:24px 30px 48px}
.portal-header{margin-bottom:22px;min-height:72px;gap:16px}
.portal-brand-logo{display:inline-flex;align-items:center;flex:0 1 300px;max-width:300px}
.portal-brand-logo img{display:block;width:100%;height:auto;max-height:82px;object-fit:contain;object-position:left center}
.portal-header-right{margin-left:auto;display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:10px}
.portal-tag{margin-left:0;color:var(--nf-forest);border:1px solid #D7CAAA;background:#FFFDF8;padding:10px 14px;font-weight:800}
.install-action{display:inline-flex;align-items:center;justify-content:center;border:1px solid var(--nf-gold);background:var(--nf-ivory);color:var(--nf-forest);padding:10px 14px;border-radius:30px;font-weight:800;font-size:12px;white-space:nowrap}
.install-action:hover{background:var(--nf-gold-light)}
.portal-hero{overflow:hidden;position:relative;isolation:isolate;min-height:252px;background:radial-gradient(ellipse at 85% 10%,#17654B 0%,transparent 46%),linear-gradient(112deg,#06372C 0%,#0A4233 70%,#0E513E 100%);border-radius:24px;padding:35px clamp(25px,3vw,50px);box-shadow:0 22px 39px rgba(8,61,50,.13)}
.portal-hero:after{content:'';position:absolute;z-index:-1;right:-95px;bottom:-150px;width:570px;height:260px;border-radius:50%;transform:rotate(-21deg);border:12px solid rgba(218,179,101,.85);box-shadow:0 -4px 14px #f9e9a747}
.portal-hero:before{content:'';position:absolute;z-index:-1;left:-72px;top:-117px;width:240px;height:150px;border:20px solid #D9AE62;border-radius:50%;transform:rotate(-27deg)}
.portal-hero>div:first-child{position:relative;z-index:2}
.portal-hero .portal-eyebrow{color:#EFDDAC;letter-spacing:2.8px}
.portal-hero h1{font-family:'DM Sans',sans-serif;font-size:clamp(31px,4vw,53px);font-weight:800;letter-spacing:-2.1px;line-height:1.13;margin:14px 0}
.portal-hero h1 em{color:var(--nf-gold-light)}
.portal-hero p{max-width:660px;font-size:14px;color:#F0F2EA;line-height:1.75}
.portal-illustration{width:230px;height:180px;position:relative;flex:none;display:grid;place-items:center;z-index:1}
.portal-illustration .invoice-symbol{position:relative;width:112px;height:150px;border:5px solid #EED5A5;border-radius:11px 23px 11px 11px;background:linear-gradient(145deg,#FFF9EC,#EEDBBC);transform:rotate(6deg);box-shadow:8px 13px 0 #134E41,0 18px 37px #020E0A66;padding:23px 13px}
.portal-illustration .invoice-symbol .inv-corner{position:absolute;right:-5px;top:-5px;border-style:solid;border-width:0 33px 33px 0;border-color:transparent #D7A95C transparent transparent}
.portal-illustration .invoice-symbol b{display:block;color:var(--nf-forest);font-style:italic;font-size:29px;letter-spacing:-3px;margin:0 0 12px}
.portal-illustration .invoice-symbol i{display:block;width:75px;height:5px;background:#1E604B;border-radius:8px;margin:9px 0}
.portal-illustration .invoice-symbol i:nth-of-type(2){width:59px}.portal-illustration .invoice-symbol i:nth-of-type(3){width:67px}
.portal-illustration .invoice-symbol em{position:absolute;right:-30px;bottom:9px;display:grid;place-items:center;width:56px;height:56px;border-radius:50%;border:5px solid #FFE4A9;color:#fff;background:#C39748;font:800 33px 'DM Sans',sans-serif;box-shadow:0 3px 12px #041A1570}
.portal-hero-orbit{position:absolute;inset:0;border:1px solid #D6AD6240;border-radius:50%;transform:rotate(-20deg);pointer-events:none}
.portal-layout{grid-template-columns:minmax(0,1fr) minmax(340px,1fr);gap:23px;margin-top:24px}
.portal-card{background:linear-gradient(160deg,#FFFBF4,#FFF8EA);border:1px solid #E7D7BC;border-radius:22px;padding:29px;box-shadow:var(--nf-shadow)}
.portal-card h2{color:var(--nf-forest);font-family:'DM Sans',sans-serif;font-size:26px;font-weight:800;letter-spacing:-.8px}
.portal-eyebrow{color:#93784D;font-weight:850;letter-spacing:2.5px}
.portal-tabs{background:#F5EAD5;gap:7px}
.portal-tabs button{color:#73674F}
.portal-tabs button.selected{background:var(--nf-forest);color:#FFF9EC;box-shadow:0 4px 8px #083D3228}
.portal-form label{color:var(--nf-ink)}
.portal-form input{background:#FFFDFA;border:1px solid #DDCEB8;color:#123B2D;min-height:51px}
.portal-form input:focus{border-color:#B99353;box-shadow:0 0 0 3px #D6AD6240}
.portal-button{background:var(--nf-forest);color:var(--nf-ivory);box-shadow:0 4px 8px #083D321b}
.portal-button:hover{background:#145D46}
.portal-button-secondary{color:var(--nf-forest);border-color:#DAC9A7;background:#F5ECD9}
.portal-link-button{color:#135140}
.portal-side>p,.portal-side ol{color:#566F5F}
.portal-side li::marker{color:#B68C43}
.portal-side .portal-small,.portal-session{background:#F3EAD8;color:#526859}
.organization-item{background:#FFFDF7;border-color:#E5D9C6}
.organization-item strong{color:var(--nf-forest)}
.organization-item a{background:var(--nf-forest);color:var(--nf-ivory)}
.request-mode,.portal-message{color:#50685C}
.portal-footer{color:#7B8478}
#installHelp:not([hidden]){max-width:470px;line-height:1.5;color:#745C35}
/* ---------- Área de trabajo ---------- */
.shell{grid-template-columns:254px minmax(0,1fr)}
.sidebar{background:linear-gradient(180deg,#073A2F,#032C25 92%);border-right:1px solid #2D7055;padding:23px 15px 18px}
.nf-brand{display:block;padding:0 8px 21px;min-height:98px;margin:0 0 12px;border-bottom:1px solid #D6AD6235}
.nf-brand img{width:100%;max-height:94px;object-fit:contain;object-position:left;display:block}
.nav-title{color:#DFCDA6;letter-spacing:2.4px}
.nav-item{color:#F0EDE5;border:1px solid transparent;border-radius:11px;font-weight:700;padding:12px 14px}
.nav-item:hover{background:#185545;color:var(--nf-ivory)}
.nav-item.active{background:linear-gradient(100deg,#F3D68B,#D4A354);color:#082E26;box-shadow:0 5px 15px #0002;border-color:#F9E2A1}
.nav-icon{font-size:21px;color:inherit}
.side-bottom{border-top:1px solid #D6AD6230;margin-top:auto;padding-top:15px}
.switch-org{display:flex;justify-content:space-between;align-items:center;text-decoration:none;border:1px solid #BAA06E7A;color:#FFF4D6;padding:11px 13px;border-radius:12px;margin-bottom:19px;font-weight:700;font-size:12px}
.switch-org:hover{background:#125843;color:white}
.side-status{color:#E3E7DE;font-size:11px}.side-fine{color:#BDD1BF}
.workspace{padding:26px clamp(18px,3vw,48px) 66px;max-width:none}
.topbar{padding-bottom:20px;border-bottom:1px solid #E8DCC8;margin-bottom:23px}
.topbar h1{font-family:'DM Sans',sans-serif;font-size:clamp(23px,2.4vw,32px);font-weight:850;letter-spacing:-1px;color:var(--nf-forest);margin:5px 0}
.topbar p{color:#64786E}
.eyebrow,.section-label{color:#99815A;letter-spacing:2px}
.top-actions{gap:8px;flex-wrap:wrap;justify-content:flex-end}
.top-actions .button{font-size:12px;padding:10px 13px;white-space:nowrap}
.org-access{background:#FFFDF6}
.notice{background:#F3E9D4;color:#47614E;border:1px solid #DFD0AF}
.notice-badge{color:#80663A}
.notice.cloud-error{background:#FFF0EB;color:#853f35;border-color:#e9b9ad}
.form-card,.history-card,.section-card{background:#FFFBF4;border:1px solid #E7DBC8;box-shadow:var(--nf-shadow);border-radius:17px}
.form-card,.history-card,.section-card{padding:24px}
h2,h3{color:var(--nf-forest)}
.form-card h2,.section-card h2,.history-card h2{font-family:'DM Sans',sans-serif;font-weight:850;letter-spacing:-.5px}
.button-primary,.button.button-primary{background:var(--nf-forest);border-color:var(--nf-forest);color:var(--nf-ivory)}
.button-primary:hover,.button.button-primary:hover{background:#195b44}
.button-outline,.button.button-outline{background:#FFFDF7;border-color:#E1CEAD;color:var(--nf-forest)}
.nav-item,.button,.portal-button,.home-shortcut{transition:filter .15s,background .15s,transform .15s}
.button:active,.portal-button:active,.home-shortcut:active{transform:translateY(1px)}
.field input,.field select,.field textarea,.search input{background:#FFFDF9;border-color:#DCCEBB;color:#274036}
.field input:focus,.field select:focus,.field textarea:focus,.search input:focus{border-color:#BB9254;box-shadow:0 0 0 3px #D6AD6240}
.number-chip,.pill,.cash-inline{border-color:#E8D9BA}
.settings-intro{background:linear-gradient(110deg,#073A30,#175D48)}
.settings-intro .section-label{color:#F1D8A7}
.settings-tab.active{background:var(--nf-gold-light);color:#133C30;border-color:#E7C98F}
.settings-info{background:#F4ECD8;border-color:#E7DAC0;color:#526858}
.settings-status{background:#F6F0E2;border-color:#E5D6BB}
/* ---------- Nuevo inicio real, no datos de demostración ---------- */
.home-banner{position:relative;overflow:hidden;isolation:isolate;background:linear-gradient(115deg,#07382D,#135A44);border-radius:20px;padding:31px 38px;color:var(--nf-ivory);display:flex;align-items:center;justify-content:space-between;gap:20px;min-height:201px;margin-bottom:23px;box-shadow:0 14px 30px rgba(7,55,44,.12)}
.home-banner:after{content:'';position:absolute;z-index:-1;right:-70px;bottom:-130px;height:210px;width:420px;transform:rotate(-19deg);border:11px solid var(--nf-gold);border-radius:50%;opacity:.75}
.home-kicker{color:#F3D89E;letter-spacing:2.6px;font-size:10px;font-weight:900}
.home-banner h2{color:var(--nf-ivory);font:850 clamp(26px,2.8vw,39px)/1.15 'DM Sans',sans-serif;letter-spacing:-1.4px;margin:10px 0}
.home-banner h2 em{font-style:normal;color:#E9C67C}
.home-banner p{margin:0;color:#E9F2E9;line-height:1.6;font-size:13px;max-width:620px}
.home-banner-icon{flex:none;opacity:.92}
.home-banner-icon img{width:118px;height:118px;border-radius:26px;box-shadow:0 9px 24px #02191366}
.home-metrics{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:15px;margin-bottom:29px}
.home-metric{min-width:0;background:#FFFCF6;border:1px solid #E7DBCA;border-radius:15px;padding:17px 17px 19px;box-shadow:0 7px 20px rgba(36,39,25,.045);display:grid;gap:6px}
.home-metric>.metric-icon{height:42px;width:42px;display:grid;place-items:center;border-radius:13px;background:#F5E8C8;color:#165A43;font-size:23px;font-weight:850;margin-bottom:5px}
.home-metric>span:not(.metric-icon){font-size:12px;color:#5B7066;font-weight:700}
.home-metric strong{font-size:clamp(21px,2vw,26px);font-weight:850;color:#103F33;letter-spacing:-.8px;overflow-wrap:anywhere}
.home-metric small{color:#899488;line-height:1.45;font-size:11px}
.home-metric.due{background:#FFF2D9;border-color:#E8D4A8}.home-metric.due .metric-icon{background:#EFD4A2;color:#936829}
.quick-head{display:flex;align-items:flex-end;justify-content:space-between;margin:5px 0 16px;gap:12px}
.quick-head h2{font:850 24px 'DM Sans',sans-serif;letter-spacing:-.6px;margin:8px 0 0}
.quick-caption{color:#7C897C;font-size:12px}
.home-shortcuts{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:15px}
.home-shortcut{border:1px solid #E7DAC6;background:#FFFCF6;border-radius:15px;box-shadow:var(--nf-shadow);padding:22px;display:flex;flex-direction:column;text-align:left;align-items:flex-start;gap:8px;min-height:174px;color:#153E34}
.home-shortcut:hover{background:#FFF5DD;filter:drop-shadow(0 3px 8px #C4B58B30)}
.home-shortcut-icon{height:51px;width:51px;display:grid;place-items:center;border-radius:14px;background:#F4E6C6;color:#0B523B;font-size:30px;font-weight:800}
.home-shortcut strong{font-size:17px;font-weight:850;color:#113D30}
.home-shortcut small{font-size:12px;line-height:1.55;color:#607367;max-width:220px}
.install-help:not([hidden]){padding:10px 13px;background:#F2E4C9;border-radius:10px;color:#69532C;font-size:12px;line-height:1.55}
/* ---------- Dispositivos ---------- */
@media(max-width:1120px){.home-metrics{grid-template-columns:repeat(2,minmax(0,1fr))}.home-shortcuts{grid-template-columns:repeat(2,minmax(0,1fr))}.top-actions{max-width:380px}.portal-illustration{width:180px}}
@media(max-width:850px){.portal-layout{grid-template-columns:1fr}.portal-shell{padding:16px}.portal-hero{padding:28px}.portal-header{flex-wrap:wrap}.portal-header-right{margin-left:auto}.portal-illustration{height:140px;width:135px}.portal-illustration .invoice-symbol{transform:scale(.76) rotate(6deg)}}
@media(max-width:820px){.workspace{padding:16px 16px 40px}.topbar{align-items:flex-start;gap:13px}.home-banner{padding:26px}.home-banner-icon img{width:80px;height:80px}.quick-head h2{font-size:21px}}
@media(max-width:620px){.portal-brand-logo{max-width:210px;flex-basis:210px}.portal-header-right{justify-content:flex-start}.portal-tag{font-size:10px;padding:7px 9px}.install-action{padding:8px 10px}.portal-hero h1{font-size:30px;letter-spacing:-1px}.portal-illustration{display:none}.portal-hero{min-height:0}.portal-card{padding:21px;border-radius:17px}.home-metrics{gap:9px}.home-metric{padding:13px}.home-metric strong{font-size:21px}.home-shortcuts{gap:10px}.home-shortcut{padding:17px;min-height:155px}.home-shortcut strong{font-size:15px}.home-shortcut-icon{width:43px;height:43px;font-size:24px}.home-banner{padding:23px}.home-banner-icon{display:none}.topbar{flex-direction:column}.top-actions{justify-content:flex-start;max-width:none}.quick-caption{display:none}}
@media(max-width:380px){.home-metrics{grid-template-columns:1fr 1fr}.home-metric strong{font-size:17px}.home-shortcuts{grid-template-columns:1fr}.portal-header{gap:5px}.portal-brand-logo{max-width:195px}.portal-header-right{width:100%}}
@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation-duration:.01ms!important;transition-duration:.01ms!important;scroll-behavior:auto!important}}
@media print{.home-banner,.home-metrics,.home-shortcuts,.quick-head{display:none!important}}

@media(max-width:620px){.top-actions{flex-direction:row;flex-wrap:wrap;align-items:center;gap:8px;justify-content:flex-start}.topbar p{max-width:none}.home-banner:after{right:-250px;bottom:-180px;opacity:.28}.home-banner h2{position:relative;z-index:1}.workspace{padding-left:16px;padding-right:16px}.mobile-top{margin-left:-16px;margin-right:-16px}}
