:root {
    color-scheme: dark;
    --api-outer: #090909;
    --api-sidebar: #121212;
    --api-main: #181818;
    --api-surface: #141414;
    --api-elevated: #222222;
    --api-hover: #292929;
    --api-border: rgba(255, 255, 255, .085);
    --api-border-strong: rgba(255, 255, 255, .14);
    --api-text: #f5f5f5;
    --api-text-secondary: #a3a3a3;
    --api-muted: #737373;
    --api-brand: #f5365c;
    --api-brand-hover: #df2d50;
    --api-danger: #ef6a76;
    --api-danger-bg: rgba(239, 83, 99, .1);
    --api-success: #70c994;
    --api-radius-sm: 10px;
    --api-radius: 16px;
    --api-radius-lg: 22px;
    --api-sidebar-width: 296px;
    --api-topbar-height: 94px;
}

* { scrollbar-color: #343434 transparent; scrollbar-width: thin; }

.api-panel-body {
    min-height: 100vh;
    background: var(--api-outer);
    color: var(--api-text);
    overflow: hidden;
}

.api-panel-body.modal-open,
.api-panel-body.sidebar-open { overflow: hidden; }

.api-panel-body button,
.api-panel-body input { font: inherit; }

.api-panel-body svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.hidden,
.api-panel-content > [data-panel-content].hidden,
.api-bale-store-step.hidden,
.api-bale-actions.hidden,
.api-bale-existing.hidden,
.api-panel-modal.hidden,
.api-panel-popover.hidden,
.api-token-empty.hidden { display: none !important; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.api-panel-skip-link {
    position: fixed;
    top: 8px;
    right: 12px;
    z-index: 5000;
    padding: 10px 14px;
    color: #fff;
    background: var(--api-brand);
    border-radius: 10px;
    text-decoration: none;
    transform: translateY(-150%);
}
.api-panel-skip-link:focus { transform: translateY(0); }

.api-bale-bot-link.is-disabled {
    pointer-events: none;
    color: var(--api-text-secondary);
    text-decoration: none;
}

.api-panel-app {
    height: calc(100dvh - 32px);
    margin: 16px;
    display: grid;
    grid-template-columns: var(--api-sidebar-width) minmax(0, 1fr);
    direction: rtl;
    overflow: hidden;
    background: var(--api-main);
    border: 1px solid var(--api-border);
    border-radius: 26px;
}

.api-panel-sidebar {
    grid-column: 1;
    min-width: 0;
    height: 100%;
    padding: 28px 18px 18px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    background: var(--api-sidebar);
    border-left: 1px solid var(--api-border);
    overflow-y: auto;
    z-index: 1200;
}

.api-panel-sidebar-brand {
    min-height: 64px;
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 0 6px;
}

.api-panel-brand-mark {
    width: 52px;
    height: 52px;
    flex: 0 0 52px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #f0f0f0;
}
.api-panel-brand-mark img { width: 100%; height: 100%; object-fit: cover; }

.api-panel-brand-copy,
.api-panel-user-meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.api-panel-brand-copy strong { font-size: 17px; font-weight: 700; line-height: 1.55; }
.api-panel-brand-copy small { color: var(--api-text-secondary); font-size: 12px; }

.api-panel-sidebar-close {
    display: none;
    margin-right: auto;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 12px;
    color: var(--api-text-secondary);
    background: transparent;
    cursor: pointer;
}

.api-panel-nav-search,
.api-panel-global-search {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--api-muted);
    background: var(--api-elevated);
    border: 1px solid transparent;
    border-radius: 13px;
    transition: border-color 180ms ease, background 180ms ease;
}
.api-panel-nav-search { min-height: 48px; padding: 0 13px; background: transparent; }
.api-panel-nav-search:focus-within,
.api-panel-global-search:focus-within { border-color: rgba(245, 54, 92, .6); background: #252525; }
.api-panel-nav-search input,
.api-panel-global-search input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    color: var(--api-text);
    background: transparent;
    font-size: 13px;
}
.api-panel-nav-search input::placeholder,
.api-panel-global-search input::placeholder { color: var(--api-muted); opacity: 1; }

.api-panel-menu { display: flex; flex: 1; flex-direction: column; gap: 22px; }
.api-panel-menu-group { display: flex; flex-direction: column; gap: 5px; }
.api-panel-menu-group.is-filtered-empty { display: none; }
.api-panel-menu-label {
    padding: 0 13px 7px;
    color: #5f5f5f;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .02em;
}

.api-panel-menu-item {
    position: relative;
    width: 100%;
    min-height: 52px;
    padding: 0 13px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 0;
    border-radius: 11px;
    color: var(--api-text-secondary);
    background: transparent;
    font-size: 14px;
    font-weight: 500;
    text-align: right;
    text-decoration: none;
    cursor: pointer;
    transition: color 170ms ease, background 170ms ease;
}
.api-panel-menu-item:hover { color: var(--api-text); background: #202020; }
.api-panel-menu-item.is-active { color: var(--api-text); background: #2a2a2a; }
.api-panel-menu-item[hidden] { display: none; }
.api-panel-menu-icon { width: 23px; height: 23px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.api-panel-menu-icon svg { width: 21px; height: 21px; }
.api-panel-menu-badge {
    margin-right: auto;
    min-width: 26px;
    height: 26px;
    padding: 0 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    color: #d8d8d8;
    background: #303030;
    font-size: 11px;
}

.api-panel-sidebar-user {
    min-height: 66px;
    padding: 10px 7px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    border-top: 1px solid var(--api-border);
}
.api-panel-user-avatar {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid var(--api-border-strong);
    border-radius: 50%;
    color: #e9e9e9;
    background: #2b2b2b;
    font-size: 13px;
    font-weight: 700;
}
.api-panel-user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.api-panel-user-meta strong { overflow: hidden; color: var(--api-text); font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.api-panel-user-meta small { color: var(--api-muted); font-size: 10px; }
.api-panel-user-link { margin-right: auto; width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; color: var(--api-muted); border-radius: 10px; }
.api-panel-user-link:hover { color: var(--api-text); background: var(--api-elevated); }

.api-panel-main-column { grid-column: 2; min-width: 0; min-height: 0; height: 100%; display: flex; flex-direction: column; }
.api-panel-topbar {
    height: var(--api-topbar-height);
    flex: 0 0 var(--api-topbar-height);
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    background: var(--api-surface);
    border-bottom: 1px solid var(--api-border);
    z-index: 1000;
}
.api-panel-topbar-start,
.api-panel-topbar-actions { min-width: 0; display: flex; align-items: center; gap: 12px; }
.api-panel-breadcrumbs { min-width: 0; display: flex; align-items: center; gap: 9px; font-size: 14px; white-space: nowrap; }
.api-panel-breadcrumbs span { color: var(--api-text-secondary); }
.api-panel-breadcrumbs b { color: #5d5d5d; font-weight: 400; }
.api-panel-breadcrumbs strong { max-width: 200px; overflow: hidden; color: var(--api-text); text-overflow: ellipsis; font-weight: 600; }

.api-panel-global-search { width: clamp(190px, 25vw, 390px); height: 48px; padding: 0 14px; }
.api-panel-global-search kbd { min-width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; color: #777; border: 1px solid var(--api-border-strong); border-radius: 6px; font: 11px Tahoma, sans-serif; }

.api-panel-icon-button,
.api-panel-profile-button,
.api-modal-close,
.api-token-menu-btn,
.api-token-created-row button {
    border: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.api-panel-icon-button {
    position: relative;
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    color: var(--api-text-secondary);
    background: #202020;
    border: 1px solid var(--api-border);
    border-radius: 13px;
    transition: color 170ms ease, background 170ms ease, border-color 170ms ease;
}
.api-panel-icon-button:hover { color: var(--api-text); background: #282828; border-color: var(--api-border-strong); }
.api-panel-menu-toggle { display: none; }
.api-panel-notification-dot { position: absolute; top: 10px; right: 11px; width: 6px; height: 6px; border-radius: 50%; background: var(--api-brand); box-shadow: 0 0 0 2px #202020; }
.api-panel-profile-button { width: 48px; height: 48px; padding: 3px; color: inherit; background: transparent; border-radius: 50%; text-decoration: none; }
.api-panel-profile-button .api-panel-user-avatar { width: 42px; height: 42px; flex-basis: 42px; }
.api-panel-profile-button:hover { background: #252525; }
.api-panel-popover-wrap { position: relative; }
.api-panel-popover {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    width: min(390px, calc(100vw - 28px));
    max-height: min(620px, calc(100dvh - 90px));
    padding: 0;
    overflow: hidden;
    color: var(--api-text);
    background: #1d1d1d;
    border: 1px solid var(--api-border-strong);
    border-radius: 15px;
    box-shadow: 0 18px 46px rgba(0, 0, 0, .34);
}
.api-panel-popover-title { padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--api-border); }
.api-panel-popover-title > strong { font-size: 14px; }
.api-panel-popover-title > span { padding: 4px 8px; color: var(--api-brand); background: rgba(245,54,92,.1); border-radius: 999px; font-size: 10px; }
.api-panel-notification-list { max-height: min(540px, calc(100dvh - 155px)); overflow-y: auto; overscroll-behavior: contain; }
.api-panel-notification { position: relative; padding: 15px 18px; border-bottom: 1px solid var(--api-border); }
.api-panel-notification:last-child { border-bottom: 0; }
.api-panel-notification.is-unread { background: rgba(245,54,92,.045); }
.api-panel-notification.is-unread::before { content: ""; position: absolute; top: 21px; right: 7px; width: 5px; height: 5px; background: var(--api-brand); border-radius: 50%; }
.api-panel-notification-head { min-width: 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.api-panel-notification-head strong { min-width: 0; overflow-wrap: anywhere; font-size: 12px; line-height: 1.7; }
.api-panel-notification-head time { flex: 0 0 auto; color: var(--api-muted); font-size: 9px; }
.api-panel-notification p { margin: 7px 0 0; padding: 0; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--api-text-secondary); border: 0; font-size: 11px; line-height: 1.9; }
.api-panel-notification-actions { min-height: 28px; margin-top: 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.api-panel-notification-actions a { color: var(--api-brand); font-size: 10px; text-decoration: none; }
.api-panel-notification-actions button { position: relative; min-width: 76px; min-height: 30px; padding: 5px 10px; color: var(--api-text); background: var(--api-elevated); border: 1px solid var(--api-border-strong); border-radius: 8px; font: inherit; font-size: 10px; cursor: pointer; }
.api-panel-notification-actions button[aria-busy="true"] { color: transparent; cursor: wait; }
.api-panel-notification-actions button[aria-busy="true"]::after { content: ""; position: absolute; inset: 0; width: 12px; height: 12px; margin: auto; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: api-button-spin .7s linear infinite; }
.api-panel-notification-read-label { color: var(--api-success); font-size: 10px; }
.api-panel-notification-empty { margin: 0 !important; padding: 24px 18px !important; color: var(--api-text-secondary); border: 0 !important; text-align: center; font-size: 11px !important; }

.api-panel-content {
    min-width: 0;
    min-height: 0;
    flex: 1;
    padding: 38px clamp(22px, 3.2vw, 52px) 56px;
    overflow-y: auto;
    background: var(--api-main);
}
.api-panel-content > section { width: min(1220px, 100%); margin: 0 auto; }

.api-page-header {
    margin-bottom: 28px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
}
.api-page-kicker { display: block; margin-bottom: 8px; color: var(--api-muted); font: 11px Tahoma, sans-serif; letter-spacing: .08em; text-transform: uppercase; }
.api-page-header h1 { margin: 0 0 7px; color: var(--api-text); font-size: clamp(24px, 2.2vw, 32px); line-height: 1.5; font-weight: 700; }
.api-page-header p { max-width: 680px; margin: 0; color: var(--api-text-secondary); font-size: 13px; line-height: 1.9; }

.api-panel-primary,
.api-panel-secondary,
.api-panel-ghost,
.api-bale-disconnect {
    min-height: 44px;
    padding: 9px 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 11px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: color 170ms ease, background 170ms ease, border-color 170ms ease, opacity 170ms ease;
}
.api-panel-primary { position: relative; color: #fff; background: var(--api-brand); border: 1px solid var(--api-brand); }
.api-panel-primary[aria-busy="true"],
.api-review-actions .api-panel-ghost[aria-busy="true"] { position: relative; color: transparent; }
.api-panel-primary[aria-busy="true"] svg,
.api-review-actions .api-panel-ghost[aria-busy="true"] svg { opacity: 0; }
.api-panel-primary[aria-busy="true"]::after,
.api-review-actions .api-panel-ghost[aria-busy="true"]::after {
    content: "";
    position: absolute;
    inset: 0;
    width: 15px;
    height: 15px;
    margin: auto;
    border: 2px solid rgba(255, 255, 255, .38);
    border-top-color: #fff;
    border-radius: 50%;
    animation: api-button-spin .7s linear infinite;
}
@keyframes api-button-spin { to { transform: rotate(360deg); } }
.api-panel-primary:hover:not(:disabled) { background: var(--api-brand-hover); border-color: var(--api-brand-hover); }
.api-panel-secondary { width: fit-content; color: var(--api-text); background: #242424; border: 1px solid var(--api-border-strong); }
.api-panel-secondary:hover { background: #2c2c2c; border-color: rgba(255, 255, 255, .2); }
.api-panel-ghost { color: var(--api-text-secondary); background: transparent; border: 1px solid var(--api-border-strong); }
.api-panel-ghost:hover:not(:disabled) { color: var(--api-text); background: var(--api-elevated); }
.api-panel-primary svg,
.api-panel-secondary svg { width: 17px; height: 17px; }
.api-panel-primary:disabled,
.api-panel-secondary:disabled,
.api-panel-ghost:disabled,
.api-bale-disconnect:disabled { opacity: .45; cursor: wait; }

.api-stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.api-stat-card,
.api-dashboard-card,
.api-token-item,
.api-token-security-note,
.api-bale-existing {
    background: var(--api-surface);
    border: 1px solid var(--api-border);
    border-radius: var(--api-radius-lg);
}
.api-stat-card { min-width: 0; min-height: 148px; padding: 20px; display: flex; align-items: flex-start; gap: 14px; }
.api-stat-icon,
.api-card-icon {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #d4d4d4;
    background: #242424;
    border: 1px solid var(--api-border);
    border-radius: 12px;
}
.api-stat-icon.is-success,
.api-card-icon.is-success { color: var(--api-success); background: rgba(112, 201, 148, .08); border-color: rgba(112, 201, 148, .2); }
.api-stat-card > div { min-width: 0; display: flex; flex-direction: column; }
.api-stat-card small { color: var(--api-text-secondary); font-size: 11px; }
.api-stat-card strong { margin: 8px 0 4px; color: var(--api-text); font-size: 25px; line-height: 1.25; font-weight: 650; font-variant-numeric: tabular-nums; }
.api-stat-card strong.api-stat-date { font-size: 14px; line-height: 2.2; }
.api-stat-card p { margin: 0; color: var(--api-muted); font-size: 10px; line-height: 1.7; }

.api-dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.api-dashboard-card { min-width: 0; min-height: 250px; padding: 24px; display: flex; flex-direction: column; }
.api-dashboard-card-wide { grid-row: span 2; min-height: 518px; }
.api-card-heading { display: flex; align-items: flex-start; gap: 13px; }
.api-card-heading > div { min-width: 0; }
.api-card-heading h2 { margin: 1px 0 4px; color: var(--api-text); font-size: 15px; font-weight: 650; }
.api-card-heading p { margin: 0; color: var(--api-text-secondary); font-size: 11px; line-height: 1.8; }
.api-access-overview { margin: 32px 0; display: grid; grid-template-columns: 1fr 1.5fr; border-block: 1px solid var(--api-border); }
.api-access-overview > div { min-width: 0; min-height: 126px; padding: 24px 0; display: flex; flex-direction: column; justify-content: center; gap: 8px; }
.api-access-overview > div + div { padding-right: 24px; border-right: 1px solid var(--api-border); }
.api-access-overview span { color: var(--api-muted); font-size: 11px; }
.api-access-overview strong { max-width: 100%; overflow: hidden; color: var(--api-text); font-size: 20px; text-overflow: ellipsis; white-space: nowrap; }
.api-dashboard-card > .api-panel-secondary { margin-top: auto; }
.api-card-number { margin: auto 0 12px; color: var(--api-text); font-size: 48px; font-weight: 650; font-variant-numeric: tabular-nums; }

.api-token-card { color: var(--api-text); }
.api-token-security-note { margin-bottom: 18px; padding: 18px 20px; display: flex; gap: 13px; color: var(--api-text-secondary); background: #171717; }
.api-token-security-note > svg { flex: 0 0 22px; color: var(--api-success); }
.api-token-security-note strong { color: var(--api-text); font-size: 12px; font-weight: 600; }
.api-token-security-note p { margin: 3px 0 0; color: var(--api-muted); font-size: 11px; line-height: 1.8; }
.api-token-list { display: flex; flex-direction: column; gap: 12px; }
.api-token-empty { min-height: 300px; padding: 44px 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.api-token-empty h2 { margin: 16px 0 5px; font-size: 16px; }
.api-token-empty p { margin: 0 0 18px; color: var(--api-text-secondary); font-size: 12px; }
.api-token-item { position: relative; min-width: 0; padding: 22px; }
.api-token-item-head { padding-left: 48px; display: flex; align-items: flex-start; gap: 13px; }
.api-token-item-main { min-width: 0; flex: 1; }
.api-token-item-title { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.api-token-item-title strong { color: var(--api-text); font-size: 14px; font-weight: 650; }
.api-token-status { padding: 4px 8px; border-radius: 999px; color: var(--api-success); background: rgba(112, 201, 148, .08); border: 1px solid rgba(112, 201, 148, .18); font-size: 10px; }
.api-token-status.is-revoked { color: var(--api-danger); background: var(--api-danger-bg); border-color: rgba(239, 106, 118, .2); }
.api-token-value-row { margin-top: 15px; padding: 12px 14px; display: flex; align-items: center; gap: 10px; color: #bdbdbd; background: #0f0f0f; border: 1px solid var(--api-border); border-radius: 11px; direction: ltr; }
.api-token-value-row code { min-width: 0; flex: 1; overflow: hidden; font: 12px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; text-overflow: ellipsis; white-space: nowrap; }
.api-token-meta { margin-top: 16px; padding-top: 16px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; border-top: 1px solid var(--api-border); }
.api-token-meta div { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.api-token-meta span { color: var(--api-muted); font-size: 10px; }
.api-token-meta strong { overflow: hidden; color: var(--api-text-secondary); font-size: 11px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.api-token-menu-wrap { position: absolute; top: 17px; left: 17px; z-index: 10; }
.api-token-menu-btn { width: 38px; height: 38px; flex-direction: column; gap: 3px; color: var(--api-text-secondary); background: transparent; border-radius: 10px; }
.api-token-menu-btn:hover { color: var(--api-text); background: var(--api-elevated); }
.api-token-menu-btn span { width: 3px; height: 3px; border-radius: 50%; background: currentColor; }
.api-token-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 190px;
    padding: 6px;
    background: #202020;
    border: 1px solid var(--api-border-strong);
    border-radius: 12px;
    box-shadow: 0 16px 36px rgba(0, 0, 0, .35);
}
.api-token-menu button { width: 100%; min-height: 40px; padding: 0 10px; display: flex; align-items: center; gap: 9px; color: var(--api-text-secondary); background: transparent; border: 0; border-radius: 8px; font: inherit; font-size: 11px; text-align: right; cursor: pointer; }
.api-token-menu button:hover { color: var(--api-text); background: #292929; }
.api-token-menu button.is-danger { color: var(--api-danger); }
.api-token-menu svg { width: 16px; height: 16px; }

.api-panel-message { display: none !important; }
.api-panel-toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 3600;
    width: min(360px, calc(100vw - 32px));
    min-height: 52px;
    padding: 13px 16px;
    display: flex;
    align-items: center;
    color: var(--api-text);
    background: #222;
    border: 1px solid var(--api-border-strong);
    border-radius: 13px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, .42);
    font-size: 12px;
    line-height: 1.8;
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    transition: opacity 180ms ease, transform 180ms ease;
}
.api-panel-toast.is-visible { opacity: 1; transform: translateY(0); }
.api-panel-toast.is-error { color: #ffc5ca; border-color: rgba(239, 106, 118, .35); }
.api-panel-toast.is-success { color: #b9e9cb; border-color: rgba(112, 201, 148, .32); }

.api-panel-modal {
    position: fixed;
    inset: 0;
    z-index: 3000;
    padding: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .68);
}
.api-panel-modal-card { position: relative; width: min(520px, 100%); max-height: calc(100dvh - 36px); overflow-y: auto; padding: 28px; color: var(--api-text); background: #191919; border: 1px solid var(--api-border-strong); border-radius: 20px; box-shadow: 0 28px 70px rgba(0, 0, 0, .5); }
.api-panel-modal-card > .api-card-icon { margin-bottom: 16px; }
.api-panel-modal-card h2 { margin: 0 0 6px; font-size: 20px; font-weight: 650; }
.api-panel-modal-card > p { margin: 0; color: var(--api-text-secondary); font-size: 12px; line-height: 1.8; }
.api-modal-close { position: absolute; top: 20px; left: 20px; width: 40px; height: 40px; color: var(--api-muted); background: transparent; border-radius: 10px; }
.api-modal-close:hover { color: var(--api-text); background: var(--api-elevated); }
.api-token-title-field { margin: 22px 0 14px; display: flex; flex-direction: column; gap: 7px; }
.api-token-title-field span { color: var(--api-text); font-size: 12px; }
.api-token-title-field input,
.api-bale-field input { width: 100%; height: 48px; padding: 0 13px; color: var(--api-text); background: var(--api-elevated); border: 1px solid var(--api-border-strong); border-radius: 11px; text-align: left; }
.api-token-title-field input.is-invalid,
.api-bale-field input[aria-invalid="true"] { border-color: var(--api-danger); }
.api-token-title-field small,
.api-bale-field-error { min-height: 18px; color: var(--api-danger); font-size: 10px; }
.api-permission-option { margin: 0 0 20px; padding: 14px; display: flex; align-items: center; gap: 11px; color: var(--api-text); background: #202020; border: 1px solid var(--api-border); border-radius: 12px; cursor: pointer; }
.api-permission-option input { width: 18px; height: 18px; accent-color: var(--api-brand); }
.api-permission-option span { display: flex; flex-direction: column; gap: 3px; }
.api-permission-option strong { font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; direction: ltr; }
.api-permission-option small { color: var(--api-muted); font-size: 10px; }
.api-panel-modal-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; }
.api-token-warning { margin: 17px 0; padding: 13px 15px; color: #e9c77e; background: rgba(202, 148, 39, .08); border: 1px solid rgba(202, 148, 39, .2); border-radius: 11px; font-size: 11px; line-height: 1.9; }
.api-token-created-row { margin-bottom: 13px; display: grid; grid-template-columns: minmax(0, 1fr) 94px; gap: 8px; }
.api-token-created-row input { min-width: 0; height: 48px; padding: 0 12px; color: var(--api-text); background: #101010; border: 1px solid var(--api-border-strong); border-radius: 11px; direction: ltr; font: 11px ui-monospace, SFMono-Regular, Menlo, monospace; }
.api-token-created-row button { gap: 6px; color: var(--api-text); background: var(--api-elevated); border: 1px solid var(--api-border-strong); border-radius: 11px; font-size: 11px; }
.api-token-created-row button.is-copied { color: #b9e9cb; border-color: rgba(112, 201, 148, .3); }
.api-token-expiry { margin: 0 0 18px !important; color: var(--api-text-secondary) !important; }

.api-bale-form { padding: 24px; gap: 14px; min-height: 0; }
.api-bale-guide { margin-bottom: 18px; padding: 22px 24px; color: var(--api-text); background: var(--api-surface); border: 1px solid var(--api-border); border-radius: var(--api-radius-lg); }
.api-bale-guide-heading { display: flex; align-items: flex-start; gap: 13px; }
.api-bale-guide-heading > div { min-width: 0; }
.api-bale-guide-heading h2 { margin: 1px 0 4px; color: var(--api-text); font-size: 15px; font-weight: 650; }
.api-bale-guide-heading p { margin: 0; color: var(--api-text-secondary); font-size: 11px; line-height: 1.8; }
.api-bale-guide-steps { margin: 20px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; list-style: none; counter-reset: bale-guide-step; }
.api-bale-guide-steps > li { min-width: 0; padding: 14px; display: grid; grid-template-columns: 30px minmax(0, 1fr); align-items: start; gap: 10px; color: var(--api-text-secondary); background: var(--api-main); border: 1px solid var(--api-border); border-radius: 13px; counter-increment: bale-guide-step; }
.api-bale-guide-steps > li::before { content: counter(bale-guide-step, persian); width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; color: var(--api-text); background: var(--api-elevated); border: 1px solid var(--api-border-strong); border-radius: 9px; font-size: 11px; font-weight: 650; }
.api-bale-guide-steps p { margin: 3px 0 0; font-size: 11px; line-height: 1.9; }
.api-bale-bot-link-row { min-width: 0; margin-top: 10px; display: flex; align-items: stretch; gap: 7px; }
.api-bale-bot-link-row a { min-width: 0; min-height: 40px; padding: 8px 11px; flex: 1; display: inline-flex; align-items: center; justify-content: space-between; gap: 9px; overflow: hidden; color: var(--api-text); background: var(--api-elevated); border: 1px solid var(--api-border-strong); border-radius: 10px; font: 700 11px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; transition: color 170ms ease, border-color 170ms ease, background 170ms ease; }
.api-bale-bot-link-row a:hover { color: var(--api-brand); border-color: rgba(245, 54, 92, .4); }
.api-bale-bot-link-row a svg { width: 15px; height: 15px; flex: 0 0 15px; }
.api-bale-bot-link-row a strong { font: inherit; font-weight: 700; letter-spacing: .01em; }
.api-bale-bot-link-row button { min-width: 78px; min-height: 40px; padding: 8px 11px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; color: var(--api-text-secondary); background: var(--api-elevated); border: 1px solid var(--api-border-strong); border-radius: 10px; font-size: 10px; cursor: pointer; transition: color 170ms ease, border-color 170ms ease, background 170ms ease; }
.api-bale-bot-link-row button:hover { color: var(--api-text); background: var(--api-hover); }
.api-bale-bot-link-row button.is-copied { color: var(--api-success); border-color: rgba(112, 201, 148, .32); }
.api-bale-bot-link-row button svg { width: 15px; height: 15px; }
.api-bale-step { min-width: 0; margin: 0; padding: 17px; display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 13px; background: #181818; border: 1px solid var(--api-border); border-radius: 15px; }
fieldset.api-bale-step { border: 1px solid var(--api-border); }
.api-bale-step-number { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; color: var(--api-text); background: var(--api-elevated); border: 1px solid var(--api-border); border-radius: 11px; font-size: 12px; }
.api-bale-field,
.api-bale-store-field { min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.api-bale-field > span,
.api-bale-store-field legend { color: var(--api-text); font-size: 12px; font-weight: 600; }
.api-bale-field small,
.api-bale-store-field > p { margin: 0; color: var(--api-muted); font-size: 10px; line-height: 1.8; }
.api-bale-store-list { margin-top: 5px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.api-bale-store-option { position: relative; min-width: 0; min-height: 72px; padding: 10px; display: grid; grid-template-columns: 40px minmax(0, 1fr) 22px; align-items: center; gap: 9px; background: #202020; border: 1px solid var(--api-border); border-radius: 12px; cursor: pointer; transition: background 170ms ease, border-color 170ms ease; }
.api-bale-store-option:hover,
.api-bale-store-option:has(input:checked) { background: #242020; border-color: rgba(245, 54, 92, .45); }
.api-bale-store-option input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.api-bale-store-avatar { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; overflow: hidden; color: var(--api-brand); background: #e9e9e9; border-radius: 10px; font-size: 12px; }
.api-bale-store-avatar img { width: 100%; height: 100%; object-fit: cover; }
.api-bale-store-copy { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.api-bale-store-copy strong,
.api-bale-store-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.api-bale-store-copy strong { color: var(--api-text); font-size: 11px; }
.api-bale-store-copy small { color: var(--api-muted); font-size: 9px; }
.api-bale-store-check { width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; color: transparent; border: 1px solid var(--api-border-strong); border-radius: 50%; font-size: 10px; }
.api-bale-store-option:has(input:checked) .api-bale-store-check { color: #fff; background: var(--api-brand); border-color: var(--api-brand); }
.api-bale-empty { grid-column: 1 / -1; padding: 18px; color: var(--api-text-secondary); border: 1px dashed var(--api-border-strong); border-radius: 11px; text-align: center; font-size: 11px; }
.api-bale-actions { display: flex; justify-content: flex-end; }
.api-bale-existing { margin-top: 18px; padding: 24px; }
.api-bale-connection-list { margin-top: 20px; display: flex; flex-direction: column; gap: 9px; }
.api-bale-connection-item { padding: 14px; display: flex; align-items: center; gap: 12px; background: #1c1c1c; border: 1px solid var(--api-border); border-radius: 12px; }
.api-bale-connection-item > div { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.api-bale-connection-item strong { color: var(--api-text); font-size: 12px; text-align: right; }
.api-bale-connection-item small { color: var(--api-muted); font-size: 10px; }
.api-bale-status { padding: 5px 8px; color: #e9c77e; background: rgba(202, 148, 39, .08); border: 1px solid rgba(202, 148, 39, .2); border-radius: 999px; font-size: 9px; }
.api-bale-status.is-verified { color: var(--api-success); background: rgba(112, 201, 148, .08); border-color: rgba(112, 201, 148, .2); }
.api-bale-status.is-failed { color: var(--api-danger); background: var(--api-danger-bg); border-color: rgba(239, 106, 118, .2); }
.api-bale-disconnect { color: var(--api-danger); background: var(--api-danger-bg); border: 1px solid rgba(239, 106, 118, .24); }
.api-bale-disconnect:hover:not(:disabled) { background: rgba(239, 83, 99, .16); border-color: rgba(239, 106, 118, .42); }

.api-panel-locked .api-panel-app { filter: blur(1.5px); pointer-events: none; user-select: none; }
.api-panel-locked #otpAuthOverlay { pointer-events: auto; user-select: auto; }
.api-panel-locked #otpAuthCloseBtn { display: none !important; }
.api-panel-drawer-overlay { display: none; }

.api-review-list { display: grid; gap: 18px; }
.api-review-card { min-width: 0; max-width: 100%; padding: 22px; overflow: hidden; box-sizing: border-box; border: 1px solid var(--api-border); border-radius: 18px; background: var(--api-surface); }
.api-review-media { width: 100%; margin-bottom: 14px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.api-review-media-item { position: relative; min-width: 0; aspect-ratio: 1; margin: 0; overflow: hidden; border-radius: 12px; background: var(--api-elevated); }
.api-review-media-item img { display: block; width: 100%; height: 100%; object-fit: cover; }
.api-review-image-remove { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; padding: 0; display: inline-flex; align-items: center; justify-content: center; color: #fff; background: rgba(12,12,12,.82); border: 1px solid rgba(255,255,255,.35); border-radius: 50%; box-shadow: 0 2px 8px rgba(0,0,0,.35); cursor: pointer; transition: background 150ms ease, transform 150ms ease; }
.api-review-image-remove:hover { background: var(--api-brand); transform: scale(1.06); }
.api-review-image-remove svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.api-review-meta { display: flex; flex-wrap: wrap; gap: 8px; color: var(--api-muted); font-size: 13px; }
.api-review-meta span, .api-review-meta time { min-width: 0; max-width: 100%; padding: 5px 9px; overflow-wrap: anywhere; border-radius: 999px; background: rgba(255,255,255,.05); }
.api-review-card details { margin: 14px 0; }
.api-review-card details p { max-width: 100%; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--api-muted); }
.api-review-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.api-review-fields, .api-review-fields > *, .api-review-fields label { min-width: 0; max-width: 100%; box-sizing: border-box; }
.api-review-fields label { display: grid; gap: 6px; }
.api-review-fields input, .api-review-fields textarea { min-width: 0; max-width: 100%; width: 100%; box-sizing: border-box; padding: 11px 12px; border: 1px solid var(--api-border); border-radius: 10px; background: var(--api-elevated); color: inherit; }
.api-review-wide { grid-column: 1/-1; }
.api-review-check { display: flex !important; align-items: center; gap: 8px; }
.api-review-check input { width: 18px; height: 18px; }
.api-review-setting-card { padding: 14px; border: 1px solid var(--api-border); border-radius: 14px; background: rgba(255,255,255,.03); }
.api-review-setting-head { min-width: 0; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.api-review-setting-card > strong { display: block; min-width: 0; max-width: 100%; margin-top: 9px; overflow-wrap: anywhere; color: var(--api-muted); font-size: 13px; line-height: 1.8; }
.api-review-preparation { margin-top: 14px; }
.api-review-edit-button { border: 1px solid rgba(245,54,92,.28); border-radius: 999px; padding: 7px 13px; background: rgba(245,54,92,.1); color: #f5365c; font: inherit; cursor: pointer; }
.api-review-picker-card { width: min(760px, calc(100vw - 28px)); max-height: min(820px, calc(100dvh - 40px)); overflow: auto; }
.api-review-province-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; margin: 18px 0; }
.api-review-picker-option { display: flex; align-items: center; gap: 9px; padding: 11px; border: 1px solid var(--api-border); border-radius: 12px; cursor: pointer; }
.api-review-picker-option input { width: 18px; height: 18px; accent-color: #f5365c; }
.api-review-picker-footer { position: sticky; bottom: -24px; display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 12px -24px -24px; padding: 16px 24px; border-top: 1px solid var(--api-border); background: var(--api-surface); }
.api-review-picker-footer strong { max-width: 65%; color: var(--api-muted); font-size: 13px; line-height: 1.7; }
.api-review-category-search input { width: 100%; margin: 14px 0; padding: 12px; border: 1px solid var(--api-border); border-radius: 12px; background: var(--api-elevated); color: inherit; }
.api-review-category-list { display: grid; gap: 10px; padding-bottom: 12px; }
.api-review-category-group { border: 1px solid var(--api-border); border-radius: 13px; overflow: hidden; }
.api-review-category-group summary { padding: 12px; cursor: pointer; font-weight: 700; }
.api-review-category-group > div { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; padding: 0 12px 12px; }
.api-review-category-option { padding: 10px; border: 1px solid var(--api-border); border-radius: 10px; background: transparent; color: inherit; text-align: right; font: inherit; cursor: pointer; }
.api-review-category-option.is-selected { border-color: #f5365c; background: rgba(245,54,92,.12); color: #f5365c; }
.api-review-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

.api-panel-body :focus-visible { outline: 3px solid rgba(245, 54, 92, .55); outline-offset: 2px; }

@media (max-width: 1100px) {
    :root { --api-sidebar-width: 258px; }
    .api-panel-app { margin: 10px; height: calc(100dvh - 20px); }
    .api-panel-content { padding-inline: 26px; }
    .api-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .api-panel-breadcrumbs span:nth-of-type(2), .api-panel-breadcrumbs b:nth-of-type(2) { display: none; }
}

@media (max-width: 860px) {
    .api-panel-app { grid-template-columns: 1fr; border-radius: 20px; }
    .api-panel-main-column { grid-column: 1; }
    .api-panel-sidebar { position: fixed; top: 0; right: 0; width: min(320px, calc(100vw - 46px)); height: 100dvh; transform: translateX(105%); box-shadow: -20px 0 50px rgba(0, 0, 0, .45); transition: transform 200ms ease; }
    .api-panel-body.sidebar-open .api-panel-sidebar { transform: translateX(0); }
    .api-panel-sidebar-close { display: inline-flex; }
    .api-panel-drawer-overlay { position: fixed; inset: 0; z-index: 1100; background: rgba(0, 0, 0, .58); }
    .api-panel-body.sidebar-open .api-panel-drawer-overlay { display: block; }
    .api-panel-menu-toggle { display: inline-flex; }
    .api-panel-global-search { width: min(280px, 35vw); }
}

@media (max-width: 680px) {
    .api-panel-app { height: 100dvh; margin: 0; border: 0; border-radius: 0; }
    .api-panel-topbar { height: 76px; flex-basis: 76px; padding: 0 14px; gap: 10px; }
    .api-panel-breadcrumbs span, .api-panel-breadcrumbs b { display: none; }
    .api-panel-breadcrumbs strong { font-size: 14px; }
    .api-panel-global-search { display: none; }
    .api-panel-topbar-actions { margin-right: auto; gap: 5px; }
    .api-panel-icon-button { width: 44px; height: 44px; flex-basis: 44px; }
    .api-panel-profile-button { width: 44px; height: 44px; }
    .api-panel-profile-button .api-panel-user-avatar { width: 38px; height: 38px; flex-basis: 38px; }
    .api-panel-content { padding: 24px 14px 40px; }
    .api-page-header { align-items: flex-start; flex-direction: column; gap: 16px; }
    .api-page-header .api-panel-primary { width: 100%; }
    .api-stat-grid,
    .api-dashboard-grid { grid-template-columns: 1fr; }
    .api-stat-card { min-height: 132px; }
    .api-dashboard-card-wide { grid-row: auto; min-height: 330px; }
    .api-access-overview { margin: 22px 0; }
    .api-token-item { padding: 18px; }
    .api-token-item-head { padding-left: 42px; }
    .api-token-meta { grid-template-columns: 1fr 1fr; }
    .api-bale-form,
    .api-bale-existing,
    .api-bale-guide { padding: 16px; }
    .api-bale-guide-steps { grid-template-columns: 1fr; }
    .api-bale-store-list { grid-template-columns: 1fr; }
    .api-bale-connection-item { align-items: flex-start; flex-direction: column; }
    .api-review-card { padding: 14px; border-radius: 14px; }
    .api-review-media { gap: 5px; }
    .api-review-image-remove { top: 3px; right: 3px; width: 24px; height: 24px; }
    .api-review-image-remove svg { width: 14px; height: 14px; }
    .api-review-fields { grid-template-columns: 1fr; }
    .api-review-wide { grid-column: auto; }
    .api-review-province-grid, .api-review-category-group > div { grid-template-columns: 1fr; }
    .api-review-picker-footer { align-items: stretch; flex-direction: column; }
    .api-review-picker-footer strong { max-width: none; }
    .api-bale-status, .api-bale-disconnect { width: 100%; text-align: center; }
    .api-panel-popover { position: fixed; top: 68px; left: 14px; right: 14px; width: auto; }
    .api-panel-toast { right: 16px; bottom: 16px; }
}

@media (max-width: 390px) {
    .api-panel-topbar { padding-inline: 10px; }
    .api-panel-breadcrumbs strong { max-width: 115px; }
    .api-panel-content { padding-inline: 10px; }
    .api-stat-grid { gap: 10px; }
    .api-stat-card,
    .api-dashboard-card { padding: 17px; }
    .api-access-overview { grid-template-columns: 1fr; }
    .api-access-overview > div { min-height: 90px; }
    .api-access-overview > div + div { padding-right: 0; border-top: 1px solid var(--api-border); border-right: 0; }
    .api-token-meta { grid-template-columns: 1fr; }
    .api-token-created-row { grid-template-columns: 1fr; }
    .api-token-created-row button { min-height: 46px; }
    .api-bale-bot-link-row { flex-direction: column; }
    .api-bale-bot-link-row button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
