/* 保拍檔 BrokerMate — 主樣式 v2（科技感升級 · 大字體可讀性優化） */
:root {
  --primary: #2563eb; --primary-2: #3b82f6; --accent: #06b6d4;
  --grad: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
  --grad-deep: linear-gradient(135deg, #0f2a5c 0%, #1c4e80 60%, #0e9f8f 130%);
  --bg: #eef2f8; --card: #fff; --line: #e2e8f2;
  --text: #16223a; --muted: #5c6b84; --danger: #e04141; --warn: #d98218;
  --ok: #14a06a; --sidebar: #0c1a33;
  --shadow: 0 1px 2px rgba(12,26,51,.05), 0 8px 24px rgba(12,26,51,.07);
  --shadow-lg: 0 12px 40px rgba(12,26,51,.16);
  --radius: 14px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body { font-family: -apple-system, "Segoe UI", "Microsoft JhengHei", "PingFang HK", "Noto Sans TC", sans-serif; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
a { color: var(--primary-2); text-decoration: none; }
button { font: inherit; cursor: pointer; }

/* ---------- 登入頁 ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--grad-deep); position: relative; overflow: hidden; }
.login-wrap::before, .login-wrap::after { content: ''; position: absolute; border-radius: 50%; filter: blur(90px); opacity: .5; }
.login-wrap::before { width: 480px; height: 480px; background: #06b6d4; top: -180px; right: -120px; }
.login-wrap::after { width: 420px; height: 420px; background: #3b82f6; bottom: -160px; left: -100px; }
.login-card { background: rgba(255,255,255,.96); backdrop-filter: blur(14px); border-radius: 20px; box-shadow: 0 24px 80px rgba(0,0,0,.35); padding: 48px 44px; width: 430px; max-width: calc(100vw - 32px); position: relative; z-index: 2; }
.login-card .logo { text-align: center; margin-bottom: 28px; }
.login-card .logo .bee { font-size: 46px; display: inline-block; animation: float 3.2s ease-in-out infinite; }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
.login-card h1 { font-size: 26px; text-align: center; letter-spacing: 2px; }
.login-card .sub { text-align: center; color: var(--muted); margin: 8px 0 28px; font-size: 14.5px; }
.login-card .field label { font-size: 14.5px; }
.login-card input { padding: 11px 12px; font-size: 15.5px; }
.login-hint { margin-top: 20px; font-size: 13.5px; color: var(--muted); background: #f4f8fd; border: 1px dashed var(--line); padding: 12px 14px; border-radius: 10px; line-height: 1.8; }

/* ---------- 佈局 ---------- */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar { background: linear-gradient(180deg, #0c1a33 0%, #10254a 100%); color: #dbe6f3; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.sidebar .brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar .brand .bee { font-size: 30px; filter: drop-shadow(0 0 10px rgba(6,182,212,.55)); }
.sidebar .brand .t { font-weight: 700; font-size: 20px; letter-spacing: 1px; color: #fff; display: block; }
.sidebar .brand .s { font-size: 10.5px; color: #7ea6cf; display: block; letter-spacing: 3px; }
.sidebar nav { flex: 1; overflow-y: auto; padding: 12px 10px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 10px; color: #b9cbe0; cursor: pointer; margin-bottom: 3px; font-size: 15.5px; position: relative; transition: background .15s, color .15s; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: linear-gradient(90deg, rgba(59,130,246,.32), rgba(6,182,212,.16)); color: #fff; font-weight: 600; }
.nav-item.active::before { content: ''; position: absolute; left: 0; top: 22%; bottom: 22%; width: 3.5px; border-radius: 4px; background: linear-gradient(180deg, #3b82f6, #06b6d4); box-shadow: 0 0 8px rgba(6,182,212,.8); }
.nav-item .ic { width: 22px; text-align: center; font-size: 16px; }
.nav-sec { font-size: 12px; color: #64829f; padding: 16px 16px 7px; letter-spacing: 1.5px; }
.sidebar .foot { padding: 16px 18px; border-top: 1px solid rgba(255,255,255,.08); font-size: 13px; color: #8fb0d0; line-height: 1.7; }
.sidebar .foot b { color: #d9e7f5; font-size: 14.5px; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { background: rgba(255,255,255,.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); padding: 14px 30px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 20; }
.topbar .crumb { font-size: 17px; font-weight: 700; letter-spacing: .5px; }
.who { display: flex; align-items: center; gap: 14px; position: relative; cursor: pointer; padding: 4px 8px; border-radius: 10px; }
.who:hover { background: #f2f6fc; }
.who .who-name { font-size: 15px; font-weight: 600; }
.who .role-badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: linear-gradient(90deg, #3b82f6, #06b6d4); color: #fff; margin-left: 6px; vertical-align: 1px; }
.who .agent-code { font-size: 13.5px; color: var(--muted); }
.who .avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--grad); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 17px; box-shadow: 0 0 0 3px rgba(59,130,246,.18); }
.who-menu { position: absolute; right: 0; top: 52px; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); min-width: 250px; padding: 10px; display: none; z-index: 60; }
.who-menu.open { display: block; animation: drop .16s ease-out; }
@keyframes drop { from { opacity: 0; transform: translateY(-6px); } }
.who-menu .mi { padding: 12px 14px; font-size: 14.5px; color: var(--muted); border-bottom: 1px solid #f0f3f8; line-height: 1.7; }
.who-menu .mi b { color: var(--text); font-size: 15.5px; }
.who-menu .logout-btn { width: 100%; margin-top: 8px; background: #fdeeee; color: var(--danger); border: 1px solid #f6cccc; border-radius: 10px; padding: 11px; font-size: 15px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 8px; }
.who-menu .logout-btn:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.content { padding: 28px 30px; max-width: 1320px; width: 100%; margin: 0 auto; }

/* 頁面標題 */
.page-head { margin-bottom: 20px; }
.page-head h2 { font-size: 24px; letter-spacing: .5px; background: linear-gradient(90deg, #16223a, #1c4e80); -webkit-background-clip: text; background-clip: text; color: transparent; }
.page-head .ph-sub { color: var(--muted); font-size: 14.5px; margin-top: 4px; }

/* ---------- 通用組件 ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card .hd { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card .hd h3 { font-size: 16.5px; }
.card .bd { padding: 20px; }
.grid { display: grid; gap: 18px; }
.g4 { grid-template-columns: repeat(4, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1080px) { .g4 { grid-template-columns: repeat(2, 1fr); } .g3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 720px) { .app { grid-template-columns: 1fr; } .sidebar { position: fixed; left: -260px; transition: left .25s; z-index: 50; width: 248px; } .sidebar.open { left: 0; } .g4, .g3, .g2 { grid-template-columns: 1fr; } .content { padding: 16px; } .who .who-name, .who .agent-code { display: none; } }

/* KPI 統計卡 */
.stat { padding: 20px 22px; display: flex; align-items: center; gap: 16px; position: relative; overflow: hidden; }
.stat::after { content: ''; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%; background: radial-gradient(circle, rgba(59,130,246,.10), transparent 70%); }
.stat .ico { width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 24px; flex: none; }
.stat .ico.a1 { background: #e8f1fe; } .stat .ico.a2 { background: #e6f7fb; }
.stat .ico.a3 { background: #fdeef2; } .stat .ico.a4 { background: #f3f0fd; }
.stat .ico.a5 { background: #e9f8f0; } .stat .ico.a6 { background: #fdf4e5; }
.stat .k { color: var(--muted); font-size: 14.5px; font-weight: 600; }
.stat .v { font-size: 28px; font-weight: 800; letter-spacing: .4px; font-variant-numeric: tabular-nums; line-height: 1.25; }
.stat .sub { font-size: 13.5px; color: var(--muted); }

.btn { display: inline-flex; align-items: center; gap: 7px; background: var(--grad); color: #fff; border: none; border-radius: 10px; padding: 10px 18px; font-weight: 600; font-size: 15px; box-shadow: 0 3px 12px rgba(37,99,235,.25); }
.btn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn.ghost { background: #fff; color: var(--primary); border: 1.5px solid var(--primary-2); box-shadow: none; }
.btn.small { padding: 5px 12px; font-size: 13.5px; border-radius: 8px; }
.btn.danger { background: var(--danger); }
.btn.ok { background: linear-gradient(135deg, #16a34a, #0d9488); }
.btn.warn { background: linear-gradient(135deg, #e08a1e, #d97706); }

input, select, textarea { font: inherit; border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; color: var(--text); width: 100%; font-size: 15px; }
input:focus, select:focus, textarea:focus { outline: 2.5px solid #b9d7f8; border-color: var(--primary-2); }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 14.5px; color: var(--muted); font-weight: 600; }
.frow { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .frow { grid-template-columns: 1fr; } }

table.tbl { width: 100%; border-collapse: collapse; font-size: 15px; }
.tbl th { text-align: left; color: var(--muted); font-weight: 700; font-size: 13.5px; padding: 12px 14px; border-bottom: 1.5px solid var(--line); background: #f7fafd; white-space: nowrap; letter-spacing: .5px; }
.tbl td { padding: 12px 14px; border-bottom: 1px solid #eef2f7; vertical-align: middle; }
.tbl tr:hover td { background: #f4f8fc; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tblwrap { overflow-x: auto; }

.tag { display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.tag.blue { background: #e7f0fb; color: #1c4e80; }
.tag.green { background: #e2f5ea; color: #1f7a4d; }
.tag.red { background: #fceaea; color: #b23131; }
.tag.orange { background: #fdf1e0; color: #a8620c; }
.tag.gray { background: #eef1f5; color: #5b6570; }
.tag.purple { background: #efe7fb; color: #6b3fa0; }

.badge-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 7px; }
.empty { text-align: center; color: var(--muted); padding: 44px 0; font-size: 15px; }
.searchbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.searchbar input, .searchbar select { width: auto; min-width: 190px; }

/* 模態框 */
.modal-mask { position: fixed; inset: 0; background: rgba(10, 20, 40, .5); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal { background: #fff; border-radius: 16px; width: 660px; max-width: 100vw; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.modal.wide { width: 940px; }
.modal .mh { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; background: #fff; z-index: 2; }
.modal .mh h3 { font-size: 18px; }
.modal .mb { padding: 22px; }
.modal .mf { padding: 15px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; position: sticky; bottom: 0; background: #fff; }
.x { background: none; border: none; font-size: 22px; color: var(--muted); }

/* toast */
#toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #10254a; color: #fff; padding: 12px 24px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: 15px; animation: fade .2s; }
.toast.err { background: var(--danger); }
@keyframes fade { from { opacity: 0; transform: translateY(-8px); } }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1.5px solid var(--line); margin-bottom: 18px; flex-wrap: wrap; }
.tab { padding: 10px 18px; cursor: pointer; border-bottom: 3px solid transparent; color: var(--muted); font-weight: 600; font-size: 15px; }
.tab.active { color: var(--primary); border-color: var(--primary); }

/* 看板 */
.kanban { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; align-items: start; }
.kan-col { background: #edf1f7; border-radius: 12px; padding: 12px; }
.kan-col .kt { font-size: 14px; font-weight: 700; padding: 4px 8px 10px; color: var(--muted); display: flex; justify-content: space-between; }
.kan-card { background: #fff; border-radius: 10px; padding: 14px; margin-bottom: 10px; box-shadow: var(--shadow); font-size: 14.5px; }

/* 計劃書 / 建議書 */
.proposal-doc { background: #fff; max-width: 880px; margin: 0 auto; padding: 60px 68px; border-radius: 10px; box-shadow: var(--shadow); line-height: 1.95; font-size: 15.5px; }
.proposal-doc h1 { font-size: 27px; text-align: center; margin-bottom: 4px; letter-spacing: 4px; }
.proposal-doc .doc-sub { text-align: center; color: var(--muted); margin-bottom: 32px; }
.proposal-doc h4 { margin: 28px 0 9px; border-left: 4px solid var(--primary-2); padding-left: 12px; font-size: 17px; }
.proposal-doc table { width: 100%; border-collapse: collapse; font-size: 15px; }
.proposal-doc table th { background: #f0f4f9; text-align: left; padding: 9px 12px; border: 1px solid var(--line); }
.proposal-doc table td { padding: 9px 12px; border: 1px solid var(--line); }
.proposal-doc .big { font-size: 22px; font-weight: 800; color: var(--primary); }
.proposal-doc .fine { font-size: 12.5px; color: var(--muted); line-height: 1.8; margin-top: 28px; border-top: 1px solid var(--line); padding-top: 13px; }
.share-bar { max-width: 880px; margin: 0 auto 18px; display: flex; gap: 10px; flex-wrap: wrap; }

/* 快照 */
.gap-item { border: 1px solid var(--line); border-left: 4px solid var(--warn); padding: 13px 16px; border-radius: 10px; margin-bottom: 11px; background: #fffdf8; }
.gap-item.good { border-left-color: var(--ok); background: #f6fcf8; }

/* bar chart */
.bars { display: flex; align-items: flex-end; gap: 16px; height: 150px; padding: 10px 4px 0; }
.bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 5px; height: 100%; }
.bar .fill { width: 72%; background: linear-gradient(180deg, #3b82f6, #1c4e80); border-radius: 5px 5px 0 0; min-height: 3px; box-shadow: 0 -2px 10px rgba(59,130,246,.35); }
.bar .l { font-size: 12px; color: var(--muted); }

/* 產品卡 */
.p-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 9px; position: relative; transition: transform .15s, box-shadow .15s; }
.p-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.p-card .pin { position: absolute; top: -9px; right: 14px; }
.p-card .insurer { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.p-card .dot { width: 10px; height: 10px; border-radius: 3px; }
.p-card h4 { font-size: 16.5px; }
.p-card .feat { font-size: 14px; color: var(--muted); line-height: 1.75; }
.p-card .acts { display: flex; gap: 8px; margin-top: 7px; flex-wrap: wrap; }
.p-card .ck { position: absolute; top: 14px; left: 14px; width: 17px; }

/* 分享頁 */
.share-page { max-width: 700px; margin: 0 auto; padding: 32px 18px; }
.bizcard { background: var(--grad-deep); color: #fff; border-radius: 18px; padding: 38px; box-shadow: var(--shadow-lg); }
.bizcard .n { font-size: 28px; font-weight: 800; letter-spacing: 1px; }
.bizcard .t { opacity: .85; margin-top: 6px; font-size: 15.5px; }
.bizcard .cs { margin-top: 24px; display: flex; flex-direction: column; gap: 9px; font-size: 16px; }
.bizcard a { color: #bfe8e2; }

/* 機器人演示（Company X 模擬 RPA） */
.robot-progress { height: 8px; background: #e6ecf4; border-radius: 6px; overflow: hidden; margin-bottom: 14px; }
.robot-progress .fillp { height: 100%; width: 0; background: linear-gradient(90deg, #3b82f6, #06b6d4); border-radius: 6px; transition: width .45s; }
.robot-console { background: #0c1a33; color: #c9e3f5; border-radius: 12px; padding: 16px 18px; font-family: Consolas, Menlo, monospace; font-size: 13.5px; line-height: 1.85; min-height: 300px; max-height: 340px; overflow-y: auto; }
.rc-line.ok { color: #5ee6a8; } .rc-line.err { color: #ff9d9d; }
.cx-window { border: 1.5px solid var(--line); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-lg); background: #fff; }
.cx-titlebar { background: #0f2a5c; color: #e7eefb; padding: 11px 18px; font-size: 13.5px; display: flex; align-items: center; gap: 10px; }
.cx-titlebar .dot3 { display: inline-flex; gap: 6px; }
.cx-titlebar .dot3 i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.cx-screen { min-height: 430px; background: #f7fafd; padding: 30px; display: flex; align-items: center; justify-content: center; }
.cx-empty { color: var(--muted); text-align: center; line-height: 2.1; font-size: 15.5px; }
.cx-login { width: 330px; background: #fff; border-radius: 14px; padding: 30px; box-shadow: var(--shadow); }
.cx-logo { font-weight: 800; font-size: 22px; text-align: center; margin-bottom: 20px; letter-spacing: 1px; }
.cx-field { margin-bottom: 14px; }
.cx-field label, .cx-row label { font-size: 13px; color: var(--muted); font-weight: 600; display: block; margin-bottom: 5px; }
.cx-input { border: 1.5px solid var(--line); border-radius: 9px; padding: 10px 12px; font-size: 15px; background: #fdfefe; min-height: 42px; display: flex; align-items: center; }
.cursor { display: inline-block; width: 9px; height: 18px; background: var(--primary-2); margin-left: 2px; animation: blink 1s step-start infinite; }
@keyframes blink { 50% { opacity: 0; } }
.cx-btn { text-align: center; background: #1c4e80; color: #fff; border-radius: 9px; padding: 11px; font-weight: 600; margin-top: 8px; transition: background .3s; }
.cx-btn.done { background: #14a06a; }
.cx-note { font-size: 12px; color: var(--muted); text-align: center; margin-top: 12px; }
.cx-menu { display: flex; width: 100%; height: 380px; background: #fff; border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); }
.cx-side { width: 200px; background: #f0f4fa; padding: 14px 10px; font-size: 14.5px; flex: none; }
.cx-side-item { padding: 10px 12px; border-radius: 8px; color: var(--muted); margin-bottom: 3px; }
.cx-side-item.active { background: #e1ecfd; color: #1c4e80; font-weight: 700; }
.cx-main { flex: 1; padding: 24px; color: var(--muted); font-size: 15px; display: flex; align-items: flex-start; }
.cx-form { width: 100%; max-width: 470px; background: #fff; border-radius: 10px; padding: 26px; box-shadow: var(--shadow); }
.cx-form-title { font-size: 17px; font-weight: 700; margin-bottom: 18px; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.cx-row { margin-bottom: 14px; }
.cx-calc { text-align: center; color: var(--muted); font-size: 16px; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.spin { width: 44px; height: 44px; border-radius: 50%; border: 4px solid #dce7f5; border-top-color: #3b82f6; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.cx-preview { width: 100%; max-width: 430px; position: relative; }
.cx-doc-mini { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 26px; box-shadow: var(--shadow); }
.dm-h { text-align: center; font-weight: 800; font-size: 17px; margin-bottom: 16px; letter-spacing: 2px; }
.dm-r { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed #e8edf4; font-size: 14.5px; }
.dm-r span { color: var(--muted); } .dm-r b { font-variant-numeric: tabular-nums; }
.cx-stamp { position: absolute; right: -8px; top: -12px; background: #e9f8f0; color: #14a06a; border: 2px solid #14a06a; border-radius: 8px; padding: 4px 12px; font-weight: 800; transform: rotate(6deg); font-size: 13.5px; }

@media print {
  body { background: #fff; }
  .sidebar, .topbar, .share-bar, .no-print, .who-menu { display: none !important; }
  .app { grid-template-columns: 1fr; }
  .content { padding: 0; max-width: none; }
  .proposal-doc { box-shadow: none; padding: 0; border-radius: 0; }
  .modal-mask { position: static; }
}
