    :root {
      --crust: #181926;
      --mantle: #1e2030;
      --base: #24273a;
      --surface0: #363a4f;
      --surface1: #494d64;
      --surface2: #5b6078;
      --overlay1: #8087a2;
      --subtext0: #a5adcb;
      --subtext1: #b8c0e0;
      --text: #cad3f5;
      --sapphire: #7dc4e4;
      --yellow: #eed49f;
      --green: #a6da95;
      --red: #ed8796;
      --noise: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.05'/%3E%3C/svg%3E");
    }
    * { box-sizing: border-box; }
    body {
      margin: 0;
      padding: 32px 16px 56px;
      min-height: 100vh;
      background-color: #181926;
      background-image: var(--noise), radial-gradient(circle at top, #1e2030 0%, #181926 100%);
      color: var(--text);
      font: 400 1rem/1.7 'Inter', system-ui, -apple-system, sans-serif;
    }
    .notebook-sheet {
      position: relative;
      max-width: 840px;
      margin: 0 auto;
      background-color: #24273a;
      background-image:
        var(--noise),
        linear-gradient(rgba(91, 96, 120, 0.28) 1px, transparent 1px);
      background-size: 200px 200px, 100% 2rem;
      border: 1px solid var(--surface1);
      box-shadow: 6px 14px 28px rgba(10, 11, 18, 0.55), 0 2px 6px rgba(10, 11, 18, 0.35);
      padding: 36px 36px 44px 68px;
    }
    .notebook-sheet::before {
      content: "";
      position: absolute;
      top: 0;
      bottom: 0;
      left: 2.85rem;
      border-left: 2px solid rgba(237, 135, 150, 0.42);
      pointer-events: none;
    }
    .notebook-sheet::after {
      content: "";
      position: absolute;
      right: 10px;
      bottom: -8px;
      width: 140px;
      height: 16px;
      background: radial-gradient(ellipse at center, rgba(10, 11, 18, 0.55), transparent 72%);
      transform: skewX(-12deg) rotate(-2deg);
      z-index: -1;
    }
    .punch-holes {
      position: absolute;
      left: 14px;
      top: 64px;
      bottom: 64px;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      pointer-events: none;
    }
    .punch-holes span {
      display: block;
      width: 16px;
      height: 16px;
      border-radius: 50%;
      background: #181926;
      border: 1px solid var(--surface0);
      box-shadow: inset 1px 2px 4px rgba(0, 0, 0, 0.65);
    }
    .sheet-header {
      position: relative;
      background-color: var(--mantle);
      background-image: var(--noise);
      border: 1px solid var(--surface1);
      padding: 22px 24px 30px;
      margin-bottom: 30px;
      transform: rotate(-0.4deg);
      box-shadow: 2px 4px 12px rgba(12, 13, 20, 0.35);
    }
    .torn-bottom {
      clip-path: polygon(
        0% 0%, 100% 0%, 100% calc(100% - 8px),
        98% 100%, 95% 93%, 92% 98%, 88% 92%, 85% 99%,
        80% 93%, 75% 98%, 70% 92%, 65% 99%, 60% 93%,
        55% 98%, 50% 92%, 45% 99%, 40% 93%, 35% 98%,
        30% 92%, 25% 99%, 20% 93%, 15% 98%, 10% 92%,
        5% 99%, 0% 93%
      );
    }
    /* Tab Navigation */
    .tab-nav {
      display: flex;
      gap: 4px;
      margin-bottom: 24px;
      padding: 4px;
      background: var(--base);
      border: 1px solid var(--surface1);
      border-radius: 10px;
      overflow-x: auto;
      position: relative;
    }
    .tab-btn {
      flex: 1;
      min-width: 96px;
      padding: 10px 12px;
      border: none;
      background: transparent;
      color: var(--subtext0);
      font: 500 0.85rem/1.2 'Courier Prime', 'Courier New', monospace;
      cursor: pointer;
      white-space: nowrap;
      transition: color 150ms ease, background 150ms ease;
      border-radius: 6px;
    }
    .tab-btn:hover {
      color: var(--text);
      background: var(--surface1);
    }
    .tab-btn.active {
      color: var(--crust);
      background: var(--sapphire);
    }
    .tab-indicator {
      position: absolute;
      bottom: 4px;
      height: 3px;
      background: var(--sapphire);
      border-radius: 2px;
      transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1), width 200ms cubic-bezier(0.4, 0, 0.2, 1);
      pointer-events: none;
      z-index: 0;
    }
    .tab-btn {
      position: relative;
      z-index: 1;
    }
    .tab-panel {
      display: block;
      visibility: hidden;
      opacity: 0;
      transform: translateY(4px);
      transition: opacity 200ms ease, transform 200ms ease, visibility 0s 200ms;
      position: absolute;
      width: 100%;
    }
    .tab-panel.active {
      visibility: visible;
      opacity: 1;
      transform: translateY(0);
      position: relative;
      transition: opacity 200ms ease, transform 200ms ease, visibility 0s;
    }

    .header-top {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 16px;
      flex-wrap: wrap;
    }
    h1 {
      margin: 0;
      font: 700 2.25rem/1.15 'Playfair Display', Georgia, serif;
      color: var(--text);
      transform: rotate(-0.5deg);
    }
    .subtitle {
      margin: 6px 0 0;
      color: var(--subtext1);
      font-size: 0.98rem;
    }
    .margin-note {
      display: inline-block;
      font: 600 1.05rem/1.2 'Caveat', 'Segoe Script', cursive;
      color: #7dc4e4;
      transform: rotate(2.5deg);
      margin-top: 6px;
    }
    .ink-stamp {
      display: inline-block;
      border: 3px solid #7dc4e4;
      border-radius: 4px;
      padding: 4px 10px;
      color: #7dc4e4;
      font: 700 0.78rem/1.1 'Courier Prime', 'Courier New', monospace;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      transform: rotate(-8deg);
      opacity: 0.88;
      background-image: var(--noise);
      user-select: none;
    }
    .card-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 22px;
      margin-bottom: 28px;
    }
    #credentials-status { margin-top: 8px; font-size: 13px; }
    #credentials-status.error { color: #e57373; }

    .paper-card {
      position: relative;
      background-color: var(--surface0);
      background-image: var(--noise);
      border: 1px solid var(--surface2);
      padding: 22px 20px 20px;
      box-shadow: 6px 14px 24px rgba(12, 13, 20, 0.34), 0 2px 6px rgba(12, 13, 20, 0.22);
      transition: transform 180ms ease, box-shadow 180ms ease;
    }
    .tilt-left { transform: rotate(-0.7deg); }
    .tilt-right { transform: rotate(0.6deg); }
    .paper-card:hover {
      transform: translateY(-4px) rotate(0.5deg) scale(1.01);
      box-shadow: 8px 18px 28px rgba(12, 13, 20, 0.46), 0 3px 8px rgba(12, 13, 20, 0.28);
    }
    .washi-tape {
      position: absolute;
      top: -11px;
      left: 50%;
      width: 96px;
      height: 22px;
      background: rgba(125, 196, 228, 0.26);
      border-left: 2px dashed rgba(202, 211, 245, 0.48);
      border-right: 2px dashed rgba(202, 211, 245, 0.48);
      box-shadow: 0 1px 3px rgba(12, 13, 20, 0.25);
      transform: translateX(-50%) rotate(-2.5deg);
      pointer-events: none;
    }
    .washi-tape.alt {
      background: rgba(238, 212, 159, 0.24);
      transform: translateX(-50%) rotate(2deg);
    }
    h2 {
      margin: 0 0 8px;
      font: 600 1.45rem/1.25 'Playfair Display', Georgia, serif;
      color: var(--text);
      display: inline-block;
      border-bottom: 2px solid rgba(125, 196, 228, 0.55);
      padding-bottom: 2px;
    }
    .card-copy {
      margin: 4px 0 12px;
      font-size: 0.94rem;
      color: var(--subtext1);
    }
    .row {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
    }
    input, select {
      background: var(--mantle);
      color: var(--text);
      border: 1px solid var(--surface2);
      border-bottom: 2px solid #7dc4e4;
      border-radius: 2px;
      padding: 8px 10px;
      font: 400 0.95rem/1.4 'Inter', system-ui, sans-serif;
    }
    input::placeholder { color: var(--overlay1); }
    input { flex: 1; min-width: 150px; }
    button {
      background: #7dc4e4;
      color: var(--crust);
      border: 1px solid var(--crust);
      border-radius: 3px;
      padding: 8px 16px;
      font: 700 0.88rem/1.2 'Courier Prime', 'Courier New', monospace;
      letter-spacing: 0.04em;
      text-transform: uppercase;
      cursor: pointer;
      box-shadow: 2px 3px 0 var(--crust);
      transition: transform 100ms ease, box-shadow 100ms ease;
    }
    button:active {
      transform: translateY(1px) scale(0.995);
      box-shadow: 1px 1px 0 var(--crust);
    }
    .play-device-row { margin-top: 12px; align-items: center; }
    .play-device-label {
      font: 700 0.88rem/1.2 'Courier Prime', 'Courier New', monospace;
      text-transform: uppercase;
      letter-spacing: 0.04em;
      color: var(--subtext1);
    }
    .ledger-sub {
      font: 700 0.85rem/1.2 'Courier Prime', 'Courier New', monospace;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      color: var(--subtext1);
      margin: 14px 0 8px;
    }
    #playback-section button { font-size: 0.78rem; padding: 6px 12px; }
    .badge-play { background: transparent; color: #a6da95; border-color: #a6da95; }
    a {
      color: #7dc4e4;
      text-decoration: underline;
      text-underline-offset: 2px;
    }
    :focus-visible {
      outline: 2px dashed #7dc4e4;
      outline-offset: 3px;
    }
    .ledger-card {
      position: relative;
      background-color: var(--mantle);
      background-image: var(--noise);
      border: 1px solid var(--surface1);
      padding: 24px 22px 22px;
      box-shadow: 4px 10px 20px rgba(12, 13, 20, 0.38);
    }
    .ledger-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      flex-wrap: wrap;
      margin-bottom: 14px;
    }
    #status {
      display: inline-block;
      border: 2px solid var(--surface2);
      border-radius: 4px;
      padding: 3px 10px;
      color: var(--subtext1);
      font: 700 0.8rem/1.2 'Courier Prime', 'Courier New', monospace;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      transform: rotate(-3deg);
      opacity: 0.9;
    }
    #status.state-loading { border-color: #7dc4e4; color: #7dc4e4; }
    #status.state-ok { border-color: var(--green); color: var(--green); }
    #status.state-err { border-color: var(--red); color: var(--red); }
    .result-list {
      list-style: none;
      margin: 0;
      padding: 0;
      background-color: #24273a;
      background-image:
        var(--noise),
        linear-gradient(rgba(91, 96, 120, 0.24) 1px, transparent 1px);
      background-size: 200px 200px, 100% 2rem;
      border: 1px solid var(--surface1);
      max-height: 440px;
      overflow-y: auto;
    }
    .result-item {
      display: flex;
      gap: 14px;
      align-items: flex-start;
      padding: 12px 14px;
      border-bottom: 1px dashed var(--surface1);
    }
    .result-item:last-child { border-bottom: 0; }
    .result-thumb {
      width: 52px;
      height: 52px;
      object-fit: cover;
      background: var(--surface0);
      padding: 3px;
      border: 1px solid var(--surface2);
      box-shadow: 2px 4px 8px rgba(12, 13, 20, 0.45);
      transform: rotate(-1.5deg);
      flex-shrink: 0;
    }
    .result-body { flex: 1; min-width: 0; }
    .result-head {
      display: flex;
      align-items: baseline;
      justify-content: space-between;
      gap: 8px;
      flex-wrap: wrap;
    }
    .result-name {
      font: 700 1.05rem/1.3 'Playfair Display', Georgia, serif;
      color: var(--text);
    }
    .badge {
      display: inline-block;
      border: 1px solid #7dc4e4;
      border-radius: 3px;
      color: #7dc4e4;
      padding: 1px 6px;
      margin-left: 8px;
      font: 700 0.7rem/1.2 'Courier Prime', 'Courier New', monospace;
      text-transform: uppercase;
      transform: rotate(-2deg);
    }
    .badge-explicit {
      border-color: var(--red);
      color: var(--red);
    }
    .result-meta {
      color: var(--subtext1);
      font-size: 0.94rem;
      margin-top: 2px;
    }
    .result-sub {
      color: var(--subtext0);
      font: 400 0.8rem/1.4 'Courier Prime', 'Courier New', monospace;
      margin-top: 3px;
    }
    .sheet-footer {
      margin-top: 24px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 8px;
      color: var(--subtext0);
      font-size: 0.85rem;
    }
    .player-card {
      position: relative;
      background-color: var(--surface0);
      background-image: var(--noise);
      border: 1px solid var(--surface2);
      padding: 22px 20px 20px;
      box-shadow: 6px 14px 24px rgba(12, 13, 20, 0.34), 0 2px 6px rgba(12, 13, 20, 0.22);
    }
    .device-list {
      list-style: none;
      margin: 0;
      padding: 0;
      background-color: #24273a;
      border: 1px solid var(--surface1);
      max-height: 260px;
      overflow-y: auto;
    }
    .device-item {
      display: flex;
      gap: 12px;
      align-items: center;
      padding: 10px 12px;
      border-bottom: 1px dashed var(--surface1);
    }
    .device-item:last-child { border-bottom: 0; }
    .device-name {
      font: 700 0.98rem/1.3 'Playfair Display', Georgia, serif;
      color: var(--text);
    }
    .device-meta {
      color: var(--subtext1);
      font-size: 0.85rem;
      margin-top: 2px;
    }
    .device-sub {
      color: var(--subtext0);
      font: 400 0.75rem/1.4 'Courier Prime', 'Courier New', monospace;
      margin-top: 2px;
    }
    .connected-as {
      margin: 4px 0 10px;
      font: 400 0.92rem/1.4 'Inter', system-ui, sans-serif;
      color: var(--subtext1);
    }
    .connected-as .who {
      font: 700 0.95rem/1.2 'Playfair Display', Georgia, serif;
      color: #a6da95;
    }
    .tx-summary-grid {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: 14px;
      margin-bottom: 22px;
    }
    .tx-stat-card {
      padding: 14px 16px;
      border-left: 3px solid var(--sapphire);
    }
    .tx-stat-revenue { border-left-color: var(--green); }
    .tx-stat-held { border-left-color: var(--red); }
    .tx-stat-pending { border-left-color: var(--yellow); }
    .tx-stat-completed { border-left-color: var(--sapphire); }
    .tx-stat-label {
      font: 700 0.75rem/1.2 'Courier Prime', 'Courier New', monospace;
      text-transform: uppercase;
      letter-spacing: 0.06em;
      color: var(--subtext0);
    }
    .tx-stat-value {
      font: 700 1.45rem/1.2 'Playfair Display', Georgia, serif;
      color: var(--text);
      margin: 4px 0 2px;
    }
    .tx-stat-revenue .tx-stat-value { color: var(--green); }
    .tx-stat-held .tx-stat-value { color: var(--red); }
    .tx-stat-pending .tx-stat-value { color: var(--yellow); }
    .tx-stat-completed .tx-stat-value { color: var(--sapphire); }
    .tx-stat-sub {
      font: 400 0.78rem/1.3 'Courier Prime', 'Courier New', monospace;
      color: var(--subtext1);
    }
    .tx-filters {
      display: flex;
      gap: 6px;
      flex-wrap: wrap;
      margin-bottom: 14px;
    }
    .tx-filter-btn {
      background: var(--base);
      color: var(--subtext1);
      border: 1px solid var(--surface2);
      padding: 5px 10px;
      font: 700 0.76rem/1.2 'Courier Prime', 'Courier New', monospace;
      box-shadow: none;
    }
    .tx-filter-btn:hover {
      background: var(--surface1);
      color: var(--text);
    }
    .tx-filter-btn.active {
      background: var(--sapphire);
      color: var(--crust);
      border-color: var(--sapphire);
    }
    #transactions-status {
      display: inline-block;
      border: 2px solid var(--surface2);
      border-radius: 4px;
      padding: 3px 10px;
      color: var(--subtext1);
      font: 700 0.8rem/1.2 'Courier Prime', 'Courier New', monospace;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      transform: rotate(-3deg);
      opacity: 0.9;
    }
    #transactions-status.state-loading { border-color: var(--sapphire); color: var(--sapphire); }
    #transactions-status.state-ok { border-color: var(--green); color: var(--green); }
    #transactions-status.state-err { border-color: var(--red); color: var(--red); }
    #refresh-transactions-btn { font-size: 0.78rem; padding: 6px 12px; }
    .badge-pending { border-color: var(--yellow); color: var(--yellow); }
    .badge-paid { border-color: var(--green); color: var(--green); }
    .badge-held { border-color: var(--red); border-width: 2px; color: var(--red); }
    .badge-completed { border-color: var(--sapphire); color: var(--sapphire); }
    .badge-cancelled { border-color: var(--overlay1); color: var(--overlay1); }
    .badge-refunded { border-color: rgba(237, 135, 150, 0.65); color: rgba(237, 135, 150, 0.85); }
    .tx-amount {
      font: 700 0.96rem/1.2 'Courier Prime', 'Courier New', monospace;
      color: var(--green);
      white-space: nowrap;
    }
    .tx-hold-note {
      margin-top: 6px;
      padding: 5px 9px;
      background: rgba(237, 135, 150, 0.1);
      border-left: 3px solid var(--red);
      color: var(--red);
      font-size: 0.84rem;
    }
    .tx-actions {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      margin-top: 8px;
    }
    .tx-btn {
      font-size: 0.74rem;
      padding: 5px 10px;
      box-shadow: 1px 2px 0 var(--crust);
    }
    .tx-btn:disabled {
      opacity: 0.55;
      cursor: not-allowed;
    }
    .tx-btn-approve { background: var(--green); color: var(--crust); }
    .tx-btn-play { background: var(--sapphire); color: var(--crust); }
    .tx-btn-hold { background: var(--yellow); color: var(--crust); }
    .tx-btn-release { background: var(--surface1); color: var(--text); border-color: var(--sapphire); }
    .tx-btn-cancel { background: transparent; color: var(--red); border-color: var(--red); }
    @media (max-width: 720px) {
      .notebook-sheet { padding: 28px 20px 32px 48px; }
      .notebook-sheet::before { left: 2.1rem; }
      .punch-holes { left: 8px; }
      .card-grid { grid-template-columns: 1fr; }
      .tx-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      h1 { font-size: 1.8rem; }
    }
    @media (prefers-reduced-motion: reduce) {
      .sheet-header, h1, .margin-note, .ink-stamp, .paper-card,
      .paper-card:hover, button:active, #status, #transactions-status, .result-thumb, .badge {
        transform: none !important;
        transition: none !important;
      }
    }
