﻿*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

    @font-face {
      font-family: 'Press Start 2P';
      font-style: normal;
      font-weight: 400;
      font-display: swap;
      src: url('/assets/press-start-2p.woff2') format('woff2');
    }
    @font-face {
      font-family: 'Space Grotesk';
      font-style: normal;
      font-weight: 300 700;
      font-display: swap;
      src: url('/assets/space-grotesk.woff2') format('woff2');
    }

    :root {
      --white:   #ffffff;
      --off:     #f9f9f9;
      --black:   #0a0a0a;
      --dim:     #444;
      --muted:   #888;
      --line:    #e0e0e0;
      --cyan:    #00d4ff;
      --red:     #ff0040;
      --magenta: #cc00ff;
      --yellow:  #ffcc00;
      --green:   #00ff88;
      --pixel:   'Press Start 2P', cursive;
      --body:    'Space Grotesk', sans-serif;
    }

    html { scroll-behavior: smooth; background: var(--white); }
    body {
      background: var(--white);
      color: var(--black);
      font-family: var(--body);
      -webkit-font-smoothing: antialiased;
      overflow-x: hidden;
      min-height: 100vh;
    }

    /* scanline texture */
    body::before {
      content: '';
      position: fixed; inset: 0; z-index: 9999;
      pointer-events: none;
      background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.018) 2px, rgba(0,0,0,0.018) 4px);
    }

    /* в”Ђв”Ђв”Ђ TOPBAR в”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђ */
    .topbar {
      position: sticky; top: 0; z-index: 500;
      height: 48px;
      background: var(--black);
      border-bottom: 2px solid var(--cyan);
      display: flex; align-items: stretch;
    }

    .topbar-logo {
      display: flex; align-items: center; gap: 10px;
      padding: 0 20px;
      border-right: 1px solid #1a1a1a;
      font-family: var(--pixel);
      font-size: 9px;
      color: var(--white);
      text-decoration: none;
      letter-spacing: 1px;
      flex-shrink: 0;
    }

    .logo-dot {
      width: 8px; height: 8px;
      border-radius: 50%;
      background: var(--cyan);
      animation: logopulse 2s ease-in-out infinite;
    }
    @keyframes logopulse {
      0%,100% { box-shadow: 0 0 0 0 rgba(0,212,255,0.6); }
      50%      { box-shadow: 0 0 0 6px rgba(0,212,255,0); }
    }

    .topbar-nav {
      display: flex; align-items: stretch;
      list-style: none;
      flex: 1;
    }

    .topbar-nav li { display: flex; }

    .topbar-nav button {
      font-family: var(--pixel);
      font-size: 7px;
      color: #555;
      background: transparent;
      border: none;
      border-bottom: 2px solid transparent;
      padding: 0 20px;
      cursor: pointer;
      letter-spacing: 1px;
      transition: color .15s, border-color .15s;
      white-space: nowrap;
    }
    .topbar-nav button:hover  { color: #aaa; }
    .topbar-nav button.active { color: var(--cyan); border-bottom-color: var(--cyan); }

    .topbar-tag {
      margin-left: auto;
      display: flex; align-items: center;
      padding: 0 20px;
      font-family: var(--pixel);
      font-size: 6px;
      color: #333;
    }

    /* в”Ђв”Ђв”Ђ VIEWS в”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђ */
    .view { display: none; }
    .view.active { display: block; animation: fadein .2s ease; }
    @keyframes fadein { from { opacity:0; transform:translateY(4px); } to { opacity:1; transform:none; } }

    /* в”Ђв”Ђв”Ђ STATUS VIEW в”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђ */
    .status-wrap {
      max-width: 860px;
      margin: 0 auto;
      padding: 48px 24px;
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 2px;
    }

    .panel {
      background: var(--off);
      border: 1px solid var(--line);
      padding: 28px;
      position: relative;
      overflow: hidden;
    }
    .panel::before {
      content: '';
      position: absolute; top: 0; left: 0; right: 0; height: 2px;
      background: linear-gradient(90deg, transparent, var(--cyan), transparent);
      background-size: 200%;
      animation: shimmer 4s ease infinite;
    }
    @keyframes shimmer { 0%,100%{background-position:0%} 50%{background-position:100%} }

    .panel-eyebrow {
      font-family: var(--pixel);
      font-size: 6px;
      color: var(--muted);
      letter-spacing: 2px;
      text-transform: uppercase;
      margin-bottom: 12px;
    }

    .panel h1 {
      font-family: var(--pixel);
      font-size: 18px;
      line-height: 1.5;
      margin-bottom: 12px;
    }

    .panel h3 {
      font-family: var(--pixel);
      font-size: 10px;
      line-height: 1.6;
      margin-bottom: 6px;
    }

    .badge {
      display: inline-flex; align-items: center; gap: 6px;
      font-family: var(--pixel);
      font-size: 6px;
      padding: 5px 10px;
      border: 1px solid;
      letter-spacing: 1px;
    }
    .badge::before { content:''; width:5px; height:5px; border-radius:50%; background:currentColor; }
    .badge-ok      { color: var(--green);   border-color: rgba(0,255,136,.3);  background: rgba(0,255,136,.06); }
    .badge-warn    { color: var(--yellow);  border-color: rgba(255,204,0,.3);  background: rgba(255,204,0,.06); }
    .badge-err     { color: var(--red);     border-color: rgba(255,0,64,.3);   background: rgba(255,0,64,.06); }

    .kv { margin: 20px 0; display: grid; grid-template-columns: 120px 1fr; gap: 10px 16px; }
    .kv dt { font-family: var(--pixel); font-size: 6px; color: var(--muted); align-self: center; }
    .kv dd { font-size: 13px; font-weight: 400; }

    code {
      font-family: 'JetBrains Mono', 'Courier New', monospace;
      font-size: 12px;
      background: #f0f0f0;
      border: 1px solid var(--line);
      padding: 2px 6px;
      color: var(--black);
    }

    .profile-type {
      font-family: var(--pixel);
      font-size: 6px;
      color: var(--muted);
      letter-spacing: 1px;
      text-transform: uppercase;
      margin-bottom: 6px;
    }

    .panel-desc { font-size: 13px; font-weight: 300; color: var(--dim); margin: 10px 0 14px; line-height: 1.7; }

    textarea.mono-box {
      font-family: 'JetBrains Mono', monospace;
      font-size: 11px;
      width: 100%;
      background: #f5f5f5;
      border: 1px solid var(--line);
      padding: 10px;
      color: var(--black);
      resize: none;
      outline: none;
      line-height: 1.6;
    }

    .btn-row { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }

    .btn {
      font-family: var(--pixel);
      font-size: 7px;
      padding: 10px 16px;
      border: none;
      cursor: pointer;
      text-decoration: none;
      display: inline-flex; align-items: center; gap: 6px;
      letter-spacing: 1px;
      transition: transform .08s, box-shadow .08s;
    }
    .btn:active { transform: translate(2px,2px); }

    .btn-primary  { background: var(--black); color: var(--white); box-shadow: 3px 3px 0 var(--cyan); }
    .btn-primary:hover  { box-shadow: 5px 5px 0 var(--cyan); transform: translate(-2px,-2px); }

    .btn-danger   { background: var(--red);   color: var(--white); box-shadow: 3px 3px 0 #7a0020; }
    .btn-danger:hover   { box-shadow: 5px 5px 0 #7a0020; transform: translate(-2px,-2px); }

    .btn-ghost    { background: transparent; color: var(--black); border: 1px solid var(--black); box-shadow: 3px 3px 0 var(--black); }
    .btn-ghost:hover    { box-shadow: 5px 5px 0 var(--black); transform: translate(-2px,-2px); }

    .btn-ghost-red { background: transparent; color: var(--red); border: 1px solid var(--red); box-shadow: 3px 3px 0 var(--red); }
    .btn-ghost-red:hover { box-shadow: 5px 5px 0 var(--red); transform: translate(-2px,-2px); }

    /* в”Ђв”Ђв”Ђ LOGIN VIEW в”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђ */
    .login-wrap {
      min-height: calc(100vh - 48px);
      display: flex; align-items: center; justify-content: center;
      padding: 40px 24px;
    }

    .login-shell { width: min(420px, 100%); }

    .login-brand {
      display: flex; align-items: center; gap: 10px;
      font-family: var(--pixel);
      font-size: 8px;
      color: var(--muted);
      margin-bottom: 20px;
    }

    .login-card {
      border: 1px solid var(--line);
      border-top: 2px solid var(--red);
      padding: 32px;
      background: var(--off);
    }

    .login-card h1 {
      font-family: var(--pixel);
      font-size: 14px;
      line-height: 1.6;
      margin-bottom: 8px;
    }

    .login-card p { font-size: 13px; font-weight: 300; color: var(--dim); line-height: 1.7; margin-bottom: 20px; }

    .ip-pill {
      font-family: 'JetBrains Mono', monospace;
      font-size: 11px;
      padding: 3px 8px;
      background: rgba(255,0,64,.06);
      border: 1px solid rgba(255,0,64,.25);
      color: var(--red);
    }

    .notice {
      font-family: var(--pixel);
      font-size: 6px;
      padding: 10px 14px;
      margin-bottom: 20px;
      letter-spacing: 1px;
    }
    .notice-ok  { background: rgba(0,255,136,.06); border: 1px solid rgba(0,255,136,.3); color: var(--green); }

    .form-field { margin-bottom: 20px; }
    .form-field label {
      display: block;
      font-family: var(--pixel);
      font-size: 6px;
      color: var(--muted);
      letter-spacing: 1px;
      margin-bottom: 8px;
    }
    .form-field input {
      width: 100%;
      font-family: var(--body);
      font-size: 14px;
      font-weight: 400;
      background: var(--white);
      border: 1px solid var(--line);
      border-bottom: 2px solid var(--black);
      padding: 10px 12px;
      color: var(--black);
      outline: none;
      transition: border-color .15s;
    }
    .form-field input:focus { border-bottom-color: var(--cyan); }

    /* в”Ђв”Ђв”Ђ CRM VIEW в”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђ */
    .crm-layout {
      display: grid;
      grid-template-columns: 200px 1fr;
      min-height: calc(100vh - 48px);
    }

    /* sidebar */
    .crm-sidebar {
      background: var(--black);
      border-right: 1px solid #1a1a1a;
      padding: 24px 0;
      position: sticky;
      top: 48px;
      height: calc(100vh - 48px);
      overflow-y: auto;
      display: flex;
      flex-direction: column;
    }

    .sidebar-section {
      font-family: var(--pixel);
      font-size: 5px;
      color: #333;
      letter-spacing: 2px;
      padding: 0 16px 8px;
      text-transform: uppercase;
    }

    .sidebar-nav { list-style: none; flex: 1; }

    .sidebar-nav button {
      width: 100%;
      text-align: left;
      font-family: var(--pixel);
      font-size: 7px;
      color: #555;
      background: transparent;
      border: none;
      border-left: 2px solid transparent;
      padding: 12px 16px;
      cursor: pointer;
      letter-spacing: 1px;
      transition: color .15s, border-color .15s, background .15s;
      display: flex; align-items: center; gap: 10px;
    }
    .sidebar-nav button:hover  { color: #aaa; background: rgba(255,255,255,.03); }
    .sidebar-nav button.active { color: var(--cyan); border-left-color: var(--cyan); background: rgba(0,212,255,.05); }

    .sidebar-nav .nav-icon {
      font-size: 8px;
      opacity: .6;
    }

    /* crm main */
    .crm-main { padding: 36px 40px; }

    .crm-pane { display: none; animation: fadein .2s ease; }
    .crm-pane.active { display: block; }

    .crm-header {
      display: flex; justify-content: space-between; align-items: flex-end;
      margin-bottom: 32px; gap: 20px; flex-wrap: wrap;
    }

    .crm-header h2 {
      font-family: var(--pixel);
      font-size: clamp(14px, 2.5vw, 22px);
      line-height: 1.5;
    }

    .crm-eyebrow {
      font-family: var(--pixel);
      font-size: 6px;
      color: var(--muted);
      letter-spacing: 2px;
      margin-bottom: 6px;
    }

    /* stat cards */
    .stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; margin-bottom: 2px; }

    .stat-card {
      background: var(--off);
      border: 1px solid var(--line);
      padding: 24px;
      position: relative;
      overflow: hidden;
      transition: border-color .15s;
    }
    .stat-card:hover { border-color: var(--cyan); }
    .stat-card:hover .stat-accent { width: 100%; }

    .stat-accent {
      position: absolute; top: 0; left: 0; height: 2px; width: 0;
      background: var(--cyan);
      transition: width .3s ease;
    }
    .stat-card:nth-child(2) .stat-accent { background: var(--yellow); }
    .stat-card:nth-child(3) .stat-accent { background: var(--green); }

    .stat-label { font-family: var(--pixel); font-size: 6px; color: var(--muted); letter-spacing: 1px; margin-bottom: 14px; }
    .stat-num   { font-family: var(--pixel); font-size: clamp(24px, 4vw, 40px); color: var(--black); margin-bottom: 10px; display: block; }

    /* table */
    .table-wrap { overflow-x: auto; border: 1px solid var(--line); }

    table { width: 100%; border-collapse: collapse; font-size: 13px; }
    thead tr { border-bottom: 2px solid var(--black); }
    th {
      font-family: var(--pixel);
      font-size: 6px;
      color: var(--muted);
      letter-spacing: 1px;
      text-transform: uppercase;
      padding: 12px 14px;
      text-align: left;
      white-space: nowrap;
      background: var(--off);
    }
    td {
      padding: 14px;
      border-bottom: 1px solid var(--line);
      vertical-align: middle;
      white-space: nowrap;
    }
    tr:hover td { background: rgba(0,212,255,.03); }
    tr:last-child td { border-bottom: none; }

    .mono { font-family: 'JetBrains Mono', monospace; font-size: 11px; }
    .td-sub { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }

    /* add device form */
    .add-form {
      background: var(--off);
      border: 1px solid var(--line);
      border-top: 2px solid var(--cyan);
      padding: 24px;
      display: grid;
      grid-template-columns: 1fr 1fr auto;
      gap: 14px;
      align-items: end;
      margin-bottom: 2px;
    }

    .add-form label {
      display: block;
      font-family: var(--pixel);
      font-size: 6px;
      color: var(--muted);
      letter-spacing: 1px;
      margin-bottom: 8px;
    }

    .add-form input {
      width: 100%;
      font-family: var(--body);
      font-size: 14px;
      background: var(--white);
      border: 1px solid var(--line);
      border-bottom: 2px solid var(--black);
      padding: 9px 11px;
      color: var(--black);
      outline: none;
      transition: border-color .15s;
    }
    .add-form input:focus { border-bottom-color: var(--cyan); }

    /* profiles grid */
    .profiles-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }

    .profile-card {
      background: var(--off);
      border: 1px solid var(--line);
      padding: 24px;
      position: relative;
      overflow: hidden;
    }
    .profile-card::before {
      content: '';
      position: absolute; top: 0; left: 0; right: 0; height: 2px;
      background: linear-gradient(90deg, transparent, var(--cyan), transparent);
      background-size: 200%;
      animation: shimmer 5s ease infinite;
    }
    .profile-card:nth-child(2)::before { 
      background: linear-gradient(90deg, transparent, var(--magenta), transparent);
      background-size: 200%;
    }

    .profile-head {
      display: flex; justify-content: space-between; align-items: flex-start;
      margin-bottom: 10px;
    }

    /* routing / settings */
    .settings-block {
      background: var(--off);
      border: 1px solid var(--line);
      border-top: 2px solid var(--black);
      padding: 28px;
      margin-bottom: 2px;
    }
    .settings-block h3 {
      font-family: var(--pixel);
      font-size: 10px;
      line-height: 1.6;
      margin-bottom: 20px;
    }
    .settings-block label {
      display: block;
      font-family: var(--pixel);
      font-size: 6px;
      color: var(--muted);
      letter-spacing: 1px;
      margin-bottom: 8px;
    }
    .settings-block input {
      width: 100%;
      font-family: 'JetBrains Mono', monospace;
      font-size: 13px;
      background: var(--white);
      border: 1px solid var(--line);
      border-bottom: 2px solid var(--black);
      padding: 10px 12px;
      color: var(--black);
      outline: none;
      margin-bottom: 16px;
      transition: border-color .15s;
    }
    .settings-block input:focus { border-bottom-color: var(--cyan); }

    /* в”Ђв”Ђв”Ђ QR MODAL в”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђ */
    .modal-overlay {
      position: fixed; inset: 0; z-index: 800;
      background: rgba(10,10,10,.85);
      display: none; place-items: center;
      padding: 24px;
      backdrop-filter: blur(2px);
    }
    .modal-overlay.open { display: grid; }

    .modal-box {
      background: var(--white);
      border: 2px solid var(--black);
      border-top: 2px solid var(--magenta);
      width: min(680px, 100%);
      max-height: 90vh;
      overflow-y: auto;
      padding: 32px;
    }

    .modal-head {
      display: flex; justify-content: space-between; align-items: center;
      margin-bottom: 28px;
    }

    .modal-head h2 { font-family: var(--pixel); font-size: 12px; line-height: 1.6; }

    .qr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }

    .qr-block { text-align: center; }

    .qr-title {
      font-family: var(--pixel);
      font-size: 7px;
      color: var(--muted);
      letter-spacing: 1px;
      margin-bottom: 16px;
    }

    .qr-art {
      display: inline-block;
      background: var(--white);
      border: 2px solid var(--black);
      padding: 14px;
      margin-bottom: 14px;
    }

    .qr-placeholder {
      width: 120px; height: 120px;
      background: repeating-conic-gradient(#111 0 25%, #fff 0 50%) 0/14px 14px;
    }

    /* в”Ђв”Ђв”Ђ FOOTER в”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђ */
    .crm-footer {
      background: var(--black);
      border-top: 2px solid var(--magenta);
      padding: 16px clamp(16px, 4vw, 40px);
      display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
    }
    .footer-name { font-family: var(--pixel); font-size: 8px; color: var(--white); }
    .footer-status {
      font-family: var(--pixel); font-size: 6px; color: var(--green);
      display: flex; align-items: center; gap: 8px;
    }
    .footer-status::before {
      content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--green);
      animation: pulse 2s ease-in-out infinite;
    }
    @keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.3} }
    .footer-copy { font-family: var(--pixel); font-size: 6px; color: #333; }

    /* в”Ђв”Ђв”Ђ ALERT BAR в”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђ */
    .alert-bar {
      font-family: var(--pixel);
      font-size: 6px;
      padding: 10px 14px;
      margin-bottom: 24px;
      letter-spacing: 1px;
      border: 1px solid rgba(0,255,136,.3);
      background: rgba(0,255,136,.06);
      color: var(--green);
    }

    /* в”Ђв”Ђв”Ђ RESPONSIVE в”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђ */
    @media (max-width: 900px) {
      .crm-layout { grid-template-columns: 1fr; }
      .crm-sidebar {
        position: static; height: auto;
        flex-direction: row; flex-wrap: wrap;
        padding: 12px 16px; gap: 4px;
        border-right: none; border-bottom: 1px solid #1a1a1a;
      }
      .sidebar-section { display: none; }
      .sidebar-nav { display: flex; flex-direction: row; flex-wrap: wrap; gap: 4px; }
      .sidebar-nav button {
        border-left: none; border-bottom: 2px solid transparent;
        padding: 8px 12px; font-size: 6px;
        width: auto;
      }
      .sidebar-nav button.active { border-left: none; border-bottom-color: var(--cyan); background: rgba(0,212,255,.08); }
      .crm-main { padding: 24px 16px; }
      .stat-grid { grid-template-columns: 1fr 1fr; }
      .add-form { grid-template-columns: 1fr; }
      .profiles-grid { grid-template-columns: 1fr; }
      .status-wrap { grid-template-columns: 1fr; }
      .qr-grid { grid-template-columns: 1fr; }
    }

    @media (max-width: 480px) {
      .stat-grid { grid-template-columns: 1fr; }
      .topbar-tag { display: none; }
    }

    @media (prefers-reduced-motion: reduce) {
      *, *::before, *::after { animation: none !important; transition: none !important; }
    }

/* Live application compatibility layer. */
body { display: block; padding: 0; background: var(--white); }
body > .shell {
  width: min(520px, calc(100% - 32px));
  margin: 72px auto;
}
body > .shell .brand,
body > header {
  background: var(--black);
  color: var(--white);
  border-bottom: 2px solid var(--cyan);
}
body > .shell .brand { margin: 0; padding: 16px 20px; font-family: var(--pixel); font-size: 8px; }
.mark { border-radius: 0 !important; background: var(--cyan) !important; color: var(--black) !important; box-shadow: 3px 3px 0 var(--magenta); }
body > .shell main {
  display: block;
  width: 100%;
  padding: 30px;
  background: var(--off);
  border: 1px solid var(--line);
  border-radius: 0;
  box-shadow: 7px 7px 0 var(--black);
}
body > .shell h1,
body > main h1,
body > main h2,
body > header .brand { font-family: var(--pixel); letter-spacing: 0; }
body > .shell h1 { font-size: 16px; line-height: 1.6; }
body > .shell p { color: var(--dim); font-size: 13px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; margin-bottom: 24px; }
.auth-tabs a { padding: 11px; border: 1px solid var(--line); color: var(--muted); font-family: var(--pixel); font-size: 7px; text-align: center; text-decoration: none; }
.auth-tabs a.active { border-color: var(--black); background: var(--black); color: var(--cyan); }
.registration-qr-wrap { display: grid; place-items: center; margin: 20px 0; }
.registration-qr { width: min(280px, 100%); padding: 12px; background: white; }
.ip { border-radius: 0 !important; background: #f0f0f0 !important; color: var(--black) !important; border: 1px solid var(--line); font-family: monospace; }
label { font-family: var(--pixel); font-size: 7px !important; letter-spacing: .5px; }
input, textarea, select {
  border-radius: 0 !important;
  border: 1px solid var(--line) !important;
  background: var(--white) !important;
  color: var(--black) !important;
  box-shadow: none !important;
}
input:focus, textarea:focus, select:focus { border-color: var(--cyan) !important; outline: 2px solid rgba(0,212,255,.18) !important; }
button, .profile-link {
  border-radius: 0 !important;
  font-family: var(--pixel) !important;
  font-size: 7px !important;
  letter-spacing: .5px;
}
button { background: var(--black) !important; color: var(--white) !important; box-shadow: 3px 3px 0 var(--cyan); }
button:hover { transform: translate(-1px,-1px); box-shadow: 5px 5px 0 var(--cyan); filter: none !important; }
button.secondary { background: var(--white) !important; color: var(--black) !important; border: 1px solid var(--black) !important; box-shadow: 3px 3px 0 var(--black); }
button.danger { background: var(--red) !important; box-shadow: 3px 3px 0 #78001e; }
.notice { border-radius: 0 !important; border: 1px solid currentColor; font-family: var(--pixel); font-size: 7px; line-height: 1.8; }
.notice.success { color: #008a4b !important; background: rgba(0,255,136,.06) !important; }
.notice.error { color: var(--red) !important; background: rgba(255,0,64,.05) !important; }

body > header {
  position: sticky; top: 0; z-index: 500;
  min-height: 48px; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
}
body > header .mark { width: 28px; height: 28px; display: grid; place-items: center; }
body > header .brand { display: flex; align-items: center; gap: 12px; font-size: 9px; }
.header-actions { font-family: var(--pixel); font-size: 6px; color: #777; }
body > main { width: min(1440px, 100%); margin: 0 auto; padding: 36px 40px; display: block; }
.hero { border-bottom: 2px solid var(--black); padding: 0 0 18px; margin-bottom: 24px; }
.hero h1 { font-size: 18px; line-height: 1.5; }
.layout { display: grid; gap: 2px; min-width: 0; }
.card, .toolbar-card {
  border: 1px solid var(--line) !important;
  border-radius: 0 !important;
  background: var(--off) !important;
  box-shadow: none !important;
  padding: 24px !important;
}
.card h2, .toolbar-card h2 { font-size: 10px; line-height: 1.6; margin-bottom: 16px; }
.toolbar-card { display: grid; grid-template-columns: 1fr 1.4fr; gap: 28px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: end; }
.table-wrap { border: 1px solid var(--line); overflow-x: auto; background: var(--white); }
.adaptive-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.routing-summary { display: flex; flex-wrap: wrap; gap: 0; margin: 0 0 18px; border: 1px solid var(--line); }
.routing-summary span { min-width: 150px; padding: 12px 16px; border-right: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.routing-summary span:last-child { border-right: 0; }
.routing-summary b { margin-right: 6px; color: var(--black); font-family: var(--pixel); font-size: 10px; }
.adaptive-ip-list { display: flex; flex-wrap: wrap; gap: 5px; min-width: 230px; }
.adaptive-ip-list code { white-space: nowrap; }
.admin-code-field { min-width: 180px; font-size: 6px !important; }
.admin-code-field input { min-width: 150px; margin-top: 5px; padding: 8px 9px; font-family: monospace; letter-spacing: 2px; }
.admin-page-nav {
  position: sticky; top: 48px; z-index: 450;
  display: flex; align-items: stretch; gap: 0; overflow-x: auto;
  padding: 0 max(16px, calc((100vw - 1440px) / 2));
  background: var(--black); border-bottom: 1px solid #222;
}
.admin-page-nav a {
  display: flex; align-items: center; gap: 7px; min-height: 42px; padding: 0 15px;
  color: #777; border-bottom: 2px solid transparent;
  font-family: var(--pixel); font-size: 6px; letter-spacing: .5px;
  text-decoration: none; white-space: nowrap;
}
.admin-page-nav a:hover { color: var(--white); }
.admin-page-nav a.active { color: var(--cyan); border-bottom-color: var(--cyan); background: rgba(0,212,255,.05); }
.admin-page-nav a span { min-width: 17px; padding: 3px 4px; color: var(--black); background: var(--yellow); text-align: center; }
.admin-eyebrow { margin: 0 0 8px !important; color: var(--muted) !important; font-family: var(--pixel); font-size: 6px !important; letter-spacing: 1px; text-transform: uppercase; }
.admin-section { display: none; min-width: 0; max-width: 100%; }
body[data-admin-section="dashboard"] .admin-section-dashboard,
body[data-admin-section="users"] .admin-section-users,
body[data-admin-section="profiles"] .admin-section-profiles,
body[data-admin-section="routing"] .admin-section-routing,
body[data-admin-section="subscription"] .admin-section-subscription,
body[data-admin-section="security"] .admin-section-security { display: block; }
body[data-admin-section="devices"] .admin-section-devices,
body[data-admin-section="requests"] .admin-section-requests { display: grid; grid-template-columns: 1fr; }
body[data-admin-section="devices"] .admin-request-list { display: none; }
body[data-admin-section="requests"] .admin-device-add { display: none; }
.admin-stat-grid { margin-bottom: 2px; }
.admin-stat-grid .stat-card { color: var(--black); text-decoration: none; }
.quick-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.quick-actions a { padding: 10px 14px; color: var(--black); border: 1px solid var(--black); box-shadow: 3px 3px 0 var(--cyan); font-family: var(--pixel); font-size: 7px; text-decoration: none; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { background: var(--black); color: #777; font-family: var(--pixel); font-size: 6px; letter-spacing: .5px; }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
tbody tr:hover { background: rgba(0,212,255,.04); }
.badge { border-radius: 0 !important; font-family: var(--pixel); font-size: 6px; }
.badge.ok { color: #008a4b; background: rgba(0,255,136,.06); border: 1px solid rgba(0,138,75,.3); }
.badge.warn { color: #9a7600; background: rgba(255,204,0,.08); border: 1px solid rgba(154,118,0,.3); }
.badge.muted { color: var(--muted); background: #f1f1f1; border: 1px solid var(--line); }
.profiles-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(280px,1fr)); gap: 2px; border: 0; }
.profile-card { border: 1px solid var(--line); background: var(--white); padding: 18px; }
.profile-kind { font-family: var(--pixel); font-size: 6px; letter-spacing: 1px; }
.profile-value { border-radius: 0 !important; background: #f5f5f5 !important; font-family: monospace; }
.profile-link { color: var(--black); border: 1px solid var(--black); padding: 9px 12px; box-shadow: 3px 3px 0 var(--black); }
.profile-qr-wrap { font-family: var(--pixel); font-size: 7px; }
.profile-qr, .qr { border-radius: 0 !important; border: 2px solid var(--black) !important; }
.modal { background: rgba(0,0,0,.72) !important; }
.modal-card { border-radius: 0 !important; border: 2px solid var(--cyan) !important; box-shadow: 8px 8px 0 var(--magenta) !important; }
.sub-log { background: var(--black) !important; color: var(--green) !important; border-radius: 0 !important; }

body > main > .face-card,
body > main > .status-card { border-radius: 0 !important; border: 1px solid var(--line) !important; box-shadow: none !important; background: var(--off) !important; }
body > main > .status-card:only-child { width: min(860px, 100%); margin: 12px auto; }
body > main:has(> .face-card) { max-width: 980px; margin: 46px auto; display: grid; grid-template-columns: 300px 1fr; gap: 2px; }
.face-card { padding: 28px !important; }
.status-card { padding: 28px !important; }
.status-card h1 { font-size: 18px; line-height: 1.5; }
.config-card { border-radius: 0 !important; background: var(--white) !important; }

@media (max-width: 900px) {
  body > main { padding: 24px 16px; }
  .toolbar-card { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .adaptive-heading { flex-wrap: wrap; }
  .routing-summary span { flex: 1 1 140px; }
  body > main:has(> .face-card) { grid-template-columns: 1fr; margin: 24px 16px; }
}
@media (max-width: 700px) {
  .admin-page-nav { top: 52px; padding: 0; }
  .admin-page-nav a { padding: 0 11px; }
}
@media (max-width: 560px) {
  body > header { align-items: flex-start; gap: 10px; padding: 12px 16px; }
  .header-actions { justify-content: flex-end; }
  body > .shell { margin: 32px auto; }
  body > .shell main { padding: 22px; box-shadow: 4px 4px 0 var(--black); }
  .profiles-grid { grid-template-columns: 1fr; }
}

/* Public Mikuru server profile. */
body.public-page { min-height: 100vh; background: var(--white); color: var(--black); }
.public-header {
  position: sticky; top: 0; z-index: 600; min-height: 54px; padding: 0 clamp(18px,4vw,56px);
  display: flex; align-items: stretch; justify-content: space-between;
  background: var(--black); border-bottom: 2px solid var(--cyan);
}
.public-brand { display: flex; align-items: center; gap: 12px; color: var(--white); font-family: var(--pixel); font-size: 9px; letter-spacing: 1px; text-decoration: none; }
.public-nav { display: flex; align-items: stretch; }
.public-nav-link { display: flex; align-items: center; padding: 0 18px; color: #777; border-bottom: 2px solid transparent; font-family: var(--pixel); font-size: 6px; text-decoration: none; }
.public-nav-link:hover { color: var(--white); }
.public-nav-primary { color: var(--cyan); border-bottom-color: var(--cyan); }
.public-main { width: 100%; max-width: none; margin: 0; padding: 0; }
.public-hero { position: relative; min-height: calc(100vh - 54px); padding: clamp(64px,10vh,110px) clamp(20px,7vw,100px) 54px; display: flex; flex-direction: column; justify-content: center; overflow: hidden; border-bottom: 2px solid var(--black); background: var(--white); }
.public-kicker { display: flex; align-items: center; gap: 10px; margin: 0 0 25px; color: var(--muted); font-family: var(--pixel); font-size: 6px; letter-spacing: 1px; text-transform: uppercase; }
.public-kicker span { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px rgba(0,255,136,.1); animation: pulse 2s ease-in-out infinite; }
.public-title-stage { position: relative; width: fit-content; max-width: 88%; isolation: isolate; }
.public-glitch {
  position: relative; align-self: flex-start; max-width: 100%;
  color: var(--black); font-family: var(--pixel); font-size: clamp(54px,12vw,156px); line-height: .95; letter-spacing: 1px;
  text-shadow: 7px 0 0 var(--cyan), -7px 0 0 var(--red);
  animation: public-glitch-shift 4.2s steps(1,end) infinite;
}
.public-miku-sticker {
  position: absolute;
  right: clamp(-145px,-10vw,-70px);
  bottom: clamp(-66px,-4vw,-30px);
  z-index: 3;
  width: clamp(170px,21vw,300px);
  height: auto;
  transform: scaleX(-1);
  transform-origin: center;
  pointer-events: none;
  user-select: none;
}
.public-glitch::before,.public-glitch::after { content: attr(data-text); position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.public-glitch::before { color: var(--magenta); clip-path: inset(12% 0 63% 0); transform: translate(-5px,2px); animation: public-glitch-a 2.7s steps(2,end) infinite; }
.public-glitch::after { color: var(--cyan); clip-path: inset(66% 0 9% 0); transform: translate(6px,-2px); animation: public-glitch-b 3.1s steps(2,end) infinite; }
@keyframes public-glitch-shift { 0%,88%,100%{transform:none} 89%{transform:translateX(5px)} 90%{transform:translateX(-3px)} 91%{transform:none} }
@keyframes public-glitch-a { 0%,82%,100%{transform:translate(-5px,2px)} 84%{transform:translate(12px,-2px)} 86%{transform:translate(-9px,3px)} }
@keyframes public-glitch-b { 0%,74%,100%{transform:translate(6px,-2px)} 76%{transform:translate(-13px,1px)} 78%{transform:translate(9px,4px)} }
.public-lead { width: min(720px,100%); margin: 28px 0 24px; color: var(--dim); font-size: clamp(16px,2vw,22px); font-weight: 300; line-height: 1.55; }
.public-route { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; width: fit-content; max-width: 100%; padding: 13px 15px; border: 1px solid var(--line); background: var(--off); font-family: var(--pixel); font-size: 6px; }
.public-route i { color: var(--muted); font-style: normal; }
.public-route strong { color: var(--magenta); }
.public-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 32px; }
.public-button { display: inline-flex; align-items: center; min-height: 44px; padding: 0 20px; color: var(--black); border: 1px solid var(--black); background: var(--white); box-shadow: 4px 4px 0 var(--black); font-family: var(--pixel); font-size: 7px; text-decoration: none; }
.public-button:hover { transform: translate(-2px,-2px); box-shadow: 6px 6px 0 var(--black); }
.public-button.primary { color: var(--white); background: var(--black); box-shadow: 4px 4px 0 var(--cyan); }
.public-button.primary:hover { box-shadow: 6px 6px 0 var(--magenta); }
.public-metrics { display: grid; grid-template-columns: repeat(4,1fr); border-bottom: 2px solid var(--black); }
.public-metrics article { min-width: 0; padding: 28px clamp(16px,3vw,38px); border-right: 1px solid var(--line); background: var(--off); }
.public-metrics article:last-child { border-right: 0; }
.public-metrics span,.public-metrics small { display: block; color: var(--muted); font-family: var(--pixel); font-size: 6px; line-height: 1.6; }
.public-metrics strong { display: block; margin: 12px 0 9px; font-family: var(--pixel); font-size: clamp(15px,2.3vw,27px); overflow-wrap: anywhere; }
.public-metrics .metric-online { color: #008d4d; }
.public-metrics .metric-ip { font-size: clamp(11px,1.7vw,20px); }
.public-network { padding: 76px clamp(20px,7vw,100px) 96px; display: grid; grid-template-columns: minmax(240px,.75fr) minmax(0,1.4fr); gap: clamp(36px,8vw,110px); }
.public-section-head p { margin: 0 0 18px; color: var(--magenta); font-family: var(--pixel); font-size: 7px; }
.public-section-head h2 { margin: 0; font-family: var(--pixel); font-size: clamp(20px,3vw,38px); line-height: 1.55; }
.public-service-list { border-top: 2px solid var(--black); }
.public-service-list article { display: grid; grid-template-columns: 34px 1fr auto; gap: 18px; align-items: start; padding: 24px 0; border-bottom: 1px solid var(--line); }
.public-service-list article>span { color: var(--muted); font-family: var(--pixel); font-size: 6px; }
.public-service-list h3 { margin: 0 0 8px; font-family: var(--pixel); font-size: 9px; }
.public-service-list p { margin: 0; color: var(--dim); font-size: 14px; line-height: 1.6; }
.public-service-list b { color: #008d4d; font-family: var(--pixel); font-size: 6px; }
.public-footer { display: flex; justify-content: space-between; gap: 18px; padding: 18px clamp(20px,4vw,56px); color: #555; background: var(--black); border-top: 2px solid var(--magenta); font-family: var(--pixel); font-size: 6px; }
.public-footer .footer-live { color: var(--green); }
@media (max-width: 800px) {
  .public-metrics { grid-template-columns: 1fr 1fr; }
  .public-metrics article:nth-child(2) { border-right: 0; }
  .public-metrics article:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .public-network { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .public-header { padding: 0 12px; }
  .public-nav-link { padding: 0 10px; }
  .public-nav>a:first-child { display: none; }
  .public-hero { min-height: auto; padding-top: 70px; }
  .public-title-stage { max-width: calc(100% - 32px); margin-bottom: 44px; }
  .public-glitch { font-size: clamp(42px,13vw,64px); text-shadow: 4px 0 var(--cyan),-4px 0 var(--red); }
  .public-miku-sticker { right: -58px; bottom: -60px; width: 142px; }
  .public-route { align-items: flex-start; }
  .public-metrics { grid-template-columns: 1fr; }
  .public-metrics article { border-right: 0; border-bottom: 1px solid var(--line); }
  .public-service-list article { grid-template-columns: 28px 1fr; }
  .public-service-list b { grid-column: 2; }
  .public-footer { flex-direction: column; }
}
