/* ==========================================
   宏盛采购管理系统 - 样式表
   Light / Dark 双主题
   ========================================== */

/* CSS Variables - Light Theme (default) */
:root,
[data-theme="light"] {
    --bg-primary: #f0f2f5;
    --bg-secondary: #ffffff;
    --bg-sidebar: #1a1d29;
    --bg-card: #ffffff;
    --bg-input: #f8f9fa;
    
    --text-primary: #1a1d29;
    --text-secondary: #5f6368;
    --text-sidebar: #b0b3c4;
    --text-sidebar-active: #ffffff;
    
    --border-color: #e4e6eb;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-hover: 0 4px 12px rgba(0,0,0,0.12);
    
    --accent: #4f6ef7;
    --accent-hover: #3b5de7;
    --accent-light: #edf0ff;
    
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    
    --sidebar-width: 0px;
    --topbar-height: 44px;
    --radius: 6px;
    --radius-lg: 10px;
}

/* Dark Theme */
[data-theme="dark"] {
    --bg-primary: #0f1119;
    --bg-secondary: #1a1d29;
    --bg-sidebar: #0d0f17;
    --bg-card: #1e2235;
    --bg-input: #262a3e;
    
    --text-primary: #e4e6eb;
    --text-secondary: #9ca3b0;
    --text-sidebar: #6b7085;
    --text-sidebar-active: #ffffff;
    
    --border-color: #2d3148;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-hover: 0 4px 12px rgba(0,0,0,0.4);
    
    --accent-light: #1e2448;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 15px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    transition: background 0.3s ease, color 0.3s ease;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}
a:hover {
    color: var(--accent-hover);
}

/* Layout */
.layout {
    display: flex;
    min-height: 100vh;
    padding-top: var(--topbar-height);
}

/* 顶部菜单栏 - 办公软件风格 */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-height, 44px);
    background: var(--bg-sidebar, #1a1d29);
    color: var(--text-sidebar, #b0b3c4);
    z-index: 9999;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.topbar-inner {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 12px;
    gap: 4px;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 10px 0 4px;
    height: 32px;
    border-right: 1px solid rgba(255,255,255,0.1);
    margin-right: 4px;
    flex-shrink: 0;
}

.brand-icon {
    width: 24px;
    height: 24px;
    background: var(--accent, #4f6ef7);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
}

.brand-text {
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
}

/* 菜单项 */
.top-menu {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 100%;
}

.menu-item {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.menu-link {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 10px;
    height: 32px;
    border-radius: 4px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-sidebar, #b0b3c4);
    text-decoration: none;
    transition: all 0.15s;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}

.menu-link:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

.menu-item .menu-link.active {
    background: rgba(79, 110, 247, 0.2);
    color: #fff;
}

.menu-arrow {
    opacity: 0.6;
    transition: transform 0.2s;
}

.has-submenu:hover .menu-arrow {
    transform: rotate(180deg);
}

/* 下拉子菜单 */
.submenu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 190px;
    background: var(--bg-card, #ffffff);
    border: 1px solid var(--border-color, #e4e6eb);
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.12);
    padding: 6px 0;
    display: none;
    z-index: 9998;
    animation: submenuIn 0.15s ease;
}

[data-theme="dark"] .submenu {
    background: #1e2235;
    border-color: #2d3148;
    box-shadow: 0 8px 30px rgba(0,0,0,0.4);
}

@keyframes submenuIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.has-submenu:hover .submenu,
.has-submenu.open .submenu {
    display: block;
}

.submenu-link {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    font-size: 0.82rem;
    color: var(--text-primary, #1a1d29);
    text-decoration: none;
    transition: all 0.15s ease;
    white-space: nowrap;
    border-left: 3px solid transparent;
}

.submenu-link:hover {
    background: var(--accent-light, #edf0ff);
    color: var(--accent, #4f6ef7);
    border-left-color: var(--accent, #4f6ef7);
}

.submenu-link.active {
    background: var(--accent, #4f6ef7);
    color: #fff;
    border-left-color: var(--accent, #4f6ef7);
}

.submenu-divider {
    height: 1px;
    background: var(--border-color, #e4e6eb);
    margin: 4px 14px;
}

/* 顶部右侧 */
.topbar-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    margin-left: auto;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0 8px;
    height: 32px;
    border-radius: 4px;
    transition: background 0.15s;
}

.topbar-user:hover {
    background: rgba(255,255,255,0.06);
}

.user-avatar-sm {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
}

.user-name-sm {
    font-size: 0.8rem;
    color: var(--text-sidebar, #b0b3c4);
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.theme-btn-sm {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    padding: 3px 6px;
    border-radius: 4px;
    transition: background 0.2s;
    color: var(--text-sidebar);
    line-height: 1;
}

.theme-btn-sm:hover {
    background: rgba(255,255,255,0.1);
}

[data-theme="light"] .theme-icon-dark,
[data-theme="dark"] .theme-icon-light {
    display: none;
}

[data-theme="light"] .theme-icon-light,
[data-theme="dark"] .theme-icon-dark {
    display: inline;
}

.logout-link {
    color: var(--danger, #ef4444);
    font-size: 0.78rem;
    padding: 3px 8px;
    border-radius: 4px;
    transition: background 0.15s;
    text-decoration: none;
}

.logout-link:hover {
    background: rgba(239, 68, 68, 0.15);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 0;
    padding: 16px 24px 50px 24px;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
    display: flex;
    flex-direction: column;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 8px;
}

.page-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
}

.page-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    margin-bottom: 14px;
    transition: box-shadow 0.25s ease, transform 0.2s ease;
    overflow: hidden;
}

.card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
}

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

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.card-header-left {
    display: flex;
    align-items: center;
}

.card-header-right {
    display: flex;
    align-items: center;
}

.card-body {
    padding: 14px 16px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
    border: 1px solid transparent;
    transition: all 0.2s;
    cursor: default;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon-blue { background: #dbeafe; color: #2563eb; }
.stat-icon-green { background: #dcfce7; color: #16a34a; }
.stat-icon-purple { background: #f3e8ff; color: #9333ea; }
.stat-icon-orange { background: #fed7aa; color: #ea580c; }
.stat-icon-red { background: #fce7f3; color: #e11d48; }
.stat-icon-yellow { background: #fef9c3; color: #ca8a04; }

[data-theme="dark"] .stat-icon-blue { background: #1e3a5f; }
[data-theme="dark"] .stat-icon-green { background: #14532d; }
[data-theme="dark"] .stat-icon-purple { background: #3b0764; }
[data-theme="dark"] .stat-icon-orange { background: #431407; }
[data-theme="dark"] .stat-icon-red { background: #4c0519; }
[data-theme="dark"] .stat-icon-yellow { background: #422006; }

/* 仪表盘统计卡片：可点击直达对应数据表 */
.stat-card.stat-link {
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}
.stat-card.stat-link:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
    border-color: var(--accent);
}
.stat-card .stat-go {
    margin-left: auto;
    font-size: 1.4rem;
    line-height: 1;
    color: var(--accent);
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity 0.2s, transform 0.2s;
}
.stat-card.stat-link:hover .stat-go {
    opacity: 1;
    transform: translateX(0);
}
.stat-card.no-perm {
    opacity: 0.55;
    cursor: not-allowed;
    filter: grayscale(0.35);
}
.stat-card .stat-lock {
    margin-left: auto;
    font-size: 1rem;
    opacity: 0.75;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-number {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.table th, .table td {
    padding: 7px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
    letter-spacing: 0.3px;
    background: var(--bg-input);
    white-space: nowrap;
}

.table tbody tr:hover {
    background: var(--bg-input);
}

.table th.text-right,
.table td.text-right {
    text-align: right;
}

.table tfoot th {
    background: var(--bg-card);
    border-top: 2px solid var(--border-color);
}

/* Action Cell */
.action-cell {
    white-space: nowrap;
}

.action-cell .btn {
    margin-right: 4px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 14px;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 5px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    gap: 4px;
}

.btn:hover {
    background: var(--bg-input);
    border-color: var(--accent);
    color: var(--accent);
}

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: #fff;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 0.8rem;
}

.btn-danger {
    color: var(--danger);
    border-color: var(--danger);
}

.btn-danger:hover {
    background: var(--danger);
    color: #fff;
}

.btn-block {
    width: 100%;
}

/* Forms */
.form {
    max-width: 680px;
}

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 7px 11px;
    border: 1.5px solid var(--border-color);
    border-radius: 7px;
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.88rem;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
    background: var(--bg-card);
}

.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover {
    border-color: var(--accent);
}

.form-group textarea {
    resize: vertical;
    min-height: 60px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.search-form {
    display: flex;
    gap: 6px;
    align-items: center;
}

.search-input {
    padding: 5px 10px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.85rem;
    min-width: 160px;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.badge-success { background: #dcfce7; color: #16a34a; }
.badge-warning { background: #fef3c7; color: #d97706; }
.badge-danger { background: #fee2e2; color: #dc2626; }
.badge-info { background: #dbeafe; color: #2563eb; }

[data-theme="dark"] .badge-success { background: #14532d; color: #4ade80; }
[data-theme="dark"] .badge-warning { background: #422006; color: #fbbf24; }
[data-theme="dark"] .badge-danger { background: #4c0519; color: #f87171; }
[data-theme="dark"] .badge-info { background: #1e3a5f; color: #60a5fa; }

/* Detail Grid */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
}

.detail-grid div {
    font-size: 0.95rem;
}

/* Alert */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.alert-error {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

[data-theme="dark"] .alert-error {
    background: #4c0519;
    color: #f87171;
    border-color: #7f1d1d;
}

.alert-success {
    background: #dcfce7;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

[data-theme="dark"] .alert-success {
    background: #14532d;
    color: #4ade80;
    border-color: #166534;
}

/* Login Page - Windows Forms Style */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.login-window {
    width: 100%;
    max-width: 520px;
    background: var(--bg-card);
    border-radius: 8px;
    box-shadow: 0 25px 80px rgba(0,0,0,0.35), 0 0 0 1px rgba(255,255,255,0.1) inset;
    overflow: hidden;
    animation: loginSlideUp 0.5s ease;
}

@keyframes loginSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.login-titlebar {
    background: linear-gradient(180deg, #4a86e8 0%, #3b6fc7 100%);
    color: #fff;
    padding: 6px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

.titlebar-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.titlebar-icon {
    width: 18px;
    height: 18px;
    background: #fff;
    color: #3b6fc7;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
}

.titlebar-close {
    background: #c42b1c;
    color: #fff;
    border: 1px solid #9e2418;
    border-radius: 3px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s;
}

.titlebar-close:hover {
    background: #e81123;
}

.login-banner {
    background: linear-gradient(135deg, #4a86e8 0%, #2980b9 100%);
    padding: 24px 30px;
    display: flex;
    align-items: center;
    gap: 20px;
    color: #fff;
    border-bottom: 1px solid rgba(0,0,0,0.08);
}

.banner-logo {
    flex-shrink: 0;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
}

.banner-text h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 4px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.banner-text p {
    font-size: 0.95rem;
    opacity: 0.9;
    font-weight: 500;
}

.login-form-area {
    padding: 24px 30px 30px;
}

.login-notice {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 14px 16px;
    display: flex;
    gap: 14px;
    margin-bottom: 24px;
}

.notice-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.notice-content p {
    margin-bottom: 6px;
    font-size: 0.9rem;
    color: #475569;
    line-height: 1.5;
}

.contact-info {
    color: #64748b !important;
    font-size: 0.85rem !important;
    margin-bottom: 0 !important;
}

.login-fields .field-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.login-fields label {
    width: 100px;
    flex-shrink: 0;
    text-align: right;
    font-size: 0.9rem;
    color: #334155;
    font-weight: 500;
}

.input-wrap {
    flex: 1;
}

.input-wrap input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    background: #fff;
    color: #1e293b;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.input-wrap input:focus {
    outline: none;
    border-color: #4a86e8;
    box-shadow: 0 0 0 3px rgba(74, 134, 232, 0.15);
}

.field-link {
    font-size: 0.85rem;
    color: #2563eb;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.2s;
}

.field-link:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

.login-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.btn-login,
.btn-exit {
    min-width: 90px;
    padding: 9px 24px;
    border-radius: 4px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    border: 1px solid transparent;
}

.btn-login {
    background: linear-gradient(180deg, #4a86e8 0%, #3b6fc7 100%);
    color: #fff;
    border-color: #2a5cb0;
    box-shadow: 0 2px 4px rgba(59, 111, 199, 0.3);
}

.btn-login:hover {
    background: linear-gradient(180deg, #3b6fc7 0%, #2a5cb0 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(59, 111, 199, 0.4);
}

.btn-exit {
    background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
    color: #475569;
    border-color: #cbd5e1;
}

.btn-exit:hover {
    background: linear-gradient(180deg, #e2e8f0 0%, #cbd5e1 100%);
}

[data-theme="dark"] .login-window {
    background: #1e293b;
    box-shadow: 0 25px 80px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.05) inset;
}

[data-theme="dark"] .login-form-area {
    background: #1e293b;
}

[data-theme="dark"] .login-notice {
    background: #0f172a;
    border-color: #334155;
}

[data-theme="dark"] .notice-content p,
[data-theme="dark"] .contact-info {
    color: #cbd5e1 !important;
}

/* Table Horizontal Scroll */
.card table {
    min-width: 700px;
}

/* Login Page - Mobile */
@media (max-width: 480px) {
    .login-page {
        padding: 10px;
        align-items: flex-start;
        padding-top: 20px;
    }
    .login-window {
        max-width: 100%;
        border-radius: 6px;
    }
    .login-banner {
        padding: 16px;
        gap: 12px;
    }
    .login-banner .banner-logo svg {
        width: 36px;
        height: 36px;
    }
    .banner-text h1 {
        font-size: 1.1rem;
    }
    .banner-text p {
        font-size: 0.8rem;
    }
    .login-form-area {
        padding: 14px;
    }
    .login-notice {
        padding: 10px 12px;
        gap: 10px;
        margin-bottom: 16px;
    }
    .notice-icon {
        font-size: 1.5rem;
    }
    .notice-content p {
        font-size: 0.8rem;
    }
    .login-fields .field-row {
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        margin-bottom: 14px;
    }
    .login-fields label {
        width: auto;
        text-align: left;
        font-size: 0.85rem;
    }
    .field-link {
        display: none;
    }
    .login-actions {
        flex-direction: column;
        gap: 10px;
        margin-top: 20px;
        padding-top: 14px;
    }
    .btn-login, .btn-exit {
        width: 100%;
    }
    .topbar-inner {
        gap: 2px;
    }
    .top-menu {
        display: flex;
        flex-wrap: nowrap;
        white-space: nowrap;
    }
    .menu-item {
        flex-shrink: 0;
    }
    .app-footer {
        font-size: 0.7rem;
    }
}

/* Responsive table scroll for all sizes */
@media (max-width: 768px) {
    .card {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

[data-theme="dark"] .input-wrap input {
    background: #0f172a;
    border-color: #475569;
    color: #f1f5f9;
}

[data-theme="dark"] .input-wrap input:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.15);
}

[data-theme="dark"] .login-actions {
    border-color: #334155;
}

[data-theme="dark"] .btn-exit {
    background: linear-gradient(180deg, #334155 0%, #1e293b 100%);
    color: #e2e8f0;
    border-color: #475569;
}

/* Error Page */
.error-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.error-container {
    text-align: center;
}

.error-container h1 {
    font-size: 6rem;
    font-weight: 800;
    color: var(--accent);
    margin-bottom: 8px;
}

.error-container p {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* Pagination */
.pagination {
    margin-top: 16px;
}

.pagination ul {
    display: flex;
    gap: 4px;
    list-style: none;
    justify-content: center;
}

.pagination a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.pagination a:hover,
.pagination .active a {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* Utility */
.text-muted { color: var(--text-secondary); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-2 { margin-top: 8px; }

/* Dashboard Panel */
.dashboard-panel {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.dashboard-panel .control-panel-banner {
    background: linear-gradient(135deg, #4a86e8 0%, #2980b9 100%);
    color: #fff;
    padding: 14px 24px;
    border-bottom: 1px solid rgba(0,0,0,0.08);
}

.dashboard-panel .banner-inner {
    max-width: 1200px;
    margin: 0 auto;
}

.dashboard-panel .banner-title h1 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 2px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.dashboard-panel .banner-title p {
    font-size: 0.9rem;
    opacity: 0.9;
    font-weight: 500;
}

.dashboard-panel .control-panel-body {
    display: flex;
    flex: 1;
    padding: 16px 20px;
    gap: 16px;
}

.dashboard-panel .control-tabs {
    width: 120px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dashboard-panel .control-tab {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.dashboard-panel .control-tab:hover {
    background: var(--bg-input);
    color: var(--text-primary);
    border-color: var(--accent);
}

.dashboard-panel .control-tab.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(79, 110, 247, 0.3);
}

.dashboard-panel .control-content {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 20px;
    min-height: 350px;
}

.dashboard-panel .tab-panel {
    display: none;
    animation: panelFadeIn 0.3s ease;
}

.dashboard-panel .tab-panel.active {
    display: block;
}

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

.dashboard-panel .icon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(105px, 1fr));
    gap: 16px;
}

.dashboard-panel .function-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 14px 10px;
    border-radius: 10px;
    background: var(--bg-card);
    border: 1px solid transparent;
    transition: all 0.2s;
    text-decoration: none;
    color: var(--text-primary);
    cursor: pointer;
}

.dashboard-panel .function-icon:hover {
    background: var(--bg-input);
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.08);
}

.dashboard-panel .function-icon span {
    font-size: 0.82rem;
    text-align: center;
    line-height: 1.3;
}

.dashboard-panel .icon-circle {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: transform 0.2s;
}

.dashboard-panel .function-icon:hover .icon-circle {
    transform: scale(1.08);
}

.icon-green { background: linear-gradient(135deg, #22c55e, #16a34a); }
.icon-blue { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.icon-orange { background: linear-gradient(135deg, #f97316, #ea580c); }
.icon-purple { background: linear-gradient(135deg, #a855f7, #9333ea); }
.icon-yellow { background: linear-gradient(135deg, #eab308, #ca8a04); }
.icon-red { background: linear-gradient(135deg, #ef4444, #dc2626); }
.icon-cyan { background: linear-gradient(135deg, #06b6d4, #0891b2); }
.icon-amber { background: linear-gradient(135deg, #f59e0b, #d97706); }
.icon-teal { background: linear-gradient(135deg, #14b8a6, #0d9488); }
.icon-indigo { background: linear-gradient(135deg, #6366f1, #4f46e5); }
.icon-pink { background: linear-gradient(135deg, #ec4899, #db2777); }
.icon-dark { background: linear-gradient(135deg, #475569, #1e293b); }

.app-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 24px;
    background: var(--bg-sidebar);
    color: #b0b3c4;
    font-size: 0.8rem;
    border-top: 1px solid rgba(255,255,255,0.08);
    margin: auto -24px -16px -24px;
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
}

.footer-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.footer-label {
    opacity: 0.8;
}

.footer-value {
    color: #fff;
    font-weight: 500;
}

/* Responsive */
@media (max-width: 768px) {
    .main-content {
        padding: 12px 12px 50px 12px;
    }
    
    .topbar-inner {
        padding: 0 6px;
    }
    
    .brand-text {
        display: none;
    }
    
    .top-menu .menu-link svg:first-child {
        display: none;
    }
    
    .top-menu .menu-link {
        padding: 0 6px;
        font-size: 0.78rem;
    }
    
    .user-name-sm {
        display: none;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .search-form {
        flex-wrap: wrap;
    }
    
    .search-input {
        min-width: 120px;
        flex: 1;
    }
    
    .table {
        font-size: 0.8rem;
    }
    
    .table th, .table td {
        padding: 5px 6px;
    }

    .dashboard-panel .control-panel-body {
        flex-direction: column;
    }
    .dashboard-panel .control-tabs {
        width: 100%;
        flex-direction: row;
    }
    .dashboard-panel .control-tab {
        flex: 1;
        text-align: center;
        padding: 8px 6px;
        font-size: 0.8rem;
    }
    .dashboard-panel .icon-grid {
        grid-template-columns: repeat(auto-fill, minmax(85px, 1fr));
        gap: 10px;
    }
    .dashboard-panel .icon-circle {
        width: 44px;
        height: 44px;
    }
    
    .app-footer {
        padding: 6px 12px;
        margin: auto -12px -12px -12px;
        flex-wrap: wrap;
        gap: 4px;
    }
    
    .footer-item {
        flex: 1 1 auto;
        justify-content: center;
    }
}
