/* ============================================================
   ERP Authentication — Velzon "auth-cover" style: full-bleed
   split screen (no floating card), image panel + quote on the
   left, plain white form panel on the right. Shares main.css's
   tokens (--brand-primary, --radius-sm/md, --border) so it reads
   as the same product as the public site.
   ============================================================ */

*{box-sizing:border-box}
html{scroll-behavior:smooth}
body.portal-auth-body{margin:0;min-height:100dvh;display:grid;grid-template-columns:1.25fr 1fr;background:#fff;font-family:"Poppins",Arial,sans-serif;color:var(--brand-secondary);-webkit-font-smoothing:antialiased}
body.portal-auth-body a{text-decoration:none}

.auth-visual{position:relative;overflow:hidden;background:linear-gradient(150deg,rgba(6,27,67,.94),rgba(8,43,104,.86)),url("../images/generated/news-hero-collage.png") center/cover;color:#fff;padding:2.6rem 3rem;display:flex;flex-direction:column;justify-content:space-between;min-height:100%}
.auth-visual:before{content:"";position:absolute;inset:0;background:radial-gradient(circle at 15% 15%,rgba(227,30,40,.22),transparent 45%);pointer-events:none}
.auth-visual-logo{position:relative;z-index:1;display:flex;align-items:center}
.auth-visual-logo img{width:180px;filter:drop-shadow(0 10px 20px rgba(0,0,0,.25))}
.auth-visual-copy{position:relative;z-index:1;max-width:460px}
.auth-visual-copy h1{font-size:clamp(1.6rem,2.6vw,2.3rem);line-height:1.2;margin:0 0 .8rem;color:#fff}
.auth-visual-copy p{color:#d7e0ee;line-height:1.6;margin:0}
.auth-quote{position:relative;z-index:1;max-width:480px}
.auth-quote-mark{font-size:2.6rem;color:rgba(255,255,255,.4);line-height:1;font-family:Georgia,serif}
.auth-quote p{font-size:1.02rem;font-style:italic;color:#e7ecf8;margin:.4rem 0 0}
.auth-quote cite{display:block;margin-top:.6rem;color:#9db3d9;font-style:normal;font-size:.85rem;font-weight:700}

.auth-panel-wrap{display:flex;align-items:center;justify-content:center;padding:2.5rem 2rem}
.auth-panel{width:100%;max-width:400px}
.auth-panel .auth-kicker{color:var(--brand-primary);font-size:.75rem;text-transform:uppercase;font-weight:900;letter-spacing:.08em}
.auth-panel h2{margin:8px 0 8px;font-size:1.7rem;color:#081225}
.auth-panel > p.auth-sub{margin:0 0 1.8rem;color:var(--text-secondary);line-height:1.55}

.auth-form{display:grid;gap:16px}
.field label{display:block;margin-bottom:6px;font-size:.85rem;color:#334155;font-weight:800}
.field label small{font-weight:600;color:var(--text-secondary);text-transform:none}
.field input{width:100%;height:46px;border:1px solid var(--border);border-radius:var(--radius-sm);padding:0 14px;font:600 .95rem inherit;outline:0;background:#fff}
.field input:focus{border-color:var(--brand-primary);box-shadow:0 0 0 3px rgba(211,25,32,.1)}
.field input#id_code{letter-spacing:.6em;font-size:1.35rem;text-align:center;font-weight:800;padding-left:.4em}
.errorlist{margin:6px 0 0;padding:0;list-style:none;color:#b91c1c;font-size:.8rem;font-weight:700}

.auth-submit{height:46px;border:0;border-radius:var(--radius-sm);background:var(--brand-primary);color:#fff;font-weight:800;font-size:.95rem;cursor:pointer;margin-top:4px}
.auth-submit:hover{background:#bf1019}

.auth-email-lock{display:flex;align-items:center;gap:.6rem;border:1px solid var(--border);background:#f8fafc;border-radius:var(--radius-sm);padding:.65rem .8rem;margin-bottom:18px}
.auth-email-lock i{color:var(--text-secondary);font-size:.95rem}
.auth-email-lock strong{flex:1;font-size:.9rem;font-weight:700;color:var(--brand-secondary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.auth-email-lock button{border:0;background:none;color:var(--brand-primary);font-weight:800;font-size:.82rem;cursor:pointer;padding:0}
.auth-email-lock button:hover{text-decoration:underline}

.auth-method-label{margin:0 0 8px;font-size:.83rem;font-weight:800;color:var(--brand-secondary)}
.auth-method-row{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:0 0 2px}
.auth-method-btn{height:52px;display:inline-flex;flex-direction:column;align-items:center;justify-content:center;gap:.2rem;border:1.5px solid var(--border);border-radius:var(--radius-sm);background:#fff;color:var(--brand-secondary);font-weight:800;font-size:.82rem;cursor:pointer;transition:border-color .15s ease,background .15s ease,color .15s ease}
.auth-method-btn i{font-size:1.05rem}
.auth-method-btn:hover{border-color:var(--brand-primary);background:#fff5f5;color:var(--brand-primary)}
.auth-method-btn.is-selected{border-color:var(--brand-primary);background:#fff5f5;color:var(--brand-primary)}

.auth-links{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;margin-top:20px;color:var(--text-secondary);font-size:.88rem}
.auth-links a{color:var(--brand-secondary);font-weight:800}
.auth-links a:hover{color:var(--brand-primary)}
.auth-back-link{display:inline-flex;align-items:center;gap:.4rem;color:var(--text-secondary);font-weight:700;font-size:.88rem;margin-top:20px}
.auth-back-link:hover{color:var(--brand-primary)}

.messages{display:grid;gap:8px;margin-bottom:16px}
.messages div{border-radius:var(--radius-sm);padding:10px 12px;background:#eef6ff;color:#0b3474;font-weight:700;font-size:.85rem}

.auth-otp-meta{display:flex;align-items:center;gap:.5rem;background:#f8fafc;border:1px solid var(--border);border-radius:var(--radius-sm);padding:.7rem .9rem;margin-bottom:18px;color:var(--text-secondary);font-size:.85rem}
.auth-otp-meta strong{color:var(--brand-secondary)}

@media(max-width:900px){
  body.portal-auth-body{grid-template-columns:1fr}
  .auth-visual{min-height:280px;padding:2rem}
  .auth-quote{display:none}
  .auth-panel-wrap{padding:2rem 1.25rem}
}

/* ------------------------------------------------------------
   Keyboard focus. The portal does not load Bootstrap's CSS, so it
   inherits no focus styling — without these, keyboard users cannot
   see where they are. Applied to both the auth screens and the portal.
   ------------------------------------------------------------ */
:focus-visible{outline:3px solid rgba(215,25,32,.45);outline-offset:2px;border-radius:2px}
.portal-sidebar a:focus-visible,
.portal-systembar a:focus-visible,
.portal-footer a:focus-visible{outline-color:#fff;outline-offset:3px}
.auth-submit:focus-visible,
.portal-btn:focus-visible,
.portal-row-actions a:focus-visible,
.portal-row-actions button:focus-visible{outline-offset:3px}
/* Never remove the indicator without providing another one. */
:focus:not(:focus-visible){outline:none}

/* Respect reduced-motion for the portal's hover transitions. */
@media(prefers-reduced-motion:reduce){
  .portal-module,.portal-btn,.auth-method-btn{transition:none!important}
  .portal-module:hover{transform:none}
}

/* ============================================================
   ERP Portal shell — system bar, sidebar, content surfaces.
   Shares main.css tokens with the auth screens above so the
   signed-in portal reads as the same product.
   ============================================================ */

body.portal-body{margin:0;background:var(--surface-soft);color:var(--brand-secondary);font-family:"Poppins",Arial,sans-serif;-webkit-font-smoothing:antialiased}
body.portal-body a{text-decoration:none}
.portal-root{min-height:100dvh;display:grid;grid-template-rows:auto auto 1fr auto}
.portal-shell{width:min(100% - 32px,1720px);margin-inline:auto}

.portal-systembar{background:var(--brand-secondary);color:#fff;position:sticky;top:0;z-index:50;box-shadow:0 10px 30px rgba(15,23,42,.16)}
.portal-systembar-inner{min-height:58px;display:flex;align-items:center;justify-content:space-between;gap:1rem}
.portal-systembar img{width:156px;height:42px;object-fit:contain;object-position:left center}
.portal-systembar-actions{display:flex;align-items:center;gap:.6rem}
.portal-systembar-actions a{color:#dbe7ff;font-weight:800;font-size:.9rem}
.portal-systembar-actions a:hover{color:#fff}
.portal-user-chip{display:flex;align-items:center;gap:.5rem;background:rgba(255,255,255,.1);border-radius:999px;padding:.4rem .7rem;font-weight:800;font-size:.88rem}

.portal-alerts{display:grid;gap:.5rem;margin:.8rem auto 0}
.portal-alerts div{background:#fff8e6;color:#8a4b00;border:1px solid #ffe1a8;border-radius:var(--radius-md);padding:.7rem .9rem;font-weight:800;font-size:.88rem}

.portal-layout{width:min(100% - 32px,1720px);margin:1rem auto 1.2rem;display:grid;grid-template-columns:292px minmax(0,1fr);gap:1rem;align-items:start}
.portal-sidebar{position:sticky;top:74px;background:var(--brand-secondary);color:#fff;border-radius:var(--radius-md);padding:1rem;box-shadow:var(--shadow-soft);max-height:calc(100dvh - 92px);overflow:auto;scrollbar-width:thin;scrollbar-color:rgba(255,255,255,.32) transparent}
.portal-sidebar::-webkit-scrollbar{width:7px}
.portal-sidebar::-webkit-scrollbar-thumb{background:rgba(255,255,255,.34);border-radius:999px;border:2px solid transparent;background-clip:content-box}
.portal-brand{display:flex;align-items:center;justify-content:space-between;gap:.75rem;padding:.25rem .15rem .9rem;border-bottom:1px solid rgba(255,255,255,.12)}
.portal-brand strong{font-size:1.05rem;color:#fff}
.portal-brand span{display:block;color:#b8c7df;font-size:.78rem;font-weight:700}
.portal-role-list{display:flex;gap:.4rem;flex-wrap:wrap;margin:.85rem 0}
.portal-role-list span{background:rgba(255,255,255,.1);border:1px solid rgba(255,255,255,.12);border-radius:999px;padding:.32rem .55rem;font-size:.76rem;font-weight:800;color:#fff}
.portal-nav-group{margin-top:.85rem}
.portal-nav-title{margin:0 0 .35rem;color:#ffccd0;font-size:.72rem;font-weight:900;text-transform:uppercase;letter-spacing:.04em}
.portal-nav{display:grid;gap:.2rem}
.portal-nav a{display:flex;align-items:center;gap:.65rem;min-height:40px;color:#dbe7ff;border-radius:var(--radius-sm);padding:.58rem .68rem;font-weight:800;font-size:.9rem}
.portal-nav a:hover,.portal-nav a.active{background:rgba(255,255,255,.12);color:#fff}
.portal-nav i{width:18px;text-align:center;color:#fff}
.portal-nav .locked{opacity:.48;pointer-events:none}
.portal-content{min-width:0}

.portal-footer{border-top:1px solid var(--border);background:#fff;color:var(--text-secondary)}
.portal-footer-inner{min-height:54px;display:flex;align-items:center;justify-content:space-between;gap:1rem;font-size:.86rem;font-weight:700}
.portal-footer a{color:var(--brand-secondary);font-weight:900}

/* --- Shared portal surfaces --- */
.portal-hero{background:linear-gradient(135deg,var(--brand-secondary),#0b3474);color:#fff;border-radius:var(--radius-md);padding:1.2rem;display:grid;grid-template-columns:minmax(0,1fr) auto;gap:1rem;align-items:center;box-shadow:var(--shadow-soft)}
.portal-hero .eyebrow{color:#ffccd0;font-size:.72rem;font-weight:900;text-transform:uppercase;letter-spacing:.04em}
.portal-hero h1{margin:.2rem 0 .35rem;font-size:clamp(1.45rem,2.4vw,2.2rem);line-height:1.15;color:#fff}
.portal-hero p{margin:0;color:#d8e4f6;max-width:700px;line-height:1.55}
.portal-actions{display:flex;gap:.55rem;flex-wrap:wrap;justify-content:flex-end}
.portal-btn{min-height:40px;display:inline-flex;align-items:center;justify-content:center;gap:.45rem;border-radius:var(--radius-sm);padding:.55rem .85rem;font-weight:900;font-size:.86rem;border:1px solid transparent;background:#fff;color:var(--brand-secondary);cursor:pointer}
.portal-btn:hover{color:var(--brand-primary)}
.portal-btn.primary{background:var(--brand-primary);color:#fff;border-color:var(--brand-primary)}
.portal-btn.primary:hover{background:#bf1019;color:#fff}
.portal-btn.muted{background:rgba(255,255,255,.1);color:#fff;border-color:rgba(255,255,255,.18)}
.portal-btn.muted:hover{color:#fff;background:rgba(255,255,255,.18)}
.portal-btn.danger{background:#fff;color:#b91c1c;border-color:#fecaca}
.portal-btn.danger:hover{background:#b91c1c;color:#fff}

.portal-main{display:grid;gap:1rem;min-width:0}
.portal-panel{background:#fff;border:1px solid var(--border);border-radius:var(--radius-md);padding:1rem;box-shadow:0 14px 32px rgba(15,23,42,.05)}
.portal-panel-title{display:flex;align-items:flex-end;justify-content:space-between;gap:1rem;margin-bottom:.75rem}
.portal-panel-title h2{margin:0;font-size:1.2rem;color:var(--brand-secondary)}
.portal-panel-title span{color:var(--brand-primary);font-size:.72rem;font-weight:900;text-transform:uppercase;letter-spacing:.04em}
.portal-empty{border:1px dashed #cbd5e1;border-radius:var(--radius-sm);padding:1.4rem;text-align:center;color:var(--text-secondary);font-weight:800;background:#f8fafc}
.portal-status{width:max-content;border-radius:999px;background:#f1f5f9;color:#334155;padding:.28rem .55rem;font-size:.72rem;font-weight:900}
.portal-status.published{background:#dcfce7;color:#166534}
.portal-status.submitted,.portal-status.under_review{background:#fff7ed;color:#9a3412}
.portal-status.draft{background:#eef2ff;color:#3730a3}
.portal-status.archived,.portal-status.rejected{background:#fee2e2;color:#991b1b}

/* --- Dashboard --- */
.portal-stats{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:.75rem}
.portal-stat{background:#fff;border:1px solid var(--border);border-radius:var(--radius-md);padding:.85rem;box-shadow:0 12px 28px rgba(15,23,42,.05)}
.portal-stat span{display:flex;align-items:center;gap:.42rem;color:var(--text-secondary);font-size:.78rem;font-weight:900}
.portal-stat strong{display:block;margin-top:.5rem;color:var(--brand-secondary);font-size:1.7rem;line-height:1}
.portal-modules{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:.75rem}
.portal-module{background:#fff;border:1px solid var(--border);border-radius:var(--radius-md);padding:.9rem;min-height:150px;display:flex;flex-direction:column;justify-content:space-between;box-shadow:0 14px 32px rgba(15,23,42,.06);transition:transform .18s ease,box-shadow .18s ease,border-color .18s ease}
.portal-module:hover{transform:translateY(-3px);box-shadow:0 22px 44px rgba(15,23,42,.1);border-color:#cbd5e1}
.portal-module.is-locked{opacity:.62;background:#f8fafc}
.portal-module-head{display:flex;align-items:flex-start;justify-content:space-between;gap:.7rem}
.portal-module i{width:38px;height:38px;border-radius:var(--radius-sm);background:#edf3ff;color:#0b3474;display:grid;place-items:center;font-size:1.1rem}
.portal-module span{display:block;color:var(--brand-primary);font-size:.72rem;font-weight:900;text-transform:uppercase}
.portal-module h2{margin:.25rem 0 0;font-size:1.02rem;color:var(--brand-secondary)}
.portal-module > div > strong{color:#0b3474;font-size:1.4rem}
.portal-module-actions{display:flex;gap:.4rem;flex-wrap:wrap;margin-top:.9rem}
.portal-module-actions a,.portal-module-actions em{display:inline-flex;align-items:center;gap:.35rem;border-radius:var(--radius-sm);padding:.42rem .58rem;background:#f1f5f9;color:var(--brand-secondary);font-size:.78rem;font-weight:900;font-style:normal}
.portal-module-actions a:hover{background:#0b3474;color:#fff}
.portal-grid{display:grid;grid-template-columns:minmax(0,1fr) 380px;gap:1rem;align-items:start}
.portal-table{display:grid}
.portal-row{display:grid;grid-template-columns:132px minmax(0,1fr) 120px;gap:.75rem;align-items:center;padding:.72rem 0;border-bottom:1px solid #edf2f7;color:var(--brand-secondary)}
.portal-row:last-child{border-bottom:0}
.portal-row small{font-weight:900;color:var(--text-secondary)}
.portal-row strong{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:.92rem}

/* --- Module list --- */
.portal-toolbar{display:flex;align-items:center;justify-content:space-between;gap:1rem;flex-wrap:wrap;margin-bottom:.85rem}
.portal-search{display:flex;gap:.45rem}
.portal-search input{height:40px;min-width:260px;border:1px solid var(--border);border-radius:var(--radius-sm);padding:0 12px;font:600 .9rem inherit;outline:0;background:#fff}
.portal-search input:focus{border-color:var(--brand-primary);box-shadow:0 0 0 3px rgba(215,25,32,.1)}
.portal-list{background:#fff;border:1px solid var(--border);border-radius:var(--radius-md);box-shadow:0 14px 34px rgba(15,23,42,.06);overflow-x:auto}
.portal-list table{width:100%;border-collapse:collapse;min-width:640px}
.portal-list th{text-align:left;padding:.75rem 1rem;background:#f8fafc;border-bottom:1px solid var(--border);color:var(--text-secondary);font-size:.75rem;font-weight:900;text-transform:uppercase;letter-spacing:.04em;white-space:nowrap}
.portal-list td{padding:.75rem 1rem;border-bottom:1px solid #edf2f7;color:var(--brand-secondary);font-size:.9rem;font-weight:700;vertical-align:middle}
.portal-list tr:last-child td{border-bottom:0}
.portal-list tbody tr:hover{background:#fbfcfe}
.portal-list .col-id{width:76px;color:var(--text-secondary);font-weight:900}
.portal-list .col-actions{width:180px;text-align:right;white-space:nowrap}
.portal-row-actions{display:inline-flex;gap:.4rem;justify-content:flex-end}
.portal-row-actions a,.portal-row-actions button{display:inline-flex;align-items:center;gap:.3rem;border:1px solid var(--border);border-radius:var(--radius-sm);padding:.35rem .6rem;background:#fff;color:var(--brand-secondary);font-size:.78rem;font-weight:900;cursor:pointer}
.portal-row-actions a:hover{border-color:var(--brand-secondary);background:var(--brand-secondary);color:#fff}
.portal-row-actions button:hover{border-color:#b91c1c;background:#b91c1c;color:#fff}
.portal-pagination{display:flex;align-items:center;justify-content:space-between;gap:1rem;flex-wrap:wrap;margin-top:.9rem;color:var(--text-secondary);font-size:.85rem;font-weight:800}
.portal-pagination .pages{display:flex;gap:.4rem}
.portal-pagination a{display:inline-flex;align-items:center;gap:.3rem;border:1px solid var(--border);border-radius:var(--radius-sm);padding:.4rem .7rem;background:#fff;color:var(--brand-secondary);font-weight:900}
.portal-pagination a:hover{border-color:var(--brand-secondary);background:var(--brand-secondary);color:#fff}

/* --- Module form --- */
.portal-form{display:grid;gap:16px;max-width:900px}
.portal-form .field label{display:block;margin-bottom:6px;font-size:.85rem;color:#334155;font-weight:800}
.portal-form .field input[type=text],.portal-form .field input[type=url],.portal-form .field input[type=email],
.portal-form .field input[type=number],.portal-form .field input[type=datetime-local],.portal-form .field input[type=date],
.portal-form .field input[type=file],.portal-form .field select,.portal-form .field textarea{width:100%;border:1px solid var(--border);border-radius:var(--radius-sm);padding:10px 14px;font:600 .95rem inherit;outline:0;background:#fff;color:var(--brand-secondary)}
.portal-form .field textarea{min-height:150px;line-height:1.6;resize:vertical}
.portal-form .field select[multiple]{min-height:150px}
.portal-form .field input:focus,.portal-form .field select:focus,.portal-form .field textarea:focus{border-color:var(--brand-primary);box-shadow:0 0 0 3px rgba(215,25,32,.1)}
.portal-form .field.is-checkbox{display:flex;align-items:center;gap:.6rem}
.portal-form .field.is-checkbox label{margin:0}
.portal-form .field.is-checkbox input{width:18px;height:18px;accent-color:var(--brand-primary)}
.portal-form .helptext{display:block;margin-top:5px;color:var(--text-secondary);font-size:.8rem;font-weight:600}
.portal-form-actions{display:flex;gap:.6rem;flex-wrap:wrap;margin-top:.4rem}
.portal-form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}
.portal-form-grid .field.is-wide{grid-column:1/-1}
.portal-nonfield-errors{margin:0 0 4px;padding:0;list-style:none;color:#b91c1c;font-size:.85rem;font-weight:800}
.portal-guest-note{margin:0;color:var(--text-secondary);line-height:1.7;font-weight:700}
.visually-hidden-label{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}

@media(max-width:1180px){
  .portal-stats{grid-template-columns:repeat(3,minmax(0,1fr))}
  .portal-modules{grid-template-columns:repeat(2,minmax(0,1fr))}
  .portal-grid{grid-template-columns:1fr}
}
@media(max-width:1100px){
  .portal-layout{grid-template-columns:1fr}
  .portal-sidebar{position:static;max-height:none}
  .portal-nav{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:720px){
  .portal-systembar-inner{min-height:auto;padding:.55rem 0;align-items:flex-start}
  .portal-systembar-actions{flex-wrap:wrap;justify-content:flex-end}
  .portal-user-chip{font-size:.78rem}
  .portal-layout{width:min(100% - 20px,1720px);margin:.75rem auto}
  .portal-nav{grid-template-columns:1fr}
  .portal-hero{grid-template-columns:1fr}
  .portal-actions{justify-content:flex-start}
  .portal-stats,.portal-modules{grid-template-columns:1fr}
  .portal-row{grid-template-columns:1fr;gap:.32rem}
  .portal-form-grid{grid-template-columns:1fr}
  .portal-search input{min-width:0;width:100%}
  .portal-footer-inner{min-height:auto;padding:.8rem 0;display:grid}
}
