/* 金虎网上药店 - 移动端优先 */
:root {
    --primary: #1a73e8;
    --primary-dark: #1557b0;
    --success: #0d9488;
    --warning: #f59e0b;
    --danger: #ef4444;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
    --radius: 8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* --- Layout --- */
.container { max-width: 640px; margin: 0 auto; padding: 16px; }
.page-header {
    background: var(--primary);
    color: #fff;
    padding: 14px 16px;
    font-size: 17px;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 10px;
}
.page-header .back { color: #fff; text-decoration: none; font-size: 20px; }

/* --- Cards --- */
.card {
    background: #fff;
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 10px; color: var(--gray-700); }

/* --- Forms --- */
.form-group { margin-bottom: 14px; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-500);
    margin-bottom: 4px;
}
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}
.form-group input:focus, .form-group select:focus {
    border-color: var(--primary);
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* --- Table --- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { background: var(--gray-100); text-align: left; padding: 8px 10px; font-weight: 500; color: var(--gray-500); white-space: nowrap; }
td { padding: 8px 10px; border-bottom: 1px solid var(--gray-100); }

/* --- Status badges --- */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-active { background: #d1fae5; color: #065f46; }
.badge-done { background: var(--gray-100); color: var(--gray-500); }
.badge-cancel { background: #fee2e2; color: #991b1b; }

/* --- Nav menu --- */
.nav-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 16px;
}
.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 20px 10px;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    text-decoration: none;
    color: var(--gray-700);
    font-size: 14px;
    font-weight: 500;
}
.nav-item .icon { font-size: 28px; }
.nav-item:active { background: var(--gray-100); }

/* --- Stats --- */
.stats-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}
.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 14px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.stat-card .num { font-size: 28px; font-weight: 700; color: var(--primary); }
.stat-card .label { font-size: 13px; color: var(--gray-500); margin-top: 2px; }

/* --- Order list item --- */
.order-item {
    display: block;
    background: #fff;
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    text-decoration: none;
    color: inherit;
}
.order-item:active { background: var(--gray-50); }
.order-item .order-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.order-item .order-no { font-weight: 600; font-size: 14px; }
.order-item .order-info { font-size: 13px; color: var(--gray-500); }

/* --- Login page --- */
.login-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}
.login-box {
    width: 100%;
    max-width: 360px;
}
.login-box h1 {
    text-align: center;
    font-size: 22px;
    margin-bottom: 24px;
    color: var(--primary);
}

/* --- H5 page --- */
.h5-header {
    text-align: center;
    padding: 24px 16px;
    background: linear-gradient(135deg, var(--primary), #4f46e5);
    color: #fff;
}
.h5-header h1 { font-size: 20px; margin-bottom: 4px; }
.h5-header .sub { font-size: 14px; opacity: 0.8; }
.confirm-btn {
    width: 100%;
    padding: 14px;
    font-size: 17px;
    font-weight: 600;
    border-radius: 12px;
    margin-top: 16px;
}

/* --- Tabs --- */
.tab-bar {
    display: flex;
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    overflow-x: auto;
}
.tab-bar a {
    flex-shrink: 0;
    padding: 10px 16px;
    font-size: 14px;
    color: var(--gray-500);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}
.tab-bar a.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 500; }

/* --- Toast --- */
.toast {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--gray-900);
    color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s;
}
.toast.show { opacity: 1; }

/* --- Search bar --- */
.search-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}
.search-bar input { flex: 1; }
.search-bar .btn { flex-shrink: 0; }

/* --- Modal overlay --- */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 200;
    align-items: flex-end;
    justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal-content {
    background: #fff;
    width: 100%;
    max-width: 640px;
    max-height: 80vh;
    border-radius: 16px 16px 0 0;
    padding: 20px;
    overflow-y: auto;
}

/* === 宽屏适配（电脑端） === */
@media (min-width: 768px) {
    .container { max-width: 960px; }
    .container.wide { max-width: 1200px; }
    .nav-grid { grid-template-columns: repeat(4, 1fr); }
    .stats-row { grid-template-columns: repeat(3, 1fr); }
    .modal-overlay { align-items: center; }
    .modal-content { border-radius: 16px; max-width: 600px; }

    /* 管理表格 */
    .mgmt-table { width: 100%; border-collapse: collapse; font-size: 14px; }
    .mgmt-table th { background: var(--gray-100); padding: 10px 12px; text-align: left; font-weight: 500; color: var(--gray-500); white-space: nowrap; position: sticky; top: 0; }
    .mgmt-table td { padding: 10px 12px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
    .mgmt-table tr:hover td { background: var(--gray-50); }
    .mgmt-table .actions { white-space: nowrap; }
    .mgmt-table .actions button { padding: 4px 10px; font-size: 12px; margin-right: 4px; }

    /* inline edit */
    .mgmt-table input, .mgmt-table select {
        padding: 4px 8px; border: 1px solid var(--gray-200); border-radius: 4px; font-size: 13px;
    }
    .mgmt-table input:focus { border-color: var(--primary); outline: none; }
}

/* 小屏管理表格退化为卡片 */
@media (max-width: 767px) {
    .mgmt-table { display: block; }
    .mgmt-table thead { display: none; }
    .mgmt-table tbody { display: block; }
    .mgmt-table tr { display: block; background: #fff; border-radius: var(--radius); padding: 12px; margin-bottom: 10px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
    .mgmt-table td { display: flex; justify-content: space-between; padding: 4px 0; border: none; font-size: 14px; }
    .mgmt-table td::before { content: attr(data-label); color: var(--gray-500); font-size: 13px; }
    .mgmt-table .actions { margin-top: 8px; display: flex; gap: 6px; }
}

/* 工具栏 */
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; flex-wrap: wrap; gap: 8px; }
.toolbar .search-bar { margin-bottom: 0; }
