*, *::before, *::after { box-sizing: border-box; }
:root {
    --bg: #f5f6fa;
    --white: #fff;
    --border: #e8eaef;
    --border-light: #f0f1f5;
    --text-0: #1a1d26;
    --text-1: #4a5068;
    --text-2: #70768a;
    --text-3: #b5b9c8;
    --primary: #48b06c;
    --primary-hover: #3d9a5e;
    --primary-light: #eaf7ee;
    --danger: #d64141;
    --danger-light: #fef0f0;
    --warning: #91610a;
    --warning-light: #fef8e8;
    --info: #416dc2;
    --info-light: #eef3fe;
    --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    --radius: 8px;
    --radius-sm: 6px;
}
html { font-size: 14px; }
body { margin: 0; font-family: var(--sans); background: var(--bg); color: var(--text-0); line-height: 1.5; letter-spacing: 0; }
button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
    outline: 3px solid var(--primary); outline-offset: 3px;
}
[hidden] { display: none !important; }
h1, h2, p { margin: 0; }
.btn { display: inline-flex; justify-content: center; align-items: center; gap: 6px; min-height: 36px; padding: 7px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--white); color: var(--text-1); font-weight: 500; white-space: nowrap; }
.btn:hover:not(:disabled) { background: var(--bg); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--white); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-danger { color: var(--danger); border-color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: var(--danger-light); }
.btn-solid-danger { background: var(--danger); color: var(--white); }
.btn-solid-danger:hover:not(:disabled) { background: #b53030; }
.btn-sm { min-height: 30px; padding: 4px 10px; font-size: 12px; }
.btn-ghost { background: transparent; border-color: transparent; }
.icon-btn { width: 34px; height: 34px; padding: 0; flex: 0 0 34px; }
.btn svg, .field-icon svg, .toolbar svg, .profile-row svg { width: 16px; height: 16px; flex-shrink: 0; }
.field { display: grid; gap: 7px; margin-bottom: 18px; }
.field > label, .field-label { color: var(--text-1); font-size: 13px; font-weight: 500; }
.form-input, .form-select { width: 100%; min-width: 0; height: 40px; padding: 8px 11px; color: var(--text-0); border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--white); }
.form-input::placeholder { color: var(--text-2); }
.field-icon { position: relative; }
.field-icon > svg { position: absolute; left: 12px; top: 12px; color: var(--text-2); }
.field-icon input { padding-left: 38px; }
.field-error { min-height: 21px; margin: 8px 0 0; font-size: 13px; color: var(--danger); overflow-wrap: anywhere; }
.topbar { min-height: 64px; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 0 28px; background: var(--white); border-bottom: 1px solid var(--border); }
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-brand { display: flex; align-items: center; gap: 10px; color: var(--primary-hover); font-weight: 700; font-size: 17px; white-space: nowrap; }
.topbar-brand img { width: 30px; height: 30px; object-fit: contain; border-radius: 4px; }
.topbar-nav { display: flex; margin-left: 20px; }
.topbar-nav a { text-decoration: none; font-size: 13px; padding: 7px 13px; border-radius: var(--radius-sm); color: var(--text-1); }
.topbar-nav a.active { background: var(--primary-light); color: var(--primary-hover); font-weight: 600; }
.topbar-user { font-size: 13px; color: var(--text-1); max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#login-overlay { min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.login-box { width: 380px; max-width: 100%; padding: 36px 30px 28px; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); }
.login-logo { display: block; width: 60px; height: 60px; object-fit: contain; margin: 0 auto 16px; }
.login-title { font-size: 21px; font-weight: 700; color: var(--primary-hover); text-align: center; }
.login-subtitle { color: var(--text-2); font-size: 13px; text-align: center; margin: 6px 0 28px; }
.login-box .btn-primary { width: 100%; margin-top: 6px; min-height: 42px; }
.login-state { color: var(--text-2); font-size: 12px; min-height: 18px; text-align: center; margin-bottom: 12px; }
dialog { width: 440px; max-width: calc(100vw - 32px); max-height: calc(100dvh - 32px); border: 1px solid var(--border); border-radius: var(--radius); padding: 0; color: var(--text-0); box-shadow: 0 16px 60px #0002; }
dialog::backdrop { background: #161b2866; }
.modal-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--border-light); }
.modal-header h2 { font-size: 16px; }
.modal-body { padding: 20px; }
.modal-footer { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border-light); }
.modal-body .field:last-of-type { margin-bottom: 0; }
.toggle-label { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; color: var(--text-1); }
.toggle-label input { width: 18px; height: 18px; accent-color: var(--primary); }
.read-only { padding: 10px 0; color: var(--text-0); font-weight: 600; overflow-wrap: anywhere; }
.toast-container { position: fixed; right: 24px; bottom: 24px; z-index: 10000; display: grid; gap: 8px; max-width: min(400px, calc(100vw - 32px)); pointer-events: none; }
.toast { background: var(--white); border: 1px solid var(--border); border-left: 4px solid var(--primary); padding: 12px 16px; border-radius: var(--radius-sm); box-shadow: 0 2px 12px #0001; overflow-wrap: anywhere; }
.toast-err { border-left-color: var(--danger); color: var(--danger); }
.danger-copy { color: var(--danger); font-weight: 600; margin-top: 12px; }
@media (max-width: 760px) {
    .topbar { padding: 12px 16px; flex-wrap: wrap; gap: 8px; }
    .topbar-left { flex: 1 1 100%; justify-content: space-between; }
    .topbar-nav { margin-left: 0; }
    .topbar-right { width: 100%; justify-content: flex-end; gap: 4px; }
    .topbar-user { margin-right: auto; max-width: 200px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
