:root {
  --ink: #14213d;
  --muted: #68738a;
  --surface: #ffffff;
  --canvas: #f4f6fb;
  --line: #e5e9f2;
  --brand: #2667ff;
  --brand-dark: #194fd5;
  --brand-soft: #edf3ff;
  --success: #138a61;
  --success-soft: #e9f8f2;
  --danger: #c54255;
  --danger-soft: #fff0f2;
  --warning: #9a6712;
  --sidebar: #111b34;
  --shadow: 0 16px 45px rgba(27, 42, 77, .08);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { font-size: 15px; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  line-height: 1.55;
}
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }
button, input, select { font: inherit; }

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 100;
  width: 256px;
  min-height: 100vh;
  padding: 28px 20px 22px;
  color: #fff;
  background:
    radial-gradient(circle at 20% 0, rgba(62, 112, 255, .28), transparent 32%),
    linear-gradient(180deg, #14213d, var(--sidebar));
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 12px; color: inherit; }
.brand:hover { color: inherit; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 13px;
  color: white;
  background: linear-gradient(145deg, #4780ff, #1957e6);
  box-shadow: 0 9px 24px rgba(38, 103, 255, .34);
  font-size: 1.25rem;
  font-weight: 800;
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 1.2rem; letter-spacing: .01em; }
.brand small { margin-top: -2px; color: #9eabc4; font-size: .74rem; }
.side-nav { display: grid; gap: 7px; margin-top: 48px; }
.side-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 10px 14px;
  color: #aeb9ce;
  border-radius: 12px;
  font-weight: 600;
  transition: .2s ease;
}
.side-nav a:hover { color: #fff; background: rgba(255,255,255,.06); }
.side-nav a.active { color: #fff; background: rgba(56, 112, 255, .22); box-shadow: inset -3px 0 #4f84ff; }
.side-nav .primary-link { margin-top: 18px; color: #fff; background: var(--brand); }
.side-nav .primary-link:hover { background: #3975ff; }
.nav-icon { width: 24px; text-align: center; font-size: 1.25rem; }
.sidebar-footer { margin-top: auto; border-top: 1px solid rgba(255,255,255,.09); padding-top: 20px; }
.user-chip { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.user-chip .avatar {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  background: #2e3d5d; color: #fff; text-transform: uppercase; font-weight: 700;
}
.user-chip strong, .user-chip small { display: block; }
.user-chip strong { font-size: .9rem; }
.user-chip small { color: #8e9bb5; font-size: .72rem; }
.logout-button { width: 100%; border: 0; border-radius: 10px; padding: 9px; color: #b7c1d4; background: rgba(255,255,255,.05); }
.logout-button:hover { color: #fff; background: rgba(255,255,255,.09); }

.main-content { min-height: 100vh; margin-right: 256px; }
.page-container { max-width: 1510px; margin: 0 auto; padding: 46px 42px 60px; }
.mobile-header { display: none; }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 34px; }
.page-heading.compact { align-items: center; margin-bottom: 28px; }
.page-heading h1 { margin: 5px 0 5px; font-size: clamp(1.8rem, 2.7vw, 2.55rem); line-height: 1.2; font-weight: 780; letter-spacing: -.035em; }
.page-heading p { margin: 0; color: var(--muted); }
.eyebrow { color: var(--brand); font-size: .72rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.eyebrow.light { color: #9fbbff; }

.btn { border-radius: 10px; font-weight: 650; padding: .65rem 1rem; }
.btn-brand { color: #fff; border-color: var(--brand); background: var(--brand); box-shadow: 0 8px 20px rgba(38,103,255,.18); }
.btn-brand:hover, .btn-brand:focus { color: #fff; border-color: var(--brand-dark); background: var(--brand-dark); }
.btn-soft { color: var(--brand); border: 0; background: var(--brand-soft); }
.btn-soft:hover { color: var(--brand-dark); background: #dfeaff; }
.btn-quiet { color: var(--ink); border: 1px solid var(--line); background: #fff; }
.btn-quiet:hover { color: var(--ink); border-color: #cbd3e2; background: #f8f9fc; }
.btn-danger-soft { color: var(--danger); border: 0; background: var(--danger-soft); }
.btn-danger-soft:hover { color: #a32f41; background: #ffe2e7; }
.btn-success-soft { color: var(--success); border: 0; background: var(--success-soft); }
.btn-success-soft:hover { color: #0d704e; background: #d9f3e9; }
.btn-success-solid { color: #fff; border-color: var(--success); background: var(--success); }
.btn-success-solid:hover, .btn-success-solid:focus { color: #fff; border-color: #0e704f; background: #0e704f; }
.full-button { width: 100%; }
.form-gap { margin-top: 18px; }
.ltr-inline { direction: ltr; unicode-bidi: isolate; display: inline-block; }

.panel { border: 1px solid rgba(221,226,237,.9); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; padding: 24px 26px 14px; }
.panel-heading h2 { margin: 3px 0 0; font-size: 1.3rem; }
.panel-heading a { font-size: .85rem; font-weight: 700; }
.app-alert { display: flex; gap: 10px; align-items: center; margin-bottom: 22px; border: 0; border-radius: 13px; }
.app-alert span { color: inherit; opacity: .9; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-bottom: 20px; }
.stat-card { position: relative; min-height: 155px; padding: 24px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
.stat-card::after { content: ""; position: absolute; top: -22px; left: -22px; width: 88px; height: 88px; border-radius: 50%; background: currentColor; opacity: .07; }
.stat-card .stat-label, .stat-card small { display: block; color: var(--muted); }
.stat-card strong { display: block; margin: 8px 0 1px; color: var(--ink); font-size: 2.4rem; line-height: 1; letter-spacing: -.04em; }
.stat-card small { font-size: .8rem; }
.accent-blue { color: #2770f8; border-top: 3px solid #2770f8; }
.accent-violet { color: #7656d8; border-top: 3px solid #7656d8; }
.accent-green { color: #16a273; border-top: 3px solid #16a273; }
.accent-orange { color: #d18b1f; border-top: 3px solid #d18b1f; }
.content-grid { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(260px, .8fr); gap: 20px; }
.server-panel { padding: 25px; }
.server-status { display: flex; align-items: center; gap: 13px; margin: 22px 0 28px; padding: 18px; border-radius: 14px; background: #f7f9fc; }
.server-status strong, .server-status small { display: block; }
.server-status small { color: var(--muted); font-size: .75rem; }
.pulse-dot { position: relative; width: 12px; height: 12px; border-radius: 50%; background: var(--danger); }
.pulse-dot.online { background: #19a978; box-shadow: 0 0 0 6px rgba(25,169,120,.11); }
.pulse-dot.offline { box-shadow: 0 0 0 6px rgba(197,66,85,.1); }
.quick-actions { display: grid; gap: 10px; }
.quick-actions a { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 13px; color: var(--ink); }
.quick-actions a:hover { border-color: #bfd0ff; background: var(--brand-soft); }
.quick-actions > a > span { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: var(--brand); background: var(--brand-soft); font-size: 1.1rem; }
.quick-actions strong, .quick-actions small { display: block; }
.quick-actions small { color: var(--muted); font-size: .75rem; }

.filter-bar { display: flex; gap: 10px; align-items: center; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.filter-bar .search-box { flex: 1 1 380px; }
.multi-filter .form-select { max-width: 220px; }
.search-box { display: flex; align-items: center; gap: 8px; min-height: 43px; padding: 0 13px; border: 1px solid #d9dfeb; border-radius: 10px; background: #f9fafd; }
.search-box:focus-within { border-color: #82a7ff; box-shadow: 0 0 0 .2rem rgba(38,103,255,.1); }
.search-box span { color: #8c97aa; font-size: 1.2rem; }
.search-box input { width: 100%; border: 0; outline: 0; color: var(--ink); background: transparent; }
.form-control, .form-select { min-height: 44px; border-color: #d8deea; border-radius: 10px; }
.form-control:focus, .form-select:focus { border-color: #83a6fa; box-shadow: 0 0 0 .2rem rgba(38,103,255,.1); }
.ltr-input, .ltr-text { direction: ltr; text-align: left; }

.app-table { margin: 0; }
.app-table th { padding: 14px 18px; color: #768096; border-color: var(--line); background: #fafbfe; font-size: .76rem; font-weight: 750; white-space: nowrap; }
.app-table td { padding: 15px 18px; color: #374158; border-color: #edf0f5; vertical-align: middle; }
.app-table tbody tr:hover { background: #fbfcff; }
.app-table td > strong, .app-table td > small { display: block; }
.app-table td > strong { color: var(--ink); font-size: .88rem; }
.app-table td > small { color: var(--muted); font-size: .75rem; }
.entity-cell { display: flex; align-items: center; gap: 11px; min-width: 190px; }
.entity-cell strong, .entity-cell code { display: block; }
.entity-cell code { color: var(--muted); font-size: .74rem; }
.entity-avatar { display: grid; place-items: center; width: 39px; height: 39px; flex: 0 0 39px; border-radius: 11px; color: var(--brand); background: var(--brand-soft); font-weight: 800; }
.entity-avatar.large { width: 52px; height: 52px; flex-basis: 52px; border-radius: 15px; font-size: 1.35rem; }
.license-key { direction: ltr; unicode-bidi: isolate; display: inline-block; padding: 5px 8px; color: #33405d; border-radius: 7px; background: #f2f4f8; font-size: .76rem; white-space: nowrap; }
.status-badge, .type-chip { display: inline-flex; align-items: center; padding: 5px 9px; border-radius: 999px; font-size: .72rem; font-weight: 750; white-space: nowrap; }
.status-success { color: var(--success); background: var(--success-soft); }
.status-danger { color: var(--danger); background: var(--danger-soft); }
.status-warning { color: var(--warning); background: #fff5dd; }
.status-muted { color: #667189; background: #eef1f5; }
.type-chip { color: #5d4bb0; background: #f0edff; }
.actions-cell { min-width: 240px; white-space: nowrap; }
.inline-form { display: inline-block; margin-inline-start: 3px; }
.table-footer { padding: 13px 20px; color: var(--muted); border-top: 1px solid var(--line); background: #fbfcfe; font-size: .8rem; }
.empty-state { padding: 60px 24px; text-align: center; }
.empty-state > span { display: grid; place-items: center; width: 62px; height: 62px; margin: 0 auto 15px; border-radius: 18px; color: var(--brand); background: var(--brand-soft); font-size: 1.7rem; }
.empty-state h3 { margin: 0 0 5px; font-size: 1.15rem; }
.empty-state p { margin: 0 0 18px; color: var(--muted); }

.form-panel { max-width: 980px; padding: 30px; overflow: visible; }
.narrow-form { max-width: 680px; }
.form-section + .form-section { margin-top: 34px; padding-top: 30px; border-top: 1px solid var(--line); }
.form-section-heading { display: flex; gap: 13px; margin-bottom: 22px; }
.form-section-heading > span { display: grid; place-items: center; width: 35px; height: 35px; flex: 0 0 35px; border-radius: 10px; color: var(--brand); background: var(--brand-soft); font-size: .76rem; font-weight: 800; }
.form-section-heading h2 { margin: 0; font-size: 1.05rem; }
.form-section-heading p { margin: 2px 0 0; color: var(--muted); font-size: .8rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.form-grid .full { grid-column: 1 / -1; }
.field-group > label:not(.toggle-field) { display: block; margin-bottom: 7px; color: #364159; font-size: .83rem; font-weight: 700; }
.field-group > small { display: block; margin-top: 5px; color: var(--muted); font-size: .72rem; }
.field-group .text-danger { display: block; margin-top: 4px; font-size: .72rem; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--line); }
.validation-summary:empty, .validation-summary-valid { display: none; }
.toggle-field { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.toggle-field input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-ui { position: relative; width: 42px; height: 24px; border-radius: 999px; background: #c9d0dd; transition: .2s; }
.toggle-ui::after { content: ""; position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,.18); transition: .2s; }
.toggle-field input:checked + .toggle-ui { background: var(--brand); }
.toggle-field input:checked + .toggle-ui::after { transform: translateX(-18px); }
.license-scope-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.license-scope-option { position: relative; margin: 0; cursor: pointer; }
.license-scope-option > input { position: absolute; opacity: 0; pointer-events: none; }
.scope-card-content { display: grid; grid-template-columns: 42px 1fr; grid-template-rows: auto auto; column-gap: 12px; min-height: 112px; padding: 16px; border: 1px solid var(--line); border-radius: 13px; background: #fff; transition: border-color .18s, box-shadow .18s, background .18s; }
.scope-icon { display: grid; grid-row: 1 / 3; place-items: center; width: 42px; height: 42px; color: var(--brand); border-radius: 12px; background: var(--brand-soft); font-weight: 850; }
.scope-card-content strong { align-self: end; color: var(--ink); font-size: .9rem; }
.scope-card-content small { align-self: start; margin-top: 3px; color: var(--muted); font-size: .73rem; line-height: 1.55; }
.license-scope-option:hover .scope-card-content { border-color: #b9c9ec; }
.license-scope-option > input:checked + .scope-card-content { border-color: var(--brand); background: #f7f9ff; box-shadow: 0 0 0 3px var(--brand-soft); }
.license-scope-option > input:focus-visible + .scope-card-content { outline: 3px solid rgba(42, 94, 214, .25); outline-offset: 2px; }
.package-count-row { display: grid; grid-template-columns: 180px 1fr; gap: 22px; align-items: end; }
.package-summary { display: flex; align-items: center; gap: 14px; min-height: 80px; padding: 14px 17px; border: 1px solid #cfe0ff; border-radius: 13px; background: #f5f8ff; }
.summary-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; color: #fff; background: var(--brand); }
.package-summary strong, .package-summary small { display: block; }
.package-summary small { color: var(--muted); font-size: .76rem; }
.security-note { display: flex; gap: 12px; margin-top: 28px; padding: 15px 17px; color: #176b50; border-radius: 13px; background: #edf9f5; }
.security-note > span { font-weight: 900; }
.security-note strong, .security-note p { display: block; margin: 0; }
.security-note p { opacity: .78; font-size: .78rem; }

.details-panel { max-width: 980px; padding: 28px; }
.details-hero { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-bottom: 25px; border-bottom: 1px solid var(--line); }
.details-hero > div { display: flex; align-items: center; gap: 14px; }
.details-hero h2 { margin: 2px 0 0; font-size: 1.35rem; }
.details-hero p { margin: 0; color: var(--muted); }
.details-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; margin-top: 22px; border: 1px solid var(--line); border-radius: 13px; overflow: hidden; background: var(--line); }
.details-grid > div { min-height: 88px; padding: 18px; background: #fff; }
.details-grid .full { grid-column: 1 / -1; }
.details-grid span, .details-grid strong { display: block; }
.details-grid span { margin-bottom: 6px; color: var(--muted); font-size: .75rem; }
.fingerprint { direction: ltr; display: block; overflow-wrap: anywhere; color: #41506c; }
.danger-detail { color: var(--danger); background: var(--danger-soft) !important; }

.heading-actions { display: flex; align-items: center; gap: 10px; }
.request-filters { flex-wrap: wrap; }
.filter-pill { padding: 8px 13px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; background: #fff; font-size: .78rem; font-weight: 700; }
.filter-pill:hover, .filter-pill.active { color: var(--brand); border-color: #b9cdfc; background: var(--brand-soft); }
.count-chip { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; min-height: 28px; padding: 3px 10px; color: var(--brand); border-radius: 999px; background: var(--brand-soft); font-size: .76rem; font-weight: 800; }

.segmented-control { display: inline-grid; grid-template-columns: repeat(2, minmax(145px, 1fr)); gap: 6px; margin-bottom: 22px; padding: 5px; border: 1px solid var(--line); border-radius: 13px; background: #f5f7fb; }
.segmented-control label { position: relative; margin: 0; cursor: pointer; }
.segmented-control input { position: absolute; opacity: 0; }
.segmented-control span { display: block; padding: 9px 17px; border-radius: 9px; color: var(--muted); text-align: center; font-weight: 700; }
.segmented-control input:checked + span { color: var(--brand); background: #fff; box-shadow: 0 3px 12px rgba(27,42,77,.09); }
.section-heading-with-action { display: flex; align-items: start; justify-content: space-between; gap: 18px; }
.branch-list { display: grid; gap: 15px; }
.branch-card { padding: 19px; border: 1px solid var(--line); border-radius: 14px; background: #fafbfe; }
.branch-card-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 17px; }
.branch-card-heading strong { color: var(--ink); }

.request-details-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(300px, .85fr); gap: 20px; align-items: start; }
.request-main-column, .request-side-column { display: grid; gap: 20px; }
.request-summary-panel { max-width: none; }
.request-branches-panel { overflow: hidden; }
.request-branch-list { border-top: 1px solid var(--line); }
.request-branch-item { display: grid; grid-template-columns: 44px minmax(150px, 1.3fr) minmax(120px, 1fr) minmax(90px, .65fr) auto; gap: 15px; align-items: center; padding: 17px 24px; border-bottom: 1px solid #edf0f5; }
.request-branch-item:last-child { border-bottom: 0; }
.request-branch-item strong, .request-branch-item small { display: block; }
.request-branch-item small { color: var(--muted); font-size: .73rem; }
.request-branch-name strong { color: var(--ink); }
.review-panel, .audit-panel { padding: 24px; }
.review-panel h2, .audit-panel h3 { margin: 5px 0 8px; font-size: 1.25rem; }
.review-panel > p, .audit-panel > p { color: var(--muted); font-size: .84rem; }
.review-panel form { margin-top: 20px; }
.review-panel .field-group { margin-bottom: 13px; }
.reject-form { padding-top: 19px; border-top: 1px solid var(--line); }
.audit-panel blockquote { margin: 14px 0; padding: 12px 14px; color: #47536c; border-right: 3px solid var(--brand); border-radius: 8px; background: #f7f9fd; font-size: .82rem; }
.audit-panel small { color: var(--muted); }

.settings-layout { display: grid; grid-template-columns: minmax(300px, .8fr) minmax(480px, 1.2fr); gap: 20px; align-items: start; }
.compact-panel { max-width: none; padding: 0 26px 26px; }
.compact-panel .panel-heading { padding-inline: 0; }
.whatsapp-body { padding: 8px 26px 26px; }
.connection-summary { display: flex; gap: 14px; align-items: center; padding: 17px; border: 1px solid var(--line); border-radius: 14px; background: #fafbfe; }
.connection-summary strong, .connection-summary small { display: block; }
.connection-summary small { margin-top: 3px; color: var(--muted); font-size: .7rem; overflow-wrap: anywhere; }
.connection-icon { display: grid; place-items: center; width: 44px; height: 44px; flex: 0 0 44px; color: #fff; border-radius: 50%; background: #1faa61; font-size: 1.1rem; font-weight: 900; }
.qr-panel { display: grid; justify-items: center; gap: 7px; margin-top: 18px; padding: 20px; border: 1px dashed #b8c4d9; border-radius: 14px; text-align: center; }
.qr-panel img { width: min(100%, 290px); aspect-ratio: 1; object-fit: contain; }
.qr-panel small { color: var(--muted); }
.configuration-note { margin-top: 18px; padding: 15px; color: #72540f; border-radius: 12px; background: #fff7e5; }
.configuration-note p { margin: 5px 0 0; font-size: .78rem; }
.configuration-note code { direction: ltr; display: inline-block; color: inherit; }
.connection-actions { display: flex; gap: 9px; margin-top: 18px; }
.owner-add-form { display: grid; grid-template-columns: 1fr 1.15fr auto; gap: 12px; align-items: end; padding: 5px 26px 24px; border-bottom: 1px solid var(--line); }
.owner-add-form .validation-summary { grid-column: 1 / -1; }
.owner-add-form .full-button { width: auto; min-height: 44px; }
.owner-list { display: grid; }
.owner-row { display: grid; grid-template-columns: 40px minmax(130px, 1fr) auto auto; align-items: center; gap: 12px; padding: 15px 25px; border-bottom: 1px solid #edf0f5; }
.owner-row:last-child { border-bottom: 0; }
.owner-row .avatar { display: grid; place-items: center; width: 38px; height: 38px; color: var(--brand); border-radius: 11px; background: var(--brand-soft); font-weight: 800; }
.owner-row strong, .owner-row small { display: block; }
.owner-row small { color: var(--muted); font-size: .73rem; }
.owner-actions { display: flex; gap: 5px; }
.mini-empty { padding: 35px 24px; color: var(--muted); text-align: center; }

.login-page { min-height: 100vh; background: #eef2fa; }
.login-shell { display: grid; grid-template-columns: minmax(340px, .85fr) minmax(450px, 1.15fr); min-height: 100vh; }
.login-brand-panel { display: flex; flex-direction: column; justify-content: space-between; padding: clamp(38px, 6vw, 78px); color: #fff; background: radial-gradient(circle at 20% 15%, rgba(72,125,255,.42), transparent 28%), linear-gradient(145deg, #172748, #0f1830); }
.large-brand { width: fit-content; }
.login-brand-panel h1 { max-width: 560px; margin: 10px 0 14px; font-size: clamp(2rem, 4vw, 4.2rem); line-height: 1.17; letter-spacing: -.045em; }
.login-brand-panel p { max-width: 540px; color: #b9c5dc; font-size: 1.02rem; }
.login-brand-panel > small { color: #7f8ca7; }
.login-card-wrap { display: grid; place-items: center; padding: 34px; }
.login-card { width: min(100%, 440px); padding: 38px; border: 1px solid var(--line); border-radius: 22px; background: #fff; box-shadow: 0 24px 70px rgba(28,43,78,.12); }
.login-card h2 { margin: 5px 0 4px; font-size: 1.75rem; }
.login-card > p { margin-bottom: 27px; color: var(--muted); }
.login-card .field-group { margin-bottom: 18px; }
.login-card .btn { min-height: 47px; margin-top: 8px; }

@media (max-width: 1180px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .content-grid { grid-template-columns: 1fr; }
  .server-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 25px; }
  .server-panel > .eyebrow { grid-column: 1 / -1; }
  .server-status { margin: 0; }
  .request-details-layout, .settings-layout { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(100%); transition: transform .22s ease; box-shadow: -12px 0 40px rgba(15,24,48,.2); }
  body.menu-open .sidebar { transform: translateX(0); }
  .main-content { margin-right: 0; }
  .mobile-header { display: flex; align-items: center; justify-content: space-between; min-height: 68px; padding: 12px 22px; color: #fff; background: var(--sidebar); }
  .brand-mobile .brand-mark { width: 36px; height: 36px; flex-basis: 36px; border-radius: 10px; }
  .menu-toggle { border: 0; color: #fff; background: transparent; font-size: 1.45rem; }
  .page-container { padding: 30px 22px 45px; }
  .multi-filter { flex-wrap: wrap; }
  .multi-filter .form-select { max-width: none; flex: 1 1 190px; }
  .owner-add-form { grid-template-columns: 1fr 1fr; }
  .owner-add-form .full-button { grid-column: 1 / -1; width: 100%; }
  .login-shell { grid-template-columns: 1fr; }
  .login-brand-panel { min-height: 300px; }
  .login-brand-panel > div:nth-child(2) { margin: 55px 0; }
}

@media (max-width: 650px) {
  .page-heading { align-items: stretch; flex-direction: column; }
  .heading-actions, .connection-actions, .section-heading-with-action { align-items: stretch; flex-direction: column; }
  .details-hero { align-items: flex-start; flex-direction: column; }
  .details-hero > div { width: 100%; }
  .heading-actions .btn, .connection-actions .btn, .connection-actions form { width: 100%; }
  .page-heading .btn { width: 100%; }
  .stats-grid { grid-template-columns: 1fr; }
  .stat-card { min-height: 130px; }
  .server-panel { display: block; }
  .server-status { margin: 20px 0; }
  .filter-bar { align-items: stretch; flex-direction: column; }
  .filter-bar .search-box { flex-basis: auto; }
  .form-panel, .details-panel { padding: 21px; }
  .form-grid, .details-grid, .package-count-row, .license-scope-grid { grid-template-columns: 1fr; }
  .segmented-control, .owner-add-form { grid-template-columns: 1fr; width: 100%; }
  .owner-add-form .full-button { grid-column: auto; }
  .request-branch-item { grid-template-columns: 40px 1fr; }
  .request-branch-item > div:not(.entity-avatar) { grid-column: 2; }
  .owner-row { grid-template-columns: 38px 1fr auto; }
  .owner-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .details-grid .full, .form-grid .full { grid-column: auto; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .btn { width: 100%; }
  .login-brand-panel { display: none; }
  .login-card-wrap { min-height: 100vh; padding: 18px; }
  .login-card { padding: 28px 22px; }
}
