:root {
    --bg: #f5f7fb;
    --panel: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --line: #e2e8f0;
    --blue: #2563eb;
    --blue-dark: #1d4ed8;
    --nav: #0d1726;
    --green: #16a34a;
    --amber: #d97706;
    --red: #b91c1c;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
.app-shell { min-height: 100vh; display: flex; }
.sidebar { width: 244px; background: var(--nav); color: #cbd5e1; display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; z-index: 20; }
.brand { color: white; font-size: 28px; font-weight: 800; padding: 28px 24px 22px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand span, .login-brand span { color: #fff; }
.brand { color: #60a5fa; }
.nav { display: grid; gap: 6px; padding: 18px 12px; }
.nav a { padding: 12px 14px; border-radius: 10px; }
.nav a:hover, .nav a.active { background: #1d4ed8; color: white; }
.sidebar-user { margin-top: auto; padding: 18px 20px 24px; border-top: 1px solid rgba(255,255,255,.08); display: grid; gap: 4px; font-size: 13px; }
.sidebar-user strong { color: white; }
.sidebar-user span { color: #94a3b8; }
.sidebar-user a { margin-top: 8px; color: #93c5fd; }
.main { margin-left: 244px; width: calc(100% - 244px); min-width: 0; }
.topbar { height: 82px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 28px; position: sticky; top: 0; z-index: 10; }
.topbar h1 { font-size: 24px; margin: 0; }
.topbar-user { font-size: 14px; color: var(--muted); }
.menu-btn { display: none; border: 0; background: none; font-size: 24px; }
.content { padding: 28px; }
.week-banner { background: #eaf2ff; border: 1px solid #cfe0ff; padding: 12px 16px; border-radius: 12px; margin-bottom: 20px; color: #1e3a8a; }
.cards { display: grid; gap: 16px; margin-bottom: 20px; }
.cards.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 20px; box-shadow: 0 8px 30px rgba(15,23,42,.03); }
.stat { min-height: 128px; display: flex; flex-direction: column; justify-content: center; }
.stat span, .stat small { color: var(--muted); }
.stat strong { font-size: 34px; margin: 6px 0; }
.stat.good strong { color: var(--green); }
.stat.warn strong { color: var(--amber); }
.grid-two { display: grid; grid-template-columns: 1.4fr .8fr; gap: 20px; }
.card-head, .toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.card-head h2, .quick-card h2, .form-card h2, .hero-card h2 { margin: 0; font-size: 18px; }
.card-head a { color: var(--blue); font-size: 14px; }
.activity-list { display: grid; }
.activity-item { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.activity-item:last-child { border-bottom: 0; }
.activity-item div { display: grid; gap: 4px; }
.activity-item span, .activity-item time { color: var(--muted); font-size: 13px; }
.quick-card { display: grid; gap: 10px; align-content: start; }
.quick-action { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.quick-action:hover { border-color: #93c5fd; background: #eff6ff; }
.btn { border: 1px solid var(--line); background: white; color: var(--text); border-radius: 9px; padding: 9px 13px; cursor: pointer; font-weight: 600; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: white; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-block { width: 100%; padding: 13px; }
.btn-small { padding: 7px 10px; font-size: 12px; }
.search { display: flex; gap: 8px; }
input, select, textarea { width: 100%; border: 1px solid #cbd5e1; border-radius: 9px; padding: 10px 12px; background: white; color: var(--text); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.form-card { margin-bottom: 18px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 18px; }
.span-2 { grid-column: 1 / -1; }
.hidden { display: none !important; }
.table-card { padding: 0; overflow: hidden; }
.table-card .card-head { padding: 18px 20px 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 13px 16px; border-bottom: 1px solid var(--line); text-align: left; font-size: 13px; }
th { background: #f8fafc; color: #475569; font-size: 12px; text-transform: uppercase; letter-spacing: .02em; }
tr:last-child td { border-bottom: 0; }
.badge { display: inline-flex; border-radius: 999px; padding: 4px 8px; font-size: 11px; font-weight: 700; }
.badge-green { background: #dcfce7; color: #166534; }
.badge-gray { background: #e2e8f0; color: #475569; }
.inline-form { display: inline; }
.muted { color: var(--muted); }
.empty { padding: 28px; text-align: center; color: var(--muted); }
.alert { padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; }
.alert-error { background: #fef2f2; border: 1px solid #fecaca; color: var(--red); }
.alert-success { background: #ecfdf5; border: 1px solid #bbf7d0; color: #166534; }
.notice { margin-top: 16px; background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; padding: 12px 14px; border-radius: 10px; }
.hero-card { margin-bottom: 20px; }
.hero-card p { color: var(--muted); line-height: 1.6; }
.preview-sheet { background: white; border: 1px solid var(--line); border-radius: 16px; padding: 28px; }
.preview-head { display: flex; justify-content: space-between; gap: 20px; align-items: start; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.preview-head h2 { margin: 8px 0 4px; }
.preview-head p { margin: 0; color: var(--muted); }
.preview-brand { font-weight: 800; color: var(--blue); }
.preview-badge { background: var(--nav); color: white; border-radius: 10px; padding: 10px 14px; font-weight: 700; }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at top, #eff6ff 0, #f8fafc 45%, #eef2f7 100%); }
.login-card { width: 100%; max-width: 430px; background: white; border: 1px solid var(--line); border-radius: 20px; padding: 34px; box-shadow: 0 30px 80px rgba(15,23,42,.12); }
.login-brand { font-size: 34px; font-weight: 800; color: var(--blue); margin-bottom: 6px; }
.login-brand span { color: var(--text); }
.login-card form { display: grid; gap: 8px; margin-top: 26px; }
.login-card input { margin-bottom: 10px; }
.login-foot { margin-top: 18px; color: var(--muted); font-size: 12px; text-align: center; }
@media (max-width: 1100px) {
    .cards.four { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .grid-two { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
    body.sidebar-open .sidebar { transform: translateX(0); }
    .main { margin-left: 0; width: 100%; }
    .menu-btn { display: block; }
    .topbar { padding: 0 18px; }
    .content { padding: 18px; }
}
@media (max-width: 640px) {
    .cards.four, .form-grid { grid-template-columns: 1fr; }
    .span-2 { grid-column: auto; }
    .toolbar { align-items: stretch; flex-direction: column; }
    .search { width: 100%; }
    .login-card { padding: 26px 22px; }
}

/* PriceHub text importer v1.1 */
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-amber { background: #fef3c7; color: #92400e; }
.alert-warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.text-danger { color: var(--red); font-weight: 700; }
.import-card { margin-bottom: 20px; }
.import-head { align-items: flex-start; }
.import-head p { margin: 6px 0 0; }
.import-form { margin-top: 10px; }
.import-textarea { min-height: 360px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.55; }
.import-actions { display: flex; align-items: center; gap: 14px; margin-top: 18px; flex-wrap: wrap; }
.review-header { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; margin-bottom: 18px; }
.review-header h2 { margin: 5px 0; }
.eyebrow { color: var(--blue); font-weight: 800; text-transform: uppercase; font-size: 11px; letter-spacing: .07em; }
.review-meta { display: grid; gap: 6px; font-size: 13px; color: var(--muted); text-align: right; }
.review-table { min-width: 1200px; }
.review-table td { vertical-align: top; }
.review-table-card { margin-bottom: 18px; }
.row-review { background: #fffbeb; }
.raw-cell { max-width: 360px; color: #475569; }
.row-warning { color: #b45309; font-weight: 700; font-size: 11px; margin-top: 5px; }
.review-actions-bar { display: flex; justify-content: space-between; gap: 18px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 20px; position: sticky; bottom: 12px; box-shadow: 0 14px 35px rgba(15,23,42,.10); z-index: 5; }
.confirm-import-form { display: flex; align-items: center; gap: 14px; }
.replace-check { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 600; }
.replace-check input { width: auto; }
.uploads-history { margin-top: 20px; }
@media (max-width: 760px) {
    .review-header { flex-direction: column; }
    .review-meta { text-align: left; }
    .review-actions-bar, .confirm-import-form { align-items: stretch; flex-direction: column; }
    .review-actions-bar form, .review-actions-bar .btn { width: 100%; }
    .import-textarea { min-height: 300px; }
}
