/* 鴻偉國際EIP 共用樣式：其他系統可引用 https://eip.hw2000.cc/static/app.css 以沿用同一畫面風格 */
:root {
  --hw-blue: #264784;
  --hw-red: #af2a35;
  --bg: #f5f6f9;
  --surface: #ffffff;
  --text: #1c2333;
  --muted: #5d6679;
  --border: #dde1ea;
  --accent: var(--hw-blue);
  --accent-text: #ffffff;
  --danger: var(--hw-red);
  --ok-bg: #e7f4ea;
  --ok-text: #1d6b33;
  --err-bg: #fbe9ea;
  --err-text: #9b1c26;
  --warn-bg: #fff6dd;
  --row-hover: #f0f3f9;
  --radius: 8px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151c;
    --surface: #1b2029;
    --text: #e5e8ee;
    --muted: #9aa3b5;
    --border: #2d3442;
    --accent: #8fa9e6;
    --accent-text: #0d1220;
    --danger: #e5656f;
    --ok-bg: #173022;
    --ok-text: #8fd9a6;
    --err-bg: #3a1a1e;
    --err-text: #f2a1a8;
    --warn-bg: #3a3218;
    --row-hover: #222936;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 system-ui, -apple-system, "Segoe UI", "Microsoft JhengHei", "PingFang TC", "Noto Sans TC", sans-serif;
}
a { color: var(--accent); }
h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
main { max-width: 1280px; margin: 0 auto; padding: 1.25rem 16px 3rem; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .6rem 16px; background: var(--bg); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: .6rem; color: var(--text); text-decoration: none; font-weight: 700; font-size: 1.1rem; }
.brand-logo img { height: 34px; width: auto; display: block; }
.who { display: flex; align-items: center; gap: .75rem; color: var(--muted); font-size: .9rem; }

.adminnav {
  display: flex; gap: .25rem; overflow-x: auto; padding: 0 16px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.adminnav a { padding: .55rem .8rem; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.adminnav a.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; margin-bottom: 1.25rem; }
.card.narrow { max-width: 520px; margin: 3rem auto; }
.card.warn { background: var(--warn-bg); }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.break { word-break: break-all; }
.nowrap { white-space: nowrap; }
.pagehead { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
@media (max-width: 860px) { .cols { grid-template-columns: 1fr; } }

.btn {
  display: inline-block; padding: .45rem .95rem; border-radius: 6px; border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-text); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; color: var(--accent); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-small { padding: .2rem .6rem; font-size: .85rem; }
.btn-google { padding: .7rem 1.4rem; font-size: 1rem; }

.flash { padding: .6rem .9rem; border-radius: 6px; }
.flash.ok { background: var(--ok-bg); color: var(--ok-text); }
.flash.err { background: var(--err-bg); color: var(--err-text); }
.badge { display: inline-block; margin-left: .35rem; padding: 0 .45rem; border-radius: 999px; background: var(--border); color: var(--muted); font-size: .75rem; font-weight: 500; vertical-align: middle; }

.login { max-width: 440px; margin: 3rem auto; text-align: center; padding: 1rem 1.5rem; }
.login-logo img { width: 240px; max-width: 100%; height: auto; }
.login h1 { margin: 1rem 0 .25rem; }

.hello { margin-bottom: 1.5rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.tile {
  display: flex; flex-direction: column; gap: .25rem; padding: 1.1rem; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text); text-decoration: none;
}
.tile:hover { border-color: var(--accent); }
.sysicon { font-size: 1.6rem; line-height: 1; }
img.sysicon { width: 28px; height: 28px; }

.scroll { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; background: var(--surface); }
.grid th, .grid td { padding: .45rem .6rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.grid th { font-size: .85rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
.grid tbody tr:hover { background: var(--row-hover); }
.grid.compact th, .grid.compact td { padding: .3rem .5rem; }
.grid tr.dim { opacity: .55; }
.grid tr.error td { color: var(--err-text); }
.grid td.actions { display: flex; gap: .35rem; }
.grid input:not([type=checkbox]):not([type=radio]), .grid select { width: 100%; min-width: 7rem; }
.grid input.num { min-width: 4.5rem; width: 4.5rem; }
.grid input.code { min-width: 5rem; }
.matrix td { text-align: center; }
.matrix td:first-child { text-align: left; white-space: nowrap; }
.matrix tr.group td { font-weight: 600; }
.roles div { white-space: nowrap; }
.roles span, .legend span { display: inline-block; font-size: .72rem; padding: 0 .35rem; border-radius: 4px; margin-right: .15rem; }
.src-all { background: #e4e9f5; color: #31446f; }
.src-unit { background: #e3f1ea; color: #23603d; }
.src-title { background: #f1e8f8; color: #5b2f7d; }
.src-grant { background: #fff0d6; color: #7a4d00; }
.src-revoke { background: #fbe1e3; color: #8b1d27; }
@media (prefers-color-scheme: dark) {
  .src-all { background: #26324b; color: #b9c8ec; }
  .src-unit { background: #1d3a2a; color: #9fd8b5; }
  .src-title { background: #35274a; color: #d3b6ec; }
  .src-grant { background: #44361a; color: #f1cf8c; }
  .src-revoke { background: #4a2328; color: #f2a9b0; }
}
code.json { font-size: .78rem; word-break: break-all; display: block; max-width: 28rem; }

.form label { display: block; margin-bottom: .8rem; font-size: .9rem; color: var(--muted); }
.form label.check { color: var(--text); }
.form input:not([type=checkbox]):not([type=radio]), .form select, .form textarea { display: block; width: 100%; margin-top: .2rem; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: .35rem .5rem;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
fieldset { border: 1px solid var(--border); border-radius: 6px; margin: 0 0 1rem; padding: .5rem .75rem; }
legend { color: var(--muted); font-size: .9rem; padding: 0 .3rem; }
fieldset label.check { display: inline-flex; align-items: center; gap: .3rem; margin-right: 1rem; }
form.inline { display: flex; gap: .5rem; flex-wrap: wrap; margin: .5rem 0; }
form.inline input { flex: 1; min-width: 12rem; }
.inline-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .5rem 1rem; align-items: end; }
.inline-grid label { margin: 0; }
.inline-grid .btn { justify-self: start; }
pre.sample { background: var(--bg); padding: .6rem; border-radius: 6px; overflow-x: auto; font-size: .85rem; }
.pager { display: flex; gap: 1rem; }
