:root {
  --bg: #08080a;
  --panel: #111114;
  --panel-2: #17171b;
  --line: rgba(255,255,255,.09);
  --text: #f5f3f2;
  --muted: #918d8c;
  --red: #ef1836;
  --green: #41c985;
  --yellow: #f2b84b;
  --blue: #5a8cff;
  --font: "DM Sans", system-ui, sans-serif;
  --heading: "Manrope", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { color-scheme: dark; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font-family: var(--font); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
.portal-shell { min-height: 100vh; display: grid; grid-template-columns: 260px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 1.5rem; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: #0c0c0f; }
.portal-brand { display: flex; align-items: center; gap: .75rem; font: 700 .82rem var(--heading); letter-spacing: .14em; }
.portal-brand img { width: 38px; height: 38px; object-fit: contain; }
.portal-brand strong { color: var(--red); }
.portal-role { margin: 1.5rem 0 2rem; padding: .75rem 1rem; border: 1px solid rgba(239,24,54,.22); background: rgba(239,24,54,.08); color: #e7a4ae; font-size: .72rem; letter-spacing: .09em; text-transform: uppercase; }
.portal-nav { display: grid; gap: .35rem; }
.portal-nav button { width: 100%; padding: .85rem 1rem; display: flex; align-items: center; gap: .8rem; border: 0; background: transparent; color: var(--muted); text-align: left; cursor: pointer; }
.portal-nav button::before { content: ""; width: 7px; height: 7px; border: 1px solid currentColor; transform: rotate(45deg); }
.portal-nav button.active { background: var(--panel-2); color: white; }
.portal-nav button.active::before { border-color: var(--red); background: var(--red); }
.sidebar-bottom { margin-top: auto; }
.sidebar-user { padding: 1rem 0; border-top: 1px solid var(--line); }
.sidebar-user strong, .sidebar-user span { display: block; }
.sidebar-user strong { font-size: .86rem; }
.sidebar-user span { margin-top: .25rem; color: var(--muted); font-size: .72rem; }
.logout { width: 100%; padding: .75rem; border: 1px solid var(--line); background: transparent; color: #bbb; cursor: pointer; }
.portal-main { min-width: 0; }
.portal-header { height: 82px; padding: 0 clamp(1.25rem,3vw,3rem); display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.portal-header h1 { margin: 0; font: 700 clamp(1.2rem,2vw,1.65rem) var(--heading); }
.portal-header p { margin: .35rem 0 0; color: var(--muted); font-size: .78rem; }
.header-actions { display: flex; align-items: center; gap: .8rem; }
.mobile-menu { display: none; }
.portal-content { padding: clamp(1.25rem,3vw,3rem); }
.view { display: none; }
.view.active { display: block; animation: view-in .3s ease; }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.metric { min-height: 135px; padding: 1.3rem; border: 1px solid var(--line); background: linear-gradient(145deg,var(--panel-2),var(--panel)); }
.metric span { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }
.metric strong { display: block; margin-top: 1.4rem; font: 700 clamp(1.55rem,3vw,2.35rem) var(--heading); }
.metric small { display: block; margin-top: .35rem; color: #777; }
.metric.alert strong { color: var(--yellow); }
.section-grid { display: grid; grid-template-columns: 1.4fr .8fr; gap: 1rem; }
.panel { padding: 1.4rem; border: 1px solid var(--line); background: var(--panel); }
.panel-head { margin-bottom: 1.2rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.panel-head h2 { margin: 0; font: 650 1rem var(--heading); }
.panel-head p { margin: .3rem 0 0; color: var(--muted); font-size: .75rem; }
.btn { min-height: 42px; padding: 0 1rem; border: 1px solid var(--red); background: var(--red); color: white; font-weight: 600; cursor: pointer; }
.btn:hover { background: #c80c29; }
.btn.secondary { border-color: var(--line); background: transparent; color: #ddd; }
.btn.small { min-height: 34px; font-size: .72rem; }
.system-list, .ticket-list { display: grid; gap: .8rem; }
.system-card { padding: 1.2rem; border: 1px solid var(--line); background: var(--panel-2); }
.system-card-top { display: flex; justify-content: space-between; gap: 1rem; }
.system-card h3 { margin: 0; font: 650 1rem var(--heading); }
.system-card p { margin: .45rem 0 0; color: var(--muted); font-size: .78rem; line-height: 1.5; }
.system-meta { margin-top: 1.1rem; display: grid; grid-template-columns: repeat(4,1fr); gap: .7rem; }
.system-meta div { padding-top: .7rem; border-top: 1px solid var(--line); }
.system-meta span, .system-meta strong { display: block; }
.system-meta span { color: #747071; font-size: .63rem; text-transform: uppercase; }
.system-meta strong { margin-top: .25rem; font-size: .78rem; }
.status { display: inline-flex; align-items: center; gap: .4rem; color: var(--green); font-size: .7rem; text-transform: capitalize; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.past_due, .status.urgent, .status.suspended, .status.locked { color: var(--red); }
.status.pending, .status.in_progress, .status.waiting_client, .status.maintenance { color: var(--yellow); }
.status.closed, .status.cancelled, .status.paused { color: #777; }
.ticket-row { padding: 1rem; display: grid; grid-template-columns: 1fr auto; gap: .8rem; border: 1px solid var(--line); cursor: pointer; }
.ticket-row:hover { border-color: rgba(239,24,54,.45); }
.ticket-row strong { font-size: .84rem; }
.ticket-row p { margin: .35rem 0 0; color: var(--muted); font-size: .7rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { padding: .9rem .7rem; border-bottom: 1px solid var(--line); text-align: left; font-size: .76rem; }
th { color: #767273; font-size: .62rem; letter-spacing: .07em; text-transform: uppercase; }
td strong, td span { display: block; }
td span { margin-top: .25rem; color: var(--muted); font-size: .68rem; }
.empty { padding: 2rem; border: 1px dashed var(--line); color: var(--muted); text-align: center; }
.modal { position: fixed; z-index: 50; inset: 0; padding: 1rem; display: none; place-items: center; background: rgba(0,0,0,.75); backdrop-filter: blur(8px); }
.modal.open { display: grid; }
.modal-card { width: min(620px,100%); max-height: 90vh; overflow-y: auto; padding: 1.5rem; border: 1px solid var(--line); background: #111114; box-shadow: 0 30px 90px #000; }
.modal-head { display: flex; justify-content: space-between; gap: 1rem; }
.modal-head h2 { margin: 0; font: 650 1.1rem var(--heading); }
.modal-close { border: 0; background: transparent; color: white; font-size: 1.5rem; cursor: pointer; }
.form-grid { margin-top: 1.3rem; display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.field { display: grid; gap: .4rem; }
.field.full { grid-column: 1/-1; }
.field label { color: #aaa5a4; font-size: .7rem; }
.field input, .field select, .field textarea { width: 100%; padding: .8rem; border: 1px solid var(--line); outline: 0; background: #09090b; color: white; }
.field textarea { min-height: 110px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--red); }
.form-actions { grid-column: 1/-1; display: flex; justify-content: flex-end; gap: .7rem; }
.notice { display: none; margin-top: 1rem; padding: .8rem; color: #f4b0ba; background: rgba(239,24,54,.1); font-size: .75rem; }
.notice.show { display: block; }
.thread { margin: 1.2rem 0; display: grid; gap: .7rem; }
.message { max-width: 85%; padding: .9rem; border: 1px solid var(--line); background: var(--panel-2); }
.message.admin { margin-left: auto; border-color: rgba(239,24,54,.3); }
.message p { margin: 0; font-size: .8rem; line-height: 1.55; white-space: pre-wrap; }
.message small { display: block; margin-top: .55rem; color: #777; }
.login-page { min-height: 100vh; display: grid; grid-template-columns: minmax(0,1.12fr) minmax(420px,.88fr); background: #09090b; }
.login-visual { position: relative; padding: clamp(2rem,5vw,5.5rem); display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; background: radial-gradient(circle at 15% 20%,rgba(239,24,54,.16),transparent 32%), linear-gradient(135deg,#16080b,#09090b 65%); }
.login-visual::after { content: ""; position: absolute; width: 55vw; height: 55vw; right: -27vw; bottom: -28vw; border-radius: 50%; border: 1px solid rgba(255,255,255,.07); box-shadow: 0 0 0 70px rgba(255,255,255,.025),0 0 0 140px rgba(255,255,255,.018); }
.login-copy { position: relative; z-index: 1; }
.login-copy h1 { max-width: 700px; margin: 1.5rem 0; font: 750 clamp(3rem,6vw,6rem)/.96 var(--heading); letter-spacing: -.07em; }
.login-copy h1 em { color: var(--red); font-style: normal; }
.login-copy p { max-width: 530px; color: #aaa2a1; line-height: 1.7; font-size: 1rem; }
.login-eyebrow { display: inline-flex; align-items: center; gap: .55rem; color: #d5b5b8; font-size: .7rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.login-eyebrow i { width: 7px; height: 7px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 5px rgba(239,24,54,.12); }
.login-highlights { display: flex; gap: 2.5rem; margin-top: 3rem; }
.login-highlights div { display: grid; gap: .3rem; }
.login-highlights strong { font: 700 1rem var(--heading); }
.login-highlights span { color: #777071; font-size: .68rem; }
.login-visual > small { position: relative; z-index: 1; color: #716a6b; font-size: .68rem; }
.login-visual > small span { margin: 0 .45rem; color: var(--red); }
.login-form-side { padding: 2rem clamp(1.5rem,5vw,5rem); display: grid; place-items: center; background: #0d0d10; }
.login-box { width: min(410px,100%); }
.login-box-mark { width: 54px; height: 54px; display: grid; place-items: center; margin-bottom: 1.5rem; }
.login-box-mark img { width: 100%; height: 100%; object-fit: contain; }
.login-box-kicker { margin: 0 0 .7rem; color: var(--red); font-size: .68rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.login-box h2 { margin: 0; font: 750 clamp(1.8rem,3vw,2.3rem) var(--heading); letter-spacing: -.04em; }
.login-subtitle { margin: .65rem 0 0; color: var(--muted); line-height: 1.6; }
.login-box form { margin-top: 2.2rem; display: grid; gap: 1.1rem; }
.login-box .field { gap: .55rem; }
.login-box .field label { color: #c4bebe; font-size: .73rem; font-weight: 500; }
.login-box .field input { min-height: 50px; padding: 0 1rem; border-color: rgba(255,255,255,.12); background: #141417; border-radius: 2px; }
.login-box .field input::placeholder { color: #5d595a; }
.password-field { position: relative; }
.password-field input { padding-right: 4rem !important; }
.password-field button { position: absolute; top: 0; right: .75rem; height: 100%; border: 0; background: transparent; color: #8d8585; font-size: .7rem; cursor: pointer; }
.password-field button:hover { color: white; }
.login-submit { display: flex; justify-content: space-between; align-items: center; width: 100%; min-height: 52px; margin-top: .5rem; padding: 0 1.1rem 0 1.2rem; text-align: left; }
.login-submit b { font-size: 1.25rem; font-weight: 400; transition: transform .2s; }
.login-submit:hover b { transform: translateX(4px); }
.login-security { display: flex; align-items: flex-start; gap: .7rem; margin-top: 2.5rem; padding-top: 1.2rem; border-top: 1px solid var(--line); color: #777071; }
.login-security span { color: var(--green); font-size: 1rem; }
.login-security p { margin: 0; font-size: .68rem; line-height: 1.5; }
.demo-access { margin-top: 1.5rem; padding: 1rem; border: 1px solid var(--line); color: #aaa; font-size: .72rem; line-height: 1.6; }
.demo-access code { color: white; }
@media (max-width: 1050px) {
  .metrics { grid-template-columns: 1fr 1fr; }
  .section-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .portal-shell { display: block; }
  .sidebar { position: fixed; z-index: 40; inset: 0 auto 0 0; width: min(82vw,290px); transform: translateX(-105%); transition: transform .3s; box-shadow: 30px 0 70px #000; }
  body.menu-open .sidebar { transform: none; }
  .portal-header { height: auto; min-height: 72px; }
  .mobile-menu { display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid var(--line); background: transparent; color: white; }
  .metrics { grid-template-columns: 1fr; }
  .system-meta { grid-template-columns: 1fr 1fr; }
  .login-page { grid-template-columns: 1fr; }
  .login-visual { min-height: 42vh; }
  .login-copy h1 { margin-top: 2rem; }
  .login-highlights { gap: 1.2rem; margin-top: 2rem; }
  .login-highlights strong { font-size: .9rem; }
  .form-grid { grid-template-columns: 1fr; }
  .field.full, .form-actions { grid-column: 1; }
}
