/* ========== 奶茶店效期检查系统 - 全局样式 ========== */
:root {
    --primary: #ff8c42;
    --primary-dark: #f06f1f;
    --primary-light: #fff1e6;
    --danger: #dc2626;
    --warning: #f59e0b;
    --success: #16a34a;
    --text: #2d3748;
    --muted: #8a94a6;
    --border: #e5eaf0;
    --bg: #f3f5f9;
    --sidebar-bg: #1f2733;
    --radius: 12px;
    --shadow: 0 2px 12px rgba(15, 42, 86, .06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
}

/* ========== 布局 ========== */
.layout { display: flex; min-height: 100vh; }
.sidebar {
    width: 230px; background: var(--sidebar-bg); color: #cbd5e0;
    display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; z-index: 20;
}
.main { flex: 1; margin-left: 230px; display: flex; flex-direction: column; min-height: 100vh; }

.brand { display: flex; align-items: center; gap: 10px; padding: 20px 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-logo { font-size: 26px; }
.brand-name { color: #fff; font-weight: 700; font-size: 15px; line-height: 1.3; }

.nav { flex: 1; padding: 14px 10px; overflow-y: auto; }
.nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; margin-bottom: 4px; border-radius: 8px;
    color: #cbd5e0; text-decoration: none; font-size: 14px;
    transition: background .15s, color .15s;
}
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav a.active { background: var(--primary); color: #fff; font-weight: 600; }
.nav-ico { width: 20px; text-align: center; font-size: 15px; }
.sidebar-foot { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; color: #718096; }

.topbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 24px; background: #fff; border-bottom: 1px solid var(--border);
}
.topbar-title { font-size: 17px; font-weight: 700; }
.topbar-user { display: flex; align-items: center; gap: 10px; }
.uname { font-weight: 600; }

.content { flex: 1; padding: 22px 24px; max-width: 1280px; width: 100%; margin: 0 auto; }
.footer { padding: 14px 24px; text-align: center; color: var(--muted); font-size: 12px; }

/* ========== 通用组件 ========== */
.card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; overflow: hidden; }
.card-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.card-head h3, .card-head h4 { font-size: 15px; }
.card-body { padding: 18px 20px; }
.card-inset { background: #fafbfd; border: 1px solid var(--border); box-shadow: none; }
.card-inset .card-body { padding: 12px 16px; }

.muted { color: var(--muted); font-size: 13px; }
.mono { font-family: Consolas, Monaco, monospace; font-size: 13px; }
.req { color: var(--danger); }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 8px 16px; border-radius: 8px; border: 1px solid transparent;
    font-size: 14px; cursor: pointer; text-decoration: none; transition: all .15s;
    background: #eef1f5; color: var(--text);
}
.btn:hover { opacity: .88; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); opacity: 1; }
.btn-ghost { background: #fff; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); opacity: 1; }
.btn-danger { background: #fff; border-color: #f5c6c6; color: var(--danger); }
.btn-danger:hover { background: #fdf0f0; opacity: 1; }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn-block { width: 100%; padding: 11px; font-size: 15px; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-ok { background: #f0faf3; color: var(--success); }
.badge-warning { background: #fff7e6; color: var(--warning); }
.badge-expired { background: #fdf0f0; color: var(--danger); }

.chip { display: inline-block; padding: 2px 10px; border-radius: 20px; background: #eef1f5; color: var(--text); font-size: 12px; }
.chip-date { background: var(--primary-light); color: var(--primary-dark); }
.chip-role { background: var(--primary-light); color: var(--primary-dark); font-weight: 600; }
.chip-role-admin { background: #fdf0f0; color: var(--danger); }
.chip-role-manager { background: #eef6ff; color: #3b82f6; }
.chip-role-partner { background: #f0faf3; color: var(--success); }

/* 表单 */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: 600; font-size: 13px; }
.form-control {
    width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px;
    font-size: 14px; background: #fff; color: var(--text); outline: none; transition: border-color .15s;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(255,140,66,.12); }
textarea.form-control { resize: vertical; }
.form-tip { font-size: 12px; color: var(--muted); margin-top: 4px; }
.form-actions { margin-top: 16px; display: flex; gap: 10px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* 提示条 */
.alert { padding: 11px 16px; border-radius: 8px; margin-bottom: 14px; font-size: 14px; position: relative; }
.alert-success { background: #f0faf3; border: 1px solid #cdeeda; color: #1f7a3d; }
.alert-danger { background: #fdf0f0; border: 1px solid #f5c6c6; color: #b02a2a; }
.alert-warning { background: #fff7e6; border: 1px solid #f3dcae; color: #92600a; }
.alert-info { background: #eef6ff; border: 1px solid #c4dcf7; color: #1d5f9e; }
.alert-close { float: right; cursor: pointer; font-size: 16px; opacity: .6; }
.alert-close:hover { opacity: 1; }

/* 表格 */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th { background: #fafbfd; color: var(--muted); font-size: 13px; font-weight: 600; }
.table tbody tr:hover { background: #fafbfd; }
.table .empty { text-align: center; color: var(--muted); padding: 40px 0; }

.thumb-sm { width: 52px; height: 52px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }

/* 统计卡片 */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat-card { display: flex; align-items: center; gap: 14px; background: #fff; border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.stat-ico { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 22px; }
.stat-num { font-size: 24px; font-weight: 700; line-height: 1.2; }
.stat-label { color: var(--muted); font-size: 13px; }

/* 趋势图 */
.trend-bars { display: flex; align-items: flex-end; gap: 12px; height: 160px; padding-top: 10px; }
.trend-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.trend-bar { width: 70%; max-width: 46px; min-height: 4px; background: linear-gradient(180deg, var(--primary), var(--primary-dark)); border-radius: 6px 6px 0 0; }
.trend-val { font-size: 13px; font-weight: 600; }
.trend-day { font-size: 12px; color: var(--muted); }

/* 快捷入口 */
.quick-links { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.quick-link { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 10px; text-decoration: none; color: var(--text); transition: all .15s; }
.quick-link:hover { border-color: var(--primary); background: var(--primary-light); }
.ql-ico { font-size: 22px; }
.ql-name { font-weight: 700; font-size: 14px; display: block; }
.ql-desc { color: var(--muted); font-size: 12px; display: block; }

/* 筛选栏 */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.filter-bar .form-control { width: auto; min-width: 120px; }

/* 分页 */
.pagination { display: flex; align-items: center; gap: 6px; margin-top: 16px; flex-wrap: wrap; }
.pg { display: inline-block; padding: 5px 11px; border: 1px solid var(--border); border-radius: 6px; color: var(--text); text-decoration: none; font-size: 13px; background: #fff; }
.pg.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pg.disabled { color: #cbd5e0; pointer-events: none; }
.pg-info { margin-left: 8px; color: var(--muted); font-size: 13px; }

/* 上传 */
.dropzone {
    position: relative; border: 2px dashed #cbd5e0; border-radius: 12px;
    padding: 48px 20px; text-align: center; cursor: pointer; transition: all .15s;
    background: #fafbfd;
}
.dropzone:hover, .dropzone.drag { border-color: var(--primary); background: var(--primary-light); }
.dropzone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dz-ico { font-size: 40px; }
.dz-text { font-size: 16px; font-weight: 600; margin-top: 8px; }
.dz-sub { color: var(--muted); font-size: 13px; margin-top: 4px; }

.photo-preview { position: relative; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: #fafbfd; }
.photo-preview img { width: 100%; display: block; }
.photo-tag { position: absolute; top: 10px; left: 10px; background: rgba(0,0,0,.55); color: #fff; padding: 3px 10px; border-radius: 20px; font-size: 12px; }
.upload-preview-grid { align-items: start; }

.ocr-text { background: #1f2733; color: #7ee787; padding: 12px; border-radius: 8px; font-size: 12px; white-space: pre-wrap; word-break: break-all; max-height: 180px; overflow-y: auto; font-family: Consolas, Monaco, monospace; }

/* AI 识别结果卡片 */
.card-ai { border-color: #c7e5ff; background: #f6fbff; }
.card-ai .card-head h4 { color: #0369a1; }
.ai-result-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px 16px; }
.ai-result-grid > div { display: flex; flex-direction: column; gap: 2px; }
.ai-result-grid .muted { font-size: 12px; }

/* 详情页 */
.detail-banner { border-radius: 12px; padding: 18px 20px; margin-bottom: 18px; color: #fff; display: flex; align-items: center; gap: 14px; }
.banner-ok { background: linear-gradient(135deg, #34d399, #16a34a); }
.banner-warning { background: linear-gradient(135deg, #fbbf24, #f59e0b); }
.banner-expired { background: linear-gradient(135deg, #f87171, #dc2626); }
.banner-badge .badge { background: rgba(255,255,255,.25); color: #fff; font-size: 14px; padding: 5px 16px; }
.banner-title { font-size: 20px; font-weight: 700; }
.banner-sub { opacity: .9; font-size: 13px; }

.photo-frame { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: #fafbfd; }
.photo-frame img { width: 100%; display: block; }
.photo-cap { text-align: center; padding: 8px; color: var(--muted); font-size: 12px; }

.detail-table { width: 100%; border-collapse: collapse; }
.detail-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); font-size: 14px; }
.detail-table .dt-label { width: 130px; color: var(--muted); font-weight: 600; }

.timeline { list-style: none; }
.timeline li { display: flex; gap: 12px; align-items: baseline; padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.tl-time { color: var(--muted); min-width: 150px; font-family: Consolas, monospace; font-size: 12px; }
.tl-action { font-weight: 600; min-width: 90px; }
.tl-note { flex: 1; }
.tl-user { color: var(--muted); }

/* 弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 460px; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 16px; }
.modal-close { border: none; background: none; font-size: 22px; cursor: pointer; color: var(--muted); line-height: 1; }
.modal-close:hover { color: var(--danger); }
.modal-body { padding: 18px 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); }

/* 登录页 */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #ff9a3c 0%, #ff5e62 100%); }
.login-wrap { width: 100%; max-width: 400px; padding: 16px; }
.login-card { background: #fff; border-radius: 16px; padding: 36px 34px; box-shadow: 0 24px 60px rgba(0,0,0,.2); }
.login-logo { font-size: 52px; text-align: center; }
.login-card h1 { text-align: center; font-size: 20px; margin-top: 8px; }
.login-sub { text-align: center; color: var(--muted); margin-bottom: 22px; font-size: 13px; }
.login-hint { text-align: center; margin-top: 18px; color: var(--muted); font-size: 12px; }
.login-hint a { color: var(--primary-dark); }

/* 响应式 */
@media (max-width: 1024px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .grid-2 { grid-template-columns: 1fr; }
    .quick-links { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .sidebar { width: 64px; }
    .brand-name, .nav a span:not(.nav-ico), .sidebar-foot { display: none; }
    .nav a { justify-content: center; }
    .main { margin-left: 64px; }
    .topbar-title { font-size: 15px; }
    .filter-bar .form-control { width: 100%; }
}
