/* nancy_erp — Fiori 風骨架樣式（Phase 0）*/
:root {
  --shell-bg: #354a5f;       /* Fiori shell bar 深藍 */
  --accent: #0a6ed1;         /* Fiori 互動藍 */
  --bg: #f7f7f7;
  --card: #ffffff;
  --border: #e5e5e5;
  --text: #32363a;
  --text-soft: #6a6d70;
  --good: #107e3e;
  --font: "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--text); }
code { background: #eef1f5; color: #c0392b; padding: 1px 5px; border-radius: 4px; font-size: .85em; }

/* Shell Bar */
.shellbar {
  height: 44px; background: var(--shell-bg); color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px; position: sticky; top: 0; z-index: 10;
}
.shellbar-left { display: flex; align-items: center; gap: 10px; }
.shellbar-logo {
  width: 26px; height: 26px; border-radius: 6px; background: var(--accent);
  display: grid; place-items: center; font-weight: 700; font-size: 15px;
}
.shellbar-title { font-weight: 600; font-size: 15px; }
.shellbar-sub { color: #c5cdd5; font-size: 12px; }
.shellbar-right { display: flex; align-items: center; gap: 8px; }
.badge {
  background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.25);
  padding: 2px 8px; border-radius: 10px; font-size: 11px;
}
.avatar {
  width: 28px; height: 28px; border-radius: 50%; background: #5b738b;
  display: grid; place-items: center; font-size: 12px; font-weight: 600;
}

/* Layout */
.app { display: flex; min-height: calc(100vh - 44px - 28px); }
.sidenav {
  width: 220px; background: var(--card); border-right: 1px solid var(--border);
  padding: 10px 0; flex-shrink: 0;
}
.nav-group {
  font-size: 11px; color: var(--text-soft); text-transform: uppercase;
  letter-spacing: .5px; padding: 12px 16px 4px;
}
.nav-item {
  display: block; padding: 9px 16px; color: var(--text); text-decoration: none;
  font-size: 14px; border-left: 3px solid transparent;
}
.nav-item:hover { background: #f2f6fb; }
.nav-item.active { border-left-color: var(--accent); color: var(--accent); font-weight: 600; background: #eaf3fc; }
.nav-item.disabled { color: #b0b4b8; cursor: default; }
.nav-item.disabled:hover { background: transparent; }

/* Content */
.content { flex: 1; padding: 22px 26px; }
.page-title { font-size: 22px; font-weight: 300; margin: 0 0 4px; }
.page-desc { color: var(--text-soft); font-size: 13px; margin: 0 0 22px; }
.tile-group { margin-bottom: 26px; }
.group-title { font-size: 13px; color: var(--text-soft); font-weight: 600; margin: 0 0 10px; }
.tiles { display: flex; flex-wrap: wrap; gap: 12px; }
.tile {
  width: 168px; min-height: 96px; background: var(--card);
  border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04); transition: box-shadow .15s, transform .15s;
}
.tile:hover { box-shadow: 0 4px 12px rgba(0,0,0,.1); transform: translateY(-1px); }
.tile-icon { font-size: 22px; margin-bottom: 8px; }
.tile-title { font-weight: 600; font-size: 14px; }
.tile-info { color: var(--text-soft); font-size: 12px; margin-top: 4px; }
.tile-tag {
  display: inline-block; margin-top: 8px; font-size: 11px; padding: 1px 7px;
  border-radius: 9px; background: #eaf3fc; color: var(--accent);
}
.tile.loading { color: var(--text-soft); display: grid; place-items: center; }
.tile.error { border-color: #e0b4b4; }

.appfoot {
  height: 28px; display: flex; align-items: center; padding: 0 16px;
  font-size: 11px; color: var(--text-soft); background: var(--card);
  border-top: 1px solid var(--border);
}
.ok { color: var(--good); }
.bad { color: #bb0000; }

/* Shell bar 使用者區 */
.user-name { font-size: 12px; color: #e3e8ed; }
.btn-logout {
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.3);
  color: #fff; font-size: 12px; padding: 3px 10px; border-radius: 6px; cursor: pointer;
}
.btn-logout:hover { background: rgba(255,255,255,.25); }

/* 登入頁 */
.login-bg {
  min-height: 100vh; display: grid; place-items: center;
  background: linear-gradient(135deg, #354a5f 0%, #0a6ed1 100%);
}
.login-card {
  width: 340px; background: #fff; border-radius: 14px; padding: 32px 30px;
  box-shadow: 0 12px 40px rgba(0,0,0,.25); text-align: center;
}
.login-logo {
  width: 52px; height: 52px; border-radius: 12px; background: var(--accent);
  color: #fff; font-weight: 700; font-size: 26px; display: grid; place-items: center;
  margin: 0 auto 14px;
}
.login-title { font-size: 22px; margin: 0; font-weight: 600; }
.login-sub { color: var(--text-soft); font-size: 13px; margin: 4px 0 22px; }
.login-form { text-align: left; }
.fld { display: block; margin-bottom: 14px; }
.fld span { display: block; font-size: 12px; color: var(--text-soft); margin-bottom: 5px; }
.fld input, .fld select {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; font-family: inherit; background: #fff;
}
.fld input:focus, .fld select:focus { outline: none; border-color: var(--accent); }
.login-msg { color: #bb0000; font-size: 12px; min-height: 16px; margin-bottom: 8px; }
.btn-primary {
  width: 100%; padding: 11px; background: var(--accent); color: #fff; border: none;
  border-radius: 8px; font-size: 15px; font-weight: 600; cursor: pointer;
}
.btn-primary:hover { background: #0858b8; }
.btn-primary:disabled { opacity: .6; cursor: default; }
.btn-sm { width: auto; padding: 7px 16px; font-size: 13px; }

/* 頁首 / 工具列 */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.toolbar { margin: 8px 0 16px; display: flex; gap: 16px; align-items: center; }
.toolbar label { font-size: 13px; color: var(--text-soft); display: flex; gap: 8px; align-items: center; }
.toolbar select {
  padding: 6px 10px; border: 1px solid var(--border); border-radius: 7px; font-family: inherit; font-size: 13px;
}
.muted { color: var(--text-soft); font-size: 13px; padding: 14px 2px; }
.mono { font-family: "Cascadia Code", Consolas, monospace; }
.ta-r { text-align: right; }

/* 表格 */
table.grid { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
table.grid th, table.grid td { padding: 10px 13px; text-align: left; font-size: 13.5px; border-bottom: 1px solid var(--border); }
table.grid thead th { background: #f3f5f7; color: var(--text-soft); font-weight: 600; font-size: 12px; }
table.grid tbody tr:last-child td { border-bottom: none; }
table.grid tbody tr:hover { background: #f7fafd; }
.chip { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 9px; background: #eaf3fc; color: var(--accent); }
.chip-c { background: #e6f4ea; color: var(--good); }            /* 客戶 */
.chip-v { background: #fbe9e7; color: #bb4400; }                /* 供應商 / 凍結 */
.btn-link { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 13px; padding: 2px 4px; }
.btn-link:hover { text-decoration: underline; }
.btn-link.bad { color: #bb0000; }

/* 單據 object page */
.act-row { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.obj-head { display: flex; flex-wrap: wrap; gap: 16px 34px; background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 16px 20px; margin-bottom: 18px; }
.obj-fld { display: flex; flex-direction: column; gap: 3px; }
.obj-lbl { font-size: 11px; color: var(--text-soft); }
.obj-val { font-size: 14px; }
.sec-title { font-size: 14px; font-weight: 600; margin: 18px 0 8px; }
.sec-title-sm { font-size: 12px; color: var(--text-soft); font-weight: 600; margin: 14px 0 6px; }
.item-row { display: flex; gap: 6px; margin-bottom: 6px; align-items: center; }
.item-row input { padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; font-family: inherit; }
.item-row .it-desc { flex: 1; min-width: 0; }
.item-row .it-qty, .item-row .it-price { width: 76px; }
.item-row .it-uom { width: 56px; }
.item-row .it-del { flex: 0 0 auto; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: grid; place-items: center; z-index: 50; }
.modal { width: 380px; max-width: 92vw; background: #fff; border-radius: 12px; box-shadow: 0 16px 50px rgba(0,0,0,.3); overflow: hidden; }
.modal.modal-wide { width: 600px; }

/* 權限矩陣 */
.matrix { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 13px; }
.matrix th, .matrix td { border: 1px solid var(--border); padding: 6px 8px; text-align: center; }
.matrix thead th { background: #f3f5f7; color: var(--text-soft); font-size: 12px; }
.matrix tbody td:first-child { text-align: left; }
.matrix tbody td:first-child code { font-size: 10px; }
.matrix input { width: 16px; height: 16px; }

/* 警示框 */
.callout-bad { background: #fdecea; border: 1px solid #f5c6c0; border-left: 4px solid #bb0000; color: #8a1f1f; padding: 10px 14px; border-radius: 8px; font-size: 13px; margin: 10px 0; }
.modal-head { padding: 15px 20px; font-size: 16px; font-weight: 600; border-bottom: 1px solid var(--border); }
.modal-body { padding: 18px 20px 4px; max-height: 68vh; overflow-y: auto; }
.fld-check { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.fld-check input { width: 16px; height: 16px; }
.fld-check span { margin: 0; font-size: 13px; color: var(--text); }
.modal-foot { padding: 14px 20px; display: flex; justify-content: flex-end; gap: 10px; border-top: 1px solid var(--border); }
.btn-ghost { background: none; border: 1px solid var(--border); color: var(--text); padding: 7px 16px; border-radius: 8px; font-size: 13px; cursor: pointer; }
.btn-ghost:hover { background: #f2f6fb; }

/* Toast */
.toast { position: fixed; bottom: 40px; left: 50%; transform: translateX(-50%); background: #32363a; color: #fff; padding: 10px 20px; border-radius: 22px; font-size: 13px; box-shadow: 0 6px 20px rgba(0,0,0,.25); z-index: 60; animation: toastIn .2s ease; }
.toast-bad { background: #bb0000; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
