:root {
    --bg: #030304;
    --bg2: #09090b;
    --panel: #100a0c;
    --panel2: #180f12;
    --line: #2e1217;
    --line2: #481a22;
    --fg: #ff3344;
    --muted: #a8535f;
    --green: #ff2a4b;
    --green-d: #d61836;
    --blue: #ff5268;
    --blue-d: #cc293e;
    --grad: linear-gradient(135deg, #ff1a3c 0%, #ff5268 100%);
    --danger: #ff0022;
    --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; color-scheme: dark; }
body {
    margin: 0;
    background:
      radial-gradient(900px 420px at 8% -10%, rgba(255,26,60,.15), transparent 60%),
      radial-gradient(900px 480px at 100% 0%, rgba(255,82,104,.12), transparent 60%),
      var(--bg);
    background-attachment: fixed;
    color: var(--fg);
    font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", "Segoe UI", system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
h1, h2, h3 { margin: 0; line-height: 1.3; font-weight: 700; color: #ff4d5e; }
h1 { font-size: 1.2rem; }
h2 { font-size: 1rem; }
h3 { font-size: .95rem; }
p { margin: 0; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

label { display: block; font-weight: 600; font-size: .85rem; color: #ff808d; margin-bottom: 6px; }
input, select, button, textarea { font: inherit; color: var(--fg); }
input[type="text"], input[type="password"], input[type="search"], textarea, select {
    width: 100%;
    min-height: 42px;
    padding: 8px 12px;
    background: var(--bg2);
    border: 1px solid var(--line2);
    border-radius: 8px;
    font-size: 16px;
    color: var(--fg);
    transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus {
    outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(255,42,75,.18);
}
input::placeholder { color: #6b2933; }
button {
    min-height: 42px; padding: 8px 16px; border-radius: 8px;
    border: 1px solid var(--line2); background: var(--panel2);
    cursor: pointer; font-weight: 600; font-size: .92rem; color: var(--fg);
    transition: background .15s, border-color .15s;
}
button:hover:not(:disabled) { border-color: var(--green); background: #241115; }
button.primary { background: var(--grad); color: #000; border: 0; font-weight: 800; }
button.danger { border-color: var(--danger); color: var(--danger); }
button.danger:hover:not(:disabled) { background: rgba(255,0,34,.15); }
.hint { font-size: .8rem; color: var(--muted); margin-top: 6px; }

header.top {
    position: sticky; top: 0; z-index: 30;
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    padding: 12px 20px;
    background: rgba(3,3,4,.85); backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand .logo { width: 30px; height: 30px; border-radius: 9px; background: var(--grad); display: grid; place-items: center; color: #000; font-weight: 900; }
.brand h1 { font-size: 1.05rem; }
.status { display: inline-flex; align-items: center; gap: 8px; font-size: .8rem; color: var(--muted); padding: 5px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #5c242b; }
.dot.on { background: var(--green); box-shadow: 0 0 0 3px rgba(255,42,75,.2); }
nav.tabs { display: flex; gap: 4px; padding: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; margin-left: auto; }
nav.tabs button { min-height: 34px; padding: 4px 16px; border: 0; background: transparent; color: var(--muted); }
nav.tabs button[aria-selected="true"] { background: var(--grad); color: #000; font-weight: 800; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 18px 20px 60px; }
section.panel {
    background: linear-gradient(180deg, var(--panel), #080405);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 18px;
    margin-bottom: 16px;
}
section.panel > h2 { margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
section.panel > h2::before { content: ""; width: 4px; height: 15px; border-radius: 3px; background: var(--grad); }

.form-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 640px) { .form-grid { grid-template-columns: 1fr 1fr; } }
.form-actions { margin-top: 16px; }

.b-node { border: 1px solid var(--line2); border-radius: 12px; padding: 14px; background: var(--bg2); }
.b-title { font-weight: 800; color: var(--green); margin-bottom: 6px; }

.member {
    display: grid; grid-template-columns: 1fr; gap: 10px; padding: 12px;
    background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px;
}
@media (min-width: 640px) { .member { grid-template-columns: 1fr 200px; align-items: center; } }
.member .name { font-weight: 700; color: var(--fg); }
.member .meta { color: var(--muted); font-size: .8rem; }
.empty { padding: 10px 0; color: var(--muted); font-size: .9rem; }

#toasts { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast { display: flex; align-items: center; gap: 10px; min-width: 260px; padding: 12px 14px; background: #180f12; border: 1px solid var(--line2); border-left: 4px solid var(--green); border-radius: 10px; }
.toast.err { border-left-color: var(--danger); }
.toast-ic { font-weight: 900; color: var(--green); }
.toast.err .toast-ic { color: var(--danger); }
.toast-tx { flex: 1; color: var(--fg); font-weight: 600; }
/* --- 登入頁面專屬精美排版 --- */
#login {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box {
    width: 100%;
    max-width: 420px;
    background: linear-gradient(180deg, var(--panel), #080405);
    border: 1px solid var(--line2);
    box-shadow: 0 10px 40px rgba(255, 0, 34, 0.2);
    border-radius: 16px;
    padding: 36px 28px;
    text-align: center;
}

.login-box .logo {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: var(--grad);
    display: grid;
    place-items: center;
    color: #000;
    font-weight: 900;
    font-size: 1.5rem;
    margin: 0 auto 16px;
    box-shadow: 0 0 20px rgba(255, 42, 75, 0.4);
}

.login-box h1 {
    font-size: 1.4rem;
    color: #ff3344;
    margin-bottom: 8px;
}

.login-box .muted {
    font-size: 0.9rem;
    color: var(--muted);
    margin-bottom: 24px;
}

.login-box button.primary {
    width: 100%;
    min-height: 46px;
    font-size: 1rem;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(255, 42, 75, 0.3);
    transition: transform 0.15s, box-shadow 0.15s;
}

.login-box button.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(255, 42, 75, 0.5);
}