:root {
  --ink:#1b302c; --muted:#5d7069; --paper:#f5f7f6; --surface:#fff;
  --line:#dee7e2; --accent:#206858; --accent-light:#eaf3ee; --danger:#a43336;
  --radius:16px; --nav-height:72px;
  font-family:-apple-system,BlinkMacSystemFont,"Noto Sans TC","PingFang TC",sans-serif;
  color:var(--ink); background:var(--paper); font-synthesis:none; font-variant-numeric:tabular-nums;
  font-size:16px; line-height:1.5; -webkit-text-size-adjust:100%;
}
* { box-sizing:border-box; }
body { margin:0; }
button,input,select,textarea { font:inherit; }
button,a,input,select,summary { touch-action:manipulation; -webkit-tap-highlight-color:transparent; }
button { cursor:pointer; border:0; min-height:44px; }
button:disabled { opacity:.55; cursor:wait; }
a { color:inherit; }
:where(button,a,input,select,textarea,summary):focus-visible { outline:2px solid var(--accent); outline-offset:3px; }
:where(button,a,summary):focus:not(:focus-visible), #content:focus, #dialog-title:focus, dialog:focus { outline:none; }
[hidden] { display:none!important; }
h1,h2,h3,p { margin:0; }
h1 { font-size:30px; line-height:1.3; letter-spacing:-.6px; font-weight:700; }
h2 { font-size:19px; line-height:1.4; } h3 { font-size:16px; } small { font-size:14px; }
input,select,textarea { border:1px solid #bdcdc5; background:white; border-radius:10px; padding:10px 12px; color:var(--ink); min-width:0; min-height:46px; font-size:16px; }
input:focus,select:focus { border-color:var(--accent); }
button svg { width:22px; height:22px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; flex-shrink:0; }
.skip { position:fixed; top:-70px; left:16px; padding:12px; background:white; z-index:30; } .skip:focus { top:8px; }
.workspace-header { min-height:76px; display:flex; align-items:center; justify-content:space-between; gap:20px; padding:12px 28px; background:var(--surface); border-bottom:1px solid var(--line); }
.guild-context { min-width:0; }
.guild-name { display:block; font-size:22px; font-weight:700; letter-spacing:-.3px; overflow-wrap:anywhere; }
.guild-context select { width:100%; max-width:360px; font-weight:600; background:var(--paper); }
.wheel-link { display:inline-flex; align-items:center; justify-content:center; gap:8px; min-height:44px; padding:10px 14px; flex-shrink:0; background:#f2ede2; border:1px solid #e7ddc7; border-radius:12px; color:#715426; text-decoration:none; font-size:15px; font-weight:600; }
.wheel-link:hover { background:#ebe2cd; }
.wheel-link svg { width:21px; height:21px; fill:none; stroke:currentColor; stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round; }
.wheel-arrow { font-size:17px; opacity:.65; }
.sidebar { position:fixed; inset:76px auto 0 0; width:236px; background:#152e28; color:#edf5ef; padding:20px; display:flex; flex-direction:column; }
.sidebar nav { display:grid; gap:6px; margin-top:0; }
.sidebar nav button { display:flex; align-items:center; gap:12px; background:transparent; color:#c3d5cb; text-align:left; padding:12px 14px; border-radius:10px; font-size:16px; }
.sidebar nav button:hover { background:#264339; }
.sidebar nav button[aria-current] { background:#deeee2; color:#1c4e3c; font-weight:650; }
.sidebar :focus-visible { outline-color:#bbddc9; }
.sidebar-foot { margin-top:auto; padding:20px 14px 0; display:grid; gap:3px; } .sidebar-foot small { color:#b2c6b9; }
main { margin-left:236px; padding:0 36px; max-width:1560px; }
.quiet { background:transparent; color:var(--muted); padding:10px 12px; border-radius:10px; font-size:14px; }
.quiet:hover { background:#e9efeb; color:var(--ink); }
#refresh { display:flex; align-items:center; justify-content:center; gap:6px; }
#refresh[aria-busy=true] svg { animation:rotate 1.2s linear infinite; }
.page-heading { padding:22px 0 18px; display:flex; justify-content:space-between; align-items:center; gap:12px; }
.page-heading>div:first-child { min-width:0; }
.page-actions { display:flex; align-items:center; gap:10px; flex-shrink:0; }
#updated-at { font-size:13px; color:var(--muted); }
#refresh { width:44px; height:44px; padding:10px; }
.page-heading p { font-size:15px; color:var(--muted); margin-top:6px; }
.stats { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; margin-bottom:20px; }
.stat { padding:20px; border:1px solid var(--line); border-radius:var(--radius); background:var(--surface); min-width:0; }
.stat:first-child { background:#235442; color:#f6fbf6; border-color:#235442; }
.stat .label { font-size:14px; color:var(--muted); }
.stat:first-child .label { color:#d3e5d8; }
.stat .value { font-size:clamp(24px,2.6vw,32px); margin-top:10px; font-weight:650; line-height:1.2; overflow-wrap:anywhere; }
.stat .unit { font-size:14px; margin-left:6px; font-weight:400; opacity:.85; }
.panel { border:1px solid var(--line); border-radius:var(--radius); background:var(--surface); overflow:hidden; margin-bottom:20px; }
.panel-heading { padding:18px 20px; display:flex; align-items:center; justify-content:space-between; gap:12px; border-bottom:1px solid var(--line); }
.panel-heading p { font-size:14px; color:var(--muted); margin-top:4px; }
.panel-body { padding:20px; }
.member-search-heading { padding:12px 16px; }
.member-search-heading .search { max-width:420px; }
.search { max-width:300px; width:100%; background:#f8faf8; }
.table-wrap { overflow:auto; }
table { width:100%; border-collapse:collapse; text-align:left; font-size:15px; }
th { font-size:13px; color:var(--muted); background:#f8faf8; font-weight:500; }
th,td { padding:14px 20px; border-bottom:1px solid #e9eeeb; }
tr:last-child td { border-bottom:0; }
.numeric { text-align:right; }
.name-cell { display:flex; align-items:center; gap:12px; min-width:0; }
.name-cell>div { min-width:0; overflow-wrap:anywhere; }
.avatar { width:36px; height:36px; border-radius:11px; background:#edf3ec; color:#46654f; display:grid; place-items:center; font-size:15px; overflow:hidden; flex-shrink:0; }
.avatar img { width:100%; height:100%; object-fit:cover; }
.sub { font-size:14px; color:var(--muted); margin-top:3px; line-height:1.5; overflow-wrap:anywhere; }
.pill { font-size:13px; display:inline-block; background:#edf3ed; color:#43664e; padding:3px 8px; border-radius:6px; white-space:nowrap; }
.amount { font-weight:650; font-size:17px; white-space:nowrap; }
.negative { color:var(--danger); } .positive { color:var(--accent); }
.link-button { display:inline-flex; align-items:center; justify-content:center; min-height:44px; background:transparent; color:var(--accent); font-size:14px; padding:8px 10px; border-radius:8px; }
.primary,.secondary { padding:11px 18px; border-radius:10px; font-size:16px; font-weight:600; }
.primary { background:var(--accent); color:white; } .primary:hover { background:#194f43; }
.secondary { background:#eaf2ec; color:var(--accent); border:1px solid #ccded2; }
.danger { color:var(--danger); }
.actions { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.run-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(248px,1fr)); gap:12px; margin-bottom:20px; }
.accounts-toolbar { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:12px; color:var(--muted); font-size:14px; }
.accounts-toolbar .secondary { font-size:14px; padding:10px 12px; white-space:nowrap; }
.account-list { border:1px solid var(--line); border-radius:var(--radius); background:var(--surface); overflow:hidden; }
.account-item { display:flex; align-items:center; padding-right:8px; }
.account-edit { width:44px; height:44px; flex-shrink:0; padding:10px; }
.account-edit svg { width:19px; height:19px; }
.accounts-unit { margin-left:10px; }
.account-item+.account-item { border-top:1px solid var(--line); }
.account-main { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:14px; padding:18px 20px; flex:1; min-width:0; background:transparent; color:var(--ink); text-align:left; }
.account-main:hover { background:#f4f8f5; }
.account-main:focus-visible { outline-offset:-3px; }
.account-identity { display:flex; align-items:center; flex-wrap:wrap; gap:6px 10px; min-width:0; }
.account-name { font-size:17px; font-weight:600; overflow-wrap:anywhere; }
.account-balance { font-size:22px; font-weight:650; text-align:right; }
.ledger-open { display:inline-grid; place-items:center; width:44px; height:44px; padding:10px; background:transparent; color:var(--muted); border-radius:10px; }
.ledger-open:hover { color:var(--accent); background:var(--accent-light); }
.ledger-open svg { width:18px; height:18px; }
.account-card { padding:18px; background:#fff; border:1px solid var(--line); border-radius:var(--radius); min-width:0; }
.account-card h3 { overflow-wrap:anywhere; }
.empty { padding:36px 20px; text-align:center; color:var(--muted); font-size:15px; line-height:1.7; }
.empty strong { display:block; color:var(--ink); font-size:18px; margin-bottom:6px; }
.notice { padding:14px 16px; background:#fff4e9; color:#804624; border:1px solid #ebceb4; border-radius:12px; margin-bottom:16px; font-size:15px; line-height:1.6; }
.notice button { margin-left:8px; }
.week-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(160px,1fr)); gap:12px; }
.day { padding:16px; border:1px solid var(--line); border-radius:12px; }
.day h3 { margin-bottom:12px; color:var(--accent); }
.schedule-item { margin-top:12px; font-size:16px; line-height:1.5; }
.schedule-time { font-size:14px; color:var(--muted); }
.form-grid { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.field { display:grid; gap:7px; font-size:15px; }
.field small { color:var(--muted); line-height:1.5; }
.rule-row { display:grid; grid-template-columns:1.2fr 1.2fr .7fr 1fr auto; gap:10px; margin:14px 0; align-items:end; }
.rule-row input,.rule-row select { width:100%; }
.rule-row label { display:grid; gap:6px; font-size:14px; color:var(--muted); min-width:0; }
.divider { border:0; border-top:1px solid var(--line); margin:20px 0; }
.hint { font-size:14px; color:var(--muted); line-height:1.65; }
.preview { margin-top:16px; padding:16px; background:#edf6ef; border-radius:12px; font-size:15px; line-height:1.8; }
.modal-form { display:grid; gap:16px; }
.dialog-actions { display:flex; justify-content:flex-end; gap:10px; margin-top:20px; }
.modal-form .dialog-actions { margin-top:0; }
.icon-button { display:grid; place-items:center; width:44px; height:44px; min-width:44px; padding:10px; border-radius:50%; background:#edf2ef; color:var(--ink); }
.icon-button:hover { background:#dfe9e2; }
dialog { border:1px solid var(--line); border-radius:20px; box-shadow:0 24px 80px #14312730; width:min(760px,calc(100% - 48px)); max-height:calc(var(--dialog-height,100dvh) - 64px); padding:0; color:var(--ink); background:white; overflow:hidden; }
dialog[open] { display:flex; flex-direction:column; }
dialog::backdrop { background:#142a2666; backdrop-filter:blur(4px); }
.dialog-heading { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:14px 20px; border-bottom:1px solid var(--line); flex-shrink:0; background:white; }
.dialog-heading h2 { overflow-wrap:anywhere; }
#dialog-body { padding:20px; overflow-y:auto; overscroll-behavior:contain; min-height:0; -webkit-overflow-scrolling:touch; }
#dialog-body .stats { margin-bottom:16px; }
.ledger-table td:first-child { overflow-wrap:anywhere; }
.loading-view { min-height:260px; }
.loading-status { display:flex; align-items:center; gap:10px; color:var(--muted); font-size:14px; margin-bottom:16px; }
.loading-status::before { content:""; width:16px; height:16px; border:2px solid #d3e2d8; border-top-color:var(--accent); border-radius:50%; animation:rotate 1s linear infinite; }
.skeleton { background:#e8eeea; border-radius:6px; position:relative; overflow:hidden; }
.skeleton::after { content:""; position:absolute; inset:0; transform:translateX(-100%); background:linear-gradient(90deg,transparent,#ffffff9c,transparent); animation:shimmer 1.7s ease-in-out infinite; }
.skeleton-line { height:14px; width:42%; margin:8px 0; }
.skeleton-value { height:28px; width:68%; margin-top:16px; }
.loading-summary { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; margin-bottom:16px; }
.loading-summary>div { padding:20px; background:#fff; border:1px solid var(--line); border-radius:16px; }
.loading-list { padding:4px 20px; }
.loading-row { display:flex; align-items:center; justify-content:space-between; gap:24px; padding:18px 0; border-bottom:1px solid var(--line); }
.loading-row:last-child { border:0; }
.loading-row .skeleton:first-child { width:48%; } .loading-row .skeleton:last-child { width:22%; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; border:0; }
.login-shell { min-height:100dvh; display:grid; place-items:center; padding:24px; background:radial-gradient(ellipse at 50% 45%,#e3eee7,transparent 65%),var(--paper); }
.login-card { width:min(430px,100%); padding:28px; background:white; border:1px solid var(--line); border-radius:20px; }
.login-card h1 { font-size:23px; line-height:1.4; }
#login-message { font-size:15px; line-height:1.7; color:var(--muted); margin:10px 0 20px; }
#login-actions { display:grid; gap:10px; }
.login-loader { display:grid; place-items:center; width:144px; height:144px; }
.orbit-loader { position:relative; display:block; width:84px; height:84px; }
.orbit-loader::before { content:""; position:absolute; inset:-24px; border-radius:50%; background:#d3e7db80; filter:blur(15px); animation:breathe 2.4s ease-in-out infinite; }
.orbit-loader i { position:absolute; inset:0; border:1.5px solid #20685820; border-top:2px solid #206858; border-radius:50%; animation:rotate 2.4s linear infinite; }
.orbit-loader i:nth-child(2) { inset:13px; border-top-color:#8aa56d; animation-direction:reverse; animation-duration:1.8s; }
.orbit-loader i:nth-child(3) { inset:26px; border-top-color:#b79755; animation-duration:1.2s; }
.orbit-loader b { position:absolute; inset:37px; background:var(--accent); border-radius:50%; animation:breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 50% { opacity:.4; transform:scale(.85); } }
.text-link { font-size:15px; color:var(--accent); display:inline-flex; min-height:44px; align-items:center; gap:8px; margin-top:12px; text-decoration:none; }
#toast { position:fixed; bottom:24px; left:50%; transform:translateX(-50%); padding:14px 20px; background:#173f32; color:white; border-radius:12px; box-shadow:0 8px 30px #142b3322; z-index:30; font-size:15px; width:max-content; max-width:calc(100% - 32px); }
@keyframes rotate { to { transform:rotate(360deg); } }
@keyframes shimmer { to { transform:translateX(100%); } }
@keyframes progress { 0% { transform:translateX(-100%); } 100% { transform:translateX(350%); } }
@media(max-width:1100px) {
  main { padding:0 24px; } .sidebar { width:212px; padding:24px 16px; } main { margin-left:212px; }
  .rule-row { grid-template-columns:1fr 1fr; padding:16px; border:1px solid var(--line); border-radius:12px; } .rule-row button { justify-self:end; grid-column:2; }
  .stat { padding:16px; } #updated-at { display:none; }
}
@media(max-width:700px) {
  :root { --radius:14px; }
  .workspace-header { min-height:68px; padding:10px 16px; gap:12px; }
  .guild-context { flex:1; }
  .guild-name { font-size:19px; line-height:1.4; }
  .wheel-link { gap:6px; padding:10px; font-size:14px; }
  .wheel-arrow { display:none; }
  .sidebar { position:static; width:auto; padding:0; }
  .sidebar nav { position:fixed; z-index:10; inset:auto 0 0; margin:0; padding:6px 8px calc(6px + env(safe-area-inset-bottom,0px)); display:flex; gap:4px; background:#fffffff5; border-top:1px solid var(--line); backdrop-filter:blur(16px); box-shadow:0 -4px 20px #1c382805; }
  .sidebar nav button { flex:1; flex-direction:column; gap:3px; min-width:0; min-height:56px; padding:6px 2px; font-size:13px; line-height:1.3; color:var(--muted); border-radius:10px; }
  .sidebar nav button svg { width:23px; height:23px; }
  .sidebar nav button[aria-current] { background:var(--accent-light); color:var(--accent); }
  .sidebar :focus-visible { outline-color:var(--accent); }
  .sidebar-foot { display:none; }
  main { margin:0; padding:0 16px calc(var(--nav-height) + env(safe-area-inset-bottom,0px) + 12px); }
  .page-heading { padding:18px 0 16px; align-items:flex-start; } .page-heading h1 { font-size:25px; } .page-heading p { font-size:14px; margin-top:4px; }
  .stats { grid-template-columns:1fr 1fr; gap:10px; margin-bottom:16px; }
  .stat { padding:14px 16px; } .stat:first-child { grid-column:1/-1; display:flex; align-items:center; justify-content:space-between; gap:12px; }
  .stat .value { font-size:26px; margin-top:6px; } .stat:first-child .value { margin:0; font-size:30px; } .stat .unit { font-size:13px; }
  .panel-heading { padding:16px; align-items:flex-start; flex-wrap:wrap; } .panel-heading p { font-size:14px; } .search { max-width:none; }
  .panel-body { padding:16px; } th,td { padding:12px 14px; }
  .member-table { table-layout:fixed; } .member-table th:nth-child(2),.member-table td:nth-child(2) { display:none; }
  .member-table th:first-child { width:auto; } .member-table th:nth-child(3) { width:34%; } .member-table th:last-child { width:48px; }
  .member-table th,.member-table td { padding:12px 8px; } .member-table th { font-size:12px; }
  .member-table .avatar { display:none; } .member-table .name-cell { gap:0; } .member-table .sub { font-size:13px; }
  .member-table th:last-child,.member-table td:last-child { padding:4px 4px 4px 0; }
  .member-table .amount { font-size:16px; overflow-wrap:anywhere; white-space:normal; }
  .run-grid { grid-template-columns:1fr; gap:12px; } .account-card { padding:16px; }
  .account-main { padding:16px 12px; gap:10px; }
  .account-identity { gap:5px; } .account-name { font-size:16px; }
  .account-balance { font-size:20px; max-width:130px; overflow-wrap:anywhere; }
  .accounts-unit { display:block; margin:0; font-size:13px; }
  .form-grid { grid-template-columns:1fr; gap:14px; } .rule-row { padding:12px; gap:12px; }
  .rule-row label:nth-child(1),.rule-row label:nth-child(2) { grid-column:1/-1; }
  .week-grid { grid-template-columns:1fr 1fr; gap:10px; } .day { padding:12px; }
  .empty { padding:28px 16px; }
  .loot-table thead { display:none; } .loot-table,.loot-table tbody { display:block; }
  .loot-table tr { display:grid; grid-template-columns:1fr auto; padding:16px; border-bottom:1px solid var(--line); gap:8px 12px; }
  .loot-table tr:last-child { border:0; } .loot-table td { display:block; padding:0; border:0; overflow-wrap:anywhere; }
  .loot-table td:first-child { font-weight:650; font-size:16px; grid-column:1; }
  .loot-table td:nth-child(2) { grid-column:1/-1; grid-row:2; font-size:14px; color:var(--muted); }
  .loot-table td:nth-child(3) { grid-column:1/-1; grid-row:3; font-size:14px; color:var(--muted); }
  .loot-table td:nth-child(3)::before { content:"參與者："; }
  .loot-table td:last-child { grid-column:2; grid-row:1; font-weight:600; } .loot-table td:last-child::before { content:"× "; }
  dialog { position:fixed; inset:var(--dialog-offset,0px) 0 auto; margin:0; width:100%; max-width:none; height:var(--dialog-height,100dvh); max-height:var(--dialog-height,100dvh); border:0; border-radius:0; box-shadow:none; }
  .dialog-heading { padding:10px 16px; padding-top:max(10px,env(safe-area-inset-top,0px)); min-height:64px; }
  #dialog-body { padding:16px 16px max(20px,env(safe-area-inset-bottom,0px)); flex:1; }
  #dialog-body .stats { gap:8px; } #dialog-body .stat { padding:12px; } #dialog-body .stat .value { font-size:24px; }
  .ledger-table { table-layout:fixed; } .ledger-table td { padding:14px 0; } .ledger-table td:first-child { padding-right:12px; width:65%; }
  .ledger-table .sub { font-size:13px; } .ledger-table .amount { white-space:normal; overflow-wrap:anywhere; }
  .dialog-actions>* { flex:1; }
  #policy-form>.actions { width:100%; } #policy-form .actions .primary { flex:1; }
  .login-card { padding:24px; } .login-shell { padding:20px; }
  .loading-summary { grid-template-columns:1fr 1fr; gap:10px; } .loading-summary>div:first-child { grid-column:1/-1; }
  .loading-summary>div { padding:14px; } .loading-list { padding:0 16px; }
  #toast { bottom:calc(var(--nav-height) + env(safe-area-inset-bottom,0px) + 12px); }
}
@media(prefers-reduced-motion:reduce) { *,*::before,*::after { animation:none!important; transition:none!important; scroll-behavior:auto!important; } }
@media(max-width:700px) {
  .member-table { font-size:16px; }
  .policy-actions { display:grid; grid-template-columns:1fr; }
  .policy-actions>button { width:100%; }
}
