:root {
    --xcl-orange: #F97316;
    --xcl-orange-light: #FFF7ED;
    --xcl-orange-mid: #FED7AA;
    --xcl-orange-dark: #EA580C;
    --xcl-bg: #F1F5F9;
    --xcl-border: #E2E8F0;
    --xcl-text: #1E293B;
    --xcl-text-muted: #94A3B8;
    --xcl-text-sec: #64748B;
    --xcl-green: #22C55E;
    --xcl-green-bg: #F0FDF4;
    --xcl-red: #EF4444;
    --xcl-red-bg: #FEF2F2;
    --xcl-blue: #3B82F6;
    --xcl-blue-bg: #EFF6FF;
    --xcl-shadow-sm: 0 1px 4px rgba(0,0,0,0.07);
    --xcl-shadow-md: 0 4px 20px rgba(0,0,0,0.10);
    --xcl-shadow-lg: 0 12px 40px rgba(0,0,0,0.15);
  }

  .xcl-page,
  .xcl-page * {
    box-sizing: border-box;
  }

  .xcl-page {
    padding: 28px 24px;
    color: var(--xcl-text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  }

  .xcl-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
  }

  .xcl-page-title {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -.6px;
    color: var(--xcl-text);
  }

  .xcl-page-subtitle {
    font-size: 13px;
    color: var(--xcl-text-muted);
    margin-top: 2px;
  }

  .xcl-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
  }

  .xcl-btn-filter {
    position: relative;
  }

  .xcl-filter-badge {
    position: absolute;
    top: -8px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--xcl-orange);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(249,115,22,.35);
  }

  .xcl-btn-orange,
  .xcl-btn-sec,
  .xcl-btn-outlined,
  .xcl-btn-edit-channel {
    border: none;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
    font-family: inherit;
    text-decoration: none !important;
  }

  .xcl-btn-orange {
    background: var(--xcl-orange);
    color: #fff;
    border-radius: 10px;
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 8px rgba(249,115,22,.28);
  }

  .xcl-btn-orange:hover {
    background: var(--xcl-orange-dark);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(249,115,22,.38);
  }

  .xcl-btn-sec {
    padding: 9px 16px;
    border: 1.5px solid var(--xcl-border);
    border-radius: 9px;
    font-size: 13px;
    font-weight: 600;
    color: var(--xcl-text-sec);
    background: #fff;
  }

  .xcl-btn-sec:hover {
    background: var(--xcl-bg);
    color: var(--xcl-text);
  }

  .xcl-btn-outlined {
    border: 1.5px solid var(--xcl-orange);
    color: var(--xcl-orange);
    background: #fff;
    border-radius: 10px;
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }

  .xcl-btn-outlined:hover {
    background: var(--xcl-orange-light);
    color: var(--xcl-orange-dark);
  }

  .xcl-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 24px;
  }

  .xcl-stat-card {
    background: #fff;
    border: 1px solid var(--xcl-border);
    border-radius: 14px;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--xcl-shadow-sm);
    min-height: 92px;
  }

  .xcl-stat-card:hover {
    box-shadow: var(--xcl-shadow-md);
  }

  .xcl-stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
  }

  .xcl-stat-value {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -.8px;
    line-height: 1;
  }

  .xcl-stat-label {
    font-size: 11px;
    color: var(--xcl-text-muted);
    font-weight: 500;
    margin-top: 3px;
  }

  .xcl-filter-bar {
    background: #fff;
    border: 1px solid var(--xcl-border);
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
    box-shadow: var(--xcl-shadow-sm);
    margin-bottom: 24px;
  }

  .xcl-filter-bar input,
  .xcl-filter-bar select,
  .xcl-q-input,
  .xcl-q-select {
    border: 1.5px solid var(--xcl-border);
    border-radius: 8px;
    padding: 7px 11px;
    font-size: 13px;
    color: var(--xcl-text);
    background: #fff;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    width: 100%;
  }

  .xcl-filter-bar input:focus,
  .xcl-filter-bar select:focus,
  .xcl-q-input:focus,
  .xcl-q-select:focus {
    border-color: var(--xcl-orange);
    box-shadow: 0 0 0 3px rgba(249,115,22,.10);
  }

  .xcl-filter-bar input {
    min-width: 0;
  }

  .xcl-filter-bar select {
    width: auto;
    min-width: 0;
  }

  #xclSearchInput {
    flex: 0 1 40%;
  }

  #xclUnitFilter,
  #xclFlowFilter {
    flex: 0 1 24%;
  }

  .xcl-filter-count {
    flex: 1 0 auto;
    min-width: max-content;
    text-align: right;
  }

  .xcl-filter-count {
    font-size: 12px;
    color: var(--xcl-text-muted);
    font-weight: 600;
    margin-left: 0;
    white-space: nowrap;
  }

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

  .xcl-channel-card {
    background: #fff;
    border: 1.5px solid var(--xcl-border);
    border-radius: 14px;
    box-shadow: var(--xcl-shadow-sm);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 310px;
    transition: all .2s;
    animation: xclFadeUp .35s ease both;
  }

  .xcl-channel-card:hover {
    box-shadow: var(--xcl-shadow-md);
    transform: translateY(-2px);
    border-color: #CBD5E1;
  }

  @keyframes xclFadeUp {
    from {
      opacity: 0;
      transform: translateY(10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .xcl-channel-card-body {
    padding: 16px 16px 12px;
    flex: 1;
  }

  .xcl-channel-card-footer {
    padding: 10px 16px;
    border-top: 1px solid var(--xcl-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
  }

  .xcl-channel-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--xcl-text);
    letter-spacing: -.2px;
    line-height: 1.35;
  }

  .xcl-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    white-space: nowrap;
  }

  .xcl-status-badge.active {
    background: var(--xcl-green-bg);
    color: #16A34A;
  }

  .xcl-status-badge.inactive {
    background: #F1F5F9;
    color: var(--xcl-text-muted);
  }

  .xcl-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
  }

  .xcl-unit-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--xcl-orange-light);
    border: 1px solid var(--xcl-orange-mid);
    color: var(--xcl-orange-dark);
    border-radius: 7px;
    padding: 3px 9px;
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 12px;
  }

  .xcl-link-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 2px;
  }

  .xcl-link-row {
    background: var(--xcl-bg);
    border-radius: 10px;
    padding: 10px 12px;
  }

  .xcl-link-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .7px;
    color: var(--xcl-text-muted);
    margin-bottom: 4px;
  }

  .xcl-link-value {
    font-size: 12px;
    color: var(--xcl-text);
    font-weight: 600;
    line-height: 1.4;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  .xcl-link-anchor {
    color: var(--xcl-blue);
    font-size: 12px;
    text-decoration: none;
    flex-shrink: 0;
  }

  .xcl-link-anchor:hover {
    color: #1D4ED8;
  }

  .xcl-metrics {
    display: flex;
    gap: 8px;
    margin-top: 14px;
  }

  .xcl-metric-box {
    background: var(--xcl-bg);
    border-radius: 9px;
    padding: 8px 6px;
    text-align: center;
    flex: 1;
  }

  .xcl-metric-val {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -.5px;
    line-height: 1;
    /*font-family: Consolas, Monaco, monospace;*/
  }

  .xcl-metric-lbl {
    font-size: 9px;
    font-weight: 600;
    color: var(--xcl-text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-top: 2px;
  }

  .xcl-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
  }

  .xcl-ibtn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1.5px solid var(--xcl-border);
    background: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .15s;
    position: relative;
    flex-shrink: 0;
    color: var(--xcl-text-sec);
  }

  .xcl-ibtn i {
    font-size: 12px;
  }

  .xcl-ibtn:hover {
    border-color: transparent;
  }

  .xcl-ibtn.edit:hover {
    background: var(--xcl-blue-bg);
    color: var(--xcl-blue);
  }

  .xcl-ibtn.share:hover {
    background: var(--xcl-green-bg);
    color: var(--xcl-green);
  }

  .xcl-ibtn.qrcode:hover {
    background: var(--xcl-orange-light);
    color: var(--xcl-orange-dark);
  }

  .xcl-ibtn.mobile:hover,
  .xcl-ibtn.open:hover {
    background: var(--xcl-green-bg);
    color: var(--xcl-green);
  }

  .xcl-ibtn.delete:hover {
    background: var(--xcl-red-bg);
    color: var(--xcl-red);
  }

  .xcl-ibtn .xcl-tip {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #0F172A;
    color: #fff;
    font-size: 10px;
    padding: 3px 7px;
    border-radius: 5px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity .15s;
    z-index: 10;
  }

  .xcl-ibtn .xcl-tip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: #0F172A;
  }

  .xcl-ibtn:hover .xcl-tip {
    opacity: 1;
  }

  .xcl-btn-edit-channel {
    background: var(--xcl-orange);
    color: #fff;
    border-radius: 8px;
    padding: 6px 13px;
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 5px;
  }

  .xcl-btn-edit-channel:hover {
    background: var(--xcl-orange-dark);
    color: #fff;
  }

  .xcl-empty {
    background: #fff;
    border: 1.5px dashed var(--xcl-border);
    border-radius: 16px;
    padding: 64px 32px;
    text-align: center;
    grid-column: 1 / -1;
  }

  .xcl-empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: .4;
  }

  .xcl-empty-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--xcl-text-sec);
  }

  .xcl-empty-sub {
    font-size: 13px;
    color: var(--xcl-text-muted);
    margin-top: 4px;
    margin-bottom: 18px;
  }

  .xcl-list-status {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px 12px 6px;
    color: var(--xcl-text-muted);
    font-size: 12px;
    font-weight: 600;
  }

  .xcl-list-status.is-hidden {
    display: none;
  }

  .xcl-list-spinner {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--xcl-border);
    border-top-color: var(--xcl-orange);
    margin-right: 8px;
    animation: xclSpin .7s linear infinite;
  }

  .xcl-list-sentinel {
    width: 100%;
    height: 1px;
  }

  @keyframes xclSpin {
    to {
      transform: rotate(360deg);
    }
  }

  .xcl-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,.45);
    backdrop-filter: blur(3px);
    z-index: 1050;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s;
  }

  .xcl-drawer-overlay.open {
    opacity: 1;
    pointer-events: all;
  }

  .xcl-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 400px;
    max-width: 100vw;
    background: #fff;
    z-index: 1051;
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 40px rgba(0,0,0,.15);
    transform: translateX(100%);
    transition: transform .3s cubic-bezier(.4,0,.2,1);
  }

  .xcl-drawer.open {
    transform: translateX(0);
  }

  .xcl-drawer-header {
    padding: 20px 22px 16px;
    border-bottom: 1px solid var(--xcl-border);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-shrink: 0;
    gap: 12px;
  }

  .xcl-drawer-title {
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -.4px;
    color: var(--xcl-text);
  }

  .xcl-drawer-subtitle {
    font-size: 12px;
    color: var(--xcl-text-muted);
    margin-top: 2px;
  }

  .xcl-drawer-close {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1.5px solid var(--xcl-border);
    background: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--xcl-text-muted);
    transition: all .15s;
    flex-shrink: 0;
  }

  .xcl-drawer-close:hover {
    background: var(--xcl-red-bg);
    color: var(--xcl-red);
    border-color: var(--xcl-red);
  }

  .xcl-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  .xcl-drawer-footer {
    padding: 16px 22px;
    border-top: 1px solid var(--xcl-border);
    display: flex;
    gap: 10px;
    flex-shrink: 0;
  }

  .xcl-q-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--xcl-text);
    margin-bottom: 5px;
  }

  .xcl-divider {
    border: none;
    border-top: 1px solid var(--xcl-border);
    margin: 4px 0;
  }

  .xcl-section-title {
    font-size: 10px;
    font-weight: 700;
    color: var(--xcl-text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
  }

  .xcl-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #0F172A;
    color: #fff;
    padding: 12px 18px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--xcl-shadow-lg);
    z-index: 9999;
    transform: translateY(60px);
    opacity: 0;
    transition: all .3s cubic-bezier(.34,1.56,.64,1);
    pointer-events: none;
    max-width: calc(100vw - 48px);
  }

  .xcl-toast.show {
    transform: translateY(0);
    opacity: 1;
  }

  .xcl-toast.success {
    border-left: 4px solid var(--xcl-green);
  }

  .xcl-modal .modal-content {
    border-radius: 18px;
    border: none;
    box-shadow: var(--xcl-shadow-lg);
  }

  .xcl-modal .modal-header {
    border-bottom: 1px solid var(--xcl-border);
    padding: 20px 24px 16px;
  }

  .xcl-modal .modal-body {
    padding: 20px 24px;
  }

  .xcl-modal .modal-footer {
    border-top: 1px solid var(--xcl-border);
    padding: 16px 24px;
  }

  .xcl-modal-title {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -.4px;
  }

  .xcl-modal-subtitle {
    font-size: 12px;
    color: var(--xcl-text-muted);
    margin-top: 2px;
  }

  .xcl-share-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--xcl-border);
    margin-bottom: 20px;
    flex-wrap: wrap;
  }

  .xcl-share-tab {
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 700;
    color: var(--xcl-text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all .15s;
    display: flex;
    align-items: center;
    gap: 5px;
  }

  .xcl-share-tab.active {
    color: var(--xcl-orange);
    border-bottom-color: var(--xcl-orange);
  }

  .xcl-share-tab:hover:not(.active) {
    color: var(--xcl-text-sec);
  }

  .xcl-share-panel {
    display: none;
  }

  .xcl-share-panel.active {
    display: block;
    animation: xclFadeUp .2s ease;
  }

  .xcl-form-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--xcl-text);
    margin-bottom: 6px;
  }

  .xcl-share-code-box {
    background: #0F172A;
    border-radius: 10px;
    padding: 14px 16px;
    position: relative;
  }

  .xcl-share-code-box code {
    font-family: Consolas, Monaco, monospace;
    font-size: 11px;
    color: #7DD3FC;
    display: block;
    white-space: pre-wrap;
    word-break: break-all;
    line-height: 1.6;
  }

  .xcl-copy-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.15);
    color: #fff;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: all .15s;
  }

  .xcl-copy-btn:hover {
    background: rgba(255,255,255,.2);
  }

  .xcl-share-tip {
    font-size: 11px;
    color: var(--xcl-text-muted);
    margin-top: 10px;
    line-height: 1.5;
  }

  .xcl-link-row {
    display: flex;
    gap: 8px;
  }

  .xcl-link-input {
    flex: 1;
    border: 1.5px solid var(--xcl-border);
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 12px;
    font-family: Consolas, Monaco, monospace;
    color: var(--xcl-text-sec);
    background: var(--xcl-bg);
    outline: none;
  }

  .xcl-qr-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 8px 0;
  }

  .xcl-qr-box {
    width: 180px;
    height: 180px;
    background: var(--xcl-bg);
    border: 1.5px solid var(--xcl-border);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
  }

  .xcl-qr-box img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  @media (max-width: 1199px) {
    .xcl-grid {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
  }

  @media (max-width: 991px) {
    .xcl-stats {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .xcl-filter-bar {
      flex-wrap: wrap;
    }

    #xclSearchInput,
    #xclUnitFilter,
    #xclFlowFilter,
    .xcl-filter-count {
      flex: 1 1 100%;
      text-align: left;
    }
  }

  @media (max-width: 575px) {
    .xcl-page {
      padding: 16px;
    }

    .xcl-page-title {
      font-size: 20px;
    }

    .xcl-stats,
    .xcl-grid {
      grid-template-columns: 1fr;
    }

    .xcl-filter-bar {
      gap: 8px;
    }

    .xcl-filter-bar select {
      width: 100%;
      min-width: 0;
    }

    .xcl-channel-card-footer {
      flex-direction: column;
      align-items: flex-start;
    }

    .xcl-drawer {
      width: 100vw;
    }
  }
