:root {
    --bg: #f4f7fb;
    --panel: #ffffff;
    --ink: #172033;
    --muted: #657189;
    --primary: #176b87;
    --primary-dark: #0d536c;
    --accent: #ef9f27;
    --success: #18864b;
    --danger: #c33d3d;
    --border: #dce4ef;
    --shadow: 0 16px 38px rgba(28, 45, 75, .09);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Noto Sans TC", "Microsoft JhengHei", sans-serif; background: var(--bg); color: var(--ink); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { white-space: nowrap; }
.topbar { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 24px; background: #102a3c; color: #fff; }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 800; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; background: linear-gradient(135deg, var(--accent), #ffd16a); color: #102a3c; }
.nav-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.nav-actions a { padding: 9px 13px; border-radius: 10px; background: rgba(255,255,255,.1); }
.container { width: min(1440px, calc(100% - 32px)); margin: 24px auto 48px; }
.hero { display: grid; grid-template-columns: 1.4fr .6fr; gap: 18px; align-items: stretch; margin-bottom: 18px; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow); padding: 22px; }
.hero-main { background: linear-gradient(135deg, #143e55, #176b87); color: #fff; }
.hero-main h1 { margin: 0 0 8px; font-size: clamp(28px, 4vw, 48px); }
.hero-main p { margin: 0; color: rgba(255,255,255,.82); line-height: 1.8; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat-card { background: var(--panel); border: 1px solid var(--border); border-radius: 18px; padding: 18px; }
.stat-card small { color: var(--muted); }
.stat-card strong { display: block; margin-top: 8px; font-size: 30px; }
.board-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 18px; }
.order-card { background: var(--panel); border: 1px solid var(--border); border-radius: 18px; padding: 18px; }
.progress { height: 10px; overflow: hidden; border-radius: 999px; background: #e7edf5; margin: 12px 0 8px; }
.progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), #39a97b); }
.badge { display: inline-flex; align-items: center; padding: 5px 9px; border-radius: 999px; font-size: 13px; font-weight: 700; background: #e9f3f7; color: var(--primary-dark); }
.badge.running { background: #dff4e8; color: #157343; }
.badge.paused { background: #fff1d9; color: #9c6200; }
.badge.completed { background: #e6ecff; color: #3d55a5; }
.login-shell, .install-shell { width: min(1080px, calc(100% - 28px)); margin: 36px auto; }
.install-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; }
.field label { font-weight: 700; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; background: #fff; color: var(--ink); }
.field textarea { min-height: 158px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.field input:focus, .field textarea:focus, .field select:focus { outline: 3px solid rgba(23,107,135,.14); border-color: var(--primary); }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-row.five { grid-template-columns: 1.3fr .6fr 1.3fr 1.1fr 1.3fr; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.btn { border: 0; border-radius: 12px; padding: 11px 16px; cursor: pointer; font-weight: 800; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-secondary { background: #e9eef5; color: var(--ink); }
.btn-danger { background: var(--danger); color: #fff; }
.help { color: var(--muted); font-size: 14px; line-height: 1.65; }
.alert { padding: 13px 15px; border-radius: 12px; margin-bottom: 14px; }
.alert-success { background: #e4f6eb; color: #126b3a; }
.alert-error { background: #fde7e7; color: #9b2929; }
.code-samples { display: grid; gap: 10px; }
.code-samples pre { margin: 0; padding: 12px; overflow: auto; border-radius: 12px; background: #112533; color: #d8eff7; font-size: 13px; }
.admin-layout { display: grid; grid-template-columns: 250px 1fr; min-height: calc(100vh - 68px); }
.sidebar { padding: 18px 12px; background: #102a3c; color: #fff; }
.sidebar a { display: block; padding: 11px 13px; margin-bottom: 5px; border-radius: 10px; color: rgba(255,255,255,.84); }
.sidebar a:hover, .sidebar a.active { color: #fff; background: rgba(255,255,255,.11); }
.admin-content { min-width: 0; padding: 24px; }
.module-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.module-card { min-height: 145px; display: flex; flex-direction: column; justify-content: space-between; }
.module-card h3 { margin: 0 0 8px; }
.module-card p { color: var(--muted); line-height: 1.65; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 13px 12px; border-bottom: 1px solid var(--border); text-align: left; }
th { color: var(--muted); font-size: 14px; }
@media (max-width: 1000px) {
    .hero, .install-grid, .admin-layout { grid-template-columns: 1fr; }
    .sidebar { display: flex; gap: 6px; overflow-x: auto; }
    .sidebar a { flex: 0 0 auto; margin: 0; }
    .stat-grid, .module-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .board-grid { grid-template-columns: 1fr 1fr; }
    .form-row.five { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
    .topbar { padding: 12px 14px; align-items: flex-start; }
    .container, .login-shell, .install-shell { width: min(100% - 20px, 100%); margin-top: 16px; }
    .panel { padding: 16px; border-radius: 16px; }
    .stat-grid, .board-grid, .module-grid, .form-row, .form-row.five { grid-template-columns: 1fr; }
    .admin-content { padding: 14px; }
}
