:root {
  --primary: #2563eb; --primary-dark: #1d4ed8; --primary-soft: #eff6ff;
  --ink: #172033; --muted: #748096; --line: #e7ebf1;
  --surface: #fff; --canvas: #f7f9fc; --sidebar-width: 258px; --topbar-height: 72px;
}
html { font-size: 14px; min-height: 100%; position: relative; }
@media (min-width: 768px) { html { font-size: 15px; } }
body { background: var(--canvas); color: var(--ink); font-family: Inter, "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif; min-height: 100vh; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
.svg-sprite { height: 0; left: -9999px; overflow: hidden; position: absolute; width: 0; }

.sidebar { --bs-offcanvas-width: var(--sidebar-width); background: var(--surface); border-right: 1px solid var(--line); color: var(--ink); display: flex; flex-direction: column; height: 100vh; height: 100dvh; max-height: 100vh; overflow: hidden; width: var(--sidebar-width) !important; }
.sidebar-brand { align-items: center; border-bottom: 1px solid var(--line); display: flex; flex: 0 0 var(--topbar-height); height: var(--topbar-height); justify-content: space-between; padding: 0 22px; }
.brand-link { align-items: center; color: var(--ink); display: flex; gap: 12px; letter-spacing: .02em; }
.brand-link:hover { color: var(--ink); }
.brand-mark { align-items: center; background: linear-gradient(145deg, #3b82f6, #1d4ed8); border-radius: 10px; box-shadow: 0 6px 16px rgba(37,99,235,.22); color: #fff; display: inline-flex; font-size: 1.15rem; font-weight: 800; height: 36px; justify-content: center; width: 36px; }
.brand-link strong { display: block; font-size: .98rem; line-height: 1.25; }
.brand-link small { color: var(--muted); display: block; font-size: .7rem; font-weight: 500; margin-top: 2px; }
.sidebar-body { display: flex !important; flex: 1 1 auto; flex-direction: column; min-height: 0; overflow: hidden; padding: 16px 10px 18px 14px !important; }
.sidebar-nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding-right: 4px; scrollbar-color: #c8d0dc transparent; scrollbar-gutter: stable; scrollbar-width: thin; }
.sidebar-nav::-webkit-scrollbar { width: 7px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: #c8d0dc; border-radius: 999px; }
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: #aeb8c7; }
.sidebar .nav-link { align-items: center; border-radius: 8px; color: #546176; display: flex; font-size: .9rem; font-weight: 600; gap: 12px; margin-bottom: 3px; min-height: 43px; padding: 10px 12px; transition: background .16s ease, color .16s ease, transform .16s ease; }
.sidebar .nav-link svg { fill: none; height: 19px; min-width: 19px; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; width: 19px; }
.sidebar .nav-link:hover, .sidebar .nav-link:focus { background: #f4f7fb; color: var(--ink); transform: translateX(2px); }
.sidebar .nav-link.active { background: var(--primary-soft); color: var(--primary); }
.sidebar .nav-link.active::after { background: var(--primary); border-radius: 99px; content: ""; height: 18px; margin-left: auto; width: 3px; }
.sidebar-heading { color: #a0a9b8; font-size: .69rem; font-weight: 700; letter-spacing: .12em; margin: 22px 12px 8px; text-transform: uppercase; }
.sidebar-footer { align-items: center; border-top: 1px solid var(--line); color: #657188; display: grid; flex: 0 0 auto; font-size: .73rem; grid-template-columns: auto 1fr auto; margin: 18px 4px 0; padding: 18px 8px 0; }
.sidebar-footer small { color: #a0a9b8; }
.status-dot { background: #22c55e; border: 3px solid #dcfce7; border-radius: 50%; height: 11px; margin-right: 8px; width: 11px; }

.topbar { align-items: center; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); display: flex; height: var(--topbar-height); left: 0; padding: 0 18px; position: fixed; right: 0; top: 0; z-index: 1020; }
.topbar-title { display: flex; flex-direction: column; line-height: 1.25; }
.topbar-title span { color: #9aa3b3; font-size: .68rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.topbar-title strong { font-size: 1rem; margin-top: 3px; }
.topbar-clock { color: #526076; display: none; font-size: .8rem; font-variant-numeric: tabular-nums; font-weight: 600; margin-left: auto; margin-right: 1rem; white-space: nowrap; }
.icon-button { align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); display: inline-flex; height: 40px; justify-content: center; margin-right: 12px; width: 40px; }
.icon-button svg { fill: none; height: 20px; stroke: currentColor; stroke-linecap: round; stroke-width: 2; width: 20px; }
.topbar-action { align-items: center; display: inline-flex; gap: 7px; white-space: nowrap; }
.topbar-action svg { fill: none; height: 17px; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; width: 17px; }
.user-menu { align-items: center; background: transparent; border: 0; border-radius: 10px; display: flex; gap: 10px; padding: 6px 8px; text-align: left; }
.user-menu:hover { background: #f7f9fc; }
.user-avatar { align-items: center; background: #eaf2ff; border-radius: 50%; color: var(--primary); display: inline-flex; font-size: .85rem; font-weight: 800; height: 38px; justify-content: center; width: 38px; }
.user-copy { display: none; line-height: 1.2; }
.user-copy strong { display: block; font-size: .82rem; }
.user-copy small { color: var(--muted); font-size: .68rem; }
.dropdown-caret { color: #9aa3b3; display: none; font-size: 1.1rem; }
.user-dropdown { border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 14px 35px rgba(25,39,65,.12); min-width: 210px; padding: 8px; }
.user-dropdown .dropdown-header { color: var(--muted); font-size: .73rem; padding: 10px 12px; }
.user-dropdown .dropdown-header strong { color: var(--ink); font-size: .88rem; }
.user-dropdown .dropdown-item { align-items: center; border-radius: 7px; color: #526076; display: flex; font-size: .84rem; gap: 9px; padding: 9px 10px; }
.user-dropdown .dropdown-item:hover { background: #f6f8fb; color: var(--ink); }
.user-dropdown svg { fill: none; height: 17px; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; width: 17px; }
.main-content { min-height: 100vh; padding: calc(var(--topbar-height) + 22px) 16px 28px; }

.page-header { align-items: center; display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; margin-bottom: 22px; }
.page-header h1 { color: var(--ink); font-size: 1.55rem; font-weight: 700; letter-spacing: -.02em; margin: 0; }
.page-header .text-muted { font-size: .82rem; margin-top: 6px; }
.card { background: var(--surface); }
.content-card { border: 1px solid var(--line); border-radius: 11px; box-shadow: 0 3px 14px rgba(31,47,76,.035); overflow: hidden; }
.content-card .card-header { background: #fff !important; border-bottom: 1px solid var(--line); color: #26334a; padding: 16px 18px; }
.content-card .card-body.border-bottom { border-color: var(--line) !important; }
.stat-card { border: 1px solid var(--line); border-radius: 11px; box-shadow: 0 3px 14px rgba(31,47,76,.035); min-height: 132px; overflow: hidden; position: relative; }
.stat-card::before { background: var(--stat-color,var(--primary)); content: ""; height: 3px; left: 0; position: absolute; right: 0; top: 0; }
.stat-card .card-body { display: flex; flex-direction: column; justify-content: space-between; padding: 19px 18px 16px; }
.stat-label { align-items: center; color: var(--muted); display: flex; font-size: .76rem; font-weight: 600; gap: 7px; }
.stat-icon { align-items: center; background: var(--stat-soft,var(--primary-soft)); border-radius: 7px; color: var(--stat-color,var(--primary)); display: inline-flex; height: 28px; justify-content: center; width: 28px; }
.stat-icon svg { fill: none; height: 15px; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.9; width: 15px; }
.stat-card .stat-value { color: var(--ink); font-size: 1.45rem !important; font-weight: 750; letter-spacing: -.035em; line-height: 1.15; margin-top: 15px; }
.stat-card.stat-danger { --stat-color: #ef4444; --stat-soft: #fef2f2; }
.stat-card.stat-danger .stat-value { color: #dc2626 !important; }
.stat-card.stat-success { --stat-color: #16a34a; --stat-soft: #f0fdf4; }
.stat-card.stat-amber { --stat-color: #d97706; --stat-soft: #fffbeb; }
.stat-card.stat-violet { --stat-color: #7c3aed; --stat-soft: #f5f3ff; }
.dashboard-section-title { align-items: center; display: flex; justify-content: space-between; margin: 4px 0 12px; }
.dashboard-section-title h2 { font-size: .96rem; font-weight: 700; margin: 0; }
.dashboard-link { font-size: .76rem; font-weight: 600; }

.table { --bs-table-bg: transparent; color: #354158; font-size: .82rem; }
.table > :not(caption) > * > * { border-bottom-color: #edf0f5; padding: .85rem 1rem; }
.table thead th, .table-light th { background: #fafbfc !important; border-bottom-color: var(--line); color: #8791a3; font-size: .7rem; font-weight: 700; letter-spacing: .025em; text-transform: uppercase; white-space: nowrap; }
.table tbody tr:last-child > * { border-bottom: 0; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: #fafcff; }
.menu-management-table { font-size: calc(.82rem + 2px); }
.menu-management-table thead th { font-size: calc(.7rem + 2px); }
.menu-management-table .small { font-size: calc(.875em + 2px); }
.menu-management-table .badge { font-size: calc(.68rem + 2px); }
.menu-management-table .btn-sm { font-size: calc(.74rem + 2px); }
.table td { vertical-align: middle; }
.table a { font-weight: 600; }
.btn { border-radius: 7px; font-size: .8rem; font-weight: 600; padding: .55rem .9rem; }
.btn-sm { border-radius: 6px; font-size: .74rem; padding: .38rem .62rem; }
.btn-primary { background: var(--primary); border-color: var(--primary); box-shadow: 0 3px 8px rgba(37,99,235,.16); }
.btn-primary:hover, .btn-primary:focus { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-outline-primary { border-color: #b7cdfd; color: var(--primary); }
.btn-outline-secondary { border-color: #d8dee8; color: #667188; }
.form-label { color: #465269; font-size: .78rem; font-weight: 600; }
.form-control, .form-select, .input-group-text { border-color: #dce2eb; border-radius: 7px; color: var(--ink); font-size: .82rem; min-height: 40px; }
.form-control::placeholder { color: #a7afbd; }
.form-control:focus, .form-select:focus, .form-check-input:focus { border-color: #8db1fc; box-shadow: 0 0 0 .2rem rgba(37,99,235,.1); }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.required-label::after { color: #dc3545; content: " *"; }
.detail-list dt { color: var(--muted); font-weight: 500; }
.badge { border-radius: 5px; font-size: .68rem; font-weight: 650; padding: .4em .62em; }
.status-badge { border: 1px solid transparent; letter-spacing: .01em; min-width: 4.25rem; text-align: center; }
.status-processing { background: #ede9fe; border-color: #ddd6fe; color: #6d28d9; }
.status-confirmed { background: #dbeafe; border-color: #bfdbfe; color: #1d4ed8; }
.status-pending { background: #fef3c7; border-color: #fde68a; color: #92400e; }
.status-shipped { background: #cffafe; border-color: #a5f3fc; color: #0e7490; }
.status-delivered { background: #dcfce7; border-color: #bbf7d0; color: #166534; }
.status-received { background: #ccfbf1; border-color: #99f6e4; color: #0f766e; }
.status-completed { background: #d1fae5; border-color: #a7f3d0; color: #047857; }
.status-cancelled { background: #fee2e2; border-color: #fecaca; color: #b91c1c; }
.status-default { background: #f1f5f9; border-color: #e2e8f0; color: #475569; }
.alert { border: 0; border-radius: 9px; font-size: .82rem; }
.text-muted { color: var(--muted) !important; }

.auth-shell { background: #f5f7fb; }
.auth-shell::before { background: linear-gradient(140deg,#eff6ff,rgba(255,255,255,0)); content: ""; height: 55vh; left: 0; position: fixed; right: 0; top: 0; }
.auth-content { align-items: center; display: flex; justify-content: center; min-height: 100vh; padding: 28px 16px; position: relative; }
.login-wrap { max-width: 430px; width: 100%; }
.login-brand { align-items: center; display: flex; flex-direction: column; margin-bottom: 24px; text-align: center; }
.login-brand .brand-mark { height: 46px; margin-bottom: 12px; width: 46px; }
.login-brand strong { font-size: 1.05rem; }
.login-card { box-shadow: 0 18px 50px rgba(31,47,76,.08); }
.login-card .card-body { padding: 32px; }
.login-card h1 { font-size: 1.35rem; font-weight: 700; }
.demo-hint { background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; color: #68758b; font-size: .75rem; padding: 10px 12px; text-align: center; }
.rich-content { color: #354158; line-height: 1.75; overflow-wrap: anywhere; }
.rich-content img { border: 1px solid var(--line); border-radius: 8px; height: auto; margin: .5rem 0; max-width: 100%; }
.rich-content > :last-child { margin-bottom: 0; }
.issue-reply { border-left: 3px solid #dbe7fd; }
.note-editor.note-frame { border-color: #dce2eb; border-radius: 8px; overflow: hidden; }
.note-editor .note-toolbar { background: #f8fafc; border-bottom-color: var(--line); }
.note-editor .note-editable { background: #fff; color: var(--ink); font-family: inherit; }

@media (min-width: 576px) { .user-copy, .dropdown-caret { display: block; } .topbar { padding-left: 24px; padding-right: 24px; } .main-content { padding-left: 24px; padding-right: 24px; } }
@media (min-width: 768px) { .sidebar { bottom: 0; position: fixed; top: 0; z-index: 1030; } .topbar { left: var(--sidebar-width); padding-left: 30px; padding-right: 30px; } .main-content { margin-left: var(--sidebar-width); padding: calc(var(--topbar-height) + 28px) 30px 40px; } }
@media (min-width: 1200px) { .topbar-clock { display: inline-block; } }
@media (min-width: 1440px) { .main-content { padding-left: 38px; padding-right: 38px; } }
@media (max-width: 575.98px) { .page-header { align-items: stretch; flex-direction: column; } .page-header > .btn, .page-header > div:last-child .btn { width: 100%; } .login-card .card-body { padding: 26px 22px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }
