:root {
  --ink-900: #141414;
  --ink-800: #1f1f1f;
  --ink-600: #3a3a3a;
  --ink-500: #4a4a4a;
  --ink-400: #666;
  --ink-200: #d9d9d9;
  --ink-100: #f1f1f1;
  --brand-500: #1f5eff;
  --brand-600: #1a4dd1;
  --accent-500: #0a9b8a;
  --danger-500: #c0392b;
  --bg-1: #f7f6f3;
  --bg-2: #e6edf7;
  --card: #ffffff;
  --shadow: 0 12px 30px rgba(20, 20, 20, 0.12);
  --radius-lg: 18px;
  --radius-md: 12px;
 }

 * {
  box-sizing: border-box;
 }

 body {
  margin: 0;
  font-family: "Trebuchet MS", "Lucida Grande", "Segoe UI", sans-serif;
  background: var(--public-bg, radial-gradient(circle at top, var(--bg-2), var(--bg-1)));
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: var(--ink-900);
 }

 a {
  color: inherit;
  text-decoration: none;
 }

 .container {
  max-width: 1100px;
  margin: 24px auto 64px;
  padding: 0 20px;
 }

 .messages {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
 }

 .msg {
  padding: 10px 14px;
  border-radius: 10px;
  margin: 10px 0;
  font-size: 0.95rem;
 }

 .msg.error {
  background: #ffe7e7;
  color: #8f1d1d;
 }

 .msg.success {
  background: #e8fff5;
  color: #0b6d62;
 }

.public-shell {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.public-banner {
  width: 100%;
  display: flex;
  justify-content: center;
}

.public-banner-img {
  width: 100%;
  max-height: 160px;
  object-fit: contain;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  background: #ffffff;
  padding: 12px;
}

.brand-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  background: var(--public-banner, var(--ink-900));
  color: var(--public-banner-text, #fff);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

 .brand-mark {
  background: #fff;
  color: var(--ink-900);
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  letter-spacing: 0.06em;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
 }

 .brand-mark img {
  height: 26px;
  width: auto;
  display: block;
 }

 .brand-title {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
 }

 .brand-title span {
  font-size: 1.15rem;
  font-weight: 700;
 }

.brand-title small {
  color: inherit;
  opacity: 0.75;
}

.ghost-link {
  color: #ffffff;
  font-size: 0.9rem;
  padding: 6px 12px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  background: var(--public-logout-bg, rgba(255, 255, 255, 0.08));
}

.ghost-link:hover {
  background: color-mix(in srgb, var(--public-logout-bg, rgba(255, 255, 255, 0.08)) 80%, #ffffff 20%);
}

 .public-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
 }

.public-grid.single {
  grid-template-columns: minmax(320px, 1fr);
}

.captive-shell {
  --portal-banner: #141414;
  --portal-banner-text: #ffffff;
  padding: 32px 0 48px;
  min-height: 70vh;
  background: transparent;
  display: grid;
  gap: 18px;
  max-width: 500px;
  margin: 0 auto;
}

.captive-banner img {
  width: 100%;
  max-height: 160px;
  object-fit: contain;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  background: #ffffff;
  padding: 12px;
  display: block;
}

.captive-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--ink-200);
  box-shadow: var(--shadow);
  padding: 18px;
}

.captive-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--portal-banner);
  color: var(--portal-banner-text);
  padding: 12px 14px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

.captive-mark {
  background: #ffffff;
  color: var(--ink-900);
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  min-height: 28px;
}

.captive-mark img {
  height: 20px;
  width: auto;
  display: block;
}

.captive-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.captive-title-wrap span {
  font-size: 12px;
  opacity: 0.75;
}

.captive-card-body form {
  display: grid;
  gap: 10px;
}

.captive-card-body h2 {
  margin-top: 0;
}

.portal-devices {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--ink-200);
}

.portal-devices-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.portal-device-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.portal-device-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-md);
  background: #f8fafc;
}

.portal-device-mac {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.panel {
  background: var(--card);
  padding: 24px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  width: 100%;
}

.panel-list {
  padding: 26px 26px 22px;
}

 .panel-hero {
  background: linear-gradient(135deg, #ffffff, #f4f7ff);
 }

 h1,
 h2 {
  margin-top: 0;
  color: var(--ink-900);
 }

.hero-list {
  margin: 18px 0 0;
  padding-left: 18px;
  color: var(--ink-500);
}

.hero-copy p {
  margin: 0 0 12px;
}

.hero-copy p:last-child {
  margin-bottom: 0;
}

 .hero-list li {
  margin-bottom: 8px;
 }

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

.form-row {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 14px;
  align-items: end;
}

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

 label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-400);
  font-weight: 600;
 }

 input,
 select {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--ink-200);
  font-size: 1rem;
  background: #fff;
 }

 input:focus,
 select:focus {
  outline: 2px solid rgba(31, 94, 255, 0.25);
  border-color: var(--brand-500);
 }

 .primary {
  background: var(--brand-500);
  color: #fff;
  border: none;
  padding: 12px 16px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
 }

 .button {
  background: #fff;
  border: 1px solid var(--ink-200);
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 0.9rem;
  cursor: pointer;
 }

 .button.ghost {
  background: transparent;
 }

 .danger {
  background: var(--danger-500);
  color: #fff;
  border: none;
 }

 .row {
  display: flex;
  gap: 12px;
  align-items: center;
 }

 .muted {
  color: var(--ink-400);
 }

 .static-pill {
  padding: 10px 12px;
  background: var(--ink-100);
  border-radius: 10px;
  font-weight: 600;
 }

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.panel-header h2 {
  font-size: 1.25rem;
  letter-spacing: 0.01em;
}

.panel-header .muted {
  font-size: 0.9rem;
}

.panel-actions {
  margin-top: 12px;
}

.filter-row {
  display: grid;
  grid-template-columns: 1.3fr 0.9fr 0.9fr auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
  padding: 12px;
  background: #f7f7f9;
  border-radius: 14px;
  border: 1px solid var(--ink-100);
}

.filter-row input,
.filter-row select {
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--ink-200);
  padding: 10px 12px;
  font-size: 0.95rem;
}

.public-table th.check,
.public-table td.check {
  width: 38px;
}

.inline-form {
  display: inline-flex;
}

.bulk-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}

.bulk-actions-top {
  margin: 0 0 10px;
  justify-content: flex-start;
}

.table-tools {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 10px;
  padding: 8px 10px;
  border: 1px solid var(--ink-200);
  border-radius: 12px;
  background: #f3f4f7;
}

.table-wrap {
  overflow-x: hidden;
  border: 1px solid var(--ink-200);
  border-radius: 16px;
  padding: 12px;
  background: #fff;
}

.public-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
  font-size: 0.95rem;
  table-layout: fixed;
}

.public-table th {
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #5a5a5a;
  padding: 14px 12px 10px;
  border-bottom: 1px solid var(--ink-200);
  font-weight: 700;
}

.public-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--ink-100);
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.public-table thead {
  background: linear-gradient(180deg, #ffffff, #fafafa);
}

 .public-table tr:nth-child(even) {
  background: #fafafa;
 }


.public-table td.actions,
.itemlist td.actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  padding-right: 16px;
}

.public-table th.actions,
.itemlist th.actions {
  text-align: right;
  padding-right: 16px;
}

.public-table td.actions {
  overflow: visible;
  padding-top: 10px;
  padding-bottom: 10px;
}

.public-table td.actions .button {
  min-width: 76px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--ink-200);
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  position: relative;
  vertical-align: middle;
  font-size: 0;
  line-height: 0;
}

.icon-btn svg {
  width: 16px;
  height: 16px;
  fill: var(--ink-500);
  display: block;
}

.icon-btn:hover {
  border-color: var(--ink-400);
}

.icon-btn.danger {
  border-color: rgba(192, 57, 43, 0.3);
  background: rgba(192, 57, 43, 0.08);
}

.icon-btn.danger svg {
  fill: var(--danger-500);
}

.icon-btn::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: 110%;
  transform: translate(-50%, 6px);
  background: #1f1f1f;
  color: #fff;
  font-size: 0.7rem;
  padding: 6px 8px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease, transform 120ms ease;
}

.icon-btn:hover::after,
.icon-btn:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.icon-btn.info::after {
  content: none;
}

.icon-btn.info {
  display: none;
  border-color: rgba(31, 94, 255, 0.25);
  background: rgba(31, 94, 255, 0.06);
}

.icon-btn.info svg {
  fill: var(--brand-500);
}

.icon-btn.info .info-pop {
  position: absolute;
  right: 0;
  top: 120%;
  min-width: 180px;
  background: #1f1f1f;
  color: #fff;
  font-size: 0.72rem;
  line-height: 1.4;
  padding: 10px 12px;
  border-radius: 10px;
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 120ms ease, transform 120ms ease;
  text-align: left;
  z-index: 10;
}

.icon-btn.info.is-open .info-pop {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

 .status-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
 }

 .status-synced {
  background: rgba(10, 155, 138, 0.15);
  color: #087565;
 }

 .status-pending {
  background: rgba(31, 94, 255, 0.15);
  color: #1a4dd1;
 }

.status-error {
  background: rgba(192, 57, 43, 0.15);
  color: #a12d21;
}

.status-unknown {
  background: rgba(120, 128, 140, 0.16);
  color: #5c6672;
}

.portal-preview {
  --preview-banner: #2b2b2b;
  --preview-banner-text: #ffffff;
  border-radius: 16px;
  background: #f5f6fa;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px #e2e6ee;
}
.portal-preview-banner {
  background: var(--preview-banner);
  color: var(--preview-banner-text);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
}
.portal-preview-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
}
.portal-preview-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.portal-preview-title {
  font-size: 14px;
  font-weight: 600;
}
.portal-preview-body {
  padding: 16px;
}
.portal-preview-subtitle {
  font-size: 13px;
  color: #3b3f4c;
}

@media (max-width: 720px) {
  .brand-bar {
    flex-direction: column;
    align-items: flex-start;
  }
  .row {
    flex-direction: column;
    align-items: stretch;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .panel {
    padding: 18px;
    border-radius: 14px;
  }
  .panel-list {
    padding: 18px;
  }
  .filter-row {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 10px;
  }
  .filter-row input,
  .filter-row select {
    padding: 8px 10px;
    font-size: 0.9rem;
  }
  .public-table {
    table-layout: auto;
  }
  .public-table th.col-group,
  .public-table td.col-group,
  .public-table th.col-desc,
  .public-table td.col-desc {
    display: none;
  }
  .public-table th,
  .public-table td {
    padding: 10px 8px;
    font-size: 0.85rem;
  }
  .public-table td.col-mac {
    font-size: 0.85rem;
  }
  .public-table th.col-status,
  .public-table td.col-status {
    display: none;
  }
  .public-table td.actions {
    gap: 6px;
  }
  .status-badge {
    padding: 3px 8px;
    font-size: 0.65rem;
  }
  .icon-btn {
    width: 30px;
    height: 30px;
    border-radius: 9px;
  }
  .icon-btn svg {
    width: 14px;
    height: 14px;
  }
  .icon-btn.info {
    display: inline-flex;
  }
  .captive-shell {
    padding: 20px 0 32px;
    gap: 14px;
  }
  .captive-banner img {
    max-height: 120px;
    padding: 8px;
    border-radius: 14px;
  }
  .captive-card {
    padding: 14px;
    border-radius: 14px;
  }
  .captive-card-header {
    padding: 10px 12px;
    border-radius: 12px;
  }
}
