:root { --brand:#e02e24; --brand-dark:#bd2119; --ink:#20252d; --muted:#7d8490; --line:#e8ebef; --bg:#f5f7fa; --green:#20a66a; --amber:#e79a21; --blue:#4285db; }
* { box-sizing:border-box; }
body { margin:0; color:var(--ink); background:var(--bg); font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif; }
button,input,select,textarea { font:inherit; }
button { cursor:pointer; }
.primary { padding:10px 18px; color:white; border:0; border-radius:9px; background:linear-gradient(135deg,#ef493b,var(--brand)); box-shadow:0 6px 15px rgba(224,46,36,.18); font-weight:700; }
.primary:disabled { opacity:.6; cursor:not-allowed; }
.wide { width:100%; }
.admin-brand { display:flex; align-items:center; gap:11px; }
.admin-brand > span { display:grid; width:40px; height:40px; place-items:center; color:white; border-radius:13px; background:var(--brand); font-size:22px; font-weight:900; }
.admin-brand strong,.admin-brand small { display:block; }
.admin-brand strong { font-size:17px; }
.admin-brand small { margin-top:2px; color:#949ba7; font-size:10px; }

.admin-login-page { min-height:100vh; display:grid; place-items:center; padding:24px; background:radial-gradient(circle at 20% 10%,#ffeae7,transparent 35%),radial-gradient(circle at 90% 85%,#ffe7d5,transparent 32%),#f7f8fb; }
.admin-login-card { width:min(460px,100%); padding:38px; border:1px solid rgba(255,255,255,.7); border-radius:24px; background:rgba(255,255,255,.92); box-shadow:0 24px 70px rgba(50,55,65,.14); backdrop-filter:blur(15px); }
.admin-brand.large > span { width:50px; height:50px; border-radius:16px; font-size:28px; }
.admin-brand.large strong { font-size:20px; }
.login-intro { margin:36px 0 26px; }
.login-intro > span { padding:4px 9px; color:var(--brand); border-radius:12px; background:#fff0ee; font-size:11px; font-weight:700; }
.login-intro h1 { margin:10px 0 6px; font-size:30px; }
.login-intro p { margin:0; color:var(--muted); font-size:13px; line-height:1.7; }
.admin-login-card label { display:block; margin-bottom:8px; font-size:12px; font-weight:700; }
.token-input { display:flex; height:48px; overflow:hidden; border:1px solid var(--line); border-radius:10px; background:white; }
.token-input:focus-within { border-color:#ef8f87; box-shadow:0 0 0 3px #fff0ef; }
.token-input input { flex:1; min-width:0; padding:0 13px; border:0; outline:0; }
.token-input button { padding:0 13px; color:var(--brand); border:0; background:transparent; }
.form-error { min-height:20px; margin:8px 0; color:var(--brand); font-size:11px; }
.back-store { display:block; margin-top:20px; color:#888; text-align:center; text-decoration:none; font-size:12px; }

.sidebar { position:fixed; inset:0 auto 0 0; z-index:20; display:flex; width:236px; padding:24px 18px; flex-direction:column; border-right:1px solid var(--line); background:white; }
.sidebar nav { display:grid; gap:7px; margin-top:34px; }
.sidebar nav a { display:flex; gap:11px; padding:12px 13px; color:#707783; align-items:center; border-radius:10px; text-decoration:none; font-size:13px; }
.sidebar nav a.active { color:var(--brand); background:#fff0ee; font-weight:800; }
.sidebar nav i { width:22px; font-size:18px; font-style:normal; text-align:center; }
.sidebar-tip { margin-top:auto; padding:14px; border-radius:12px; background:#fff6ef; }
.sidebar-tip strong { font-size:12px; }
.sidebar-tip p { margin:6px 0 0; color:#9a785e; font-size:10px; line-height:1.6; }
.logout { margin-top:13px; padding:10px; color:#888; border:1px solid var(--line); border-radius:9px; background:white; }
.admin-main { min-height:100vh; margin-left:236px; padding:28px 32px 60px; }
.admin-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:24px; }
.admin-header small { color:#9ba1aa; }
.admin-header h1 { margin:6px 0 0; font-size:27px; }
.dashboard-cards { display:grid; grid-template-columns:repeat(4,1fr); gap:15px; margin-bottom:20px; }
.dashboard-cards > div { display:grid; grid-template-columns:46px 1fr auto; gap:11px; padding:18px; align-items:center; border:1px solid #edf0f3; border-radius:14px; background:white; box-shadow:0 7px 22px rgba(50,60,70,.035); }
.metric-icon { display:grid; width:44px; height:44px; place-items:center; color:white; border-radius:13px; font-weight:900; }
.metric-icon.red{background:#ed554a}.metric-icon.green{background:var(--green)}.metric-icon.amber{background:var(--amber)}.metric-icon.blue{background:var(--blue)}
.dashboard-cards p { margin:0; font-size:12px; font-weight:700; }
.dashboard-cards p small { display:block; margin-top:4px; color:#a3a8b0; font-size:9px; font-weight:400; }
.dashboard-cards > div > strong { font-size:27px; }
.panel { border:1px solid #edf0f3; border-radius:15px; background:white; box-shadow:0 8px 26px rgba(40,50,60,.04); overflow:hidden; }
.panel-toolbar { display:flex; padding:17px 18px; align-items:center; justify-content:space-between; border-bottom:1px solid var(--line); }
.filter-row { display:flex; gap:9px; }
.filter-row input,.filter-row select { height:38px; padding:0 11px; border:1px solid var(--line); border-radius:8px; outline:0; background:white; }
.filter-row input { width:240px; }
.filter-row button,.ghost { padding:0 15px; border:1px solid var(--line); border-radius:8px; background:#f9fafb; }
.ghost { height:38px; color:#6f7680; }
.table-wrap { overflow:auto; }
table { width:100%; border-collapse:collapse; white-space:nowrap; }
th,td { padding:14px 16px; text-align:left; border-bottom:1px solid #f0f1f3; font-size:12px; }
th { color:#8f96a0; background:#fafbfc; font-size:10px; letter-spacing:.3px; }
.table-product { display:flex; min-width:240px; gap:11px; align-items:center; }
.table-product img { width:48px; height:48px; object-fit:cover; border-radius:9px; background:#f3f3f3; }
.table-product strong,.table-product small { display:block; max-width:220px; overflow:hidden; text-overflow:ellipsis; }
.table-product strong { font-size:12px; }
.table-product small { margin-top:5px; color:#999; font-size:9px; }
.price-stack del,.price-stack strong,.rule-cell strong,.rule-cell small { display:block; }
.price-stack del { color:#aaa; font-size:9px; }
.price-stack strong { margin-top:3px; color:var(--brand); font-size:15px; }
.rule-cell small { margin-top:4px; color:#999; font-size:9px; }
.status-badge { display:inline-block; padding:4px 8px; border-radius:12px; font-size:9px; }
.status-badge.online { color:#168a57; background:#e7f8f0; }
.status-badge.draft { color:#b87918; background:#fff4dd; }
.status-badge.offline,.status-badge.abandoned { color:#777; background:#eff1f3; }
.row-actions { display:flex; gap:5px; }
.row-actions button { padding:5px 8px; color:#5d6570; border:1px solid var(--line); border-radius:6px; background:white; font-size:9px; }
.row-actions button.publish { color:#168a57; border-color:#bde7d3; }
.row-actions button.danger { color:var(--brand); border-color:#ffd1cd; }
.loading-cell { height:180px; color:#999; text-align:center; }
.loading-cell.error { color:var(--brand); }
.pagination { display:flex; padding:14px 18px; align-items:center; justify-content:space-between; color:#888; font-size:10px; }
.pagination button { margin-left:5px; padding:6px 10px; border:1px solid var(--line); border-radius:6px; background:white; }
.pagination button:disabled { opacity:.4; }

.drawer-backdrop { position:fixed; inset:0; z-index:40; background:rgba(20,25,30,.42); opacity:0; pointer-events:none; transition:.25s; }
.drawer-backdrop.open { opacity:1; pointer-events:auto; }
.config-drawer { position:fixed; top:0; right:0; bottom:0; z-index:50; width:min(720px,100%); overflow-y:auto; background:#f7f8fa; box-shadow:-18px 0 45px rgba(20,25,30,.2); transform:translateX(102%); transition:.3s ease; }
.config-drawer.open { transform:translateX(0); }
.config-drawer > header { position:sticky; top:0; z-index:2; display:flex; padding:18px 22px; align-items:center; justify-content:space-between; border-bottom:1px solid var(--line); background:rgba(255,255,255,.95); backdrop-filter:blur(10px); }
.config-drawer header small { color:var(--brand); }
.config-drawer header h2 { margin:4px 0 0; font-size:20px; }
.config-drawer header button { width:38px; height:38px; color:#888; border:0; border-radius:50%; background:#f3f4f5; font-size:24px; }
.config-drawer form { padding:18px; }
.form-section { margin-bottom:16px; padding:20px; border:1px solid #eceef1; border-radius:14px; background:white; }
.section-title { display:flex; gap:11px; margin-bottom:18px; align-items:center; }
.section-title > span { display:grid; width:31px; height:31px; place-items:center; color:white; border-radius:10px; background:var(--brand); font-weight:800; }
.section-title h3 { margin:0; font-size:15px; }
.section-title p { margin:3px 0 0; color:#999; font-size:9px; }
.form-section > label,.form-grid label { display:block; margin-bottom:13px; color:#555c65; font-size:11px; font-weight:700; }
.form-section input,.form-section select,.form-section textarea { width:100%; margin-top:6px; padding:10px 11px; color:#333; border:1px solid #dfe3e8; border-radius:8px; outline:0; background:white; resize:vertical; font-weight:400; }
.form-section input:focus,.form-section select:focus,.form-section textarea:focus { border-color:#ed8c84; box-shadow:0 0 0 3px #fff2f1; }
.form-section input[readonly] { color:#888; background:#f4f5f6; }
.form-section label small { display:block; margin-top:5px; color:#aaa; font-size:9px; font-weight:400; }
.form-grid { display:grid; gap:12px; }
.form-grid.two { grid-template-columns:repeat(2,1fr); }
.form-grid.three { grid-template-columns:repeat(3,1fr); }
.image-input-row { display:flex; gap:8px; }
.image-input-row > input { flex:1; }
.upload-button { flex:0 0 90px; display:grid!important; margin-top:6px!important; margin-bottom:0!important; place-items:center; color:var(--brand)!important; border:1px solid #ffd1cd; border-radius:8px; background:#fff5f4; cursor:pointer; }
.upload-button input { display:none; }
.image-preview-row { display:flex; gap:12px; margin:-4px 0 13px; align-items:center; }
.image-preview-row img { display:none; width:84px; height:84px; object-fit:cover; border-radius:10px; border:1px solid var(--line); }
.image-preview-row img.visible { display:block; }
.image-preview-row p { margin:0; color:#999; font-size:9px; line-height:1.6; }
.trial-card { display:grid; grid-template-columns:1fr auto 1fr auto 1.3fr; gap:9px; margin:6px 0 12px; padding:14px; align-items:center; border:1px dashed #e3e5e8; border-radius:10px; background:#fafbfc; text-align:center; }
.trial-card div small,.trial-card div strong { display:block; }
.trial-card small { color:#999; font-size:8px; }
.trial-card strong { margin-top:3px; font-size:17px; }
.trial-card > span { color:#aaa; }
.trial-card .result strong { color:var(--brand); }
.trial-card p { grid-column:1/-1; margin:4px 0 0; color:#999; font-size:9px; }
.trial-card.valid { border-color:#f1ada6; background:#fff7f6; }
.secondary { padding:8px 14px; color:var(--brand); border:1px solid #f1aaa3; border-radius:8px; background:white; }
.drawer-actions { position:sticky; bottom:-18px; display:flex; gap:9px; margin:0 -18px -18px; padding:14px 18px; justify-content:flex-end; border-top:1px solid var(--line); background:rgba(255,255,255,.97); }
.drawer-actions > button { padding:10px 22px; border:1px solid var(--line); border-radius:9px; background:white; }
.drawer-actions > button.primary { border:0; background:var(--brand); }
.confirm-modal { position:fixed; inset:0; z-index:80; display:none; place-items:center; padding:20px; background:rgba(20,25,30,.45); }
.confirm-modal.open { display:grid; }
.confirm-modal > div { width:min(380px,100%); padding:26px; text-align:center; border-radius:16px; background:white; box-shadow:0 18px 60px rgba(0,0,0,.2); }
.confirm-icon { display:grid; width:48px; height:48px; margin:auto; place-items:center; color:var(--brand); border-radius:50%; background:#fff0ee; font-size:22px; font-weight:900; }
.confirm-modal h3 { margin:13px 0 6px; }
.confirm-modal p { margin:0 0 20px; color:#888; font-size:11px; line-height:1.7; }
.confirm-modal > div > div { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.confirm-modal button { padding:9px; border:1px solid var(--line); border-radius:8px; background:white; }
.confirm-modal button.primary { color:white; border:0; background:var(--brand); }
.admin-toast { position:fixed; left:50%; bottom:30px; z-index:100; padding:10px 18px; color:white; border-radius:20px; background:#30343a; opacity:0; pointer-events:none; transform:translate(-50%,15px); transition:.25s; font-size:11px; }
.admin-toast.show { opacity:1; transform:translate(-50%,0); }
.admin-toast.success { background:#19885a; }.admin-toast.error { background:var(--brand); }

@media (max-width:1000px) {
    .dashboard-cards { grid-template-columns:repeat(2,1fr); }
    .sidebar { width:190px; }
    .admin-main { margin-left:190px; padding:22px 18px; }
}
@media (max-width:720px) {
    .sidebar { position:static; width:100%; height:auto; padding:14px 16px; flex-direction:row; align-items:center; }
    .sidebar nav { display:flex; margin:0 0 0 auto; }
    .sidebar nav a { padding:8px; }
    .sidebar-tip,.logout,.sidebar nav a:nth-child(2) { display:none; }
    .admin-main { margin:0; padding:18px 10px 50px; }
    .admin-header h1 { font-size:21px; }
    .dashboard-cards { gap:7px; }
    .dashboard-cards > div { grid-template-columns:38px 1fr; padding:12px; }
    .dashboard-cards > div > strong { grid-column:2; font-size:21px; }
    .metric-icon { width:36px; height:36px; }
    .panel-toolbar { display:block; }
    .filter-row { display:grid; grid-template-columns:1fr 110px 60px; }
    .filter-row input { width:auto; min-width:0; }
    .ghost { display:none; }
    .form-grid.three { grid-template-columns:1fr; gap:0; }
}
@media (max-width:520px) {
    .admin-login-card { padding:28px 22px; }
    .dashboard-cards { grid-template-columns:1fr 1fr; }
    .form-grid.two { grid-template-columns:1fr; gap:0; }
    .trial-card { grid-template-columns:1fr auto 1fr; }
    .trial-card .result { grid-column:1/-1; }
}
