/* MIMI ERP demo — 倉儲工具風格
   配色：冷灰藍底 + 墨綠主色（倉儲/物流語彙，避開 AI 預設奶油+陶土）
   字體：系統無襯線 + 等寬用於編號/數字（貨號、單號要好對齊） */

:root {
    --bg: #eef1f4;
    --panel: #ffffff;
    --ink: #1a2230;
    --ink-soft: #5b6675;
    --line: #dde2e8;
    --brand: #0f5c4a;         /* 墨綠 */
    --brand-soft: #e4efe9;
    --accent: #c2410c;        /* 警示橙，只用在低庫存 */
    --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
    --sans: -apple-system, "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--sans);
    background: var(--bg);
    color: var(--ink);
    font-size: 14px;
    line-height: 1.5;
}

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 232px;
    background: var(--ink);
    color: #cfd6df;
    display: flex;
    flex-direction: column;
    padding: 20px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 20px; }
.brand-mark {
    width: 34px; height: 34px; border-radius: 8px;
    background: var(--brand); color: #fff;
    display: grid; place-items: center;
    font-weight: 800; font-size: 18px;
}
.brand-mark.lg { width: 48px; height: 48px; font-size: 24px; border-radius: 11px; }
.brand-text strong { display: block; color: #fff; font-size: 15px; letter-spacing: .3px; }
.brand-text small { color: #8b96a5; font-size: 11px; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 8px;
    color: #cfd6df; text-decoration: none; font-size: 14px;
    transition: background .12s, color .12s;
}
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: var(--brand); color: #fff; font-weight: 600; }
.nav-ico { font-size: 15px; opacity: .9; }

.user-box { border-top: 1px solid rgba(255,255,255,.1); padding-top: 14px; }
.user-line { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.user-name { color: #fff; font-size: 13px; }
.role-tag { font-size: 10px; padding: 2px 7px; border-radius: 20px; }
.role-admin { background: var(--brand); color: #fff; }
.role-client_viewer { background: #3a4557; color: #b9c2cf; }
.logout { color: #8b96a5; font-size: 12px; text-decoration: none; }
.logout:hover { color: #fff; }

.content { flex: 1; padding: 28px 34px; max-width: 1100px; }

/* ---------- Page head ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 20px; }
.page-head h1 { margin: 0; font-size: 22px; letter-spacing: .3px; }
.sub { margin: 4px 0 0; color: var(--ink-soft); font-size: 13px; }

/* ---------- Filters ---------- */
.filters { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.filter-group { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.filter-label { font-size: 12px; color: var(--ink-soft); width: 42px; }
.chip {
    padding: 5px 12px; border-radius: 20px;
    background: var(--panel); border: 1px solid var(--line);
    color: var(--ink-soft); text-decoration: none; font-size: 12.5px;
    transition: all .12s;
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---------- Table ---------- */
.table-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
}
table { width: 100%; border-collapse: collapse; }
thead th {
    text-align: left; padding: 12px 16px;
    font-size: 11.5px; font-weight: 600; letter-spacing: .5px;
    color: var(--ink-soft); text-transform: uppercase;
    background: #f6f8fa; border-bottom: 1px solid var(--line);
}
tbody td { padding: 13px 16px; border-bottom: 1px solid var(--line); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f9fafb; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 13px; }
.muted { color: var(--ink-soft); }
.empty { text-align: center; color: var(--ink-soft); padding: 40px 16px; }

.wh-tag {
    font-family: var(--mono); font-size: 11px;
    background: var(--brand-soft); color: var(--brand);
    padding: 2px 7px; border-radius: 5px; font-weight: 600;
}

/* status badges */
.status { font-size: 12px; padding: 3px 10px; border-radius: 20px; font-weight: 600; white-space: nowrap; }
.st-pending { background: #fef3e2; color: #b45309; }
.st-processing { background: #e0edff; color: #1d4ed8; }
.st-inspected { background: #ede9fe; color: #6d28d9; }
.st-shipped { background: var(--brand-soft); color: var(--brand); }
.st-cancelled { background: #f1f3f5; color: #868e96; }

/* low stock */
.row-low { background: #fff7f3; }
.row-low:hover { background: #fff1ea; }
.low-flag {
    font-size: 10px; background: var(--accent); color: #fff;
    padding: 1px 6px; border-radius: 4px; margin-left: 6px; font-weight: 700;
}

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card {
    width: 100%; max-width: 360px;
    background: var(--panel); border: 1px solid var(--line);
    border-radius: 16px; padding: 34px 30px;
    box-shadow: 0 10px 40px rgba(26,34,48,.08);
}
.login-head { text-align: center; margin-bottom: 24px; }
.login-head .brand-mark { margin: 0 auto 14px; }
.login-head h1 { margin: 0; font-size: 20px; }
.login-head p { margin: 4px 0 0; color: var(--ink-soft); font-size: 12.5px; }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-form label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--ink-soft); }
.login-form input {
    padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
    font-size: 14px; font-family: var(--sans); color: var(--ink);
    transition: border-color .12s;
}
.login-form input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.login-form button {
    margin-top: 4px; padding: 11px; border: none; border-radius: 8px;
    background: var(--brand); color: #fff; font-size: 14px; font-weight: 600;
    cursor: pointer; transition: background .12s;
}
.login-form button:hover { background: #0c4a3c; }
.alert { background: #fdecea; color: #b42318; padding: 10px 12px; border-radius: 8px; font-size: 12.5px; margin-bottom: 16px; }
.login-hint { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.login-hint span { font-size: 11px; color: var(--ink-soft); }
.login-hint code { font-family: var(--mono); font-size: 12px; color: var(--brand); background: var(--brand-soft); padding: 3px 8px; border-radius: 5px; }

/* label badges（面單狀態）*/
.lb-ok { background: var(--brand-soft); color: var(--brand); }
.lb-wait { background: #fef3e2; color: #b45309; }

/* ---------- 平台串接卡片 ---------- */
.plat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}
.plat-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.plat-card.plat-applying { border-style: dashed; border-color: #d9a648; }
.plat-head { display: flex; align-items: center; justify-content: space-between; }
.plat-head strong { font-size: 15px; letter-spacing: .2px; }
.pf-badge { font-size: 11px; padding: 3px 10px; border-radius: 20px; font-weight: 600; white-space: nowrap; }
.pf-live { background: var(--brand-soft); color: var(--brand); }
.pf-applying { background: #fef3e2; color: #b45309; }
.plat-meta { color: var(--ink-soft); font-size: 12.5px; display: flex; flex-wrap: wrap; gap: 5px; }
.plat-meta .dot { color: var(--line); }
.plat-caps { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.cap-tag {
    font-size: 11.5px;
    background: #f1f4f7; color: var(--ink-soft);
    padding: 3px 9px; border-radius: 5px;
}
.plat-stats {
    border-top: 1px solid var(--line);
    padding-top: 10px;
    font-size: 12px;
    color: var(--ink-soft);
    font-variant-numeric: tabular-nums;
}
.plat-stats strong { color: var(--brand); font-size: 14px; }

/* ---------- Footer ---------- */
.foot {
    margin-top: 34px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    color: var(--ink-soft);
    font-size: 11.5px;
    letter-spacing: .3px;
}
.login-foot {
    margin-top: 20px; padding-top: 16px;
    border-top: 1px solid var(--line);
    text-align: center;
    color: var(--ink-soft); font-size: 11px;
}

/* ---------- RWD（手機：側欄收頂、表格橫向捲動）---------- */
@media (max-width: 760px) {
    .layout { flex-direction: column; }
    .sidebar {
        width: 100%; height: auto; position: static;
        flex-direction: row; align-items: center; padding: 12px 16px; gap: 14px;
    }
    .brand { padding: 0; }
    .brand-text { display: none; }
    .nav { flex-direction: row; flex: 1; gap: 4px; }
    .nav a { padding: 8px 12px; }
    .user-box { border-top: none; padding-top: 0; }
    .user-line { margin-bottom: 0; }
    .user-name { display: none; }
    .content { padding: 18px 16px; }
    .table-card { overflow-x: auto; }
    table { min-width: 640px; }
}
