* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Microsoft YaHei", Arial, sans-serif;
    background: #f0f2f5;
    height: 100vh;
    overflow: hidden;
}

/* ===== 顶部栏 ===== */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 200px;
    padding: 0 24px;
    background: url('static/banner_pic.jpg') center/cover no-repeat;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}

.header .logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header .logo-area img {
    height: 40px;
    border-radius: 4px;
}

.header .logo-area .title {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 1px;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.header .device-btns {
    display: flex;
    gap: 12px;
}

.header .device-btns {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* SwitchButton 样式 */
.switch-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #fff;
    user-select: none;
}

.switch-wrapper .switch-label {
    font-weight: 500;
}

.switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #e53935;
    border-radius: 28px;
    transition: all 0.3s;
}

.switch .slider::before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: #fff;
    border-radius: 50%;
    transition: all 0.3s;
}

.switch input:checked + .slider {
    background-color: #43a047;
}

.switch input:checked + .slider::before {
    transform: translateX(24px);
}

.switch .slider {
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

/* ===== 整体布局 ===== */
.layout {
    display: flex;
    height: calc(100vh - 64px);
}

/* ===== 左侧菜单 ===== */
.sidebar {
    width: 220px;
    background: #fff;
    border-right: 1px solid #e0e0e0;
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar .menu-item {
    border-bottom: 1px solid #f0f0f0;
}

.sidebar .menu-item .menu-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    cursor: pointer;
    font-size: 15px;
    color: #333;
    transition: all 0.2s;
    user-select: none;
}

.sidebar .menu-item .menu-label:hover {
    background: #e8f0fe;
}

.sidebar .menu-item .menu-label .icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.sidebar .menu-item .menu-label .arrow {
    margin-left: auto;
    transition: transform 0.25s;
    font-size: 12px;
    color: #999;
}

.sidebar .menu-item .menu-label .arrow.open {
    transform: rotate(90deg);
}

.sidebar .menu-item .sub-menu {
    display: none;
    background: #fafafa;
}

.sidebar .menu-item .sub-menu.open {
    display: block;
}

.sidebar .menu-item .sub-menu .sub-item {
    padding: 10px 20px 10px 54px;
    font-size: 13px;
    color: #555;
    cursor: pointer;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}

.sidebar .menu-item .sub-menu .sub-item:hover {
    background: #e3f2fd;
    color: #1a73e8;
}

.sidebar .menu-item .sub-menu .sub-item.active {
    background: #e3f2fd;
    color: #1a73e8;
    border-left-color: #1a73e8;
    font-weight: 500;
}

/* ===== 右侧内容区 ===== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.content-panel {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f5f7fa;
}

/* 功能卡片容器 */
.func-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.func-card {
    background: #fff;
    border-radius: 8px;
    padding: 18px 20px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    border: 1px solid #e8e8e8;
    width: 320px;
    transition: box-shadow 0.2s;
}

.func-card:hover {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
}

.func-card .card-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px dashed #e8e8e8;
}

.func-card .card-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.func-card .card-body .field-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #555;
}

.func-card .card-body .field-row label {
    flex-shrink: 0;
    min-width: 70px;
}

.func-card .card-body .field-row input[type="text"] {
    flex: 1;
    padding: 4px 8px;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}

.func-card .card-body .field-row input[type="text"]:focus {
    border-color: #1a73e8;
}

.func-card .card-body .btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.func-card .card-body input[type="button"] {
    padding: 6px 16px;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    background: #1a73e8;
    color: #fff;
}

.func-card .card-body input[type="button"]:hover {
    background: #1557b0;
}

.func-card .card-body input[type="button"].btn-danger {
    background: #e53935;
}

.func-card .card-body input[type="button"].btn-danger:hover {
    background: #c62828;
}

.func-card .card-body input[type="button"].btn-success {
    background: #43a047;
}

.func-card .card-body input[type="button"].btn-success:hover {
    background: #388e3c;
}

.func-card .card-body input[type="button"].btn-warning {
    background: #f59e0b;
}

.func-card .card-body input[type="button"].btn-warning:hover {
    background: #d97706;
}

.func-card .card-body input[type="button"].btn-outline {
    background: transparent;
    color: #1a73e8;
    border: 1px solid #1a73e8;
}

.func-card .card-body input[type="button"].btn-outline:hover {
    background: #e8f0fe;
}

/* ===== 消息区域 ===== */
.message-bar {
    height: 120px;
    background: #fff;
    border-top: 1px solid #e0e0e0;
    padding: 10px 20px;
    overflow-y: auto;
    flex-shrink: 0;
}

.message-bar .msg-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 6px;
}

.message-bar .msg-content {
    font-size: 13px;
    color: #555;
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* ===== 模态框 ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.4);
}

.modal-content {
    width: 70%;
    max-width: 900px;
    background-color: #fefefe;
    margin: 5% auto;
    padding: 24px;
    border: 1px solid #888;
    border-radius: 8px;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

/* ===== 滚动条美化 ===== */
.sidebar::-webkit-scrollbar,
.content-panel::-webkit-scrollbar,
.message-bar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-thumb,
.content-panel::-webkit-scrollbar-thumb,
.message-bar::-webkit-scrollbar-thumb {
    background: #c0c0c0;
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover,
.content-panel::-webkit-scrollbar-thumb:hover,
.message-bar::-webkit-scrollbar-thumb:hover {
    background: #a0a0a0;
}

/* ===== 空状态提示 ===== */
.empty-tip {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #bbb;
    font-size: 16px;
}

.empty-tip .big-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

/* 左侧banner - 已删除 */

/* 摄像头模态框内的样式 */
.camera-modal-content {
    max-width: 960px;
    width: 85%;
}

.camera-section {
    background: #f8f9fc;
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 14px;
    border: 1px solid #e8ecf1;
}

.camera-section .section-title {
    font-size: 13px;
    font-weight: 600;
    color: #444;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.camera-section .section-title::before {
    content: '';
    display: inline-block;
    width: 3px;
    height: 14px;
    background: #1a73e8;
    border-radius: 2px;
}

.camera-section .section-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.camera-section select {
    padding: 6px 10px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
    outline: none;
    min-width: 100px;
}

.camera-section select:focus {
    border-color: #1a73e8;
    box-shadow: 0 0 0 2px rgba(26,115,232,0.15);
}

.camera-section .btn {
    padding: 6px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
    font-weight: 500;
    white-space: nowrap;
}

.camera-section .btn-primary {
    background: #1a73e8;
    color: #fff;
}

.camera-section .btn-primary:hover {
    background: #1557b0;
}

.camera-section .btn-success {
    background: #43a047;
    color: #fff;
}

.camera-section .btn-success:hover {
    background: #388e3c;
}

.camera-section .btn-danger {
    background: #e53935;
    color: #fff;
}

.camera-section .btn-danger:hover {
    background: #c62828;
}

.camera-section .btn-warning {
    background: #f59e0b;
    color: #fff;
}

.camera-section .btn-warning:hover {
    background: #d97706;
}

.camera-section .btn-outline {
    background: transparent;
    color: #555;
    border: 1px solid #d0d5dd;
}

.camera-section .btn-outline:hover {
    background: #f0f2f5;
    border-color: #b0b5bd;
}

.camera-section .btn-sm {
    padding: 4px 12px;
    font-size: 12px;
}

.camera-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: #555;
    cursor: pointer;
    user-select: none;
}

.camera-checkbox-label input[type="checkbox"] {
    width: 15px;
    height: 15px;
    cursor: pointer;
}

.camera-preview {
    display: flex;
    gap: 16px;
    min-height: 300px;
}

.camera-preview .main-view {
    flex: 6;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eef1f6;
    min-height: 280px;
}

.camera-preview .main-view img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.camera-preview .thumb-view {
    flex: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.camera-preview .thumb-view .thumb-label {
    font-size: 12px;
    color: #888;
}

.camera-preview .thumb-view .thumb-box {
    background-color: #eef1f6;
    width: 200px;
    height: 200px;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #d0d5dd;
}

.camera-preview .thumb-view .thumb-box img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* 身份证展示样式 */
.idcard-container {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 10px 0;
}

.idcard-wrapper {
    position: relative;
    width: 540px;
    flex-shrink: 0;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.idcard-wrapper .idcard-bg {
    display: block;
    width: 100%;
    height: auto;
}

.idcard-wrapper .idcard-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.idcard-wrapper .idcard-overlay .field {
    position: absolute;
    white-space: nowrap;
    line-height: 1.1;
    font-size: 20px;
    color: #222;
    font-weight: 700;
    font-family: 'SimHei', 'Microsoft YaHei', '黑体', 'Heiti SC', sans-serif;
}

.idcard-wrapper .idcard-overlay .field.f-idnum {
    font-size: 24px;
    letter-spacing: 2px;
    font-weight: 700;
    font-family: 'Courier New', 'SimHei', monospace;
}

.idcard-wrapper .idcard-overlay .field.f-addr {
    font-size: 17px;
    line-height: 1.4;
    white-space: normal !important;
}

/* 正面字段 - Java drawText基线转CSS左上角(减字体高度比) */
.idcard-front .f-name   { left: 18.37%; top: 14.9%; }
.idcard-front .f-sex    { left: 18.37%; top: 26.9%; }
.idcard-front .f-nation { left: 40.12%; top: 26.9%; }
.idcard-front .f-birth-y { left: 18.37%; top: 39.0%; }
.idcard-front .f-birth-m { left: 34.37%; top: 39.0%; }
.idcard-front .f-birth-d { left: 43.37%; top: 39.0%; }
.idcard-front .f-addr   { left: 18.37%; top: 52.9%; max-width: 46%; }
.idcard-front .f-idnum  { left: 36.12%; top: 83.8%; }

/* 头像 - IMAGE_X=62.70%, IMAGE_Y=25.64%, 头像原尺寸102x126 */
.idcard-front .f-photo {
    position: absolute;
    left: 62.70%;
    top: 25.64%;
    width: 26.15%;
    height: 51.22%;
    border: 1px solid #ddd;
    background: #f5f5f5;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 2px;
}
.idcard-front .f-photo img { width: 100%; height: 100%; object-fit: cover; }
.idcard-front .f-photo .photo-placeholder { font-size: 13px; color: #bbb; text-align: center; line-height: 1.3; }

/* 反面字段 - 基线offset -6.1% */
.idcard-back .b-issuer    { left: 40.12%; top: 69.3%; max-width: 55%; white-space: normal !important; line-height: 1.3; }
.idcard-back .b-issuedate { left: 40.12%; top: 82.8%; }
.idcard-back .b-extra     { left: 40.12%; top: 62%; font-size: 16px; color: #666; }

.idcard-toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    align-items: center;
}

.idcard-toolbar input[type="button"] {
    padding: 8px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.idcard-toolbar .btn-idcard {
    background: #1a73e8;
    color: #fff;
}

.idcard-toolbar .btn-idcard:hover {
    background: #1557b0;
}

.idcard-toolbar .btn-photo {
    background: #7c4dff;
    color: #fff;
}

.idcard-toolbar .btn-photo:hover {
    background: #651fff;
}

.idcard-toolbar .btn-close-id {
    background: #e53935;
    color: #fff;
}

.idcard-toolbar .btn-close-id:hover {
    background: #c62828;
}

.idcard-type-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 12px;
}

.idcard-type-badge.type0 { background: #e3f2fd; color: #1565c0; }
.idcard-type-badge.type1 { background: #fce4ec; color: #c62828; }
.idcard-type-badge.type2 { background: #e8f5e9; color: #2e7d32; }
.idcard-type-badge.type3 { background: #fff3e0; color: #e65100; }

.idcard-empty {
    text-align: center;
    padding: 60px 20px;
    color: #bbb;
    font-size: 15px;
}

.idcard-empty .icon {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
}

/* 隐藏banner_pic元素 */
.banner_pic {
    display: none !important;
}

/* 评价器表情样式 */
.evaluate-empty {
    text-align: center;
    padding: 20px;
    color: #bbb;
    font-size: 14px;
}

.evaluate-result {
    text-align: center;
    padding: 16px;
}

.evaluate-result .evaluate-emoji {
    font-size: 72px;
    line-height: 1.2;
    display: inline-block;
    animation: evaluateBounce 0.6s ease-out;
}

.evaluate-result .evaluate-emoji:hover {
    transform: scale(1.15);
}

@keyframes evaluateBounce {
    0%   { transform: scale(0.3); opacity: 0; }
    50%  { transform: scale(1.2); opacity: 1; }
    70%  { transform: scale(0.9); }
    100% { transform: scale(1); }
}

.evaluate-result .evaluate-label {
    font-size: 20px;
    font-weight: 700;
    margin-top: 8px;
}

.evaluate-result .evaluate-level {
    font-size: 13px;
    color: #999;
    margin-top: 4px;
}

/* 指纹图片样式 */
.fingerprint-empty {
    text-align: center;
    padding: 20px;
    color: #bbb;
    font-size: 14px;
}

.fingerprint-img {
    max-width: 100%;
    max-height: 200px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* 签字图片样式 */
.sign-empty {
    text-align: center;
    padding: 20px;
    color: #bbb;
    font-size: 14px;
}

.sign-result-img {
    max-width: 100%;
    max-height: 180px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.sign-fin-grid {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.sign-fin-item {
    text-align: center;
    flex: 1;
    min-width: 120px;
}

.sign-fin-label {
    font-size: 12px;
    color: #888;
    margin-bottom: 4px;
}

/* PDF预览弹窗 */
.pdf-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 9998;
    align-items: center;
    justify-content: center;
}

.pdf-overlay.active {
    display: flex;
}

.pdf-modal {
    background: #fff;
    border-radius: 16px;
    width: 85%;
    max-width: 900px;
    height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: pdfModalIn 0.3s ease-out;
    overflow: hidden;
}

@keyframes pdfModalIn {
    0%   { transform: scale(0.95); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.pdf-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.pdf-modal-header .pdf-modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.pdf-modal-header .pdf-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    padding: 0 4px;
    border-radius: 6px;
    line-height: 1;
    transition: all 0.2s;
}

.pdf-modal-header .pdf-modal-close:hover {
    background: #f0f0f0;
    color: #333;
}

.pdf-modal-body {
    flex: 1;
    padding: 0;
    overflow: hidden;
}

.pdf-modal-body iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* 断线弹窗 */
.disconnect-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(6px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.disconnect-overlay.active {
    display: flex;
}

.disconnect-modal {
    background: #fff;
    border-radius: 20px;
    padding: 48px 56px 40px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    max-width: 400px;
    width: 90%;
    animation: disconnectSlideIn 0.4s ease-out;
    position: relative;
}

.disconnect-modal .modal-close-btn {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 24px;
    color: #bbb;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    transition: all 0.2s;
    line-height: 1;
}

.disconnect-modal .modal-close-btn:hover {
    background: #f5f5f5;
    color: #666;
}

@keyframes disconnectSlideIn {
    0%   { transform: translateY(-30px) scale(0.95); opacity: 0; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

.disconnect-modal .icon-warning {
    display: inline-flex;
    width: 80px;
    height: 80px;
    background: #fff3e0;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    margin-bottom: 16px;
    animation: warningPulse 2s ease-in-out infinite;
}

@keyframes warningPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255,152,0,0.3); }
    50%      { box-shadow: 0 0 0 16px rgba(255,152,0,0); }
}

.disconnect-modal .disconnect-title {
    font-size: 22px;
    font-weight: 700;
    color: #333;
    margin-bottom: 8px;
}

.disconnect-modal .disconnect-desc {
    font-size: 14px;
    color: #888;
    margin-bottom: 28px;
    line-height: 1.6;
}

.disconnect-modal .btn-reconnect {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f60;
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 14px 36px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.disconnect-modal .btn-reconnect:hover {
    background: #e55d00;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(255,102,0,0.35);
}

.disconnect-modal .btn-reconnect:active {
    transform: translateY(0);
}

.disconnect-modal .btn-reconnect .spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.disconnect-modal .btn-reconnect.loading .spinner {
    display: inline-block;
}

.disconnect-modal .btn-reconnect.loading .btn-text {
    display: none;
}

/* 端口设置按钮 */
.port-setting-btn {
    padding: 6px 14px;
    border: 1px solid rgba(255,255,255,0.5);
    border-radius: 6px;
    background: rgba(255,255,255,0.15);
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    font-family: inherit;
}

.port-setting-btn:hover {
    background: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.8);
}

/* 端口设置弹窗 */
.port-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.port-overlay.active {
    display: flex;
}

.port-modal {
    background: #fff;
    border-radius: 14px;
    width: 400px;
    max-width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    animation: portModalIn 0.25s ease-out;
    overflow: hidden;
}

@keyframes portModalIn {
    0%   { transform: scale(0.92); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.port-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px 12px;
    border-bottom: 1px solid #eee;
}

.port-modal-header .port-modal-title {
    font-size: 17px;
    font-weight: 600;
    color: #333;
}

.port-modal-header .port-modal-close {
    background: none;
    border: none;
    font-size: 26px;
    color: #999;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    border-radius: 6px;
    transition: all 0.2s;
}

.port-modal-header .port-modal-close:hover {
    background: #f0f0f0;
    color: #333;
}

.port-modal-body {
    padding: 20px 24px;
}

.port-field-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.port-field-row label {
    font-size: 14px;
    color: #555;
    white-space: nowrap;
}

.port-field-row input[type="number"] {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}

.port-field-row input[type="number"]:focus {
    border-color: #1a73e8;
    box-shadow: 0 0 0 2px rgba(26,115,232,0.15);
}

.port-tip {
    font-size: 12px;
    color: #999;
    line-height: 1.5;
}

.port-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 24px 18px;
    border-top: 1px solid #f0f0f0;
}

.port-modal-footer button {
    padding: 8px 22px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.port-btn-cancel {
    background: #f0f0f0;
    color: #555;
}

.port-btn-cancel:hover {
    background: #e0e0e0;
}

.port-btn-save {
    background: #1a73e8;
    color: #fff;
}

.port-btn-save:hover {
    background: #1557b0;
}