/* ── 全局重置 ── */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: 'Calibri', 'Microsoft YaHei', 'Segoe UI', sans-serif;
    background: #f0f2f5;
    color: #333;
    font-size: 16px;
    line-height: 1.5;
    overflow: auto;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ── 导航栏 ── */
.navbar {
    background: #1a365d;
    color: #fff;
    height: 56px;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.nav-inner {
    width: 100%;
    max-width: 1920px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 1px;
}

.nav-links {
    display: flex;
    gap: 20px;
    align-items: center;
}

.nav-links a {
    color: rgba(255,255,255,0.85);
    font-size: 15px;
    padding: 6px 12px;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
}

.nav-links a:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
}

.nav-logout {
    border: 1px solid rgba(255,255,255,0.3);
}

.nav-logout:hover {
    border-color: #e74c3c;
    background: #e74c3c !important;
}

/* ── 主内容区（无导航栏页面，如登录页） ── */
.main-content {
    min-height: 100vh;
}

.main-content.full-width {
    padding-top: 0; /* 登录页没有固定导航栏 */
}

/* ── 登录页 ── */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1a365d 0%, #2a4a7f 100%);
    padding: 20px;
}

.login-card {
    background: #fff;
    border-radius: 12px;
    padding: 48px 40px 36px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.login-card h1 {
    text-align: center;
    color: #1a365d;
    font-size: 28px;
    margin-bottom: 4px;
}

.login-card h2 {
    text-align: center;
    color: #666;
    font-size: 16px;
    font-weight: 400;
    margin-bottom: 28px;
}

/* ── 表单 ── */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #555;
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    font-size: 16px;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.form-group input:focus {
    border-color: #1a365d;
    box-shadow: 0 0 0 3px rgba(26,54,93,0.1);
}

/* ── 按钮 ── */
.btn {
    padding: 10px 24px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    display: inline-block;
    text-align: center;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: #1a365d;
    color: #fff;
}

.btn-primary:hover {
    background: #234a7a;
}

.btn-full {
    width: 100%;
    padding: 12px;
    font-size: 18px;
    letter-spacing: 4px;
}

/* ── 提示消息 ── */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

/* ── 菜单布局（侧边栏+内容区） ── */
.menu-layout {
    display: flex;
    height: calc(100vh - 56px); /* 固定高度，让 content-area scrollable */
    max-width: 1920px;
    margin: 56px auto 0; /* 偏移固定导航栏高度 */
}

/* ── 侧边栏（深蓝灰主题） ── */
.sidebar {
    width: 240px;
    background: #1E2A3A;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 24px 20px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #2A3A4D;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1px;
    flex-shrink: 0;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 700;
    font-size: 15px;
    color: #E8EDF2;
}

.user-role {
    font-size: 13px;
    color: #8899AA;
    margin-top: 2px;
}

.sidebar-divider {
    border: none;
    border-top: 1px solid #2A3A4D;
    margin: 0 16px 8px;
}

.sidebar-nav {
    flex: 1;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-footer {
    padding: 8px 12px 16px;
}

/* ── 左下角品牌区 ARK TURBO ── */
.sidebar-brand {
    text-align: center;
    padding: 12px 0 8px;
    letter-spacing: 2px;
}

.brand-ark {
    color: #1E90FF;
    font-size: 32px;
    font-weight: bold;
}

.brand-turbo {
    color: #FFD700;
    font-size: 32px;
    font-weight: bold;
}

.nav-item {
    padding: 12px 16px;
    border-radius: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 15px;
    color: #B0B8C4;
    transition: background 0.15s, color 0.15s;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: #2A3A4D;
    color: #E8EDF2;
    border-left-color: #FFD700;
}

.nav-item.disabled {
    color: #556677;
    cursor: not-allowed;
    pointer-events: none;
}

.nav-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

/* ── 内容区 ── */
.content-area {
    flex: 1;
    padding: 32px 40px;
    overflow-y: auto;
}

.welcome-banner {
    background: linear-gradient(135deg, #1a365d 0%, #2a4a7f 100%);
    color: #fff;
    padding: 40px 36px;
    border-radius: 12px;
    margin-bottom: 32px;
}

.welcome-banner h1 {
    font-size: 28px;
    margin-bottom: 8px;
}

.welcome-banner p {
    font-size: 16px;
    opacity: 0.85;
}

/* ── 菜单页卡片（Grid 布局） ── */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.menu-card {
    width: 100%;
    height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    background: white;
    transition: all 0.3s;
    cursor: pointer;
    text-decoration: none;
}

.menu-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.menu-card .icon {
    font-size: 32px;
    margin-bottom: 8px;
    line-height: 1;
}

.menu-card .title {
    font-size: 14px;
    font-weight: 600;
    color: #1E90FF;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    text-align: center;
}

.menu-card .desc {
    font-size: 11px;
    color: #666;
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    text-align: center;
}

@media (max-width: 768px) {
    .menu-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ── 快捷卡片（旧版，兼容保留） ── */
.quick-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

.card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 28px 20px;
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.15s;
}

.card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}

.card.disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.card-icon {
    font-size: 36px;
    margin-bottom: 12px;
}

.card-title {
    font-size: 18px;
    font-weight: 700;
    color: #1E90FF;
    margin-bottom: 4px;
}

.card-desc {
    font-size: 14px;
    color: #888;
}

/* ── 占位页（模块开发中） ── */
.placeholder-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 56px - 64px);
    padding: 40px;
    text-align: center;
}

.placeholder-icon {
    font-size: 80px;
    margin-bottom: 20px;
    opacity: 0.6;
}

.placeholder-page h1 {
    font-size: 32px;
    color: #1a365d;
    margin-bottom: 12px;
}

.placeholder-page p {
    font-size: 18px;
    color: #888;
    margin-bottom: 32px;
}

/* ── 响应式：大屏适配 ── */
@media (min-width: 1920px) {
    .sidebar {
        width: 280px;
    }
    .content-area {
        padding: 40px 60px;
    }
    .quick-cards {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 200px;
    }
    .content-area {
        padding: 20px;
    }
    .quick-cards {
        grid-template-columns: 1fr;
    }
}

/* ═══════════════════════════════════════════
   报关单录入表单页
   ═══════════════════════════════════════════ */

.form-page {
    max-width: 1600px;
    margin: 0 auto;
    padding: 24px 32px 60px;
}

.form-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.form-page-header h1 {
    font-size: 24px;
    color: #1a365d;
}

.user-badge {
    background: #e8edf5;
    color: #1a365d;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

/* ── 查询条 ── */
.query-bar {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    background: #fff;
    padding: 16px 20px;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.query-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: center;
}

.query-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.query-group label {
    font-size: 13px;
    font-weight: 600;
    color: #555;
    white-space: nowrap;
}

.query-group input {
    padding: 7px 12px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    width: 160px;
    outline: none;
}

.query-group input:focus {
    border-color: #1a365d;
    box-shadow: 0 0 0 2px rgba(26,54,93,0.08);
}

.serial-display {
    font-size: 15px;
    color: #1a365d;
    background: #edf2ff;
    padding: 7px 14px;
    border-radius: 6px;
}

.btn-success {
    background: #16a34a;
    color: #fff;
}

.btn-success:hover {
    background: #15803d;
}

.btn-secondary {
    background: #e5e7eb;
    color: #333;
}

.btn-secondary:hover {
    background: #d1d5db;
}

.btn-info {
    background: #0ea5e9;
    color: #fff;
}

.btn-info:hover {
    background: #0284c7;
}

/* ── 表单区域 ── */
.form-section {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 20px 24px 16px;
    margin-bottom: 16px;
}

.section-title {
    font-size: 16px;
    font-weight: 700;
    color: #1a365d;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid #edf2ff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.max-hint {
    font-size: 12px;
    font-weight: 400;
    color: #999;
}

/* ── 栅格布局 ── */
.form-grid {
    display: grid;
    gap: 12px;
}

.grid-1 { grid-template-columns: 1fr; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.grid-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }
.grid-5 { grid-template-columns: 1fr 1fr 1fr 1fr 1fr; }

.form-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-field label {
    font-size: 12px;
    font-weight: 600;
    color: #666;
}

.form-field input,
.form-field select {
    padding: 7px 10px;
    border: 1px solid #d0d5dd;
    border-radius: 5px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    background: #fff;
}

.form-field input:focus,
.form-field select:focus {
    border-color: #1a365d;
    box-shadow: 0 0 0 2px rgba(26,54,93,0.08);
}

.form-field input[readonly] {
    background: #f9fafb;
    color: #666;
    cursor: not-allowed;
}

.form-field.required label::after {
    content: ' *';
    color: #e74c3c;
}

/* ── 商品明细 ── */
.goods-toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

.btn-danger {
    background: #e74c3c;
    color: #fff;
}

.btn-danger:hover {
    background: #c0392b;
}

.goods-row {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 10px;
    background: #fafbfc;
}

.goods-row-header {
    margin-bottom: 10px;
}

.goods-row-num {
    font-size: 13px;
    font-weight: 700;
    color: #1a365d;
}

.goods-fields .form-field label {
    font-size: 11px;
}

/* ── 操作按钮区 ── */
.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
}

.btn-lg {
    padding: 12px 32px;
    font-size: 16px;
}

/* ── 消息提示 ── */
.alert-warning {
    background: #fffbeb;
    color: #b45309;
    border: 1px solid #fde68a;
}

.alert-success {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

/* ═══════════════════════════════════════════
   报关单详情页（审核/作废/退关）
   ═══════════════════════════════════════════ */

.status-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 24px;
    margin-bottom: 20px;
}

.status-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.status-label {
    font-size: 14px;
    font-weight: 600;
    color: #888;
}

.status-value {
    font-size: 20px;
    font-weight: 700;
    color: #1a365d;
    font-family: 'Consolas', 'Courier New', monospace;
}

.status-badges {
    display: flex;
    gap: 24px;
    margin-bottom: 20px;
}

.badge-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.badge-label {
    font-size: 12px;
    color: #888;
    font-weight: 600;
}

.badge {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 700;
    font-family: 'Consolas', 'Courier New', monospace;
}

.badge-pending {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.badge-audited {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.badge-normal {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.badge-void {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.badge-refund {
    background: #fce7f3;
    color: #9d174d;
    border: 1px solid #fbcfe8;
}

.badge-other {
    background: #e5e7eb;
    color: #4b5563;
    border: 1px solid #d1d5db;
}

.action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
}

.btn-warning {
    background: #f59e0b;
    color: #fff;
}

.btn-warning:hover {
    background: #d97706;
}

/* ── 详情表格 ── */
.detail-table {
    width: 100%;
    border-collapse: collapse;
}

.detail-table tr {
    border-bottom: 1px solid #f3f4f6;
}

.detail-table tr:last-child {
    border-bottom: none;
}

.detail-table td {
    padding: 10px 8px;
    font-size: 14px;
    vertical-align: top;
}

.dt-label {
    font-weight: 600;
    color: #888;
    width: 100px;
    white-space: nowrap;
}

.dt-value {
    color: #333;
    width: auto;
    min-width: 120px;
}

.detail-table td[colspan] {
    color: #666;
}

.download-links {
    display: flex;
    gap: 12px;
}

/* ═══════════════════════════════════════════
   查询历史页
   ═══════════════════════════════════════════ */

.table-wrapper {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table thead th {
    background: #f8f9fa;
    padding: 10px 8px;
    font-size: 12px;
    font-weight: 700;
    color: #555;
    text-align: left;
    border-bottom: 2px solid #e5e7eb;
    white-space: nowrap;
}

.data-table tbody td {
    padding: 10px 8px;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background: #fafbfc;
}

.data-table a.link {
    color: #1a365d;
    font-weight: 600;
    font-family: 'Consolas', 'Courier New', monospace;
}

.data-table a.link:hover {
    text-decoration: underline;
}

.btn-xs {
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 4px;
    margin: 0 2px;
}

.btn-info {
    background: #3b82f6;
    color: #fff;
}

.btn-info:hover {
    background: #2563eb;
}

.action-cell {
    white-space: nowrap;
}

.badge-sm {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding-top: 16px;
    margin-top: 12px;
    border-top: 1px solid #e5e7eb;
}

.page-info {
    font-size: 13px;
    color: #666;
}

/* ── 模态框 ── */
.modal {
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #fff;
    border-radius: 10px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
}

.modal-header h3 {
    font-size: 16px;
    color: #1a365d;
}

.modal-close {
    font-size: 22px;
    cursor: pointer;
    color: #999;
    line-height: 1;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
    font-size: 14px;
    line-height: 1.8;
}

/* ── 大屏适配 ── */
@media (min-width: 1920px) {
    .form-page {
        max-width: 1800px;
        padding: 28px 48px 80px;
    }
    .query-group input {
        width: 200px;
    }
}

@media (max-width: 1200px) {
    .grid-5 { grid-template-columns: 1fr 1fr 1fr 1fr; }
    .grid-4 { grid-template-columns: 1fr 1fr 1fr; }
}

@media (max-width: 900px) {
    .grid-5, .grid-4, .grid-3 {
        grid-template-columns: 1fr 1fr;
    }
    .query-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .query-group {
        flex-wrap: wrap;
    }
    .query-group input {
        flex: 1;
    }
}

/* ═══════════════════════════════════════════
   首页（深蓝主题，与登录页一致）
   ═══════════════════════════════════════════ */

.welcome-page {
    background: linear-gradient(135deg, #1a365d 0%, #2c5282 100%);
    min-height: 100%;
    padding: 40px;
}

.hero {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

.hero h1 {
    font-size: 32px;
    font-weight: 600;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.hero p {
    font-size: 16px;
    opacity: 0.9;
}

/* 卡片网格 - 4列 */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto;
}

.cards-grid .card {
    background: white;
    border-radius: 12px;
    padding: 32px 24px;
    text-align: center;
    text-decoration: none;
    color: #2d3748;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
    border: 1px solid rgba(255,255,255,0.1);
    display: block;
}

.cards-grid .card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.2);
}

.cards-grid .card-icon {
    font-size: 48px;
    margin-bottom: 16px;
    display: block;
}

.cards-grid .card-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #1a365d;
}

.cards-grid .card-desc {
    font-size: 13px;
    color: #718096;
    line-height: 1.5;
}

.cards-grid .card.admin-only {
    position: relative;
}

.cards-grid .card.admin-only::after {
    content: "管理";
    position: absolute;
    top: 12px;
    right: 12px;
    background: #e53e3e;
    color: white;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
}

/* 响应式 */
@media (max-width: 1024px) {
    .cards-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .welcome-page {
        padding: 20px;
    }
}
