:root {
  color-scheme: light;
  --bg: #f4f1eb;
  --panel: #ffffff;
  --ink: #1c1b1a;
  --muted: #6f6b66;
  --accent: #d36f4c;
  --accent-dark: #b35738;
  --line: #e3dfd6;
  --shadow: 0 18px 40px rgba(32, 28, 24, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Work Sans", "Segoe UI", Tahoma, sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top, #fff8ef 0%, #f4f1eb 45%, #ede7dd 100%);
  min-height: 100vh;
}

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

.table a {
  color: #1c64d1;
  text-decoration: underline;
}

.app {
  display: flex;
  min-height: 100vh;
  align-items: flex-start;
}

.sidebar {
  width: 260px;
  background: linear-gradient(180deg, #fef7ec 0%, #f7efe2 100%);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  height: 100vh;
  overflow: hidden;
  padding: 24px 20px 80px;
  gap: 18px;
  position: sticky;
  top: 0;
}

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

.menu-toggle {
  display: none;
  background: var(--accent);
  border: 1px solid var(--accent-dark);
  border-radius: 12px;
  padding: 8px 12px;
  color: #fff;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.menu-toggle-bar {
  display: block;
  height: 2px;
  background: #fff;
  border-radius: 2px;
}

.menu-toggle-icon {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.menu-toggle-label {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
}

.brand-logout {
  display: none;
}

.logo {
  width: 120px;
  height: auto;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.08));
}

.session-timer {
  font-size: 14px;
  color: var(--muted);
  background: #fff;
  border: 1px dashed var(--line);
  padding: 8px 12px;
  border-radius: 8px;
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.menu-meta {
  margin-top: 12px;
}

.menu-meta .session-timer {
  width: 100%;
}

.menu-item {
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 600;
  color: var(--muted);
  transition: background 0.2s ease, color 0.2s ease;
}

.menu-item:hover {
  background: rgba(211, 111, 76, 0.12);
  color: var(--ink);
}

.menu-item.active {
  background: rgba(211, 111, 76, 0.2);
  color: var(--ink);
}

.menu-section {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 14px 8px 2px;
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 14px;
  color: var(--muted);
  margin-top: auto;
}

.content {
  flex: 1;
  padding: 32px 40px 120px;
}

@media (max-width: 900px) {
  .app {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    padding: 12px 14px 16px;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .brand {
    flex-direction: row;
    align-items: center;
    flex-wrap: nowrap;
    gap: 10px;
  }

  .logo {
    width: 80px;
  }

  .menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .brand-logout {
    display: inline-block;
    margin-left: auto;
  }

  .brand-logout .button {
    padding: 8px 12px;
  }

  .session-timer {
    flex: 1 1 160px;
    font-size: 12px;
    padding: 6px 10px;
  }

  .menu {
    display: none;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
    padding-top: 8px;
  }

  .menu-item {
    text-align: center;
  }

  .sidebar-footer {
    display: none;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
  }

  .sidebar-footer .button {
    width: 100%;
  }

  .user-info {
    width: 100%;
  }

  .content {
    padding: 20px 16px 80px;
  }

  .card {
    padding: 18px;
    border-radius: 14px;
  }

  .page-title {
    font-size: 24px;
  }

  .table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .sidebar.open .menu {
    display: grid;
  }

  .sidebar.open .sidebar-footer {
    display: flex;
  }
}

.page-title {
  font-size: 28px;
  margin: 0 0 18px;
}

.subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.subnav .button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.prompt-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  align-items: end;
  margin: 16px 0 18px;
}

.prompt-tabs .button {
  width: 100%;
}

.prompt-tabs .button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.prompt-filter label {
  margin-bottom: 4px;
}

.prompt-grid {
  display: grid;
  gap: 18px;
}

.prompt-block {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffaf3;
}

.dashboard-sections > div + div {
  margin-top: 18px;
}

.card {
  background: var(--panel);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 24px;
  border: 1px solid var(--line);
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.two {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

label {
  display: block;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 6px;
}

input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font-size: 15px;
  background: #fff;
}

.ip-group {
  display: contents;
}

.ip-group.hidden {
  display: none;
}

button, .button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 15px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s ease;
}

.access-prompt-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.link-button {
  width: 100%;
  text-align: left;
  background: #fff1e4;
  border: 1px solid #f2d0ba;
  color: #7a4d34;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.link-button:hover {
  background: #ffe5d2;
}

.link-button.compact {
  width: auto;
  display: inline-block;
  padding: 6px 12px;
  font-size: 14px;
}

.link-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.icon-button {
  padding: 8px 10px;
  line-height: 1;
  min-width: 38px;
  text-align: center;
}

button:hover, .button:hover {
  background: var(--accent-dark);
}

.button.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
}

.notice {
  padding: 12px 14px;
  border-radius: 10px;
  background: #fff5e8;
  border: 1px solid #f2d9c5;
  color: #7a4d34;
  margin-bottom: 16px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th, .table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.table .users-split {
  border-right: 1px solid var(--line);
}

.route-active {
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 2px;
}

.rpki-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: 4px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--line);
  line-height: 1;
}

.rpki-valid {
  color: #1f7a3d;
  background: rgba(31, 122, 61, 0.12);
  border-color: rgba(31, 122, 61, 0.35);
}

.rpki-invalid {
  color: #a63a2d;
  background: rgba(166, 58, 45, 0.12);
  border-color: rgba(166, 58, 45, 0.35);
}

.rpki-unknown {
  color: #7a5b12;
  background: rgba(122, 91, 18, 0.12);
  border-color: rgba(122, 91, 18, 0.35);
}

.table th {
  color: var(--muted);
  font-weight: 600;
}

.table.compact th,
.table.compact td {
  padding: 6px 8px;
}

.icon-actions {
  display: inline-block;
  margin-right: 6px;
}

.icon-button {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
}

.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: rgba(211, 111, 76, 0.15);
  color: #7a3f28;
}

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

.button-stack .button {
  width: 100%;
  text-align: center;
}

.qr-code {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  background: #fff;
}

.filter-panel {
  margin-top: 12px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.8), rgba(250, 247, 244, 0.95));
  box-shadow: 0 10px 24px rgba(30, 20, 10, 0.06);
}

.filter-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.filter-item {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
  align-items: start;
  font-size: 14px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.filter-item input {
  margin-top: 3px;
  width: 16px;
  height: 16px;
  accent-color: #d36f4c;
}

.filter-item span {
  color: #3e2b22;
  line-height: 1.3;
  font-weight: 600;
}

.row-hidden {
  display: none;
}

.asn-summary {
  margin-top: 10px;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(280px, 1.2fr) minmax(260px, 1fr);
}

.asn-meta {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 8px 18px rgba(30, 20, 10, 0.06);
}

.asn-meta-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 12px;
  padding: 8px 4px;
  border-bottom: 1px dashed var(--line);
}

.asn-meta-row:last-child {
  border-bottom: none;
}

.asn-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.asn-value {
  color: #2a1a14;
  font-weight: 600;
}

.asn-stats {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.stat-card {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 8px 18px rgba(30, 20, 10, 0.05);
}

.stat-label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.stat-value {
  margin-top: 6px;
  font-size: 20px;
  font-weight: 700;
  color: #2a1a14;
}

.asset-result {
  margin-top: 12px;
}

.asset-tree {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 8px 18px rgba(30, 20, 10, 0.05);
}

.asset-node {
  padding: 10px 12px;
  border-left: 2px solid rgba(211, 111, 76, 0.25);
  margin-left: 6px;
}

.asset-node + .asset-node {
  margin-top: 8px;
}

.asset-node-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.asset-link {
  color: #5c2d1a;
}

.asset-link.asset-duplicate {
  color: #7a1d0c;
  background: #f6c9bc;
  padding: 4px 8px;
  border-radius: 999px;
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(122, 29, 12, 0.2);
}

.asset-members {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.asset-asn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(211, 111, 76, 0.12);
  color: #5c2d1a;
  font-size: 13px;
  font-weight: 600;
}

.asset-asn.asset-duplicate {
  background: #f6c9bc;
  color: #7a1d0c;
  box-shadow: 0 0 0 1px rgba(122, 29, 12, 0.25), 0 4px 10px rgba(122, 29, 12, 0.18);
}

.asset-link.asset-missing {
  color: #7a1d0c;
  background: #fde6e0;
  border: 1px solid rgba(122, 29, 12, 0.35);
  padding: 4px 8px;
  border-radius: 999px;
}

.badge-cache {
  background: rgba(62, 98, 138, 0.12);
  color: #27435f;
  border: 1px solid rgba(62, 98, 138, 0.25);
}

.asset-asn-name {
  color: #6f4d40;
  font-weight: 500;
  font-size: 12px;
}

.asset-children {
  margin-top: 10px;
  margin-left: 12px;
  padding-left: 12px;
  border-left: 1px dashed rgba(211, 111, 76, 0.3);
}

.asset-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: flex-end;
}

.asset-form {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.asset-form > div:first-child {
  flex: 1 1 360px;
}

.asset-refresh {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(211, 111, 76, 0.12);
  color: #5c2d1a;
  font-size: 13px;
  font-weight: 600;
}

.asset-refresh input {
  width: 16px;
  height: 16px;
  accent-color: #d36f4c;
}

.asset-prefix-filters {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 8px 0 12px;
}

.asset-prefix-filters label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(211, 111, 76, 0.12);
  color: #5c2d1a;
  font-size: 13px;
  font-weight: 600;
}

.asset-prefix-filters input {
  width: 14px;
  height: 14px;
  accent-color: #d36f4c;
}

@media (max-width: 720px) {
  .asset-controls {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

@media (max-width: 980px) {
  .asn-summary {
    grid-template-columns: 1fr;
  }
  .asn-meta-row {
    grid-template-columns: 1fr;
  }
  .asn-label {
    font-size: 12px;
  }
}

@media (max-width: 960px) {
  .col-more-specifics {
    display: none;
  }
}

@media (max-width: 720px) {
  .col-netname {
    display: none;
  }
}

.login-wrap {
  max-width: 420px;
  margin: 10vh auto;
  margin-bottom: calc(10vh + 56px);
  padding: 24px;
  background: var(--panel);
  border-radius: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}

.login-title {
  font-size: 24px;
  margin-top: 0;
}

.env-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #1c1b1a;
  color: #fff;
  padding: 12px 16px;
  font-size: 16px;
  text-align: center;
  letter-spacing: 0.02em;
}
