/* 网关访问授权页：复用 admin.css 的蔚蓝玻璃风格，补充开关、凭据卡、代码块与会话表 */

.access-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 1180px;
    margin: 20px auto 60px;
    padding: 0 24px;
}

.form__hint {
    color: var(--ink-faint);
    font-size: 0.6875rem;
    line-height: 1.6;
}

.panel__note {
    color: var(--ink-faint);
    font-size: 0.6875rem;
    line-height: 1.6;
}

/* 复制兜底用的隐藏 textarea：不能 display:none，否则 execCommand 选不中 */
.copy-helper {
    position: fixed;
    top: 0;
    left: 0;
    width: 1px;
    height: 1px;
    border: 0;
    opacity: 0;
    pointer-events: none;
}

.panel__tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 12px 20px 0;
}

/* ---- 开关 ---- */

.switch {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-field);
    background: rgba(255, 255, 255, 0.66);
    cursor: pointer;
    transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease);
}

.switch:hover {
    border-color: var(--line-strong);
    background: rgba(255, 255, 255, 0.86);
}

.switch input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.switch__track {
    position: relative;
    flex: none;
    width: 40px;
    height: 22px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.2);
    transition: background-color 0.2s var(--ease);
}

.switch__track::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 6px rgba(11, 28, 57, 0.28);
    transition: transform 0.2s var(--ease);
}

.switch input:checked + .switch__track {
    background: linear-gradient(140deg, var(--accent-deep), var(--accent));
}

.switch input:checked + .switch__track::after {
    transform: translateX(18px);
}

.switch input:focus-visible + .switch__track {
    outline: 2px solid var(--ink);
    outline-offset: 2px;
}

.switch__copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.switch__title {
    color: var(--ink);
    font-size: 0.8125rem;
    font-weight: 600;
}

.switch__desc {
    color: var(--ink-faint);
    font-size: 0.6875rem;
    line-height: 1.4;
}

/* ---- 状态徽标 ---- */

.state-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 9px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 600;
    white-space: nowrap;
}

.state-badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.state-badge--on {
    border-color: var(--ok-line);
    background: var(--ok-soft);
    color: var(--ok);
}

.state-badge--off {
    border-color: var(--muted-line);
    background: var(--muted-soft);
    color: var(--muted);
}

/* ---- 凭据卡 ---- */

.credential {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 14px 20px 0;
    padding: 14px;
    border: 1px solid var(--ok-line);
    border-radius: 12px;
    background: var(--ok-soft);
}

.credential__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.credential__title {
    color: var(--ink);
    font-size: 0.8125rem;
    font-weight: 700;
}

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

.credential__item {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.92);
}

.credential__label {
    flex: none;
    color: var(--ink-faint);
    font-size: 0.75rem;
    font-weight: 600;
}

.credential__value {
    flex: 1 1 auto;
    min-width: 0;
    color: var(--ink);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    line-height: 1.5;
    word-break: break-all;
}

.credential__note {
    color: var(--ink-faint);
    font-size: 0.6875rem;
    line-height: 1.6;
}

/* ---- 表格 ---- */

.ak-code {
    color: var(--ink-dim);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    white-space: nowrap;
}

.cell-elec {
    display: block;
    max-width: 220px;
    overflow: hidden;
    color: var(--ink-dim);
    font-size: 0.75rem;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.cell-time,
.cell-count {
    color: var(--ink-dim);
    font-size: 0.75rem;
    white-space: nowrap;
}

.cell-host,
.cell-mono {
    color: var(--ink-dim);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    white-space: nowrap;
}

.cell-ua {
    display: block;
    max-width: 170px;
    overflow: hidden;
    color: var(--ink-faint);
    font-size: 0.6875rem;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* 窄视口不压列、不折行：表格给最小宽度，由 .table-wrap 横向滚动 */
.ak-table {
    min-width: 1040px;
}

.session-table {
    min-width: 1240px;
}

/* 操作按钮必须保持一行；中文在窄格子里会被逐字硬拆，这里显式禁止换行 */
.ak-table .cell-actions,
.session-table .cell-actions {
    flex-wrap: nowrap;
    justify-content: flex-end;
    white-space: nowrap;
}

.ak-table .cell-actions .link-btn,
.session-table .cell-actions .link-btn {
    display: inline-flex;
    flex: none;
    align-items: center;
    white-space: nowrap;
}

.session-table td {
    padding: 10px 8px;
}

.session-table th {
    white-space: nowrap;
}

/* ---- 资源多选 ---- */

.tag-option__text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 资源超过 20 个时由 JS 加 has-scroll，容器限高并滚动 */
.ak-elec-list.has-scroll {
    max-height: 240px;
    padding-right: 4px;
    overflow-y: auto;
}

/* ---- 接入说明 ---- */

.doc-panel {
    min-width: 0;
}

.doc {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 16px 20px 20px;
}

.doc__item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.doc__title {
    color: var(--ink);
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.doc__text {
    color: var(--ink-dim);
    font-size: 0.8125rem;
    line-height: 1.7;
}

.doc__text strong {
    color: var(--ink);
    font-weight: 700;
}

.doc__text code,
.doc__list code {
    padding: 1px 5px;
    border-radius: 6px;
    background: var(--accent-soft);
    color: var(--accent-deep);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    word-break: break-all;
}

.doc__list {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding-left: 18px;
    color: var(--ink-dim);
    font-size: 0.8125rem;
    line-height: 1.7;
    list-style: disc;
}

.doc__actions {
    display: flex;
    justify-content: flex-end;
}

/* 等宽代码块，可直接选中复制 */
.doc__pre {
    margin: 0;
    padding: 10px 12px;
    border: 1px dashed var(--line-strong);
    border-radius: 10px;
    background: rgba(11, 28, 57, 0.05);
    color: var(--ink);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre;
    user-select: all;
}

.doc__pre code {
    font: inherit;
}

@media (max-width: 560px) {
    .access-layout {
        gap: 14px;
        margin-top: 14px;
        padding: 0 16px;
    }

    .panel__tools {
        padding: 12px 16px 0;
    }

    .credential {
        margin: 12px 16px 0;
        padding: 12px;
    }

    .doc {
        padding: 14px 16px 18px;
    }

    /* 表格改为横向滚动后不再额外截断，否则窄视口会双重压缩 */
    .table-wrap {
        padding: 8px 16px 16px;
    }
}
