/*
 * Clip - iOS WebClip Packaging System Stylesheet
 * Apple HIG inspired modern design
 */

:root {
    --primary: #007AFF;
    --primary-hover: #0062CC;
    --success: #34C759;
    --warning: #FF9500;
    --danger: #FF3B30;
    --bg-page: #F2F2F7;
    --bg-card: #FFFFFF;
    --text-main: #1D1D1F;
    --text-muted: #86868B;
    --text-secondary: #48484A;
    --border-color: #E5E5EA;
    --border-light: #F0F0F5;
    --border-focus: #007AFF;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-page);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
}

/* Header */
.app-header {
    background-color: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 1320px;
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-logo-badge {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #007AFF, #0051A8);
    color: #fff;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 4px 10px rgba(0, 122, 255, 0.3);
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text-main);
}

.brand-subtitle {
    font-size: 12px;
    color: var(--text-muted);
}

.header-stats {
    display: flex;
    align-items: center;
    gap: 24px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-main);
}

/* Container */
.main-container {
    max-width: 1320px;
    margin: 0 auto;
    padding: 20px 24px 24px 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Grid Layout for Top Row */
.creation-layout {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 24px;
    align-items: start;
}

@media (max-width: 960px) {
    .creation-layout {
        grid-template-columns: 1fr;
    }
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0, 0, 0, 0.04);
    overflow: hidden;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
}

/* Form Styling - Matching 示意图 */
.create-card form {
    padding: 24px;
}

.form-grid {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-row {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 16px;
    align-items: start;
}

.form-row.align-center {
    align-items: center;
}

.field-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    text-align: right;
    padding-top: 6px;
    user-select: none;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.25;
}

.form-row.align-center .field-label {
    padding-top: 0;
}

.label-zh {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.25;
}

.label-en {
    font-size: 11.5px;
    font-weight: 400;
    color: var(--text-muted);
    line-height: 1.25;
    margin-top: 2px;
}

.label-subtext {
    font-size: 11px;
    font-weight: normal;
    color: var(--text-muted);
}

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

.form-input, .form-textarea {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-main);
    background: #FFFFFF;
    border: 1px solid #D1D1D6;
    border-radius: 6px;
    transition: all 0.2s ease;
    outline: none;
}

.form-input:focus, .form-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
}

.form-input::placeholder, .form-textarea::placeholder {
    color: #A0A0A5;
}

.form-textarea {
    resize: vertical;
    line-height: 1.4;
}

.field-hint {
    font-size: 12px;
    color: var(--text-muted);
}

/* Icon Upload Box */
.icon-upload-box {
    width: 80px;
    height: 80px;
    border: 2px dashed #C7C7CC;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background-color: #FAFAFC;
    transition: all 0.2s ease;
    overflow: hidden;
    position: relative;
}

.icon-upload-box:hover {
    border-color: var(--primary);
    background-color: #F0F7FF;
}

.icon-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.icon-help-text {
    font-size: 12px;
    color: var(--text-muted);
}

/* iOS Switch (Matching 示意图) */
.ios-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 30px;
}

.ios-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #E5E5EA;
    transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 30px;
}

.switch-slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked + .switch-slider {
    background-color: #34C759;
}

input:checked + .switch-slider:before {
    transform: translateX(20px);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    gap: 6px;
}

.btn-primary {
    background-color: var(--primary);
    color: #FFFFFF;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-secondary {
    background-color: #E5E5EA;
    color: var(--text-main);
}

.btn-secondary:hover {
    background-color: #D1D1D6;
}

.btn-success {
    background-color: var(--success);
    color: #FFFFFF;
}

.btn-danger {
    background-color: #FF3B30;
    color: #FFFFFF;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
    border-radius: 6px;
}

.btn-submit {
    background-color: #FFFFFF;
    color: #1D1D1F;
    border: 1px solid #C7C7CC;
    padding: 8px 36px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-submit:hover {
    background-color: #F2F2F7;
    border-color: #8E8E93;
}

.btn-submit:active {
    background-color: #E5E5EA;
}

/* Badges */
.badge {
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
}

.badge-info {
    background-color: #E5F1FF;
    color: var(--primary);
}

.badge-subtle {
    background-color: #F2F2F7;
    color: var(--text-muted);
}

.badge-success {
    background-color: #E8F9ED;
    color: var(--success);
}

/* iPhone Mockup Simulator */
.preview-card {
    display: flex;
    flex-direction: column;
}

.iphone-mockup {
    width: 290px;
    height: 580px;
    background: #000000;
    border-radius: 44px;
    margin: 20px auto;
    border: 10px solid #2C2C2E;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.iphone-notch {
    width: 110px;
    height: 22px;
    background: #000000;
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    border-bottom-left-radius: 14px;
    border-bottom-right-radius: 14px;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.iphone-notch .camera {
    width: 8px;
    height: 8px;
    background: #1C1C1E;
    border-radius: 50%;
}

.iphone-notch .speaker {
    width: 38px;
    height: 4px;
    background: #1C1C1E;
    border-radius: 2px;
}

.preview-mode-bar {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-light);
}

.mode-btn {
    padding: 4px 14px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 14px;
    border: none;
    background: #F2F2F7;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.mode-btn.active {
    background: var(--primary);
    color: #FFFFFF;
}

.iphone-screen {
    flex: 1;
    background: linear-gradient(180deg, #1C1C28 0%, #0C0C14 100%);
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Home Screen View */
.home-screen-view {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 40px 16px 16px 16px;
}

.home-time {
    text-align: center;
    font-size: 46px;
    font-weight: 200;
    color: #FFFFFF;
    margin-top: 10px;
    letter-spacing: -1px;
}

.home-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-top: 20px;
}

.home-app-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.app-icon-img {
    width: 50px;
    height: 50px;
    border-radius: 11px;
    background: var(--primary);
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.app-icon-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dummy-safari { background: #007AFF; font-size: 24px; }
.dummy-settings { background: #8E8E93; font-size: 24px; }
.dummy-photos { background: #FFFFFF; font-size: 24px; }

.app-icon-label {
    font-size: 10px;
    color: #FFFFFF;
    text-align: center;
    max-width: 56px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.home-dock {
    padding-bottom: 6px;
}

.dock-inner {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 8px 12px;
    display: flex;
    justify-content: space-around;
}

.dock-icon {
    font-size: 20px;
}

/* In-App View */
.app-screen-view {
    height: 100%;
    background: #FFFFFF;
    display: flex;
    flex-direction: column;
    color: #1D1D1F;
}

.app-status-bar {
    padding: 10px 16px 4px 16px;
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 600;
    color: #1D1D1F;
}

.app-content-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 12px;
}

.app-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.preview-header-title {
    font-size: 14px;
    font-weight: 700;
}

.preview-secure-tag {
    font-size: 10px;
    color: var(--success);
    font-weight: 600;
}

.app-preview-iframe-box {
    flex: 1;
    margin-top: 10px;
    border-radius: 8px;
    background: #F8F9FA;
    border: 1px dashed #D1D1D6;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 16px;
}

.webview-url {
    font-size: 11px;
    color: var(--primary);
    word-break: break-all;
    margin-top: 8px;
}

.webview-desc {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 6px;
}

.iphone-home-indicator {
    width: 90px;
    height: 4px;
    background: #1D1D1F;
    border-radius: 2px;
    margin: 6px auto;
}

/* Management Section & Table */
.section-title-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.title-with-count {
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title {
    font-size: 18px;
    font-weight: 700;
}

.count-pill {
    font-size: 12px;
    font-weight: 600;
    background: #E5E5EA;
    color: var(--text-secondary);
    padding: 2px 8px;
    border-radius: 12px;
}

.clips-table-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0, 0, 0, 0.04);
    overflow: hidden;
}

.table-responsive {
    overflow-x: auto;
    overflow-y: auto;
    max-height: calc(100vh - 215px);
    min-height: 320px;
    scrollbar-width: thin;
}

.table-responsive::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.table-responsive::-webkit-scrollbar-track {
    background: transparent;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 3px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.28);
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
    text-align: left;
}

.data-table th {
    position: sticky;
    top: 0;
    z-index: 20;
    background-color: #FAFAFC;
    padding: 16px 20px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    box-shadow: inset 0 -1px 0 var(--border-color);
    white-space: nowrap;
}

.data-table td {
    padding: 22px 20px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.data-table tr:hover td {
    background-color: #F8F9FA;
}

.clip-info-col {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 220px;
}

.clip-row-icon {
    width: 46px;
    height: 46px;
    border-radius: 11px;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    color: #FFFFFF;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), inset 0 0 0 1px rgba(0, 0, 0, 0.05);
    background-color: #007AFF;
    transition: transform 0.15s ease;
    margin: 0 auto;
}

.clip-row-icon:hover {
    transform: scale(1.05);
}

.clip-row-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.clip-title-text {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-main);
    letter-spacing: -0.2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.clip-meta-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    color: var(--text-muted);
}

.clip-id-tag {
    font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 11.5px;
    background: #F0F2F5;
    color: #6E6E73;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
}

.clip-org-tag {
    font-size: 11.5px;
    color: #86868B;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.clip-badge-pill {
    font-size: 10.5px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
}

.clip-badge-green {
    background: #E8F8EE;
    color: #34C759;
}

.clip-badge-gray {
    background: #F0F2F5;
    color: #86868B;
}

.clip-target-cell {
    display: flex;
    flex-direction: column;
    gap: 3px;
    max-width: 320px;
}

.target-url-line {
    display: flex;
    align-items: flex-start;
    gap: 5px;
    width: 100%;
}

.target-url-text {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-main);
    word-break: break-all;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    white-space: normal;
    line-height: 1.35;
    flex: 1;
}

.status-dot-green {
    width: 6px;
    height: 6px;
    background-color: #34C759;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-block;
    margin-top: 5px;
}

.target-switch-link {
    font-size: 11.5px;
    color: var(--primary);
    cursor: pointer;
    font-weight: 500;
    text-decoration: none;
    width: fit-content;
    display: inline-block;
    margin-top: 1px;
}

.target-switch-link:hover {
    text-decoration: underline;
}

.target-api-badge {
    font-size: 9.5px;
    background: #E8F2FF;
    color: #007AFF;
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 600;
    flex-shrink: 0;
    margin-top: 2px;
}

.target-api-subpath {
    font-size: 11px;
    color: #86868B;
    font-family: SFMono-Regular, Consolas, monospace;
    word-break: break-all;
}

.text-muted-empty {
    color: #A0A0A5;
    font-size: 12.5px;
}

.gateway-link-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background-color: #EAF3FF;
    color: #007AFF;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    font-family: SFMono-Regular, Consolas, monospace;
    text-decoration: none;
    transition: all 0.2s;
    border: 1px solid #D2E5FF;
    white-space: nowrap;
}

.gateway-link-badge:hover {
    background-color: #007AFF;
    color: #FFFFFF;
    border-color: #007AFF;
}

.stats-box {
    display: inline-flex;
    flex-direction: column;
    gap: 4px;
    background: #F0F2F5;
    padding: 6px 12px;
    border-radius: 8px;
    text-align: left;
}

.stat-single-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    background: #F4F6F9;
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-main);
    white-space: nowrap;
    border: 1px solid #EAECEF;
}

.stat-single-box .stat-icon {
    font-size: 13px;
}

.stat-single-box .stat-num {
    font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
}

.stat-line {
    font-size: 12px;
    color: #48484A;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.stat-icon {
    font-size: 12px;
}

.date-col-text {
    color: #86868B;
    font-size: 13px;
    white-space: nowrap;
}

.action-buttons-group {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    height: 34px;
    padding: 0 13px;
    font-size: 12.5px;
    font-weight: 500;
    border-radius: 8px;
    border: 1px solid #E5E7EB;
    background-color: #FFFFFF;
    color: #1D1D1F;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.15s ease;
    user-select: none;
    box-sizing: border-box;
}

.btn-action-install {
    background-color: #007AFF;
    border-color: #007AFF;
    color: #FFFFFF;
    font-weight: 600;
}
.btn-action-install:hover {
    background-color: #0062CC;
    border-color: #0062CC;
}

.btn-action-switch {
    background-color: #FFFFFF;
    border-color: #E5E7EB;
    color: #1D1D1F;
}
.btn-action-switch:hover {
    background-color: #F8F9FA;
    border-color: #D1D5DB;
    color: #007AFF;
}

.btn-action-download {
    background-color: #FFFFFF;
    border-color: #E5E7EB;
    color: #1D1D1F;
}
.btn-action-download:hover {
    background-color: #F8F9FA;
    border-color: #D1D5DB;
}

.btn-action-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 13.5px;
    background-color: #FFFFFF;
    border: 1px solid #E5E7EB;
    color: #48484A;
    cursor: pointer;
    transition: all 0.15s ease;
    box-sizing: border-box;
}
.btn-action-icon:hover {
    background-color: #F8F9FA;
    border-color: #D1D5DB;
    color: #1D1D1F;
}

.btn-action-danger {
    background-color: #FFF2F2;
    border-color: #FFE0E0;
    color: #FF3B30;
}
.btn-action-danger:hover {
    background-color: #FF3B30;
    border-color: #FF3B30;
    color: #FFFFFF;
}

.table-empty {
    text-align: center;
    padding: 48px 0;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.empty-icon {
    font-size: 36px;
}

.empty-text {
    color: var(--text-muted);
    font-size: 14px;
}

/* Modals */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

#modal-param-guide,
#modal-delete-confirm {
    z-index: 9500;
}

.modal-dialog {
    background: #FFFFFF;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    margin: auto;
    position: relative;
    animation: modalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-dialog-large {
    max-width: 960px;
}

.modal-dialog-confirm {
    max-width: 400px;
    border-radius: 20px;
    padding: 26px 24px 22px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin: auto;
    background: #FFFFFF;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.confirm-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.confirm-icon-box {
    display: none;
}

.confirm-title {
    font-size: 18px;
    font-weight: 700;
    color: #1D1D1F;
    margin: 0;
}

.confirm-desc {
    font-size: 13px;
    color: #6E6E73;
    line-height: 1.55;
    margin-bottom: 6px;
}

.confirm-desc strong {
    color: #1D1D1F;
}

.confirm-footer {
    width: 100%;
    display: flex;
    gap: 12px;
    margin-top: 18px;
}

.btn-confirm-cancel, .btn-confirm-delete {
    flex: 1;
    height: 40px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.create-modal-layout {
    display: grid;
    grid-template-columns: 1.25fr 0.75fr;
    gap: 24px;
    align-items: start;
}

@media (max-width: 820px) {
    .create-modal-layout {
        grid-template-columns: 1fr;
    }
    .modal-simulator-pane {
        display: none;
    }
}

.search-box {
    width: 240px;
}

.search-box .form-input {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.refresh-icon {
    display: inline-block;
    transition: transform 0.2s ease;
}

.refresh-icon.spinning {
    animation: spin 0.6s linear infinite;
}

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

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
}

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

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
}

.modal-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1;
    overflow-y: auto;
    max-height: calc(88vh - 140px);
    -webkit-overflow-scrolling: touch;
}

.modal-footer {
    padding: 16px 24px;
    background: #FAFAFC;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-shrink: 0;
}

.qr-preview-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
    padding-bottom: 8px;
}

.qr-canvas-box {
    padding: 12px;
    background: #FFFFFF;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
}

.qr-tip-highlight {
    font-weight: 600;
    color: var(--primary);
    font-size: 14px;
}

.qr-tip-sub {
    font-size: 12px;
    color: var(--text-muted);
}

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

.link-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

.input-with-btn {
    display: flex;
    gap: 8px;
}

.input-with-status {
    display: flex;
    gap: 8px;
}

.target-switch-card {
    background: #FAFAFC;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
}

.test-result-bar {
    font-size: 12px;
    margin-top: 6px;
    padding: 4px 8px;
    border-radius: 4px;
}

.test-result-success {
    background: #E8F9ED;
    color: #198754;
}

.test-result-fail {
    background: #FFEBEA;
    color: #DC3545;
}

.alert-info-box {
    background: #EAF4FF;
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 12px;
    color: #004085;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    line-height: 1.45;
}

.history-logs-section {
    border-top: 1px solid var(--border-light);
    padding-top: 12px;
}

.history-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.history-item {
    font-size: 11px;
    color: var(--text-secondary);
    padding: 4px 0;
    border-bottom: 1px dashed var(--border-light);
    display: flex;
    justify-content: space-between;
}

/* Toast Notification (Always on the Topmost Layer) */
.toast {
    position: fixed;
    top: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(-60px);
    background: rgba(24, 24, 27, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    color: #FFFFFF;
    padding: 11px 24px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.15);
    z-index: 999999 !important;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease;
    opacity: 0;
    pointer-events: none;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Help Guide Button & Parameter Guide Modal Table */
.btn-help-guide {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: #F2F4F7;
    border: 1px solid #E2E4E9;
    border-radius: 20px;
    color: var(--text-main);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.btn-help-guide:hover {
    background: #E8EDF5;
    border-color: #C2D4EE;
    color: var(--primary);
    box-shadow: 0 2px 6px rgba(0, 122, 255, 0.12);
    transform: translateY(-1px);
}

.help-question-mark {
    width: 19px;
    height: 19px;
    background: var(--primary);
    color: #FFFFFF;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

.help-btn-label {
    font-size: 13px;
    font-weight: 600;
}

.guide-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    line-height: 1.5;
}

.guide-table th {
    background: #F8F9FB;
    padding: 12px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}

.guide-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
    color: var(--text-main);
}

.guide-table tr:hover td {
    background: #F9FBFC;
}

.guide-table code {
    background: #F0F2F5;
    color: #007AFF;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-family: SFMono-Regular, Consolas, monospace;
}

.badge-required {
    display: inline-block;
    background: #FFEBEA;
    color: #D93025;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
}

.badge-optional {
    display: inline-block;
    background: #F0F2F5;
    color: #6E6E73;
    font-size: 11px;
    font-weight: 500;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
}

.badge-switch {
    display: inline-block;
    background: #E8F8EE;
    color: #1E8E3E;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
}

/* ==========================================================================
   Clickable App Row in Table & Detail Modal
   ========================================================================== */
.clip-clickable-row {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.clip-clickable-row:hover {
    background-color: #F6F8FC !important;
}

.clip-clickable-row:hover .clip-title-text {
    color: var(--primary);
}

.clip-clickable-row:hover .clip-row-icon {
    transform: scale(1.06);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

.clip-row-icon {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.modal-dialog-detail {
    max-width: 680px;
    width: 92%;
}

.detail-hero-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 18px;
    background: #F8F9FB;
    border: 1px solid #EAECEF;
    border-radius: 12px;
}

.detail-hero-icon {
    width: 58px;
    height: 58px;
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    color: #FFFFFF;
    background-color: var(--primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
}

.detail-hero-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.detail-hero-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.detail-hero-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.detail-hero-title {
    font-size: 18px;
    font-weight: 700;
    color: #1D1D1F;
    margin: 0;
}

.detail-id-tag {
    font-family: SFMono-Regular, Consolas, monospace;
    font-size: 11px;
    background: #E5E7EB;
    color: #4B5563;
    padding: 2px 7px;
    border-radius: 4px;
    font-weight: 600;
}

.detail-status-tag {
    font-size: 11px;
    background: #E8F8EE;
    color: #34C759;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

.detail-hero-sub {
    font-family: SFMono-Regular, Consolas, monospace;
    font-size: 12px;
    color: #86868B;
    word-break: break-all;
}

.detail-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
}

.detail-section-title {
    font-size: 13px;
    font-weight: 700;
    color: #1D1D1F;
    display: flex;
    align-items: center;
    gap: 6px;
    padding-bottom: 5px;
    border-bottom: 1px solid #ECEEF1;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

@media (max-width: 620px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }
}

.detail-item {
    background: #F9FAFB;
    border: 1px solid #ECEEF1;
    border-radius: 8px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-item-full {
    grid-column: 1 / -1;
}

.detail-key {
    font-size: 11px;
    font-weight: 600;
    color: #86868B;
}

.detail-val {
    font-size: 13px;
    color: #1D1D1F;
    font-weight: 500;
    word-break: break-all;
    line-height: 1.4;
}

.detail-val-highlight {
    font-size: 13px;
    font-weight: 600;
}

.detail-link {
    color: var(--primary);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    word-break: break-all;
}

.detail-link:hover {
    text-decoration: underline;
}

.link-ext-icon {
    font-size: 12px;
    opacity: 0.8;
}

.detail-val-code {
    font-family: SFMono-Regular, Consolas, monospace;
    font-size: 11.5px;
    color: #007AFF;
    background: #EBF4FF;
    padding: 4px 8px;
    border-radius: 4px;
    word-break: break-all;
}

.detail-val-mono {
    font-family: SFMono-Regular, Consolas, monospace;
    font-size: 11.5px;
    color: #4B5563;
    background: #F0F2F5;
    padding: 4px 8px;
    border-radius: 4px;
    word-break: break-all;
}

.detail-val-stat {
    font-size: 13px;
    color: #1D1D1F;
}

.detail-val-stat strong {
    font-family: SFMono-Regular, Consolas, monospace;
    font-size: 14px;
    color: var(--primary);
}

/* ==========================================================================
   Table Pagination Bar
   ========================================================================== */
.table-pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: #FAFAFC;
    border-top: 1px solid var(--border-color);
    border-bottom-left-radius: var(--radius-lg);
    border-bottom-right-radius: var(--radius-lg);
    flex-wrap: wrap;
    gap: 12px;
}

.pagination-left-info {
    font-size: 13px;
    color: var(--text-muted);
}

.pagination-left-info strong {
    color: var(--text-main);
    font-weight: 600;
}

.pagination-right-controls {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.page-size-selector-group {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
}

.pagination-select {
    padding: 5px 28px 5px 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: #FFFFFF url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2386868B' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>") no-repeat right 8px center;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-main);
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    transition: all 0.2s ease;
}

.pagination-select:hover,
.pagination-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.15);
}

.pagination-pages-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-page-nav,
.btn-page-num {
    min-width: 32px;
    height: 32px;
    padding: 0 6px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: #FFFFFF;
    color: var(--text-main);
    font-size: 13px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.btn-page-nav:hover:not(:disabled),
.btn-page-num:hover:not(.active) {
    background: #F2F4F7;
    border-color: #D1D5DB;
    color: var(--primary);
}

.btn-page-nav:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: #F8F9FA;
    border-color: #E5E7EB;
}

.btn-page-num.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #FFFFFF;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(0, 122, 255, 0.3);
}

.pagination-ellipsis {
    color: var(--text-muted);
    padding: 0 4px;
    font-size: 13px;
    user-select: none;
}

.pagination-jump-group {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
}

.pagination-jump-input {
    width: 46px;
    height: 32px;
    padding: 0 6px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: #FFFFFF;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-main);
    text-align: center;
    outline: none;
    transition: all 0.2s ease;
    -moz-appearance: textfield;
}

.pagination-jump-input::-webkit-outer-spin-button,
.pagination-jump-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.pagination-jump-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.15);
}

/* User Profile & Role Badges */
.user-profile-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 8px;
    background: #FFFFFF;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.user-avatar {
    font-size: 16px;
    line-height: 1;
}
.user-meta {
    display: flex;
    align-items: center;
    gap: 6px;
}
.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
}
.user-role-badge {
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 600;
    line-height: 1.4;
}
.role-admin {
    background: #5856D6;
    color: #FFFFFF;
}
.role-user {
    background: #007AFF;
    color: #FFFFFF;
}
.role-guest {
    background: #8E8E93;
    color: #FFFFFF;
}
.btn-logout {
    padding: 3px 8px;
    border: 1px solid #E5E7EB;
    background: #F9FAFB;
    border-radius: 6px;
    font-size: 11.5px;
    cursor: pointer;
    color: #D70015;
    font-weight: 500;
    transition: all 0.15s ease;
}
.btn-logout:hover {
    background: #FEE2E2;
    border-color: #FCA5A5;
}

/* Disabled Application Badge & Row Styling */
.badge-disabled {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 6px;
    background: #FF3B30;
    color: #FFFFFF;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
}
.badge-user {
    display: inline-block;
    padding: 2px 7px;
    background: #EEF4FF;
    color: #0066CC;
    border: 1px solid #CCE0FF;
    border-radius: 5px;
    font-size: 11.5px;
    font-weight: 600;
}
.row-disabled {
    background-color: #FAFAFA !important;
}
.row-disabled .clip-label {
    color: #8E8E93;
}
.btn-action-status {
    color: #D97706;
    border-color: #FDE68A;
    background-color: #FFFBEB;
}
.btn-action-status:hover {
    background-color: #FEF3C7;
    border-color: #F59E0B;
    color: #B45309;
}
.btn-action-status.is-disabled {
    color: #059669;
    border-color: #A7F3D0;
    background-color: #ECFDF5;
}
.btn-action-status.is-disabled:hover {
    background-color: #D1FAE5;
    border-color: #10B981;
    color: #047857;
}
