:root {
  color-scheme: dark;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --bg: #08100f;
  --surface: #0e1817;
  --surface-2: #121f1d;
  --line: #263733;
  --line-soft: #1b2926;
  --text: #edf4ef;
  --muted: #879b94;
  --accent: #86d2a8;
  --accent-deep: #28694d;
  --gold: #ddc47e;
  --danger: #ef8c86;
  --sidebar: 248px;
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); }
button, input, select { font: inherit; }
button { color: inherit; }
.hidden { display: none !important; }
.eyebrow { margin: 0 0 7px; color: #72958a; font-size: 10px; font-weight: 700; letter-spacing: .22em; }
.muted { color: var(--muted); }

.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(380px, .92fr) minmax(480px, 1.08fr); background: #07100e; }
.login-brand { position: relative; overflow: hidden; padding: clamp(50px, 7vw, 92px); display: flex; flex-direction: column; justify-content: center; background: radial-gradient(circle at 23% 35%, #1e4a38 0, #10231d 33%, #0a1412 70%); border-right: 1px solid #25362f; }
.login-brand::before, .login-brand::after { content: ""; position: absolute; border: 1px solid rgba(141, 195, 164, .13); border-radius: 50%; }
.login-brand::before { width: 560px; height: 560px; left: -295px; top: calc(50% - 280px); box-shadow: 0 0 0 76px rgba(120, 180, 148, .025), 0 0 0 152px rgba(120, 180, 148, .018); }
.login-brand::after { width: 170px; height: 170px; right: 8%; top: 11%; border-style: dashed; }
.brand-seal { position: absolute; right: 10%; top: 15%; display: grid; place-items: center; width: 96px; height: 96px; border: 1px solid #54836d; border-radius: 50%; color: #7fb99a; font: 400 46px "STKaiti", KaiTi, serif; opacity: .65; transform: rotate(-8deg); }
.login-brand h1 { position: relative; margin: 10px 0 24px; font: 600 clamp(46px, 6vw, 80px)/1.07 "STKaiti", KaiTi, serif; letter-spacing: .09em; color: #f3f0df; }
.brand-copy { position: relative; max-width: 390px; color: #9fb3aa; font-size: 15px; line-height: 1.8; }
.security-note { position: absolute; left: clamp(50px, 7vw, 92px); bottom: 55px; display: flex; align-items: center; gap: 12px; color: #aec0b7; }
.security-note small { display: block; margin-top: 4px; color: #71877d; }
.security-dot { width: 32px; height: 32px; border: 1px solid #3f6754; border-radius: 50%; position: relative; }
.security-dot::after { content: ""; position: absolute; inset: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 15px var(--accent); }
.login-panel { display: grid; place-items: center; padding: 36px; background: radial-gradient(circle at 50% 40%, #111d1a 0, #09110f 62%); }
.login-card { width: min(430px, 100%); padding: 42px; border: 1px solid var(--line); background: rgba(14, 25, 22, .83); box-shadow: 0 30px 80px rgba(0, 0, 0, .35); }
.login-heading { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.login-heading h2 { margin: 0; font-size: 26px; }
.mini-seal { flex: 0 0 auto; display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid #4e775f; color: var(--accent); font: 22px KaiTi, serif; transform: rotate(-3deg); }
.login-card > label { display: grid; gap: 9px; margin-top: 23px; color: #c6d4ce; font-size: 13px; }
input, select { width: 100%; border: 1px solid #30433e; outline: none; background: #091310; color: var(--text); padding: 12px 13px; transition: .18s; }
input:focus, select:focus { border-color: #6dac8a; box-shadow: 0 0 0 3px rgba(91, 169, 127, .12); }
textarea { width: 100%; resize: vertical; border: 1px solid #30433e; outline: none; background: #091310; color: var(--text); padding: 13px; font: inherit; line-height: 1.7; transition: .18s; }
textarea:focus { border-color: #6dac8a; box-shadow: 0 0 0 3px rgba(91, 169, 127, .12); }
.password-field { position: relative; }
.password-field input { padding-right: 56px; }
.text-button { position: absolute; right: 5px; top: 5px; bottom: 5px; border: 0; background: transparent; color: #86a396; cursor: pointer; font-size: 12px; }
.primary-button, .primary-small { border: 1px solid #76bd95; background: #86d2a8; color: #08140e; font-weight: 700; cursor: pointer; transition: .18s; }
.primary-button { width: 100%; margin-top: 20px; padding: 14px 17px; display: flex; justify-content: space-between; }
.primary-button:hover, .primary-small:hover { background: #9ee3bd; transform: translateY(-1px); }
.primary-button:disabled { opacity: .55; cursor: wait; transform: none; }
.login-foot { display: flex; align-items: center; gap: 10px; margin-top: 25px; color: #5f746b; font-size: 10px; text-align: center; white-space: nowrap; }
.login-foot span { height: 1px; flex: 1; background: #283833; }
.form-error { min-height: 18px; margin: 10px 0 0; color: var(--danger); font-size: 12px; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; z-index: 10; inset: 0 auto 0 0; width: var(--sidebar); display: flex; flex-direction: column; padding: 28px 20px 20px; border-right: 1px solid var(--line); background: #0a1311; }
.sidebar-brand { display: flex; align-items: center; gap: 13px; padding: 0 8px 29px; }
.sidebar-brand b, .sidebar-brand small { display: block; }
.sidebar-brand b { font-family: KaiTi, serif; font-size: 20px; letter-spacing: .08em; }
.sidebar-brand small { margin-top: 3px; color: var(--muted); font-size: 10px; letter-spacing: .18em; }
#main-nav { display: grid; gap: 6px; }
.nav-item { position: relative; width: 100%; display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 10px; padding: 12px 13px; border: 1px solid transparent; background: transparent; color: #7f928b; text-align: left; cursor: pointer; }
.nav-item span { font: 600 10px ui-monospace, monospace; color: #4c6259; }
.nav-item b { font-size: 13px; font-weight: 500; }
.nav-item i { min-width: 21px; padding: 2px 6px; border-radius: 10px; background: #2a5a43; color: #b5e4c9; font-size: 9px; font-style: normal; text-align: center; }
.nav-item:hover { color: #d5e1dc; background: #101d19; }
.nav-item.active { border-color: #29493b; background: linear-gradient(90deg, rgba(50, 112, 78, .28), rgba(25, 55, 43, .14)); color: #e0eee6; }
.nav-item.active::before { content: ""; position: absolute; left: -21px; width: 2px; height: 24px; background: var(--accent); box-shadow: 0 0 14px rgba(134, 210, 168, .5); }
.nav-item.active span { color: var(--accent); }
.nav-divider { margin: 22px 12px 7px; border-top: 1px solid var(--line-soft); padding-top: 17px; }
.nav-divider small { color: #4f655c; font-size: 9px; letter-spacing: .2em; }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--line-soft); padding-top: 18px; }
.health-line { display: flex; align-items: center; gap: 10px; padding: 6px 8px 17px; }
.health-line > span { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px rgba(134,210,168,.7); }
.health-line b, .health-line small { display: block; }
.health-line b { font-size: 11px; }
.health-line small { margin-top: 4px; color: #60766d; font-size: 9px; }
.logout-button { width: 100%; padding: 10px; border: 1px solid #283b35; background: transparent; color: #82968e; cursor: pointer; }
.logout-button:hover { border-color: #7e4747; color: #e29a95; }

.content { min-height: 100vh; margin-left: var(--sidebar); padding: 0 clamp(26px, 4vw, 58px) 50px; background: radial-gradient(circle at 78% 0, rgba(30, 77, 56, .13), transparent 33%), #0a1211; }
.topbar { min-height: 108px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line-soft); }
.topbar h2 { margin: 0; font-size: 25px; letter-spacing: .02em; }
.account-chip { display: flex; align-items: center; gap: 11px; }
.account-chip > span { display: grid; place-items: center; width: 37px; height: 37px; border: 1px solid #426450; background: #14251d; color: var(--accent); font-family: KaiTi, serif; }
.account-chip b, .account-chip small { display: block; }
.account-chip b { font-size: 12px; }
.account-chip small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.page { display: none; padding-top: 30px; animation: reveal .24s ease; }
.page.active { display: block; }
@keyframes reveal { from { opacity: 0; transform: translateY(5px); } }
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; }
.kpi-card { position: relative; min-height: 158px; overflow: hidden; padding: 23px; border: 1px solid var(--line); background: linear-gradient(145deg, #101d1a, #0d1715); }
.kpi-card::after { content: ""; position: absolute; right: -30px; bottom: -50px; width: 120px; height: 120px; border: 1px solid rgba(129, 190, 158, .09); border-radius: 50%; }
.kpi-card.accent { border-top-color: #82caa2; background: linear-gradient(145deg, #14251e, #0d1815); }
.kpi-card p { margin: 0; color: #9aaca5; font-size: 12px; }
.kpi-card strong { display: block; margin: 13px 0 9px; font: 600 36px ui-monospace, "SFMono-Regular", monospace; letter-spacing: -.05em; }
.kpi-card small { color: #5e756c; font-size: 10px; }
.kpi-card > i { position: absolute; right: 20px; top: 22px; display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid #29483a; color: #75ad8e; font: normal 13px KaiTi, serif; }
.pulse { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: pulse 1.7s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(134,210,168,0); } 0%,100% { box-shadow: 0 0 0 0 rgba(134,210,168,.35); } }
.overview-grid { display: grid; grid-template-columns: 1.4fr .8fr; gap: 15px; margin-top: 15px; }
.panel { border: 1px solid var(--line); background: rgba(14, 24, 22, .88); }
.panel-head { min-height: 82px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 19px 23px; border-bottom: 1px solid var(--line-soft); }
.panel-head h3 { margin: 0; font-size: 15px; }
.link-button { border: 0; background: transparent; color: #78af93; font-size: 11px; cursor: pointer; }
.soft-badge { padding: 5px 8px; border: 1px solid #2d443b; color: #81968e; font-size: 9px; }
.room-list { min-height: 243px; }
.room-row { display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 13px; padding: 16px 23px; border-bottom: 1px solid var(--line-soft); }
.room-row:last-child { border-bottom: 0; }
.room-icon { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid #355a47; color: #86c4a2; font: 15px KaiTi, serif; }
.room-row b, .room-row small { display: block; }
.room-row b { font-size: 12px; }
.room-row small { margin-top: 4px; color: #6b8178; font-size: 9px; }
.live-status { color: #83c7a2; font-size: 10px; }
.system-list { padding: 8px 23px; }
.system-list > div { display: flex; justify-content: space-between; align-items: center; min-height: 54px; border-bottom: 1px solid var(--line-soft); color: #82968e; font-size: 11px; }
.system-list > div:last-child { border-bottom: 0; }
.system-list b { color: #bdccc6; font-weight: 500; }
.ok-dot { display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: var(--accent); }
.skeleton-box:empty { background: linear-gradient(100deg, transparent 20%, rgba(255,255,255,.025) 35%, transparent 50%) #0d1715; background-size: 240% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position: -150% 0; } }

.table-panel { min-height: 0; overflow: hidden; }
.broadcast-compose-panel { max-width: 920px; }
.broadcast-compose-panel .section-note { margin-bottom: 0; }
.broadcast-form { display: grid; gap: 10px; padding: 24px; }
.broadcast-form > label { color: #bdccc6; font-size: 12px; }
.broadcast-form textarea { min-height: 132px; }
.broadcast-form-foot { display: flex; align-items: center; justify-content: space-between; gap: 15px; color: #698078; font-size: 10px; }
.broadcast-form-foot b { color: #b6c9c0; font: 600 11px ui-monospace, monospace; }
.broadcast-result { display: none; margin: 0 24px 24px; padding: 12px 14px; border: 1px solid #344b41; color: #8fa49b; font-size: 11px; }
.broadcast-result.success,.broadcast-result.error { display: block; }
.broadcast-result.success { border-color: #397052; background: #10241a; color: #9fd4b5; }
.broadcast-result.error { border-color: #774542; background: #261716; color: #efaaa5; }
.table-toolbar { min-height: 88px; }
.toolbar-actions { display: flex; align-items: center; gap: 10px; }
.user-toolbar { flex-wrap: wrap; justify-content: flex-end; }
.sect-contribution-search { display: flex; align-items: stretch; gap: 7px; }
.sect-contribution-search input { width: 180px; padding: 9px 11px; border: 1px solid #2d403a; background: #0a1412; color: #d9e4df; font-size: 11px; outline: none; }
.sect-contribution-search input:focus { border-color: #6a917e; box-shadow: 0 0 0 2px rgba(106,145,126,.12); }
.search-box { display: flex; align-items: center; gap: 8px; width: 260px; padding: 0 11px; border: 1px solid #2d403a; background: #0a1412; color: #668076; }
.search-box input { border: 0; padding: 9px 0; background: transparent; box-shadow: none; font-size: 11px; }
.secondary-button, .primary-small { padding: 9px 13px; font-size: 11px; }
.secondary-button { border: 1px solid #354941; background: #111d1a; color: #a6b6af; cursor: pointer; }
.secondary-button:hover { border-color: #6a917e; color: #d9e4df; }
.secondary-button.danger-button { border-color: #66403e; color: #d98d88; }
.secondary-button.danger-button:hover { border-color: #9a514d; background: #241615; color: #f2aaa5; }
.secondary-button:disabled { opacity: .42; cursor: not-allowed; }
.table-scroll {
  position: relative;
  min-height: 320px;
  max-height: clamp(360px, calc(100vh - 305px), 680px);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable both-edges;
  border-bottom: 1px solid var(--line-soft);
  background: #0b1412;
}
table { width: 100%; min-width: 930px; border-collapse: collapse; }
th { position: sticky; z-index: 3; top: 0; height: 43px; padding: 0 18px; border-bottom: 1px solid var(--line); background: #0b1513; color: #647970; font-size: 9px; font-weight: 600; letter-spacing: .08em; text-align: left; white-space: nowrap; }
td { height: 63px; padding: 10px 18px; border-bottom: 1px solid var(--line-soft); color: #b4c3bd; font-size: 11px; white-space: nowrap; }
tbody tr:hover { background: rgba(83, 131, 105, .045); }
.table-scroll th:last-child, .table-scroll td:last-child:not(.empty-state) { position: sticky; right: 0; min-width: 116px; background: #0d1815; box-shadow: -12px 0 18px rgba(2, 8, 6, .48), -1px 0 #253a32; }
.table-scroll th:last-child { z-index: 5; background: #101c18; }
.table-scroll tbody tr:hover td:last-child:not(.empty-state) { background: #122019; }
#page-users table { min-width: 1540px; }
#page-gifts table { min-width: 1320px; }
#page-sects table { min-width: 1120px; }
#page-trash table { min-width: 1050px; }
.name-cell { display: flex; align-items: center; gap: 10px; }
.name-avatar { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid #345143; background: #101d19; color: #82ba9c; font: 14px KaiTi, serif; }
.user-avatar-button { position: relative; flex: none; overflow: hidden; padding: 0; cursor: zoom-in; }
.user-avatar-button:hover, .user-avatar-button:focus-visible { border-color: #75a88f; outline: none; box-shadow: 0 0 0 2px rgba(117, 168, 143, .16); }
.user-avatar-button span { grid-area: 1 / 1; }
.user-avatar-button img { grid-area: 1 / 1; z-index: 1; width: 100%; height: 100%; object-fit: cover; }
.name-cell b, .name-cell small { display: block; }
.name-cell b { color: #dbe6e1; font-size: 11px; }
.name-cell small { margin-top: 4px; color: #587067; font-size: 9px; }
.mono { color: #738a80; font-family: ui-monospace, monospace; }
.number { color: #d5deb8; font-family: ui-monospace, monospace; }
.level-badge, .role-badge, .status-badge { display: inline-block; padding: 4px 7px; border: 1px solid #30463d; font-size: 9px; }
.level-badge { color: #d5c080; }
.role-badge.admin { border-color: #5b7659; color: #c9d88c; }
.role-badge.viewer { color: #8ea59b; }
.status-badge.enabled { border-color: #315743; color: #81c39d; }
.status-badge.disabled { border-color: #5f3d3d; color: #d48984; }
.action-button { padding: 5px 9px; border: 1px solid #365047; background: transparent; color: #89aa9b; font-size: 9px; cursor: pointer; }
.action-button:hover { border-color: #75a88f; color: #d6e7df; }
.action-button.danger:hover { border-color: #8a4b49; color: #ef9b96; }
.action-button.restore { border-color: #45684e; color: #9cc99f; }
.action-button.transfer { border-color: #6f653d; color: #d6c985; }
.action-button.transfer:hover { border-color: #b39b4b; color: #fff1ad; }
.action-button:disabled { opacity: .45; cursor: not-allowed; }
.row-actions { display: inline-flex; flex-wrap: wrap; gap: 5px; }
.type-badge { display: inline-block; min-width: 42px; padding: 4px 7px; border: 1px solid #385046; text-align: center; font-size: 9px; }
.type-badge.sect { border-color: #6d6240; color: #d6c985; }
.type-badge.user { border-color: #39604e; color: #96ceb0; }
.trash-warning { display: flex; align-items: center; gap: 12px; margin: 16px 20px 0; padding: 11px 13px; border: 1px solid #654a38; background: #211711; color: #b9997f; font-size: 9px; }
.trash-warning b { color: #e0b58d; }
.table-footer { min-height: 49px; display: flex; align-items: center; padding: 0 22px; color: #5f746b; font-size: 9px; }
.empty-state { padding: 45px 20px !important; color: #62766e; text-align: center; }
.section-note { margin: 7px 0 0; color: #60766d; font-size: 10px; }
.user-avatar-preview { grid-column: 1 / -1; display: grid; justify-items: center; gap: 14px; min-width: min(520px, 70vw); padding: 8px 0 2px; }
.user-avatar-preview-image { display: grid; place-items: center; width: 220px; height: 220px; overflow: hidden; border: 1px solid #456c5b; background: #0c1714; color: #82ba9c; font: 52px KaiTi, serif; box-shadow: 0 14px 34px rgba(0, 0, 0, .34); }
.user-avatar-preview-image span, .user-avatar-preview-image img { grid-area: 1 / 1; }
.user-avatar-preview-image img { z-index: 1; width: 100%; height: 100%; object-fit: contain; background: #09110f; }
.user-avatar-preview > p { margin: 0; color: #6f887d; font-size: 10px; }
.user-avatar-preview > p.error { color: #d48984; }
.user-avatar-preview dl { width: 100%; margin: 0; border: 1px solid #263b33; }
.user-avatar-preview dl > div { display: grid; grid-template-columns: 92px minmax(0, 1fr); border-bottom: 1px solid #20332b; }
.user-avatar-preview dl > div:last-child { border-bottom: 0; }
.user-avatar-preview dt, .user-avatar-preview dd { margin: 0; padding: 10px 12px; }
.user-avatar-preview dt { color: #60766d; }
.user-avatar-preview dd { overflow-wrap: anywhere; color: #b4c3bd; white-space: normal; }
.auto-refresh { color: #698078; font-size: 10px; }
.room-filter { display: inline-flex; align-items: center; gap: 8px; padding: 7px 9px; border: 1px solid #3d624f; background: #13241d; color: #9dccb2; font-size: 9px; white-space: nowrap; }
.room-filter[hidden] { display: none; }
.room-filter button { padding: 0; border: 0; background: transparent; color: #87aa9a; cursor: pointer; }
.rooms-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 13px; padding: 20px; }
.room-card { position: relative; min-height: 228px; padding: 20px; border: 1px solid #263d34; background: linear-gradient(145deg, #111e1a, #0c1614); }
.room-card::after { content: "LIVE"; position: absolute; right: 16px; top: 16px; padding: 4px 6px; border: 1px solid #35614a; color: #83c7a2; font: 8px ui-monospace, monospace; }
.room-card h4 { margin: 15px 0 5px; font-size: 15px; }
.room-card > small { color: #5b7469; font: 9px ui-monospace, monospace; }
.room-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 22px; }
.room-stats div { padding: 10px; border: 1px solid #20342d; background: #0b1512; }
.room-stats span, .room-stats b { display: block; }
.room-stats span { color: #60756c; font-size: 8px; }
.room-stats b { margin-top: 5px; color: #bacdc4; font-size: 11px; }
.room-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.room-actions button { flex: 1; min-width: 90px; padding: 7px 8px; border: 1px solid #304a3f; background: #0b1612; color: #91ad9f; font-size: 9px; cursor: pointer; }
.room-actions button:hover { border-color: #72a58c; color: #d7e6df; }
.room-actions button:disabled { opacity: .38; cursor: not-allowed; }
.room-actions .gift-compensation-button { flex-basis: 100%; border-color: #766438; background: #1c190f; color: #d9c27d; }
.room-actions .gift-compensation-button:hover:not(:disabled) { border-color: #b0964d; background: #282112; color: #f0d891; }
.equipment-summary { display: flex; align-items: center; gap: 4px; }
.equipment-chip { display: inline-block; padding: 3px 5px; border: 1px solid #354b42; color: #b5c69e; font-size: 8px; }
.equipment-more { color: #6b8178; font-size: 8px; }

.rules-panel { min-height: 680px; }
.rules-loading { padding: 70px 24px; color: #71877d; text-align: center; }
.rules-form { display: grid; gap: 15px; padding: 20px; }
.rules-form[hidden] { display: none; }
.schedule-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; }
.schedule-summary article { min-height: 92px; padding: 15px 16px; border: 1px solid #2a4238; background: linear-gradient(145deg, #101e19, #0b1512); }
.schedule-summary span, .schedule-summary b, .schedule-summary small { display: block; }
.schedule-summary span { color: #6f867c; font-size: 8px; letter-spacing: .12em; }
.schedule-summary b { margin-top: 10px; color: #d2dfd8; font-size: 12px; }
.schedule-summary small { margin-top: 7px; color: #5c7168; font-size: 8px; }
.rules-section { border: 1px solid #263c33; background: #0b1512; }
.rules-section-head { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 16px 18px; border-bottom: 1px solid #21342c; }
.rules-section-head h4 { margin: 0; font-size: 13px; }
.rules-section-head p:not(.eyebrow) { margin: 6px 0 0; color: #60766d; font-size: 9px; }
.rules-field-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; padding: 17px 18px; }
.rules-field-grid.compact { grid-template-columns: repeat(5, minmax(120px, 1fr)); }
.rules-field-grid label, .loot-entry label, .special-drop-row label { display: grid; gap: 7px; color: #91a69d; font-size: 9px; }
.rules-field-grid label.full { grid-column: 1 / -1; }
.rules-field-grid textarea { width: 100%; resize: vertical; padding: 10px 11px; border: 1px solid #2d403a; background: #0a1412; color: #d9e4df; font: 10px/1.55 ui-monospace, monospace; outline: none; }
.rules-field-grid textarea:focus { border-color: #6dac8a; box-shadow: 0 0 0 3px rgba(91, 139, 116, .12); }
.rules-field-grid label > small { color: #5f756b; font-size: 8px; }
.rules-field-grid input[readonly] { color: #7f938a; cursor: not-allowed; }
.weekday-field { grid-column: 1 / -1; min-width: 0; margin: 0; padding: 11px 12px 12px; border: 1px solid #2a4137; }
.weekday-field legend { padding: 0 6px; color: #91a69d; font-size: 9px; }
.weekday-picker { display: grid; grid-template-columns: repeat(7, minmax(48px, 1fr)); gap: 7px; }
.weekday-option { position: relative; display: block !important; cursor: pointer; }
.weekday-option input { position: absolute; opacity: 0; pointer-events: none; }
.weekday-option span { display: flex; min-height: 34px; align-items: center; justify-content: center; border: 1px solid #2b4439; background: #0d1915; color: #71877d; font-size: 9px; transition: .16s; }
.weekday-option input:checked + span { border-color: #6c987e; background: #193326; color: #d7e5de; box-shadow: inset 0 -2px #8aac65; }
.weekday-option input:focus-visible + span { outline: 2px solid #91b59f; outline-offset: 1px; }
.switch-card { display: flex !important; align-items: center; gap: 10px !important; min-height: 55px; padding: 9px 11px; border: 1px solid #2a4137; background: #0e1b17; }
.switch-card input { flex: 0 0 auto; width: 17px; height: 17px; accent-color: var(--accent-deep); }
.switch-card span, .switch-card b, .switch-card small { display: block; }
.switch-card b { color: #c8d7d0; font-size: 10px; }
.switch-card small { margin-top: 4px; color: #5f756b; font-size: 8px; }
.runtime-stage-list, .normal-loot-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 15px; }
.runtime-stage-card, .loot-stage-card { border: 1px solid #253b32; background: #0d1815; }
.runtime-stage-title, .loot-stage-head { min-height: 57px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-bottom: 1px solid #21342c; }
.runtime-stage-title .switch-card { min-height: auto; padding: 0; border: 0; background: transparent; }
.runtime-stage-card .rules-field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 12px; }
.loot-stage-head b, .loot-stage-head small { display: block; }
.loot-stage-head b { color: #c8d8d0; font-size: 10px; }
.loot-stage-head small { margin-top: 4px; color: #60766d; font-size: 8px; }
.loot-entry-list { padding: 5px 12px; }
.loot-entry { display: grid; grid-template-columns: 1fr 1.2fr auto; align-items: end; gap: 8px; padding: 9px 0; border-bottom: 1px solid #1e3029; }
.loot-entry input, .special-drop-row input, .special-drop-row select { padding: 8px 9px; }
.add-loot-entry { padding: 11px 12px; }
.special-drop-list { padding: 15px; }
.special-drop-row { display: grid; grid-template-columns: 1fr 1.2fr 1.4fr auto; align-items: end; gap: 10px; padding: 11px 12px; border: 1px solid #253b32; border-bottom: 0; background: #0d1815; }
.special-drop-row:last-child { border-bottom: 1px solid #253b32; }
.rules-error { min-height: 0; margin: 0; padding: 0 20px 22px; }
.rules-status { display: none; margin: 0 20px 12px; padding: 11px 13px; border: 1px solid #2c4339; background: #0c1714; color: #789087; font-size: 10px; }
.rules-status.show { display: block; }
.rules-status.pending { border-color: #4f5940; color: #c1b783; }
.rules-status.success { border-color: #397052; background: #10241a; color: #9fd4b5; }
.rules-status.error { border-color: #774542; background: #261716; color: #efaaa5; }
.platform-filter { display: flex; align-items: center; gap: 7px; color: #789087; font-size: 11px; }
.platform-filter select { min-width: 120px; padding: 8px 10px; border: 1px solid #293d35; border-radius: 3px; background: #0b1512; color: #c7d6d0; }
.platform-badge { display: inline-flex; min-width: 42px; justify-content: center; padding: 4px 8px; border: 1px solid #315744; border-radius: 12px; color: #a9d9bd; font: 600 10px ui-monospace, monospace; }
.platform-badge.unknown { border-color: #3b4541; color: #778680; }
.platform-panel { padding-bottom: 18px; }
.platform-panel + .platform-panel { margin-top: 18px; }
.platform-form { padding: 0 20px 18px; }
.platform-status-card { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; margin-bottom: 18px; border: 1px solid #263a32; background: #263a32; }
.platform-status-card > div { display: grid; gap: 6px; padding: 14px; background: #0c1714; }
.platform-status-card b { color: #647970; font-size: 10px; font-weight: 500; }
.platform-status-card strong { color: #b9ddc8; font-size: 13px; }
.platform-security-note { margin: 18px 0 0; padding: 12px 14px; border-left: 2px solid #94743d; background: #1b1810; color: #b9aa86; font-size: 11px; line-height: 1.7; }
.platform-security-note code { color: #e0c983; }
@media (max-width: 760px) { .platform-status-card { grid-template-columns: 1fr; } }

dialog { width: min(720px, calc(100% - 30px)); max-height: calc(100vh - 40px); overflow: auto; padding: 0; border: 1px solid #385348; background: #0d1815; color: var(--text); box-shadow: 0 30px 100px #000; }
dialog::backdrop { background: rgba(2, 8, 6, .76); backdrop-filter: blur(4px); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; padding: 21px 24px; border-bottom: 1px solid var(--line); }
.dialog-head h3 { margin: 0; font-size: 17px; }
.dialog-close { border: 0; background: transparent; color: #82968d; font-size: 23px; cursor: pointer; }
.dialog-x { border: 0; background: transparent; color: #82968d; font-size: 23px; cursor: pointer; }
.dialog-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 23px 24px 10px; }
.dialog-fields label { display: grid; gap: 8px; color: #9cafA6; font-size: 11px; }
.dialog-fields label.full { grid-column: 1 / -1; }
.dialog-fields label small { color: #5f736b; font-size: 9px; font-weight: 400; }
.dialog-section-title { grid-column: 1 / -1; display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-top: 4px; padding: 13px 0 2px; border-top: 1px solid #263b33; }
.dialog-section-title b { color: #cddbd4; font-size: 12px; }
.dialog-section-title small { color: #62776e; font-size: 9px; text-align: right; }
.dialog-fields .switch-line { display: flex; align-items: center; gap: 10px; }
.dialog-fields input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent-deep); }
.equipment-manager { grid-column: 1 / -1; margin-top: 5px; border: 1px solid #263b33; background: #0a1411; }
.equipment-manager-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid #20322b; }
.equipment-manager-head h4 { margin: 0; font-size: 12px; }
.equipment-manager-head small { display: block; margin-top: 4px; color: #61766d; font-size: 8px; }
.equipment-list-row { display: grid; grid-template-columns: 1.2fr .65fr .65fr .8fr auto; align-items: center; gap: 8px; min-height: 47px; padding: 7px 14px; border-bottom: 1px solid #1d2e28; color: #aebeb7; font-size: 10px; }
.equipment-list-row:last-child { border-bottom: 0; }
.equipment-list-row b { color: #d2dfd8; }
.equipment-list-row .equipment-actions { display: flex; gap: 5px; }
.equipment-inline { display: grid; grid-template-columns: 1.2fr .7fr .7fr 1fr auto; align-items: end; gap: 8px; padding: 12px 14px; border-top: 1px solid #30493e; background: #0e1b17; }
.equipment-inline[hidden] { display: none; }
.equipment-inline label { gap: 5px; font-size: 9px; }
.equipment-inline input, .equipment-inline select { padding: 8px; }
.equipment-inline-actions { display: flex; gap: 5px; padding-bottom: 1px; }
.info-grid { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 1px; border: 1px solid #273c34; background: #273c34; }
.info-grid > div { min-height: 65px; padding: 13px 15px; background: #0b1512; }
.info-grid span, .info-grid b { display: block; }
.info-grid span { color: #61766d; font-size: 9px; }
.info-grid b { margin-top: 7px; color: #cfddd6; font-size: 11px; word-break: break-all; }
#dialog-error { padding: 0 24px; }
.gift-compensation-dialog { width: min(660px, calc(100% - 30px)); }
.compensation-context { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin: 22px 24px 0; border: 1px solid #34493f; background: #34493f; }
.compensation-context > div { padding: 13px 15px; background: #0b1512; }
.compensation-context span, .compensation-context b { display: block; }
.compensation-context span { color: #61766d; font-size: 9px; }
.compensation-context b { margin-top: 7px; color: #d6c985; font-size: 12px; }
.compensation-context p { grid-column: 1 / -1; margin: 0; padding: 11px 14px; background: #101b17; color: #738a80; font-size: 9px; line-height: 1.7; }
.compensation-fields { padding-top: 18px; }
.compensation-summary { padding: 11px 13px; border: 1px solid #5b5232; background: #1b180e; color: #d8c681; font-size: 10px; line-height: 1.65; }
.compensation-success { margin: 0 24px 12px; padding: 11px 13px; border: 1px solid #3f6d55; background: #10251b; color: #a9dec0; font-size: 10px; line-height: 1.65; }
.compensation-success:empty { display: none; }
#gift-compensation-error { padding: 0 24px; }
#direct-gift-compensation-error { padding: 0 24px; }
.reward-compensation-error { padding: 0 24px; }
.direct-compensation-context b { color: #a9dec0; }
.transfer-context b { color: #e4ca73; }
.gift-summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; margin-bottom: 13px; }
.gift-summary-grid article { min-height: 112px; padding: 18px 20px; border: 1px solid #2a4037; background: linear-gradient(145deg, #101d1a, #0c1614); }
.gift-summary-grid article.accent { border-color: #665b34; background: linear-gradient(145deg, #201c10, #111710); }
.gift-summary-grid span, .gift-summary-grid strong, .gift-summary-grid small { display: block; }
.gift-summary-grid span { color: #70867d; font-size: 9px; }
.gift-summary-grid strong { margin-top: 10px; color: #d7e4dd; font: 600 25px ui-monospace, monospace; }
.gift-summary-grid article.accent strong { color: #e0ca83; }
.gift-summary-grid small { margin-top: 5px; color: #586e65; font-size: 8px; }
.gift-filter-form { display: flex; align-items: flex-end; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.gift-filter-form label { display: grid; gap: 5px; color: #758a81; font-size: 8px; }
.gift-filter-form input { width: 145px; padding: 8px 9px; font-size: 10px; }
.gift-record-panel .table-scroll { max-height: clamp(360px, calc(100vh - 430px), 620px); }
.gift-name { color: #d7c681; }
.gift-total { color: #ead489; font-weight: 700; }
.source-badge { display: inline-block; padding: 4px 7px; border: 1px solid #345647; font-size: 8px; }
.source-badge.platform { color: #8ec9aa; }
.source-badge.compensation { border-color: #766438; color: #d9c27d; }
.source-badge.mixed { border-color: #5d5875; color: #bcb4e2; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; padding: 17px 24px 23px; }
.cleanup-dialog { width: min(860px, calc(100% - 30px)); }
.cleanup-rule { display: grid; gap: 5px; margin: 18px 24px 12px; padding: 12px 14px; border: 1px solid #654a38; background: #211711; color: #b9997f; font-size: 10px; }
.cleanup-rule b { color: #e0b58d; }
.cleanup-rule code { color: #d6c985; font-family: ui-monospace, monospace; }
.test-user-cleanup-list { max-height: min(460px, calc(100vh - 300px)); margin: 0 24px; overflow: auto; border: 1px solid #263b33; background: #0a1411; }
.test-user-cleanup-row { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(220px, 1.6fr) auto auto; align-items: center; gap: 12px; min-height: 57px; padding: 9px 12px; border-bottom: 1px solid #1d2e28; }
.test-user-cleanup-row:last-child { border-bottom: 0; }
.test-user-cleanup-row b, .test-user-cleanup-row small { display: block; }
.test-user-cleanup-row b { color: #d2dfd8; font-size: 11px; }
.test-user-cleanup-row small { margin-top: 4px; color: #61766d; font-size: 9px; }
.test-user-cleanup-row .mono { overflow: hidden; text-overflow: ellipsis; font-size: 10px; }
.cleanup-live { padding: 4px 7px; border: 1px solid #774542; color: #efaaa5; font-size: 9px; white-space: nowrap; }
.cleanup-safe { color: #6f8b7e; font-size: 9px; white-space: nowrap; }
.cleanup-error { min-height: 18px; padding: 0 24px; }
.cleanup-count { margin-right: auto; color: #789087; font-size: 10px; }
.toast { position: fixed; z-index: 50; right: 24px; bottom: 24px; max-width: 360px; padding: 13px 17px; border: 1px solid #3f6654; background: #11251c; color: #c7dfd1; font-size: 11px; opacity: 0; transform: translateY(12px); pointer-events: none; transition: .25s; }
.toast.show { opacity: 1; transform: none; }
.toast.error { border-color: #764745; background: #281717; color: #efaaa5; }
body:not(.is-development) .development-only { display: none !important; }
.platform-test-panel { max-width: 980px; }
.platform-test-form { display: grid; gap: 18px; padding: 22px; }
.platform-test-warning { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid #725d31; background: #201a0d; color: #c9b978; font-size: 10px; }
.platform-test-warning b { color: #ead786; }
.platform-test-actions { display: flex; align-items: center; gap: 16px; }
.platform-test-actions .primary-button { width: auto; min-width: 190px; }
#platform-test-result { margin: 0; color: #8fc6a8; font-size: 10px; }
#platform-test-result.error { color: #e79b95; }

@media (max-width: 1050px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .overview-grid { grid-template-columns: 1fr; }
  .rooms-grid { grid-template-columns: repeat(2, 1fr); }
  .rules-field-grid, .rules-field-grid.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .runtime-stage-list, .normal-loot-list { grid-template-columns: 1fr; }
  .schedule-summary { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  :root { --sidebar: 76px; }
  .sidebar { padding: 20px 12px; }
  .sidebar-brand { justify-content: center; padding: 0 0 22px; }
  .sidebar-brand > div, .nav-item b, .nav-divider small, .health-line { display: none; }
  .nav-item { grid-template-columns: 1fr; text-align: center; padding: 12px 5px; }
  .nav-item span { font-size: 11px; }
  .nav-item i { position: absolute; top: 4px; right: 3px; min-width: 16px; padding: 1px 4px; }
  .sidebar-foot { padding-top: 12px; }
  .logout-button { font-size: 0; }
  .logout-button::after { content: "退"; font: 13px KaiTi, serif; }
  .content { padding: 0 18px 35px; }
  .topbar { min-height: 88px; }
  .account-chip > div { display: none; }
  .table-toolbar { align-items: flex-start; flex-direction: column; }
  .toolbar-actions { width: 100%; }
  .search-box { flex: 1; width: auto; }
  .rooms-grid { grid-template-columns: 1fr; }
  .gift-summary-grid { grid-template-columns: 1fr; }
  .gift-filter-form { width: 100%; justify-content: flex-start; }
  .table-scroll { min-height: 280px; max-height: calc(100dvh - 245px); }
}
@media (max-width: 700px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { min-height: 270px; padding: 42px 30px; justify-content: flex-start; }
  .login-brand h1 { font-size: 42px; }
  .brand-copy, .security-note { display: none; }
  .brand-seal { width: 70px; height: 70px; font-size: 34px; }
  .login-panel { padding: 24px 18px 45px; place-items: start center; }
  .login-card { padding: 28px 24px; }
  .kpi-grid { grid-template-columns: 1fr; }
  .dialog-fields { grid-template-columns: 1fr; }
  .dialog-fields label.full { grid-column: auto; }
  .test-user-cleanup-row { grid-template-columns: 1fr auto; }
  .test-user-cleanup-row .mono { grid-column: 1 / -1; }
  .equipment-manager { grid-column: auto; }
  .equipment-list-row { grid-template-columns: 1fr 1fr; padding: 10px; }
  .equipment-list-row .equipment-actions { grid-column: 1 / -1; }
  .equipment-inline { grid-template-columns: 1fr 1fr; }
  .equipment-inline-actions { grid-column: 1 / -1; }
  .info-grid { grid-column: auto; grid-template-columns: 1fr; }
  .rules-form { padding: 12px; }
  .rules-section-head { align-items: flex-start; flex-direction: column; }
  .rules-field-grid, .rules-field-grid.compact, .runtime-stage-card .rules-field-grid { grid-template-columns: 1fr; }
  .weekday-picker { grid-template-columns: repeat(4, 1fr); }
  .special-drop-row { grid-template-columns: 1fr 1fr; }
}
