/* ============================================================
   柴犬小部 — 版面與元件樣式
   ============================================================ */
:root {
  /* 色彩 */
  --bg: #eef2f7;            /* 頁面底色 */
  --panel: #ffffff;         /* 區塊底色 */
  --panel-2: #f8fafc;       /* 區塊標題列、表頭 */
  --side: #0f1f38;          /* 側邊欄 */
  --side-2: #1a2f50;        /* 側邊欄選中 */
  --side-text: #a9b6cc;
  --text: #1e293b; --text-2: #475569; --muted: #64748b;
  --line: #e2e8f0; --line-2: #cbd5e1;
  --primary: #1d4ed8; --primary-d: #1e40af; --primary-bg: #eff4ff;
  --green: #047857; --green-bg: #ecfdf5;
  --red: #b91c1c; --red-bg: #fef2f2;
  --amber: #b45309; --amber-bg: #fffbeb;
  --blue-bg: var(--primary-bg);
  /* 尺寸 */
  --radius: 10px; --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .04);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, .25);
  font-family: "Noto Sans TC", "Microsoft JhengHei", "PingFang TC", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
h1 { font-size: 20px; margin: 0; font-weight: 700; letter-spacing: .3px; }
h2 { font-size: 15px; margin: 0 0 12px; font-weight: 700; }
h3 { font-size: 14px; margin: 16px 0 8px; font-weight: 700; color: var(--text-2); }
.muted { color: var(--muted); }
.err { color: var(--red); min-height: 1.2em; margin-top: 4px; font-size: 13px; }
.pos { color: var(--green); } .neg { color: var(--red); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- 整體版面：側邊欄 + 內容 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; flex: none; background: var(--side); color: var(--side-text);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 16px; color: #fff; font-weight: 700; font-size: 16px; letter-spacing: .5px;
  border-bottom: 1px solid rgba(255, 255, 255, .08); }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-weight: 800;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8); color: #fff; font-size: 16px; }
.nav-title { font-size: 11px; letter-spacing: 1.5px; color: #6b7c99; padding: 16px 18px 6px; }
#nav { display: flex; flex-direction: column; gap: 2px; padding: 0 10px; }
#nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; cursor: pointer; color: var(--side-text);
  font-size: 14px; text-decoration: none; transition: background .15s, color .15s; }
#nav a svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
#nav a.active { background: var(--side-2); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 #60a5fa; }
.btn.ghost { background: transparent; color: var(--side-text); border-color: rgba(255, 255, 255, .18); }
.btn.ghost:hover { background: rgba(255, 255, 255, .08); color: #fff; }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 28px;
  background: var(--panel); border-bottom: 1px solid var(--line); }
.page-desc { color: var(--muted); font-size: 13px; margin-top: 2px; }
.page-date { color: var(--muted); font-size: 13px; white-space: nowrap; }
/* 右上角：日期＋登入者＋改密碼／登出 */
.head-right { display: flex; align-items: center; gap: 16px; flex: none; }
.user-box { display: flex; align-items: center; gap: 8px; padding-left: 16px; border-left: 1px solid var(--line); }
.user-box:has(#whoami:empty) { display: none; }
#whoami { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; }
main { padding: 24px 28px 40px; width: 100%; }

@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .sidebar { width: auto; height: auto; position: sticky; top: 0; z-index: 20; flex-direction: row; align-items: center; overflow-x: auto; }
  .brand { border-bottom: 0; padding: 10px 12px; }
  .brand span:last-child, .nav-title { display: none; }
  #nav { flex-direction: row; padding: 6px; }
  #nav a { padding: 8px 10px; white-space: nowrap; }
  #nav a svg { display: none; }
  .page-head { padding: 14px 16px; }
  .page-date { display: none; }
  .user-box { padding-left: 0; border-left: 0; }
  main { padding: 16px; }
}

/* ---------- 區塊 ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.card > h2 { margin: -16px -18px 14px; padding: 12px 18px; border-bottom: 1px solid var(--line); background: var(--panel-2);
  border-radius: var(--radius) var(--radius) 0 0; font-size: 14px; color: var(--text); display: flex; align-items: center; gap: 8px; }
.card > h2::before { content: ""; width: 3px; height: 14px; border-radius: 2px; background: var(--primary); }
main > * + * { margin-top: 18px; }
main > p.muted { font-size: 12px; margin-top: 10px; }

/* ---------- 篩選列（獨立面板） ---------- */
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 18px; box-shadow: var(--shadow); }
.toolbar .spacer { flex: 1; }
.toolbar label { min-width: 130px; }
.toolbar .btn { height: 36px; }

/* ---------- 統計卡片 ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.kpi { position: relative; padding: 14px 18px 16px; border-left: 4px solid var(--primary); }
.kpi:has(.value.pos), .kpi:has(.value .pos) { border-left-color: var(--green); }
.kpi:has(.value.neg) { border-left-color: var(--red); }
.kpi:has(.value[style*="amber"]) { border-left-color: var(--amber); }
.kpi .label { color: var(--muted); font-size: 12px; letter-spacing: .3px; }
.kpi .value { font-size: 22px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; line-height: 1.25; }
.kpi .value .cur { font-size: 12px; }
.kpi .value > div + div { margin-top: 2px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 16px; }
@media (max-width: 520px) {
  .grid2 { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 10px 12px 12px; }
  .kpi .value { font-size: 16px; }
  .page-head { flex-wrap: wrap; }
}

/* ---------- 表單元件 ---------- */
label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--text-2); font-weight: 500; }
input, select, textarea {
  font: inherit; font-size: 14px; font-weight: 400; color: var(--text); height: 36px; padding: 6px 10px;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: #fff; min-width: 0; transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; resize: vertical; min-height: 70px; }
input:hover, select:hover, textarea:hover { border-color: #94a3b8; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(29, 78, 216, .15); }
input[readonly] { background: #f1f5f9; color: var(--text-2); cursor: not-allowed; }
input[type="date"], input[type="month"] { cursor: pointer; }
input[type="date"]::-webkit-calendar-picker-indicator { cursor: pointer; }
.month-filter { display: flex; align-items: center; gap: 2px; }
.fx-hint { font-size: 12px; color: var(--primary); background: var(--primary-bg); border: 1px solid #dbe5ff; padding: 7px 12px; border-radius: var(--radius-sm); }
.orig { font-size: 11px; color: var(--muted); font-weight: 400; margin-top: 1px; }
.cur { font-size: 11px; color: var(--muted); font-weight: 500; margin-left: 2px; }
td.num > div + div { margin-top: 2px; }

.btn { font: inherit; font-size: 14px; height: 36px; padding: 0 16px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: #fff;
  color: var(--text); cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  text-decoration: none; transition: background .15s, border-color .15s; }
.btn:hover { background: #f1f5f9; }
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 600; }
.btn.primary:hover { background: var(--primary-d); }
.btn.danger { color: var(--red); border-color: #fecaca; }
.btn.danger:hover { background: var(--red-bg); }
.btn.green { background: var(--green); color: #fff; border-color: var(--green); }
.btn.red { background: var(--red); color: #fff; border-color: var(--red); }
.btn.small { height: 28px; padding: 0 10px; font-size: 12px; }
.btn.link { height: auto; border: 0; background: none; color: var(--primary); padding: 2px 6px; font-size: 13px; }
.btn.link:hover { text-decoration: underline; background: none; }
.btn:disabled { opacity: .5; cursor: default; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
.card.table-wrap { padding: 0; }
.card.table-wrap > .muted { padding: 10px 16px; font-size: 12px; }
.card .table-wrap { margin: 0 -18px -16px; border-top: 0; }
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; white-space: nowrap; }
th { background: #f1f5f9; font-weight: 600; color: var(--text-2); font-size: 12px; letter-spacing: .3px; border-bottom: 1px solid var(--line-2); }
th.num { text-align: right; }
tbody tr:nth-child(even) td { background: #fafbfd; }
tbody tr:hover td { background: #f0f6ff; }
tbody tr:last-child td { border-bottom: 0; }
tfoot td { font-weight: 700; background: var(--panel-2); border-top: 2px solid var(--line-2); border-bottom: 0; }
/* 表格內字體統一 13px（狀態標籤、操作連結也一樣），只有原幣/匯率說明行較小 */
td { font-size: 13px; }
td .badge, td .btn.link { font-size: 13px; }
td .badge { font-weight: 500; padding: 1px 9px; }
td .cur { font-size: 12px; }
td .orig { font-size: 12px; }
td.note { min-width: 120px; max-width: 280px; white-space: pre-wrap; word-break: break-word; color: var(--text-2); }
.group-row td { background: #e8eef6 !important; font-weight: 700; color: var(--text); border-top: 1px solid var(--line-2); }
.empty { text-align: center; color: var(--muted); padding: 36px; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.b-income, .b-loan_collect, .b-closed { background: var(--green-bg); color: var(--green); }
.b-expense, .b-loan_repay, .b-overdue { background: var(--red-bg); color: var(--red); }
.b-loan_borrow, .b-borrow, .b-open { background: var(--primary-bg); color: var(--primary); }
.b-loan_lend, .b-lend { background: var(--amber-bg); color: var(--amber); }

/* ---------- 彈出視窗：標題 / 內容 / 按鈕 三段分明 ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 23, 42, .5); display: flex; align-items: flex-start; justify-content: center;
  padding: 48px 16px; overflow-y: auto; z-index: 50; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 640px; box-shadow: var(--shadow-lg); overflow: hidden; }
.modal.wide { max-width: 900px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 22px; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.modal-head h2 { margin: 0; font-size: 16px; }
.modal-body { padding: 20px 22px 0; }
.modal-body > :last-child:not(.modal-foot) { margin-bottom: 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin: 20px -22px 0; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--panel-2); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 520px) { .form-grid { grid-template-columns: 1fr; } }
.seg { display: flex; gap: 0; }
.seg button { flex: 1; border-radius: 0; }
.seg button:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.seg button:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.seg button + button { margin-left: -1px; }
.seg button.on { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 600; position: relative; }

/* ---------- 表單分區（收支 / 借貸 的新增與編輯） ---------- */
.modal:has(form.sections) { max-width: 700px; }
form.sections { display: flex; flex-direction: column; gap: 14px; }
.fs { border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px 16px; background: #fff; }
.fs-title { font-size: 12px; font-weight: 700; color: var(--text-2); letter-spacing: .5px; margin-bottom: 10px;
  display: flex; align-items: center; gap: 8px; }
.fs-title::before { content: ""; width: 3px; height: 12px; border-radius: 2px; background: var(--primary); }
/* 固定 4 欄，欄位不會因為同列欄位少而被拉長 */
.fs-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 14px; }
@media (max-width: 600px) { .fs-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.fs-grid + .fs-grid { margin-top: 12px; }
.fs-grid .span2 { grid-column: span 2; }
.fs-money { background: #f8fbff; border-color: #cfdcf5; }
.fs-money .fs-title::before { background: var(--green); }
.fs-money .fx-hint { margin-top: 10px; }
.amount-input { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.sr-label { gap: 0; font-size: 0; grid-column: 1 / -1; }
.dir-hint { font-size: 13px; color: var(--muted); margin-top: -4px; }

/* ---------- 沖正 / 狀態 / 唯讀查看 ---------- */
.b-normal { background: #f1f5f9; color: var(--text-2); }
.b-reversed { background: #f1f5f9; color: var(--muted); text-decoration: line-through; }
.b-reversal { background: #fef2f2; color: var(--red); }
tr.row-reversed td { color: #94a3b8; }
tr.row-reversed td .pos, tr.row-reversed td .neg { color: #94a3b8; text-decoration: line-through; }
tr.row-reversal td { background: #fffafa !important; }
td.actions { white-space: nowrap; }
td.doc-no { font-family: Consolas, "Cascadia Mono", ui-monospace, monospace; color: var(--text-2); letter-spacing: .3px; }
.btn.link.danger-link { color: var(--red); }
.btn.danger-solid { background: var(--red); color: #fff; border-color: var(--red); font-weight: 600; }
.btn.danger-solid:hover { background: #991b1b; }
.status-note { padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }
.status-note.reversed { background: #f1f5f9; color: var(--text-2); border: 1px solid var(--line-2); }
.status-note.reversal { background: var(--red-bg); color: var(--red); border: 1px solid #fecaca; }
.modal-body > .sections { display: flex; flex-direction: column; gap: 14px; }
.modal:has(.sections) { max-width: 700px; }
.kv { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 14px; margin: 0; }
.kv > div { min-width: 0; }
.kv > div.wide { grid-column: 1 / -1; }
.kv dt { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.kv dd { margin: 0; font-size: 14px; word-break: break-word; }
.kv dt:empty { display: none; }
.note-text { white-space: pre-wrap; min-height: 1.5em; }
@media (max-width: 600px) { .kv { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.foot-note { font-size: 12px; color: var(--muted); align-self: center; }
.rev-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; padding: 12px 16px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--panel-2); }
.rev-summary span { display: block; font-size: 12px; color: var(--muted); }
.rev-explain { font-size: 13px; color: var(--text-2); background: var(--amber-bg); border: 1px solid #fde68a; padding: 10px 14px; border-radius: 8px; margin: 14px 0; }

/* ---------- 分類設定 ---------- */
.btn.icon-btn { width: 36px; padding: 0; }
.btn.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.modal:has(.cat-list) { max-width: 620px; }
.cat-tip { font-size: 12px; color: var(--muted); margin: 12px 0; }
.cat-list { border: 1px solid var(--line); border-radius: 8px; max-height: 50vh; overflow-y: auto; }
.cat-row { display: grid; grid-template-columns: 34px 1fr 90px 76px 44px; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.cat-row:last-child { border-bottom: 0; }
.cat-row:nth-child(even) { background: #fafbfd; }
.cat-row.off .cat-name { color: var(--muted); text-decoration: line-through; }
.cat-move { display: flex; flex-direction: column; line-height: 1; }
.cat-move .btn.link { font-size: 10px; padding: 1px 4px; color: var(--muted); }
.cat-move .btn.link:hover:not(:disabled) { color: var(--primary); text-decoration: none; }
.cat-move .btn.link:disabled { opacity: .25; }
.cat-name { height: 32px; }
.cat-name[readonly] { background: transparent; border-color: transparent; cursor: default; color: var(--text); }
.cat-used { font-size: 12px; color: var(--muted); text-align: right; }
.switch { flex-direction: row; align-items: center; gap: 6px; cursor: pointer; font-size: 12px; color: var(--text-2); }
.switch input { height: auto; width: 16px; margin: 0; accent-color: var(--green); cursor: pointer; }
.cat-add { display: flex; gap: 8px; margin-top: 12px; }
.cat-add input { flex: 1; }
@media (max-width: 520px) { .cat-row { grid-template-columns: 26px 1fr auto 36px; gap: 6px; padding: 6px 8px; } .cat-used { display: none; } }

/* ---------- 附件 ---------- */
.att { margin-top: 0; }
.modal-body > .att, .modal-body > div > .att, #txAtt, #loanAtt { margin-top: 14px; }
#txAtt .att, #loanAtt .att { border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px 16px; }
.att h3 { margin: 0 0 10px; font-size: 12px; font-weight: 700; color: var(--text-2); letter-spacing: .5px; display: flex; align-items: center; gap: 8px; }
.att h3::before { content: ""; width: 3px; height: 12px; border-radius: 2px; background: var(--amber); }
.drop { border: 2px dashed var(--line-2); border-radius: 8px; padding: 16px; text-align: center; color: var(--muted); cursor: pointer; background: var(--panel-2); transition: all .15s; }
.drop:hover, .drop.over { border-color: var(--primary); background: var(--primary-bg); color: var(--primary); }
.att-list { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.att-item { width: 120px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; position: relative; background: #fff; box-shadow: var(--shadow); }
.att-item .thumb { height: 90px; display: grid; place-items: center; cursor: pointer; overflow: hidden; background: #eef2f6; }
.att-item .thumb img { width: 100%; height: 100%; object-fit: cover; }
.att-item .thumb .ext { font-weight: 700; color: var(--muted); font-size: 16px; }
.att-item .name { font-size: 11px; padding: 4px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-item .del { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 11px; border: 0; background: rgba(0,0,0,.55); color: #fff; cursor: pointer; line-height: 22px; padding: 0; }
.att-item.pending { opacity: .7; border-style: dashed; }

/* ---------- 日期區間月曆 ---------- */
.rp-field { font: inherit; font-size: 14px; font-weight: 400; height: 36px; display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 210px;
  padding: 0 10px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: #fff; color: var(--text); cursor: pointer; text-align: left; }
.rp-field:hover { border-color: var(--primary); }
.rp-icon { font-size: 13px; }
.rp-pop { position: absolute; z-index: 90; display: flex; background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(15,23,42,.18); max-width: calc(100vw - 16px); overflow: hidden; }
.rp-presets { display: flex; flex-direction: column; padding: 8px; border-right: 1px solid var(--line); gap: 2px; background: var(--panel-2); }
.rp-presets button { font: inherit; border: 0; background: none; text-align: left; padding: 6px 12px; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.rp-presets button:hover { background: var(--primary-bg); color: var(--primary); }
.rp-main { padding: 10px 12px; }
.rp-nav { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.rp-nav button { font: inherit; font-size: 18px; border: 0; background: none; cursor: pointer; width: 32px; height: 28px; border-radius: 6px; }
.rp-nav button:hover { background: #f1f5f9; }
.rp-months { display: flex; gap: 20px; }
.rp-title { text-align: center; font-weight: 600; margin: 6px 0; }
.rp-grid { display: grid; grid-template-columns: repeat(7, 34px); gap: 2px 0; }
.rp-wd { text-align: center; font-size: 12px; color: var(--muted); padding: 4px 0; }
.rp-day { font: inherit; height: 32px; border: 0; background: none; cursor: pointer; border-radius: 6px; }
.rp-day:hover { background: var(--primary-bg); }
.rp-day.today { font-weight: 700; color: var(--primary); }
.rp-day.in { background: var(--primary-bg); border-radius: 0; }
.rp-day.edge { background: var(--primary); color: #fff; }
.rp-foot { display: flex; align-items: center; gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 13px; }
@media (max-width: 520px) { .rp-pop { flex-direction: column; } .rp-presets { flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--line); } }

/* ---------- 登入 / 改密碼 ---------- */
.center-screen { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(circle at 20% 10%, #1e3a6b 0, transparent 50%), var(--side); }
.login-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 12px; padding: 28px; box-shadow: var(--shadow-lg); border: 0; }
.login-card h1 { font-size: 20px; }
.login-brand { padding: 0; border: 0; }
.login-card .btn { width: 100%; }

/* ---------- 其他 ---------- */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.85); z-index: 80; display: grid; place-items: center; cursor: zoom-out; padding: 20px; }
.lightbox img { max-width: 100%; max-height: 100%; }
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 100; }
#toast div { background: #0f172a; color: #fff; padding: 10px 18px; border-radius: 8px; margin-top: 6px; box-shadow: 0 6px 20px rgba(0,0,0,.2); font-size: 13px; }
#toast div.error { background: var(--red); }

/* ===== 角色設定 ===== */
.user-tabs { flex: none; }
.user-tabs button { flex: none; min-width: 96px; }
.perm-text { max-width: 520px; white-space: normal; color: var(--text-2); }
.fs-title .spacer { flex: 1; }
.fs-title .btn.link { font-size: 12px; font-weight: 500; letter-spacing: 0; padding: 0 4px; }
.perm-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.perm-group { border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; background: #fafbfd; }
.perm-group-name { font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.perm-item { display: flex; flex-direction: row; align-items: center; gap: 8px; font-size: 13px; padding: 3px 0; cursor: pointer; color: var(--text); }
.perm-item input { width: 16px; height: 16px; margin: 0; }
