:root {
  --ink: #182331;
  --muted: #667085;
  --line: #d8e0ea;
  --paper: #ffffff;
  --page: #f3f6fa;
  --navy: #08233f;
  --teal: #0f766e;
  --gold: #b8892f;
  --danger: #b42318;
  --success: #067647;
}

* { box-sizing: border-box; }
body { min-height: 100vh; margin: 0; color: var(--ink); background: var(--page); font-family: Arial, Helvetica, sans-serif; letter-spacing: 0; }
a { color: inherit; }
.topbar { background: var(--paper); border-bottom: 1px solid var(--line); }
.topbar.dark { color: #fff; background: var(--navy); }
.topbar-inner, .portal-main, .footer-inner { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
.topbar-inner { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand img { width: 112px; height: 50px; object-fit: contain; display: block; background: #fff; border: 1px solid #edf0f3; border-radius: 8px; padding: 6px; }
.brand-text strong { display: block; color: var(--navy); font-size: 17px; line-height: 1.2; }
.brand-text span { display: block; margin-top: 3px; color: var(--muted); font-size: 13px; }
.topbar.dark .brand-text strong, .topbar.dark nav a, .topbar.dark .brand-text span { color: #fff; }
nav { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
nav a { color: var(--navy); text-decoration: none; font-weight: 800; }
.nav-logout { display: inline; margin: 0; }
.nav-logout button { padding: 0; border: 0; background: transparent; color: var(--navy); font: inherit; font-weight: 800; cursor: pointer; }
.topbar.dark .nav-logout button { color: #fff; }
.impersonation-banner { display: flex; align-items: center; justify-content: center; gap: 1rem; padding: .75rem 1rem; color: #fff; background: #8a4b08; }
.impersonation-banner form { margin: 0; }
.impersonation-banner button { border: 1px solid #fff; border-radius: 6px; padding: .4rem .7rem; color: #fff; background: transparent; cursor: pointer; font-weight: 800; }
.portal-main { padding: 38px 0 42px; }
.hero { display: flex; gap: 28px; align-items: center; margin-bottom: 32px; }
.hero-logo { flex: 0 0 190px; width: 190px; height: 116px; object-fit: contain; display: block; border: 1px solid #edf0f3; border-radius: 8px; background: #fff; padding: 14px; box-shadow: 0 14px 32px rgba(8, 35, 63, 0.08); }
.kicker { color: var(--gold); font-size: 13px; font-weight: 800; text-transform: uppercase; margin: 0 0 12px; }
h1 { margin: 0 0 8px; color: var(--navy); font-size: 34px; line-height: 1.14; font-weight: 800; }
h2 { margin: 0; color: var(--navy); font-size: 22px; line-height: 1.2; }
.lead { max-width: 820px; margin: 12px 0 0; color: #465567; font-size: 17px; line-height: 1.55; }
.hero-actions, .actions, .button-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 22px; }
.btn, .portal-button, .system-button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 10px 14px; border: 1px solid transparent; border-radius: 8px; color: #fff; background: var(--teal); font-size: 14px; font-weight: 800; text-decoration: none; text-align: center; cursor: pointer; }
.btn.secondary, .portal-button.secondary { color: var(--navy); background: #fff; border-color: var(--line); }
.btn.developer { color: var(--navy); background: #fff8eb; border-color: var(--gold); }
.systems-grid, .plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.system-card, .plan, .panel, .card { border: 1px solid var(--line); border-radius: 8px; background: var(--paper); box-shadow: 0 10px 26px rgba(24, 35, 49, 0.06); }
.system-card { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 16px; min-height: 250px; padding: 22px; }
.system-mark { width: 58px; height: 58px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; color: #fff; background: var(--navy); font-weight: 800; }
.system-card[data-system="ppe"] .system-mark, .system-card[data-system="ppe"] .system-button { background: var(--teal); border-color: var(--teal); }
.system-card[data-system="gpb"] .system-mark, .system-card[data-system="gpb"] .system-button { background: #5b2b35; border-color: #5b2b35; }
.system-card p, .description, p { color: var(--muted); line-height: 1.5; }
.system-note { margin-top: 12px; color: var(--muted); font-size: 13px; }
.status-pill, .systems span { display: inline-flex; align-items: center; min-height: 28px; padding: 5px 10px; border: 1px solid #d8e0ea; border-radius: 999px; color: #0f766e; background: #fff; font-size: 12px; font-weight: 800; }
.status-pill.warning { border-color: #fed7aa; color: #9a3412; background: #fff7ed; }
.status-pill.active { border-color: #abefc6; color: #067647; background: #ecfdf3; }
.plan { padding: 18px; display: grid; gap: 14px; }
.prices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.price { border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: #f8fafc; display: grid; gap: 8px; }
.price form { display: block; }
.price .btn { width: 100%; }
.price small, label { color: var(--muted); font-weight: 800; text-transform: uppercase; font-size: 11px; }
.price strong { color: var(--navy); font-size: 19px; overflow-wrap: anywhere; }
.old-price { color: var(--muted); font-size: 12px; text-decoration: line-through; }
.discount { color: var(--teal); font-size: 12px; font-weight: 800; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.messages { display: grid; gap: 8px; margin-bottom: 16px; }
.message { padding: 12px 14px; border-radius: 8px; border: 1px solid var(--line); background: #fff; font-weight: 700; }
.message.success { border-color: #abefc6; color: var(--success); background: #ecfdf3; }
.message.error { border-color: #fecdca; color: var(--danger); background: #fef3f2; }
form { display: grid; gap: 16px; }
.plan-form { padding: 18px; }
.plan-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.field-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field.wide { grid-column: span 2; }
input, select, textarea { width: 100%; min-height: 40px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; color: var(--ink); font: inherit; background: #fff; }
textarea { resize: vertical; }
input[type="checkbox"] { width: auto; min-height: auto; }
.check-row { display: flex; gap: 8px; align-items: center; min-height: 40px; }
.errorlist { margin: 0; padding-left: 18px; color: var(--danger); font-size: 12px; }
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--navy); font-size: 12px; text-transform: uppercase; }
.portal-footer { border-top: 1px solid var(--line); background: var(--paper); }
.footer-inner { min-height: 58px; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-panel { width: min(520px, 100%); overflow: hidden; }
.login-panel header { padding: 22px 26px; background: var(--navy); color: #fff; }
.login-panel main { padding: 26px; display: grid; gap: 18px; }
@media (max-width: 900px) {
  .topbar-inner, .portal-main, .footer-inner { width: min(100% - 28px, 1180px); }
  .topbar-inner { align-items: flex-start; flex-direction: column; padding: 16px 0; }
  .hero { flex-direction: column; align-items: flex-start; }
  h1 { font-size: 30px; }
  .field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .prices, .field-grid { grid-template-columns: 1fr; }
  .field.wide { grid-column: auto; }
  .system-card { grid-template-columns: 1fr; }
}
.access-hint {
  display: block;
  margin-top: .65rem;
  color: #7a4b16;
}

.commercial-page { display: grid; gap: 2rem; }
.commercial-hero { min-height: 360px; }
.system-card.featured { border-color: #c89b3c; background: linear-gradient(135deg, #fff, #fff8e8); }
.commercial-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 2rem;
  border-radius: 18px;
  background: #0b2742;
  color: #fff;
}
.commercial-cta h2,
.commercial-cta p { color: #fff; }
.commercial-cta .kicker { color: var(--gold); }
.portal-messages { margin-bottom: 1rem; }
.portal-message { padding: .9rem 1rem; border-radius: 10px; background: #fff4d6; color: #5f3b00; }
@media (max-width: 720px) { .commercial-cta { align-items: flex-start; flex-direction: column; } }
.team-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.team-form label { display: grid; gap: .4rem; font-weight: 700; }
.team-form input, .team-form select { border: 1px solid #ccd5df; border-radius: 8px; padding: .75rem; }
.team-table { width: 100%; border-collapse: collapse; }
.team-table th, .team-table td { border-bottom: 1px solid #e1e6ec; padding: .75rem; text-align: left; }
.user-control-page { display: grid; gap: 1.4rem; }
.page-heading-row, .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.total-counter { padding: .7rem 1rem; border-radius: 999px; color: var(--navy); background: #fff; border: 1px solid var(--line); font-weight: 800; }
.filter-panel { display: grid; grid-template-columns: minmax(220px, 2fr) repeat(4, minmax(140px, 1fr)) auto auto; gap: .8rem; align-items: end; padding: 1rem; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.filter-panel label, .detail-form label, .inline-control-form label, .authorization-card label { display: grid; gap: .35rem; color: var(--navy); font-size: .78rem; font-weight: 800; }
.filter-panel input, .filter-panel select, .detail-form input, .detail-form textarea, .inline-control-form input, .authorization-card input, .authorization-card select, .authorization-card textarea { width: 100%; border: 1px solid #cbd5df; border-radius: 7px; padding: .65rem; background: #fff; font: inherit; }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.users-table { min-width: 1180px; }
.users-table td { font-size: .86rem; }
.state-badge { display: inline-flex; align-items: center; padding: .3rem .55rem; border-radius: 999px; font-size: .72rem; font-weight: 800; white-space: nowrap; }
.state-badge.active { color: #07583d; background: #dff8ec; }
.state-badge.blocked { color: #8f1d1d; background: #ffe4e4; }
.state-badge.neutral { color: #52616f; background: #edf1f5; }
.state-badge.package { color: #6d4b00; background: #fff2c7; }
.system-badges, .row-actions { display: flex; gap: .35rem; flex-wrap: wrap; }
.row-actions { min-width: 260px; flex-direction: row; align-items: center; flex-wrap: nowrap; }
.row-actions > .btn, .row-actions form { flex: 1 1 0; }
.row-actions form { margin: 0; }
.row-actions form .btn { width: 100%; white-space: nowrap; }
.btn.small { min-height: 32px; padding: .4rem .6rem; font-size: .76rem; }
.btn.danger { background: #a32626; }
.btn.danger-outline { color: #a32626; background: #fff; border-color: #a32626; }
.pagination { display: flex; justify-content: center; gap: 1rem; align-items: center; }
.pagination a { color: var(--teal); font-weight: 800; }
.control-section { display: grid; gap: 1rem; }
.panel.control-section { padding: 1.25rem; }
.detail-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.detail-form .wide { grid-column: 1 / -1; }
.inline-control-form { display: grid; grid-template-columns: repeat(4, minmax(140px, 1fr)) auto; gap: .8rem; align-items: end; }
.authorization-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 1rem; }
.authorization-card { display: grid; gap: .8rem; padding: 1rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: 0 8px 20px rgba(8,35,63,.06); }
.authorization-card.new-card { border-style: dashed; background: #f7fbfb; }
@media (max-width: 1100px) { .filter-panel { grid-template-columns: repeat(2, minmax(0,1fr)); } .inline-control-form { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 720px) { .page-heading-row, .section-heading { align-items: flex-start; flex-direction: column; } .filter-panel, .detail-form, .inline-control-form { grid-template-columns: 1fr; } .detail-form .wide { grid-column: auto; } }
.activation-card { max-width: 680px; margin: 2rem auto; }
@media (max-width: 720px) { .team-form { grid-template-columns: 1fr; } }

.heading-actions { display: flex; align-items: center; justify-content: flex-end; gap: .75rem; flex-wrap: wrap; }
.form-actions { display: flex; justify-content: flex-end; gap: .75rem; }
.field-note { color: var(--muted); font-size: .72rem; font-weight: 400; text-transform: none; }
.security-notice { padding: .85rem 1rem; border: 1px solid #b8d8d5; border-radius: 8px; color: #155e59; background: #f0fdfa; font-size: .86rem; line-height: 1.45; }
.security-actions { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr); gap: 1rem; align-items: stretch; }
.temporary-password-form, .danger-zone { display: grid; gap: .8rem; padding: 1rem; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; }
.temporary-password-form { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; }
.temporary-password-form label, .danger-zone label { display: grid; gap: .35rem; color: var(--navy); font-size: .78rem; font-weight: 800; }
.temporary-password-form label:nth-of-type(3), .temporary-password-form button { grid-column: 1 / -1; }
.danger-zone { border-color: #fecdca; background: #fff7f6; }
.danger-zone h3 { margin: 0; color: var(--danger); }
.danger-zone p { margin: 0; }
@media (max-width: 820px) { .security-actions, .temporary-password-form { grid-template-columns: 1fr; } .temporary-password-form label:nth-of-type(3), .temporary-password-form button { grid-column: auto; } .heading-actions { justify-content: flex-start; } }