/* ============================================
   Production Management System - Global Styles
   Design: Modern Clean & Minimalist
   Primary: #3b82f6 (vibrant blue)
   ============================================ */

:root {
    /* Colors - Modern Clean Palette */
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-light: #dbeafe;
    --primary-bg: #eff6ff;
    --success: #22c55e;
    --success-bg: #dcfce7;
    --warning: #f59e0b;
    --warning-bg: #fef3c7;
    --danger: #ef4444;
    --danger-bg: #fee2e2;
    --info: #06b6d4;
    --info-bg: #cffafe;

    /* Neutrals - Clean & Soft */
    --bg: #f8fafc;
    --bg-white: #ffffff;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --text: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    /* Layout */
    --sidebar-width: 250px;
    --sidebar-collapsed: 64px;
    --topbar-height: 60px;
    --radius: 2px;
    --radius-sm: 2px;
    --radius-lg: 4px;
    --shadow: 0 1px 2px rgba(0,0,0,0.04), 0 1px 1px rgba(0,0,0,0.02);
    --shadow-sm: 0 1px 1px rgba(0,0,0,0.02);
    --shadow-md: 0 2px 4px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02);
    --shadow-lg: 0 4px 8px rgba(0,0,0,0.05), 0 2px 4px rgba(0,0,0,0.03);
    --shadow-xl: 0 8px 16px rgba(0,0,0,0.06), 0 4px 8px rgba(0,0,0,0.04);

    /* Transitions */
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);

    /* Typography */
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    --font-mono: "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono", monospace;
}

/* ============ RESET ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 14px; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-hover); }
ul, ol { list-style: none; }
img { max-width: 100%; display: block; }
input, button, select, textarea { font-family: inherit; font-size: inherit; }

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ============ LAYOUT: Standard Document Flow ============ */
.app-layout {
    display: block;
    height: auto;
    min-height: auto;
    position: static;
}

/* ============ SIDEBAR: Fixed left ============ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    height: 100dvh;
    background: #111827;
    color: #9ca3af;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 4px 0 16px rgba(0,0,0,0.04);
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.sidebar::-webkit-scrollbar {
    display: none;
}

.sidebar-header {
    padding: 18px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: var(--topbar-height);
}

.sidebar-header .logo {
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.sidebar-header .site-name {
    font-size: 15px;
    font-weight: 600;
    color: #f8fafc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.sidebar-nav::-webkit-scrollbar {
    display: none;
}

.sidebar-section-label {
    padding: 14px 20px 6px;
    font-size: 13px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
    transition: var(--transition);
}

.sidebar-section-label:hover {
    color: #94a3b8;
    background: rgba(255,255,255,0.02);
}

.sidebar-section-label .section-arrow {
    font-size: 10px;
    transition: transform 0.2s;
    color: #475569;
}

.sidebar-section.collapsed .sidebar-section-label .section-arrow {
    transform: rotate(-90deg);
}

.sidebar-section.collapsed .sidebar-section-body {
    display: none;
}

.sidebar-section-body {
    transition: display 0.2s;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 11px 20px;
    color: #94a3b8;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    border-left: 3px solid transparent;
    margin: 2px 8px;
    border-radius: 0 8px 8px 0;
    font-size: 13.5px;
}

.sidebar-item:hover {
    background: rgba(255,255,255,0.04);
    color: #e2e8f0;
}

.sidebar-item.active {
    background: rgba(59,130,246,0.12);
    color: #60a5fa;
    border-left-color: var(--primary);
}

.sidebar-item i {
    width: 18px;
    text-align: center;
    font-size: 14px;
    flex-shrink: 0;
}

.sidebar-item .badge {
    margin-left: auto;
    background: var(--danger);
    color: white;
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    font-weight: 600;
}

.sidebar-footer {
    padding: 14px 20px;
    border-top: 1px solid rgba(255,255,255,0.06);
    font-size: 11px;
    color: #475569;
    text-align: center;
}

/* Sidebar item drag & rename */
.sidebar-item.dragging {
    opacity: 0.4;
}
.sidebar-item.drag-over {
    border-top: 2px solid var(--primary);
    margin-top: -2px;
}
.sidebar-item .item-rename-input {
    background: rgba(255,255,255,0.1);
    border: 1px solid var(--primary);
    color: #f8fafc;
    font-size: 13px;
    padding: 2px 6px;
    border-radius: 4px;
    outline: none;
    width: 100%;
    flex: 1;
}

/* ============ SIDEBAR OVERLAY ============ */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15,23,42,0.5);
    backdrop-filter: blur(2px);
    z-index: 999;
}

/* ============ MAIN CONTENT ============ */
.main-content {
    margin-left: var(--sidebar-width);
    background: var(--bg);
    transition: var(--transition);
}

/* ============ TOPBAR: Sticky ============ */
.topbar {
    height: var(--topbar-height);
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    z-index: 100;
    gap: 16px;
    position: sticky;
    top: 0;
    box-shadow: var(--shadow-sm);
}

.topbar .menu-toggle {
    display: inline-flex;
    font-size: 18px;
    cursor: pointer;
    color: var(--text-secondary);
    background: none;
    border: none;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    align-items: center;
    justify-content: center;
}

.topbar .menu-toggle:hover {
    background: var(--bg);
}

.topbar .page-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.2px;
}

.topbar .topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar .user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: var(--radius);
    transition: var(--transition);
    border: 1px solid transparent;
}

.topbar .user-info:hover {
    background: var(--bg);
    border-color: var(--border);
}

.topbar .user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
}

.topbar .user-name {
    font-size: 13px;
    font-weight: 500;
}

.topbar .user-role {
    font-size: 11px;
    color: var(--text-muted);
}

/* User dropdown menu */
.user-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    min-width: 160px;
    z-index: 200;
    overflow: hidden;
}
.user-info.dropdown-open .user-dropdown {
    display: block;
}
.user-info { position: relative; }
.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: 13px;
    color: var(--text);
    text-decoration: none;
    transition: var(--transition);
    border-bottom: 1px solid var(--border-light);
}
.user-dropdown-item:last-child { border-bottom: none; }
.user-dropdown-item:hover {
    background: var(--bg);
    color: var(--primary);
}

/* Sidebar collapsed state (desktop) */
.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}
.sidebar.collapsed .site-name,
.sidebar.collapsed .sidebar-section-label,
.sidebar.collapsed .sidebar-item span,
.sidebar.collapsed .sidebar-footer {
    display: none;
}
.sidebar.collapsed .sidebar-item {
    justify-content: center;
    padding: 12px 0;
}
.sidebar.collapsed .sidebar-header {
    justify-content: center;
}
.main-content.sidebar-collapsed {
    margin-left: var(--sidebar-collapsed);
}

/* ============ CONTENT AREA ============ */
.content-area {
    padding: 24px;
    min-height: calc(100vh - var(--topbar-height) - 60px);
    min-height: calc(100dvh - var(--topbar-height) - 60px);
}

/* ============ FOOTER ============ */
.company-footer {
    padding: 14px 24px;
    border-top: 1px solid var(--border);
    background: var(--bg-white);
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
}

.company-footer .company-name {
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 2px;
}

/* ============ CARD ============ */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    border: 1px solid var(--border);
    transition: var(--transition);
    margin-bottom: 16px;
}

.card:last-child {
    margin-bottom: 0;
}

.card:hover {
    box-shadow: var(--shadow-md);
    border-color: #d1d9e0;
}

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

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.1px;
}

.card-body {
    padding: 20px;
}

/* ============ BUTTONS ============ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 6px 14px;
    border: none;
    border-radius: 2px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: none;
    white-space: nowrap;
    box-shadow: none;
}

.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-lg { padding: 9px 20px; font-size: 14px; }

.btn-primary {
    background: var(--primary);
    color: white;
    border: 1px solid var(--primary);
}

.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

.btn-secondary {
    background: #fff;
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-success {
    background: var(--success);
    color: white;
    border: 1px solid var(--success);
}

.btn-success:hover { background: #16a34a; border-color: #16a34a; }

.btn-danger {
    background: var(--danger);
    color: white;
    border: 1px solid var(--danger);
}

.btn-danger:hover { background: #dc2626; border-color: #dc2626; }

.btn-warning {
    background: var(--warning);
    color: white;
    border: 1px solid var(--warning);
}

.btn-warning:hover { background: #d97706; border-color: #d97706; }

/* 登录/注册页提示条 */
.login-msg { font-size: 13px; margin-bottom: 12px; text-align: center; padding: 8px 10px; border-radius: 6px; }
.login-msg.success { color: var(--success); background: var(--success-bg); }
.login-msg.error { color: var(--danger); background: var(--danger-bg); }

.btn-info {
    background: var(--info);
    color: white;
    border: 1px solid var(--info);
}

.btn-info:hover { background: #0891b2; border-color: #0891b2; }

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #eff6ff;
}

/* ============ FORM ============ */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 6px;
}

.form-group label .required {
    color: var(--danger);
    margin-left: 2px;
}

.form-control {
    width: 100%;
    padding: 7px 11px;
    border: 1px solid var(--border);
    border-radius: 2px;
    background: var(--bg-white);
    color: var(--text);
    font-size: 13px;
    transition: border-color 0.15s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-control:disabled {
    background: var(--border-light);
    cursor: not-allowed;
}

textarea.form-control {
    min-height: 80px;
    resize: vertical;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.form-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-error {
    font-size: 11px;
    color: var(--danger);
    margin-top: 4px;
}

/* ============ TABLE ============ */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    width: 100%;
    cursor: grab;
    scrollbar-width: thin;
}

.table-wrapper.dragging {
    cursor: grabbing;
    user-select: none;
    -webkit-user-select: none;
}

.table-wrapper::-webkit-scrollbar {
    height: 8px;
}

.table-wrapper::-webkit-scrollbar-thumb {
    background: var(--border, #cbd5e1);
    border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
    background: var(--border-strong, #94a3b8);
}

table.data-table {
    width: 100%;
    min-width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background: var(--bg-white);
}

table.data-table th,
table.data-table td {
    padding: 8px 12px;
    white-space: nowrap;
    vertical-align: middle;
}

table.data-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

table.data-table thead th {
    background: var(--bg);
    text-align: left;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 12px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

table.data-table tbody td {
    border-bottom: 1px solid var(--border-light);
    color: var(--text);
}

table.data-table th:last-child,
table.data-table td:last-child {
    border-right: none;
}

table.data-table tbody tr:nth-child(even) {
    background: var(--bg);
}

table.data-table tbody tr:hover {
    background: #f5f7fa;
}

table.data-table tbody tr:last-child td {
    border-bottom: none;
}

table.data-table .actions {
    display: flex;
    gap: 4px;
    justify-content: flex-end;
    align-items: center;
}

/* 宝塔面板风格：操作列使用文字按钮（扁平淡边框文字链接），图标小型化 */
table.data-table .actions .btn {
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 500;
    border: none;
    background: transparent !important;
    color: var(--primary, #3b82f6);
    box-shadow: none;
}
table.data-table .actions .btn:hover {
    color: var(--primary-hover, #2563eb);
    background: var(--primary-bg, #eff6ff) !important;
    text-decoration: none;
}
table.data-table .actions .btn-danger,
table.data-table .actions .btn.danger,
table.data-table .actions .btn.text-error {
    color: var(--danger, #ef4444);
}
table.data-table .actions .btn-danger:hover,
table.data-table .actions .btn.danger:hover,
table.data-table .actions .btn.text-error:hover {
    color: #dc2626;
    background: var(--danger-bg, #fee2e2) !important;
}
table.data-table .actions .btn-warning,
table.data-table .actions .btn.warning {
    color: var(--warning, #d97706);
}
table.data-table .actions .btn-warning:hover,
table.data-table .actions .btn.warning:hover {
    background: var(--warning-bg, #fef3c7) !important;
}
table.data-table .actions .btn-success,
table.data-table .actions .btn.success {
    color: var(--success, #16a34a);
}
table.data-table .actions .btn-success:hover,
table.data-table .actions .btn.success:hover {
    background: var(--success-bg, #dcfce7) !important;
}
table.data-table .actions .btn-secondary,
table.data-table .actions .btn.outline,
table.data-table .actions .btn-outline { color: var(--text-secondary, #475569); }
table.data-table .actions .btn-secondary:hover,
table.data-table .actions .btn.outline:hover,
table.data-table .actions .btn-outline:hover { color: var(--text, #0f172a); background: var(--bg, #f8fafc) !important; }
table.data-table .actions .btn i,
table.data-table .actions .btn .fa,
table.data-table .actions .btn .fas {
    font-size: 12px;
    margin-right: 2px;
}
table.data-table .actions .btn-sm { padding: 2px 8px; font-size: 12px; }
table.data-table .actions .btn-xs { padding: 1px 6px; font-size: 11px; }

.table-empty {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

/* ============================================
   Operation Log Styles
   ============================================ */
.oplog-toolbar { display:flex; gap:12px; align-items:center; flex-wrap:wrap; margin-bottom:16px; }
.oplog-stats-grid { display:grid; grid-template-columns: repeat(auto-fit,minmax(160px,1fr)); gap:12px; margin-bottom:16px; }
.oplog-stat-card { background:var(--card-bg); border-radius:var(--radius); padding:14px 16px; box-shadow:var(--shadow); border:1px solid var(--border-light); }
.oplog-stat-card .stat-label { font-size:12px; color:var(--text-muted); margin-bottom:4px; }
.oplog-stat-card .stat-value { font-size:20px; font-weight:700; color:var(--text); }

.oplog-table { width:100%; border-collapse:collapse; font-size:13px; background:var(--bg-white); }
.oplog-table thead th { background:var(--bg); padding:10px 14px; text-align:left; font-weight:600; color:var(--text-secondary); font-size:12px; border-bottom:1px solid var(--border); white-space:nowrap; }
.oplog-table tbody td { padding:10px 14px; border-bottom:1px solid var(--border-light); color:var(--text); vertical-align:middle; }
.oplog-table tbody tr:hover { background:var(--bg); }
.oplog-table tbody tr:last-child td { border-bottom:none; }

.oplog-action-tag { display:inline-flex; align-items:center; padding:2px 8px; border-radius:4px; font-size:12px; font-weight:500; }
.oplog-action-tag.create  { background:var(--success-bg);  color:var(--success); }
.oplog-action-tag.update  { background:var(--primary-light); color:var(--primary); }
.oplog-action-tag.delete  { background:var(--danger-bg);    color:var(--danger); }
.oplog-action-tag.approve { background:var(--success-bg);  color:var(--success); }
.oplog-action-tag.batch_approve { background:var(--info-bg); color:var(--info); }
.oplog-action-tag.reject  { background:var(--warning-bg);   color:var(--warning); }
.oplog-action-tag.import  { background:var(--primary-light); color:var(--primary); }
.oplog-action-tag.login   { background:var(--border-light);  color:var(--text-muted); }
.oplog-action-tag.settlement { background:var(--info-bg); color:var(--info); }

/* ============ BADGE ============ */
.badge-tag {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}

.badge-tag.success { background: var(--success-bg); color: #15803d; }
.badge-tag.warning { background: var(--warning-bg); color: #b45309; }
.badge-tag.danger { background: var(--danger-bg); color: #b91c1c; }
.badge-tag.info { background: var(--info-bg); color: #0e7490; }
.badge-tag.default { background: var(--bg); color: var(--text-secondary); border: 1px solid var(--border); }

/* ============ MODAL ============ */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15,23,42,0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.show {
    display: flex;
}

.modal,
.modal-box {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xl);
    max-width: 640px;
    width: 100%;
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
    animation: modalIn 0.2s ease;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.modal-close {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--bg);
    color: var(--text);
}

.modal-body {
    padding: 24px;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

/* 弹窗内表格可横向滚动，避免窄屏/多列挤压换行 */
.modal-body > .table-wrapper,
.modal-body .table-wrapper,
.modal-box .modal-body .data-table {
    max-width: 100%;
    overflow-x: auto;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-shrink: 0;
    background: var(--bg-white);
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(-20px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ============ MODAL FULLSCREEN (designer) ============ */
.modal-fullscreen.modal {
    max-width: none;
    width: 95%;
    height: 95%;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
}
.modal-fullscreen .modal-body {
    padding: 0;
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
@media (max-width: 768px) {
    .modal-fullscreen.modal {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    .modal-fullscreen .modal-body { padding: 0; }
    .modal-fullscreen .modal-header, .modal-fullscreen .modal-footer { padding: 12px 16px; }
}

/* ============ DRAWER (slide-out from right) ============ */
.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2100;
    display: flex;
    justify-content: flex-end;
    align-items: stretch;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}
.drawer-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.drawer-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.08);
}

.drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    height: 100vh;
    width: 100%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-radius: 0;
    box-shadow: -4px 0 24px rgba(0,0,0,0.08);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    z-index: 1;
    overflow: hidden;
}

.drawer-body {
    padding: 0;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}
.drawer-overlay.show .drawer {
    transform: translateX(0);
}

.drawer-header {
    padding: 16px 20px 12px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    background: #ffffff;
}

.drawer-title {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
}

.drawer-close {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}
.drawer-close:hover {
    background: var(--bg);
    color: var(--text);
}

.drawer-footer {
    padding: 14px 24px;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-shrink: 0;
}



/* Drawer content cleanup - Node-style compact layout
   （.drawer-injected 为 fetch 注入到抽屉 body 的内容容器，替代原 iframe body.in-drawer）*/
.drawer-body iframe {
    display: none;
}

.drawer-loading {
    padding: 40px 0;
    text-align: center;
    color: #9ca3af;
    font-size: 13px;
}

.drawer-injected {
    padding: 16px 20px 24px;
}

/* 注入内容抑制冗余头部/卡片 */
.drawer-injected .page-head,
.drawer-injected .card-header,
.drawer-injected .card-title,
.drawer-injected .fd-head,
.drawer-injected .ue-head,
.drawer-injected .ge-head,
.drawer-injected h2:first-child,
.drawer-injected .page-head + .card > .card-header {
    display: none !important;
}

.drawer-injected .card {
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
}

.drawer-injected .card-body {
    padding: 0 !important;
}

.drawer-injected .form-row {
    margin-bottom: 12px;
}

.drawer-injected .form-group label {
    font-size: 13px;
    margin-bottom: 4px;
    color: #475569;
}

.drawer-injected .form-control {
    padding: 8px 10px;
    font-size: 14px;
    min-height: 36px;
}

.drawer-injected .form-actions {
    position: sticky;
    bottom: 0;
    background: #ffffff;
    padding: 12px 0 0;
    margin-top: 8px;
    border-top: 1px solid #f1f5f9;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    z-index: 10;
}

.drawer-injected .alert {
    margin: 12px 0;
    padding: 10px 14px;
    font-size: 13px;
}

/* 抽屉顶部错误提示条 */
.drawer-alert {
    margin: 0 0 12px !important;
}

@media (max-width: 768px) {
    .drawer-injected .card-body {
        padding: 0 !important;
    }
}

@media (max-width: 640px) {
    .drawer-injected {
        padding: 12px 16px 20px;
    }
}

/* Drawer mobile: full-screen right drawer (consistent with desktop) */
@media (max-width: 640px) {
    .drawer-overlay {
        justify-content: flex-end;
        align-items: stretch;
        padding: 0;
    }
    .drawer {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        left: auto;
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        box-shadow: -4px 0 24px rgba(0,0,0,0.08);
        transform: translateX(100%);
        animation: none;
    }
    .drawer-header { padding: 14px 16px; }
    .drawer-body { padding: 16px; }
    .drawer-footer { padding: 12px 16px; }
}
@keyframes drawerSlideUp {
    from { transform: translateY(100%); opacity: 0.5; }
    to { transform: translateY(0); opacity: 1; }
}

/* ============ PROBLEM ATTACHMENT IMAGES ============ */
.img-thumbs-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    margin-top: 4px;
}
.img-thumbs-row .thumb-label {
    font-size: 11px;
    color: #9ca3af;
    margin-right: 2px;
}
.img-thumbs-row .img-thumb {
    display: inline-block;
    width: 48px;
    height: 48px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    flex-shrink: 0;
}
.img-thumbs-row .img-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.img-thumbs-row .thumb-more {
    font-size: 11px;
    color: #6b7280;
    background: #f3f4f6;
    border-radius: 6px;
    padding: 2px 6px;
    line-height: 44px;
    display: inline-block;
}
.img-preview-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}
.img-preview-group .img-preview-thumb {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}
.att-existing-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 6px;
}
.att-existing-row .att-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #6b7280;
}
.att-existing-row .att-checkbox img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    vertical-align: middle;
}

/* ============ TOAST ============ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 400px;
}

.toast {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 14px 18px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 500;
    animation: toastIn 0.3s ease;
    border-left: 3px solid;
}

.toast.success { border-left-color: var(--success); color: #15803d; }
.toast.error { border-left-color: var(--danger); color: #b91c1c; }
.toast.warning { border-left-color: var(--warning); color: #b45309; }
.toast.info { border-left-color: var(--info); color: #0e7490; }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ============ PAGINATION ============ */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 0;
    gap: 0;
    flex-wrap: wrap;
}

.pagination-info {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    margin-left: 12px;
}

.pagination-controls {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

.pagination-controls button {
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    background: var(--bg-white);
    color: var(--text);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 12px;
    transition: var(--transition);
}

.pagination-controls button:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
}

.pagination-controls button.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pagination-controls button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ============ STATS ============ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.stat-icon.primary { background: var(--primary-bg); color: var(--primary); }
.stat-icon.success { background: var(--success-bg); color: var(--success); }
.stat-icon.warning { background: var(--warning-bg); color: var(--warning); }
.stat-icon.danger { background: var(--danger-bg); color: var(--danger); }

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ============ TABS ============ */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
    background: var(--bg-white);
    padding: 0 24px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.tab {
    padding: 12px 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.tab:hover {
    color: var(--text);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

.tab-bar {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    background: var(--bg);
    padding: 4px;
    border-radius: var(--radius);
    width: fit-content;
}

.tab-btn {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    background: none;
    border: none;
}

.tab-btn:hover {
    color: var(--text);
    background: var(--bg-white);
}

.tab-btn.active {
    background: var(--bg-white);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
    font-weight: 600;
}

/* ============ FILTER BAR ============ */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: var(--bg-white);
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    margin-bottom: 16px;
    flex-wrap: wrap;
}

/* ============ PERMISSION TABLE ============ */
.permission-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.permission-table th {
    background: var(--bg);
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

.permission-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-light);
}

.permission-table label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
}

.permission-table input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

/* ============ NOTIFICATION ============ */
.notification-bell {
    position: relative;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: var(--radius);
    transition: var(--transition);
    color: var(--text-secondary);
    font-size: 16px;
    border: 1px solid transparent;
    flex-shrink: 0;
}

.notification-bell:hover {
    background: var(--bg);
    border-color: var(--border);
    color: var(--text);
}

.notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    padding: 0 4px;
}

.notification-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 360px;
    max-height: 480px;
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-light);
    z-index: 200;
    overflow: hidden;
    display: none;
}

.notification-panel.show {
    display: block;
}

.notification-panel-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.notification-panel-header h3 {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
}

.notification-panel-header a {
    font-size: 12px;
    color: var(--primary);
}

.notification-mark-all {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 500;
    color: var(--primary);
    background: var(--primary-bg);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    line-height: 1;
    transition: var(--transition);
}

.notification-mark-all + .notification-mark-all {
    width: 26px;
    height: 26px;
    padding: 0;
}

.notification-mark-all:hover {
    background: var(--primary-light);
    color: var(--primary-hover);
}

.notification-mark-all:active {
    transform: scale(0.95);
}

.notification-panel-body {
    max-height: 360px;
    overflow-y: auto;
}

.notification-item {
    padding: 12px 18px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: var(--transition);
}

.notification-item:hover {
    background: var(--bg);
}

.notification-item.unread {
    background: var(--primary-bg);
    border-left: 3px solid var(--primary);
}

.notification-item-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 4px;
}

.notification-item-content {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.notification-item-time {
    font-size: 11px;
    color: var(--text-muted);
}

.notification-panel-empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.notification-panel-empty i {
    font-size: 26px;
    color: var(--border);
}

.notification-panel-loading {
    padding: 40px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

/* Notification item delete button */
.notification-item { position: relative; }
.notification-item .notification-mark-read {
    position: absolute;
    top: 8px;
    right: 32px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--bg);
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s, color 0.2s;
    z-index: 2;
}
.notification-item:hover .notification-mark-read {
    opacity: 1;
}
.notification-item .notification-mark-read:hover {
    background: var(--primary-bg);
    color: var(--primary);
}
.notification-item .notification-delete {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--bg);
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s, color 0.2s;
    z-index: 2;
}
.notification-item:hover .notification-delete {
    opacity: 1;
}
.notification-item .notification-delete:hover {
    background: var(--danger-bg);
    color: var(--danger);
}

/* ============ LOGIN ============ */
.login-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 20px;
}

.login-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 40px 32px;
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--border-light);
}

.login-card .logo {
    width: 56px;
    height: 56px;
    background: var(--primary);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 22px;
    font-weight: 700;
    margin: 0 auto 24px;
}

.login-card h2 {
    text-align: center;
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text);
}

.login-card .subtitle {
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 28px;
}

.login-card .form-group {
    margin-bottom: 18px;
}

.login-card .btn {
    width: 100%;
    margin-top: 8px;
    padding: 12px;
    font-size: 14px;
}

.login-card .login-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 12px;
    color: var(--text-muted);
}

.login-card .login-footer a {
    color: var(--primary);
    font-weight: 500;
}

/* ============ LOADING ============ */
.loading-placeholder {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
    font-size: 13px;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

.spinner-lg {
    width: 32px;
    height: 32px;
    border-width: 3px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============ USER MENU ============ */
.user-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-light);
    min-width: 200px;
    z-index: 200;
    display: none;
    overflow: hidden;
}

.user-menu.show {
    display: block;
}

.user-menu-item {
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    transition: var(--transition);
}

.user-menu-item:hover {
    background: var(--bg);
}

.user-menu-item i {
    width: 18px;
    color: var(--text-muted);
    text-align: center;
}

.user-menu-divider {
    height: 1px;
    background: var(--border-light);
    margin: 4px 0;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 1024px) {
    .form-row { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width);
        z-index: 1001;
    }
    .sidebar.show { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .topbar .menu-toggle { display: inline-flex; }
    .content-area { padding: 16px; }
    .card-body { padding: 16px; }
    .stats-grid { grid-template-columns: 1fr; }
    .filter-bar { padding: 12px 14px; gap: 8px; }
    .company-footer { padding: 10px 16px; font-size: 11px; }
    .topbar { padding: 0 16px; }
    .pagination { flex-direction: column; align-items: center; gap: 10px; }
    .pagination-info { text-align: center; margin-left: 0; }
    .pagination-controls { justify-content: center; }
    .sidebar-overlay.show { display: block; }
    table.data-table th,
    table.data-table td { padding: 10px 12px; font-size: 12px; }
    .login-card { padding: 28px 20px; }
    /* Mobile modal → full-screen right drawer: fixed header/footer, scrollable body */
    .modal-overlay {
        justify-content: flex-end !important;
        align-items: stretch !important;
        padding: 0 !important;
    }
    .modal,
    .modal-box {
        width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
        max-height: 100% !important;
        border-radius: 0 !important;
        display: flex;
        flex-direction: column;
        overflow: hidden !important;
        animation: modalSlideRight 0.32s cubic-bezier(0.32, 0.72, 0, 1);
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    .modal::-webkit-scrollbar, .modal-box::-webkit-scrollbar { display: none; }
    .modal-header, .modal-box .modal-header {
        flex-shrink: 0;
        padding: 14px 16px;
    }
    .modal-body, .modal-box .modal-body {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 16px;
    }
    .modal-footer, .modal-box .modal-footer {
        flex-shrink: 0;
        padding: 12px 16px;
    }
    /* Dashboard config modal (custom classes) */
    .dash-config-overlay {
        justify-content: flex-end !important;
        align-items: stretch !important;
    }
    .dash-config-modal {
        width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
        max-height: 100% !important;
        border-radius: 0 !important;
        animation: modalSlideRight 0.32s cubic-bezier(0.32, 0.72, 0, 1);
        overflow: hidden;
    }
    .dash-config-header {
        flex-shrink: 0;
    }
    .dash-config-body {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .dash-config-footer {
        flex-shrink: 0;
    }
    /* Notification panel: slide down from topbar on mobile */
    .notification-panel {
        position: fixed !important;
        top: calc(var(--topbar-height) + env(safe-area-inset-top)) !important;
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%) translateY(-110%) !important;
        width: calc(100vw - 24px) !important;
        max-height: calc(100dvh - var(--topbar-height) - env(safe-area-inset-top) - 40px);
        border-radius: 0 0 16px 16px;
        opacity: 0;
        transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.25s ease;
        visibility: hidden;
        pointer-events: none;
    }
    .notification-panel.show {
        transform: translateX(-50%) translateY(0) !important;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }
    @keyframes modalSlideRight {
        from { transform: translateX(100%); opacity: 0.5; }
        to { transform: translateX(0); opacity: 1; }
    }
}

@media (max-width: 480px) {
    .content-area { padding: 12px; }
    .card-body { padding: 14px; }
    .stats-grid { grid-template-columns: 1fr; }
    .btn { padding: 8px 14px; font-size: 12px; }
    .login-card { padding: 28px 20px; }
    .topbar { padding: 0 12px; height: 52px; }
    .topbar .page-title { font-size: 15px; }
    .topbar .user-name { display: none; }
    .tabs { gap: 0; }
    .tab { padding: 9px 12px; font-size: 12px; }
    .tab-bar { gap: 0; }
    .tab-btn { padding: 9px 12px; font-size: 12px; }
    .filter-bar { padding: 10px 12px; }
    .notification-panel { width: calc(100vw - 24px); }
    .toast-container { left: 12px; right: 12px; top: 12px; }
    .toast { max-width: none; width: 100%; }
    .perm-matrix { font-size: 12px; }
    .perm-matrix th, .perm-matrix td { padding: 6px 4px; }
    .perm-matrix th:first-child, .perm-matrix td:first-child { padding-left: 8px; min-width: 100px; }
    .perm-matrix input[type="checkbox"] { width: 16px; height: 16px; }
}

/* ============ Safe area for notched phones ============ */
@supports (padding: env(safe-area-inset-top)) {
    .sidebar {
        padding-top: env(safe-area-inset-top);
        height: calc(100dvh - env(safe-area-inset-top));
    }
    .topbar {
        padding-top: env(safe-area-inset-top);
        height: calc(var(--topbar-height) + env(safe-area-inset-top));
    }
    .company-footer {
        padding-bottom: env(safe-area-inset-bottom);
    }
    .toast-container {
        top: calc(12px + env(safe-area-inset-top));
    }
}

/* ============ Capacitor WebView ============ */
@supports (-webkit-touch-callout: none) {
    html {
        -webkit-text-size-adjust: 100%;
        -webkit-tap-highlight-color: transparent;
    }
}

/* ============ UTILITIES ============ */
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }

.bg-primary { background: var(--primary-bg); }
.bg-success { background: var(--success-bg); }
.bg-warning { background: var(--warning-bg); }
.bg-danger { background: var(--danger-bg); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }

.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }

.w-full { width: 100%; }
.text-center { text-align: center; }
.text-right { text-align: right; }

.hidden { display: none; }

/* ============ BATCH DELETE BAR ============ */
.batch-delete-bar {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    margin-bottom: 12px;
    background: var(--danger-bg);
    border: 1px solid var(--danger);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--danger);
    animation: fadeIn 0.2s ease;
}
.batch-delete-bar .batch-count {
    font-weight: 700;
    min-width: 20px;
    text-align: center;
}
.batch-delete-bar .batch-delete-btn {
    margin-left: auto;
    background: var(--danger);
    color: #fff;
    border: none;
}
.batch-delete-bar .batch-delete-btn:hover {
    opacity: 0.85;
}

/* Row checkbox */
.row-checkbox {
    width: 32px;
    text-align: center;
}
.row-checkbox input[type="checkbox"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
}
.data-table tbody tr.selected {
    background: var(--primary-bg) !important;
}

/* ============ MOBILE CARD LIST ============ */
@media (max-width: 768px) {
    .data-table thead { display: none; }
    .data-table, .data-table tbody, .data-table tr, .data-table td {
        display: block;
        width: 100% !important;
    }
    .data-table tbody tr {
        background: var(--card-bg);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        margin-bottom: 10px;
        padding: 12px 16px;
        box-shadow: var(--shadow-sm);
        position: relative;
    }
    .data-table tbody tr td {
        border: none;
        padding: 4px 0;
        font-size: 13px;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    .data-table tbody tr td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-secondary);
        font-size: 12px;
    }
    .data-table tbody tr td:last-child {
        border-top: 1px solid var(--border-light);
        margin-top: 8px;
        padding-top: 8px;
        justify-content: flex-end;
        gap: 8px;
    }
    .data-table tbody tr td.row-checkbox {
        position: absolute;
        top: 8px;
        left: 8px;
        padding: 0;
        width: auto !important;
    }
    .data-table tbody tr td.row-checkbox::before { display: none; }
    .data-table tbody tr.selected {
        border-color: var(--primary);
        background: var(--primary-bg);
    }
    /* Hide CSV import/export buttons on mobile */
    .filter-bar a[href*="export"],
    .filter-bar button[onclick*="Export"],
    .filter-bar button[onclick*="export"],
    .filter-bar button[onclick*="Import"],
    .filter-bar button[onclick*="import"],
    .filter-bar a[onclick*="export"],
    .filter-bar a[onclick*="Import"] {
        display: none !important;
    }
    /* Hide batch delete UI on mobile */
    .batch-delete-bar { display: none !important; }
    .data-table tbody tr td.row-checkbox { display: none !important; }
    .data-table thead th.row-checkbox { display: none !important; }
}

/* ============ PERMISSION MATRIX (group permissions) ============ */
.perm-matrix {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-top: 8px;
}
.perm-matrix table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.perm-matrix th {
    background: var(--bg);
    padding: 10px 8px;
    text-align: center;
    font-weight: 600;
    font-size: 12px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}
.perm-matrix th:first-child {
    text-align: left;
    padding-left: 12px;
    min-width: 120px;
}
.perm-matrix td {
    padding: 10px 8px;
    text-align: center;
    border-bottom: 1px solid var(--border-light);
    color: var(--text);
}
.perm-matrix td:first-child {
    text-align: left;
    padding-left: 12px;
    font-weight: 500;
}
.perm-matrix tr:last-child td {
    border-bottom: none;
}
.perm-matrix tr:hover td {
    background: var(--bg);
}
.perm-matrix input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* ============ PRINT ============ */
@media print {
    .sidebar, .topbar, .notification-bell, .user-menu, .btn {
        display: none !important;
    }
    .main-content { margin-left: 0; }
    .content-area { padding: 0; }
}

/* ============ DASHBOARD CONFIG MODAL STYLES ============ */
/* SPA architecture: moved from dashboard.html <head> to style.css */
/* 仪表盘配置窗口样式（SPA 架构下页面内联样式不会被重新注入） */
.dash-config-panel { display:flex; flex-direction:column; gap:12px; max-height:60vh; overflow-y:auto; }
.dash-config-section { border:1px solid var(--border); border-radius:var(--radius-sm); overflow:hidden; transition:var(--transition); }
.dash-config-section-header { display:flex; align-items:center; gap:10px; padding:12px; cursor:pointer; background:var(--bg); color:var(--text); }
.dash-config-section-header input[type="checkbox"] { width:18px; height:18px; accent-color:var(--primary); flex-shrink:0; }
.dash-config-section-header .preview-icon { width:32px; height:32px; border-radius:8px; display:flex; align-items:center; justify-content:center; font-size:14px; flex-shrink:0; }
.dash-config-section-title { flex:1; font-size:14px; font-weight:600; color:var(--text); }
.dash-config-section.has-fields .fa-chevron-down { transition:transform 0.2s; }
.dash-config-section.expanded .fa-chevron-down { transform:rotate(180deg); }
.dash-config-section-body { padding:8px 12px 12px 44px; display:none; flex-direction:column; gap:8px; }
.dash-config-section.expanded .dash-config-section-body { display:flex; }
.dash-config-field-item { display:flex; align-items:center; gap:8px; font-size:13px; color:var(--text-secondary); cursor:pointer; padding:4px 0; }
.dash-config-field-item:hover { color:var(--text); }
.dash-config-field-item input[type="checkbox"] { width:16px; height:16px; accent-color:var(--primary); flex-shrink:0; }

/* Custom card config */
.custom-card-form { display:flex; flex-direction:column; gap:12px; padding:16px; background:var(--bg); border-radius:var(--radius-sm); }
.custom-card-form .form-group { display:flex; flex-direction:column; gap:4px; }
.custom-card-form label { font-size:12px; font-weight:600; color:var(--text-secondary); }
.custom-card-form select, .custom-card-form input { padding:8px 12px; border:1px solid var(--border); border-radius:var(--radius-sm); font-size:13px; background:var(--card-bg); color:var(--text); }
.custom-card-form select:focus, .custom-card-form input:focus { outline:none; border-color:var(--primary); }
.custom-card-form .color-picker { display:flex; gap:8px; flex-wrap:wrap; }
.color-option { width:28px; height:28px; border-radius:6px; cursor:pointer; border:2px solid transparent; transition:var(--transition); }
.color-option:hover { transform:scale(1.1); }
.color-option.selected { border-color:var(--text); box-shadow:0 0 0 2px var(--card-bg),0 0 0 4px var(--primary); }
.icon-picker { display:flex; gap:8px; flex-wrap:wrap; }
.icon-option { width:36px; height:36px; border-radius:6px; display:flex; align-items:center; justify-content:center; cursor:pointer; border:2px solid var(--border); background:var(--card-bg); color:var(--text); transition:var(--transition); }
.icon-option:hover { border-color:var(--primary); background:var(--primary-bg); }
.icon-option.selected { border-color:var(--primary); background:var(--primary-bg); color:var(--primary); }
.custom-cards-list { display:flex; flex-direction:column; gap:8px; }
.custom-card-item { display:flex; align-items:center; gap:12px; padding:10px 12px; background:var(--bg); border-radius:var(--radius-sm); border:1px solid var(--border); }
.custom-card-item .icon { width:32px; height:32px; border-radius:8px; display:flex; align-items:center; justify-content:center; font-size:14px; }
.custom-card-item .info { flex:1; }
.custom-card-item .title { font-size:13px; font-weight:500; }
.custom-card-item .detail { font-size:11px; color:var(--text-muted); }
.custom-card-item .actions { display:flex; gap:8px; }
.custom-card-item .actions button { background:none; border:none; color:var(--text-muted); cursor:pointer; padding:4px; font-size:13px; }
.custom-card-item .actions button:hover { color:var(--primary); }
.custom-card-item .actions button.delete-btn:hover { color:var(--danger); }
/* Fallback for icon preview in config sections when color vars are missing */
.dash-config-section-header .preview-icon { color:var(--text) !important; }

/* ============ COST ACCOUNTING (v2) ============ */
.cost-period-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    margin-bottom: 16px;
}
.cost-period-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-light);
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
}
.cost-period-body {
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}
.period-radio-group {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}
.period-radio {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
    user-select: none;
}
.period-radio input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}
.period-radio:has(input:checked) {
    color: var(--primary);
    font-weight: 600;
}
.period-custom-range {
    display: inline-flex;
    gap: 8px;
    align-items: center;
}
.period-custom-range input[type="date"] {
    width: 140px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
}

.cost-config-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    margin-bottom: 16px;
}
.cost-config-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-light);
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.cost-config-header .title {
    display: flex;
    align-items: center;
    gap: 8px;
}
.cost-config-header .title i {
    color: var(--text-muted);
    font-size: 15px;
}

.cost-detail-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    margin-bottom: 16px;
}
.cost-detail-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-light);
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}
.cost-detail-header .period-label {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 13px;
    margin-left: 4px;
}

/* Type tags for cost items */
.type-tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}
.type-tag-blue { background: var(--primary-light); color: var(--primary-hover); }
.type-tag-yellow { background: var(--warning-bg); color: #b45309; }
.type-tag-green { background: var(--success-bg); color: #15803d; }
.type-tag-gray { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }

/* Status tag */
.status-tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}
.status-tag-enable { background: var(--success-bg); color: #15803d; }
.status-tag-disable { background: var(--danger-bg); color: var(--danger); }
.status-tag-warning { background: var(--warning-bg); color: #b45309; }
.status-tag-warn  { background: var(--warning-bg); color: var(--warning); }

/* Expandable detail link */
.detail-expand-link {
    color: var(--primary);
    font-size: 12px;
    cursor: pointer;
    margin-left: 8px;
    text-decoration: none;
    white-space: nowrap;
}
.detail-expand-link:hover { text-decoration: underline; }

/* Percentage bar */
.pct-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
}
.pct-bar {
    width: 50px;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    flex-shrink: 0;
}
.pct-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* Detail sub-table (expanded rows) */
.cost-detail-subrow {
    background: var(--bg);
}
.cost-detail-subrow td {
    padding: 12px 20px 12px 48px;
}
.cost-detail-subtable {
    width: 100%;
    font-size: 13px;
}
.cost-detail-subtable th {
    text-align: left;
    padding: 6px 12px;
    color: var(--text-muted);
    font-weight: 500;
    border-bottom: 1px solid var(--border-light);
}
.cost-detail-subtable td {
    text-align: left;
    padding: 6px 12px;
    border-bottom: 1px solid var(--border-light);
}

/* Cost hint area */
.cost-hint-area {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 16px;
}
.cost-hint-area i {
    font-size: 28px;
    margin-bottom: 8px;
    display: block;
    color: var(--text-muted);
    opacity: 0.5;
}

/* Cost total row */
.cost-total-row {
    background: var(--primary-bg) !important;
    font-weight: 700;
}
.cost-total-row td {
    border-top: 2px solid var(--primary) !important;
}

/* Cost stat cards */
.cost-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.cost-stat-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    padding: 16px 20px;
}
.cost-stat-card .label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.cost-stat-card .value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
}
.cost-stat-card .value.primary { color: var(--primary); }

/* Responsive */
@media (max-width: 768px) {
    .period-radio-group { gap: 12px; }
    .period-radio { font-size: 13px; }
    .period-custom-range input[type="date"] { width: 120px; }
    .pct-bar { width: 40px; }
}


/* ===== Settlement page styles ===== */
.settlement-form { background:var(--card-bg); border-radius:var(--radius); border:1px solid var(--border-light); padding:16px 20px; margin-bottom:16px; }
.settlement-form-title { font-size:15px; font-weight:600; color:var(--text); margin-bottom:12px; display:flex; align-items:center; gap:6px; }
.settlement-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(200px,1fr)); gap:12px; }
.settlement-grid .form-group { margin:0; }
.settlement-grid .form-label { font-size:12px; }
.settlement-actions { display:flex; gap:10px; flex-wrap:wrap; margin:16px 0; }

.custom-labels-section { margin-top:16px; padding-top:16px; border-top:1px dashed var(--border-light); }
.custom-labels-section .settlement-form-title { font-size:13px; }
.custom-labels-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(250px,1fr)); gap:12px; }
.custom-labels-grid .form-group { margin:0; }
.custom-labels-grid .form-label { font-size:12px; }
.custom-labels-hint { font-size:11px; color:var(--text-muted); margin-top:4px; }

.settlement-preview { background:#fff; border:1px solid var(--border); border-radius:var(--radius); padding:24px 32px; max-width:1000px; margin:0 auto; }
.settlement-preview-title { text-align:center; font-size:18px; font-weight:700; margin-bottom:6px; }
.settlement-preview-subtitle { text-align:center; font-size:13px; color:var(--text-secondary); margin-bottom:20px; }
.section-title { text-align:center; font-size:14px; font-weight:700; margin:16px 0 8px; letter-spacing:6px; }

.st-table { width:100%; border-collapse:collapse; font-size:13px; margin-bottom:16px; }
.st-table th, .st-table td { border:1px solid #333; padding:8px 10px; text-align:center; vertical-align:middle; }
.st-table th { background:#f5f5f5; font-weight:600; }
.st-table .total-row { font-weight:700; background:#fffbe6; }
.st-table .amount-row { font-weight:700; background:#f0f8ff; }

.signature-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:0; margin-top:24px; border-top:1px solid #333; }
.signature-col { border-right:1px solid #333; border-bottom:1px solid #333; padding:16px; min-height:120px; text-align:center; position:relative; }
.signature-col:last-child { border-right:none; }
.signature-col .company-name { font-size:13px; font-weight:600; margin-bottom:16px; }
.signature-col .sign-area { font-size:12px; color:var(--text-muted); position:absolute; bottom:12px; left:16px; right:16px; }

@media print {
    .no-print, .tabs, .settlement-form, .sidebar, .topbar, .notification-bell { display:none !important; }
    .settlement-preview { border:none; padding:0; max-width:none; }
}

/* ===== Rich text editor (Quill) ===== */
.module-editor { width: 100%; }
.module-editor .ql-toolbar.ql-snow {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    background: #f8fafc;
}
.module-editor .ql-container.ql-snow {
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
}
.module-editor .ql-editor { min-height: 180px; max-height: 420px; overflow-y: auto; }
.module-editor .ql-editor.ql-blank::before {
    color: var(--text-muted);
    font-style: normal;
}

/* ============================================
   INSTALL WIZARD (安装向导)
   入口：public/install.php（未安装时全站跳转至此）
   ============================================ */
.install-body {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 32px 16px;
}

.install-wrap {
    width: 100%;
    max-width: 620px;
}

.install-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-light);
    padding: 36px 40px;
}

.install-head {
    text-align: center;
    margin-bottom: 24px;
}

.install-head h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.3px;
    margin-bottom: 6px;
}

.muted {
    font-size: 13px;
    color: var(--text-muted);
}

/* 步骤条 */
.install-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 28px;
    padding: 18px 16px;
    background: var(--bg);
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
}

.step-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    white-space: nowrap;
}

.step-item .dot {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--bg-white);
    border: 1px solid var(--border);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
    transition: var(--transition);
}

.step-item.active {
    color: var(--primary);
    font-weight: 600;
}

.step-item.active .dot {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: none;
}

.step-item.done {
    color: var(--success);
}

.step-item.done .dot {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}

.step-line {
    flex: 1;
    height: 2px;
    background: var(--border);
    margin: 0 12px;
    min-width: 24px;
    border-radius: 1px;
}

/* 安装表单（纵向单列，覆盖全局 .form-row 网格布局） */
.install-form .form-row {
    display: block;
}

.install-form label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 6px;
}

.install-form input[type="text"],
.install-form input[type="password"],
.install-form input[type="number"] {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-white);
    color: var(--text);
    font-size: 13px;
    transition: var(--transition);
}

.install-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}

.install-form input::placeholder {
    color: var(--text-muted);
}

/* 复选框行 */
.install-form .form-row.check {
    margin-bottom: 4px;
}

.install-form .checkbox {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    margin-bottom: 0;
}

.install-form .checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.install-form .form-actions {
    margin-top: 22px;
}

/* 授权码面板（第 3 步） */
.license-panel {
    background: var(--bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 20px;
}

.license-panel.ok {
    background: var(--success-bg);
    border-color: #a7f3d0;
}

.license-panel h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.license-ok {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    color: var(--text-secondary);
}

.license-ok strong {
    color: #047857;
    font-size: 14px;
    margin-bottom: 4px;
}

/* 内联小表单（授权码输入） */
.install-form.inline-form .form-actions {
    margin-top: 14px;
}

/* 验证结果信息面板（数据库验证 / 授权信息展示） */
.verify-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    padding: 10px 0 6px;
}

.verify-info p {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin: 0;
    line-height: 1.5;
}

.verify-label {
    flex-shrink: 0;
    min-width: 82px;
    color: var(--text-muted);
    font-weight: 500;
}

/* 模块选择列表（第 3 步） */
.module-list {
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    background: var(--bg-white);
    padding: 4px 16px;
    margin-top: 4px;
}

.module-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 4px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
}

.module-item:last-child {
    border-bottom: none;
}

.module-item input[type="checkbox"] {
    margin-top: 3px;
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    flex-shrink: 0;
}

.module-item.required input[type="checkbox"] {
    cursor: not-allowed;
}

.module-info {
    display: block;
}

.module-info strong {
    font-size: 14px;
    color: var(--text);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.module-info strong em {
    font-style: normal;
    font-size: 11px;
    padding: 1px 8px;
    border-radius: 10px;
    background: var(--primary-bg);
    color: var(--primary);
    font-weight: 500;
}

.module-info small {
    font-size: 12px;
    color: var(--text-muted);
    display: block;
    margin-top: 3px;
    line-height: 1.5;
}

/* 安装页整体表单间距 */
.install-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.install-form .form-actions {
    margin-top: 4px;
}

/* 安装页提示条 */
.install-card .alert {
    margin-bottom: 20px;
}

/* 响应式 */
@media (max-width: 640px) {
    .install-card { padding: 26px 22px; }
    .install-head h1 { font-size: 19px; }
    .install-steps { padding: 14px 10px; }
    .step-item { font-size: 12px; }
    .step-item .dot { width: 22px; height: 22px; font-size: 11px; }
    .step-line { margin: 0 8px; min-width: 12px; }
}

/* 环境自检面板（安装向导第 1 步） */
.env-check-panel {
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 14px 18px;
    margin-bottom: 20px;
    font-size: 13px;
    background: var(--bg);
}

.env-check-panel.env-check-ok {
    border-color: #a7f3d0;
    background: var(--success-bg);
    color: #047857;
}

.env-check-panel .env-check-list {
    margin: 8px 0 4px;
    padding-left: 20px;
    line-height: 1.7;
}

.env-check-panel .env-check-list li::marker {
    color: var(--danger);
}

.env-check-panel .muted {
    margin-top: 6px;
    font-size: 12px;
}

/* ============ 模块管理页（T6） ============ */
/* 卡片内嵌子区块（自定义模块分组/编辑/字段设计） */
.card-inner {
    border-top: 1px dashed var(--border);
    margin-top: 4px;
    padding: 16px 20px;
}
.card-inner .card-header {
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 12px;
    margin-bottom: 4px;
}

/* 行内表单（按钮组内嵌 POST 删除/提交） */
.inline-form {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 0;
    vertical-align: middle;
}
.inline-form .form-inline-input {
    width: 160px;
    display: inline-block;
}

/* 行内勾选项 */
.checkbox-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: 18px;
    font-size: 13px;
    cursor: pointer;
    user-select: none;
}
.checkbox-inline input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: var(--primary);
}
.form-row-inline {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 12px 0;
    flex-wrap: wrap;
}

/* 宽表单组（选项输入框占满一半） */
.form-group-wide {
    flex: 1 1 200px;
    min-width: 160px;
}
/* pump_multi / inventory_multi 动态行布局 */
.pump-multi-row,
.inventory-multi-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px dashed var(--border-light);
}
.pump-multi-row:last-child,
.inventory-multi-row:last-child {
    border-bottom: none;
}
.pump-multi-row select,
.inventory-multi-row select {
    flex: 1 1 160px;
}
.pump-multi-row input[type="number"],
.inventory-multi-row input[type="number"] {
    flex: 0 0 120px;
}
.pump-multi-row .btn,
.inventory-multi-row .btn {
    flex: 0 0 auto;
}

.form-row .form-group-wide + .form-group {
    min-width: 24%;
}

/* 模块管理页内跳转锚点平滑滚动 —— 禁用全局 smooth，避免刷新时自动跳转 */
/* html { scroll-behavior: smooth; } */
.card-inner .card-header {
    margin-bottom: 0;
}
.table-wrapper + .card-inner {
    margin-top: 0;
}

/* ===== 内容区底部版权（OASystem 品牌，二进制关联授权，后台不可修改） ===== */
.content-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    margin: 0;
    padding: 8px 18px;
    border-top: 1px solid var(--border, #e2e8f0);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 12.5px;
    color: var(--muted, #718096);
    background: var(--bg, #f1f5f9);
    z-index: 50;
}
/* 给 fixed 版权 footer 预留底部空间，避免遮挡页面内容 */
body.embed-body {
    padding-bottom: calc(46px + 22px) !important;
}
@media (max-width: 768px) {
    body.embed-body {
        padding-bottom: calc(38px + 16px) !important;
    }
}
.content-footer-text {
    color: var(--muted, #718096);
    letter-spacing: 0.2px;
}
.content-footer-version {
    color: #a0aec0;
    font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
}

/* 手机端隐藏指定操作按钮（如导出/导入/分享），仅保留新增与批量删除 */
@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }
    .content-footer {
        padding: 6px 12px;
        font-size: 11.5px;
    }
}

/* ============ 问题清单：轻量富文本编辑器 ============ */
.rich-editor {
    border: 1px solid #d4dce8;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}
.rich-editor:focus-within {
    border-color: var(--primary, #3b82f6);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.08);
}
.rich-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 6px 8px;
    background: #f6f8fb;
    border-bottom: 1px solid #eef2f7;
}
.rich-toolbar button {
    border: none;
    background: transparent;
    border-radius: 6px;
    width: 30px;
    height: 28px;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    color: #334155;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.rich-toolbar button:hover {
    background: #e2e8f0;
}
.rich-toolbar button.rich-active {
    background: #dbeafe;
    color: #1d4ed8;
}
.rich-content {
    min-height: 96px;
    max-height: 260px;
    overflow-y: auto;
    padding: 8px 12px;
    font-size: 14px;
    line-height: 1.7;
    color: #1e293b;
    outline: none;
}
.rich-content:empty::before {
    content: attr(data-placeholder);
    color: #b6c2d2;
    pointer-events: none;
}
.rich-content p { margin: 0 0 6px; }
.rich-content ul, .rich-content ol { margin: 0 0 6px; padding-left: 22px; }
.rich-content blockquote {
    margin: 6px 0;
    padding: 4px 12px;
    border-left: 3px solid #cbd5e1;
    color: #64748b;
    background: #f8fafc;
}
.rich-content a { color: #2563eb; text-decoration: underline; }

/* 富文本内容预览（表格/卡片内） */
.rich-preview {
    line-height: 1.6;
    word-break: break-word;
    color: inherit;
}
.rich-preview p { margin: 0 0 4px; }
.rich-preview ul, .rich-preview ol { margin: 0 0 4px; padding-left: 18px; }
.rich-preview a { color: #2563eb; text-decoration: underline; }
.rich-preview blockquote {
    margin: 4px 0;
    padding: 2px 8px;
    border-left: 3px solid #cbd5e1;
    color: #64748b;
    background: #f8fafc;
}
