:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f8fbff;
  --line: #dce6f2;
  --line-strong: #c8d6e8;
  --text: #0f172a;
  --muted: #5f6f86;
  --primary: #0f3d91;
  --primary-2: #1787a8;
  --success-bg: #eef9f0;
  --success-text: #17653a;
  --danger-bg: #fff0f0;
  --danger-text: #9a1c1c;
  --warning-bg: #fff9eb;
  --warning-text: #8c6212;
  --shadow: 0 10px 26px rgba(15, 23, 42, 0.07);
  --radius: 18px;
  --sidebar-w: 280px;
  --topbar-h: 72px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: "Segoe UI", Inter, system-ui, Arial, sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #f7f9fc 0%, #f3f6fb 100%);
}

a { color: inherit; text-decoration: none; }
button, input { font: inherit; }

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-shell {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 18px;
  align-items: stretch;
}

.auth-shell--compact {
  width: min(440px, 100%);
  grid-template-columns: 1fr;
}

.auth-brand,
.auth-card {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 20px;
  padding: 24px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 20px;
}

.auth-brand img {
  width: 96px;
  height: 96px;
  flex: 0 0 auto;
}

.auth-brand h1,
.auth-card h2 {
  margin: 0;
  color: var(--primary);
  font-size: 32px;
  line-height: 1.05;
}

.auth-brand p,
.auth-note {
  color: var(--muted);
  line-height: 1.65;
}

.auth-form {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.auth-form label span {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
}

.auth-form .input {
  margin-bottom: 0;
}

.auth-form--inline {
  max-width: 420px;
}

.alert {
  border-radius: 14px;
  padding: 10px 12px;
  margin: 12px 0;
  font-size: 13px;
  font-weight: 700;
}

.alert.error {
  background: var(--danger-bg);
  color: var(--danger-text);
  border: 1px solid #ffd1d1;
}

.alert.success {
  background: var(--success-bg);
  color: var(--success-text);
  border: 1px solid #cfead6;
}

.security-card,
.locked-feature {
  max-width: 860px;
}

.totp-box {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-2);
}

.totp-setup {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
  margin: 14px 0;
}

.totp-qr-card {
  width: 252px;
  min-height: 252px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  display: grid;
  place-items: center;
}

.totp-qr-card img {
  width: 220px;
  height: 220px;
}

.totp-box code {
  display: block;
  overflow-wrap: anywhere;
  color: var(--primary);
  font-size: 12px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  background: rgba(255,255,255,.82);
  backdrop-filter: blur(12px);
  border-right: 1px solid var(--line);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow: hidden;
}

.logo-box,
.client-box,
.tenant-box,
.topbar,
.card,
.pending-bar,
.help-article,
.help-card,
.tutorial-nav,
.modal-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.logo-box {
  border-radius: 22px;
  padding: 8px 12px;
  min-height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
}

.logo-box img {
  width: 54px;
  height: 54px;
  object-fit: contain;
  display: block;
  flex: 0 0 54px;
}

.logo-text-wrap {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.logo-text-main {
  display: inline-grid;
  grid-template-columns: 1fr;
  grid-template-areas:
    "next"
    "dns";
  row-gap: 0;
  font-size: 18px;
  line-height: 1.02;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.02em;
  word-break: normal;
  white-space: normal;
  text-align: center;
}

.logo-text-main .logo-next {
  grid-area: next;
  justify-self: start;
}

.logo-text-main .logo-dns {
  grid-area: dns;
  justify-self: center;
}

.client-box,
.tenant-box {
  border-radius: var(--radius);
  padding: 16px;
}

.tenant-box {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.section-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--muted);
  margin-bottom: 8px;
  font-weight: 700;
}

.client-name {
  font-weight: 700;
  font-size: 17px;
  line-height: 1.35;
}

.client-meta {
  color: var(--muted);
  font-size: 13px;
  margin-top: 6px;
}

.tenant-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  flex: 0 0 auto;
}

.icon-btn {
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--primary);
  width: 30px;
  height: 30px;
  border-radius: 10px;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 18px;
  line-height: 1;
}

.icon-btn.small {
  width: 26px;
  height: 26px;
  font-size: 15px;
}

.tenant-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.tenant-item {
  border: 1px solid var(--line);
  background: #fbfdff;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 10px 10px 12px;
}

.tenant-item.active {
  border-color: rgba(15,61,145,.38);
  background: linear-gradient(90deg,#f5f9ff,#ffffff);
}

.tenant-ip {
  font-weight: 600;
  font-size: 14px;
}

.tenant-label,
.tenant-status {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.tenant-status {
  text-transform: uppercase;
}

.main-area {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar-wrap {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 18px 20px 0;
  background: linear-gradient(180deg, rgba(245,247,251,.96), rgba(245,247,251,.88) 72%, rgba(245,247,251,0));
}

.topbar {
  height: var(--topbar-h);
  border-radius: 22px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.top-account {
  display: grid;
  justify-items: end;
  gap: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  min-width: 118px;
  max-width: 150px;
}

.top-account span {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-account strong {
  color: var(--primary);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.menu {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  align-items: center;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}

.menu-link {
  padding: 9px 12px;
  border-radius: 12px;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  border: 1px solid transparent;
}

.menu-link.active {
  background: #eff5ff;
  border-color: #d6e6ff;
  color: var(--primary);
}

.content {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.page-grid-dashboard {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(2, minmax(0,1fr));
}

.span-2 {
  grid-column: 1 / -1;
}

.card {
  border-radius: 20px;
  padding: 16px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.card-title {
  font-size: 17px;
  font-weight: 800;
  margin: 0;
}

.card-subtitle {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.list-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rank-row,
.stream-row {
  display: grid;
  align-items: center;
  gap: 10px;
  border: 1px solid #edf2f7;
  background: #fbfdff;
  border-radius: 12px;
}

.rank-row {
  grid-template-columns: 1fr auto;
  padding: 8px 10px;
}

.rank-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank-value {
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.chip {
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  padding: 5px 9px;
  min-height: 28px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}

.chip.active {
  background: #eef5ff;
  border-color: #cfe0ff;
  color: var(--primary);
}

.stream-card .list-rows {
  max-height: 276px;
  overflow: auto;
}

.stream-row {
  grid-template-columns: 74px 1fr auto;
  padding: 8px 10px;
}

.stream-row .time {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.stream-row .domain {
  font-size: 13px;
  font-weight: 700;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stream-row .category {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
}

.stream-row.allowed .category {
  background: var(--success-bg);
  color: var(--success-text);
}

.stream-row.blocked .category {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.chart-wrap {
  height: 290px;
}

.card-note {
  color: var(--muted);
  font-size: 12px;
}

.pending-bar {
  border-radius: 18px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.page-grid-access {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0,1fr));
}

.tenant-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.page-grid-lists {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.list-manager {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.list-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.list-form .input {
  margin-bottom: 0;
}

.list-feedback {
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.list-feedback[data-type="success"] {
  color: var(--success-text);
}

.list-feedback[data-type="error"] {
  color: var(--danger-text);
}

.managed-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.managed-list__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid #edf2f7;
  background: #fbfdff;
  border-radius: 12px;
  padding: 8px 10px;
}

.managed-list__address {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 700;
}

.managed-list__empty {
  border: 1px dashed var(--line-strong);
  background: var(--surface-2);
  border-radius: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  padding: 14px;
  text-align: center;
}

.category-card {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 16px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 58px;
}

.category-name {
  font-weight: 700;
  font-size: 14px;
}

.total-block-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1.1fr);
  gap: 18px;
  align-items: start;
}

.total-block-hero {
  display: grid;
  gap: 16px;
}

.total-block-status {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  width: max-content;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--success-text);
  background: var(--success-bg);
  border: 1px solid #cfead6;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.total-block-status.is-active {
  color: var(--danger-text);
  background: var(--danger-bg);
  border-color: #ffd1d1;
}

.emergency-button-wrap {
  display: grid;
  place-items: center;
  padding: 12px 0 4px;
}

.emergency-button {
  width: min(170px, 56vw);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 8px solid #ffe1e1;
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 18px;
  font-size: 15px;
  line-height: 1.1;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
  background:
    radial-gradient(circle at 34% 26%, rgba(255,255,255,.45), rgba(255,255,255,0) 25%),
    linear-gradient(145deg, #ff5151 0%, #d61f1f 48%, #8d1010 100%);
  box-shadow:
    inset 0 -14px 22px rgba(78,4,4,.34),
    0 16px 28px rgba(154,28,28,.18);
}

.emergency-button:focus-visible {
  outline: 4px solid rgba(15,61,145,.25);
  outline-offset: 6px;
}

.emergency-button small {
  display: block;
  margin-top: 7px;
  font-size: 9px;
  letter-spacing: .12em;
}

.total-block-summary {
  display: grid;
  gap: 10px;
}

.summary-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  border: 1px solid #edf2f7;
  background: #fbfdff;
  border-radius: 12px;
  padding: 10px 12px;
}

.summary-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.summary-row strong {
  color: var(--primary);
  font-size: 13px;
  text-align: right;
}

.block-page-preview {
  border-radius: 18px;
  border: 1px solid var(--line);
  overflow: hidden;
  background: #fff;
}

.block-page-preview__bar {
  display: flex;
  gap: 7px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.block-page-preview__bar span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #c9d6e6;
}

.block-page-preview__body {
  padding: 26px 22px;
  min-height: 230px;
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
  gap: 10px;
}

.block-page-preview--real {
  border-radius: 18px;
  box-shadow: none;
}

.block-page-preview--real .block-page-preview__body {
  min-height: 300px;
}

.block-page-preview__mark {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--danger-text);
  background: var(--danger-bg);
  border: 1px solid #ffd1d1;
  font-size: 30px;
  font-weight: 900;
}

.block-page-preview h3 {
  margin: 0;
  font-size: 22px;
}

.block-page-preview p {
  margin: 0;
  max-width: 420px;
  color: var(--muted);
  line-height: 1.55;
}

.schedule-card {
  margin-top: 18px;
}

.schedule-list {
  display: grid;
  gap: 10px;
}

.schedule-row {
  display: grid;
  grid-template-columns: 112px repeat(2, minmax(100px, 1fr)) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid #edf2f7;
  background: #fbfdff;
  border-radius: 14px;
  padding: 10px;
}

.schedule-day {
  font-weight: 800;
}

.schedule-row label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.schedule-row input[type="time"] {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  padding: 9px 10px;
}

.schedule-note {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.block-page {
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(15,61,145,.08), rgba(23,135,168,.08)),
    #f5f7fb;
}

.block-page-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.block-page-card {
  width: min(560px, 100%);
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 30px;
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 14px;
}

.block-page-logo {
  width: 78px;
  height: 78px;
  object-fit: contain;
}

.block-page-mark {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--danger-text);
  background: var(--danger-bg);
  border: 1px solid #ffd1d1;
  font-size: 30px;
  font-weight: 900;
}

.block-page-card h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1.05;
}

.block-page-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
  max-width: 460px;
}

.block-page-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 4px;
}

.switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex: 0 0 auto;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  inset: 0;
  background: #d7e2f1;
  border-radius: 999px;
  transition: .2s;
  cursor: pointer;
}

.slider:before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(15,23,42,.18);
  transition: .2s;
}

.switch input:checked + .slider {
  background: linear-gradient(90deg,var(--primary),var(--primary-2));
}

.switch input:checked + .slider:before {
  transform: translateX(20px);
}

.help-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.help-card {
  border-radius: 20px;
  padding: 18px;
  min-height: 170px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.help-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, #eff5ff, #f8fbff);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 28px;
}

.help-card h3,
.help-article h3 {
  margin: 0;
  font-size: 18px;
}

.help-card p,
.help-article p,
.help-article li {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.help-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 18px;
}

.tutorial-nav {
  border-radius: 20px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tutorial-link {
  padding: 12px 14px;
  border-radius: 12px;
  color: var(--muted);
  font-weight: 600;
  border: 1px solid transparent;
}

.tutorial-link.active {
  background: #eff5ff;
  color: var(--primary);
  border-color: #d6e6ff;
}

.help-article {
  border-radius: 20px;
  padding: 18px;
}

.hero-image {
  height: 210px;
  border-radius: 18px;
  margin-bottom: 14px;
  background:
    linear-gradient(135deg, rgba(15,61,145,.12), rgba(23,135,168,.08)),
    radial-gradient(circle at top right, rgba(212,166,61,.18), transparent 38%),
    #f6faff;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  color: var(--primary);
  font-size: 54px;
  font-weight: 800;
}

.steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-left: 18px;
}

.footer {
  margin-top: auto;
  padding: 8px 20px 22px;
}

.footer-inner {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding-top: 14px;
}

.btn {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
}

.btn.primary {
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  color: #fff;
  border: none;
}

.btn.danger {
  background: var(--danger-bg);
  color: var(--danger-text);
  border-color: #ffd1d1;
}

.btn:disabled,
.input:disabled {
  cursor: not-allowed;
  opacity: .62;
}

.monitored-ips-card {
  max-width: 980px;
}

.tenant-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.tenant-form label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.tenant-form .input {
  margin-bottom: 0;
}

.limit-pill {
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--primary);
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 800;
}

.tenant-management-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.tenant-management-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: 16px;
  min-height: 118px;
}

.tenant-management-ip {
  font-size: 18px;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.tenant-management-label {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.tenant-management-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-start;
  min-width: 0;
}

.tenant-management-actions form {
  margin: 0;
}

.tenant-management-actions .btn {
  min-width: 98px;
  text-align: center;
  white-space: nowrap;
}

.empty-state-card {
  max-width: 720px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.35);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal-backdrop.open {
  display: flex;
}

.modal-panel {
  border-radius: 22px;
  width: min(460px, 100%);
  padding: 18px;
}

.modal-title {
  margin: 0 0 8px;
  font-size: 20px;
}

.modal-text {
  margin: 0 0 14px;
  color: var(--muted);
}

.input {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 12px 14px;
  background: #fbfdff;
  margin-bottom: 16px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

@media (max-width: 1180px) {
  .page-grid-dashboard,
  .page-grid-lists,
  .total-block-layout,
  .help-grid,
  .tenant-management-grid,
  .help-layout {
    grid-template-columns: 1fr;
  }

  .page-grid-access {
    grid-template-columns: repeat(3, minmax(0,1fr));
  }
}

@media (max-width: 920px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }

  .totp-setup {
    grid-template-columns: 1fr;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
    overflow: visible;
  }

  .tenant-box {
    flex: initial;
    min-height: auto;
    overflow: visible;
  }

  .tenant-list {
    max-height: 320px;
    flex: initial;
  }

  .topbar-wrap {
    padding-top: 0;
  }

  .page-grid-access {
    grid-template-columns: repeat(2, minmax(0,1fr));
  }
}

@media (max-width: 640px) {
  .logo-box {
    padding: 10px 12px;
    gap: 10px;
  }

  .logo-box img {
    width: 52px;
    height: 52px;
    flex-basis: 52px;
  }

  .logo-text-main {
    font-size: 17px;
    grid-template-columns: 1fr;
  }

  .page-grid-access {
    grid-template-columns: 1fr;
  }

  .topbar {
    height: auto;
    padding: 14px;
    align-items: flex-start;
  }

  .menu {
    width: 100%;
  }

  .stream-row {
    grid-template-columns: 62px 1fr;
  }

  .stream-row .category {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .list-form,
  .schedule-row,
  .tenant-form,
  .managed-list__row {
    grid-template-columns: 1fr;
  }

  .tenant-management-card {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .tenant-management-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
    min-width: 0;
    width: 100%;
  }

  .tenant-management-actions .btn {
    width: 100%;
    min-width: 0;
  }
}
