:root {
  color-scheme: light;
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-soft: #f8f9fc;
  --border: #e4e7ef;
  --text: #202331;
  --muted: #73798c;
  --primary: #5b4bdb;
  --primary-dark: #4939c2;
  --primary-soft: #eeecff;
  --green: #168a5b;
  --green-soft: #e9f8f1;
  --red: #d64550;
  --red-soft: #fff0f1;
  --amber: #a96809;
  --amber-soft: #fff6dc;
  --shadow: 0 14px 35px rgba(32, 35, 49, .07);
  --radius: 16px;
  font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #11131a;
  --surface: #191c25;
  --surface-soft: #20242f;
  --border: #303543;
  --text: #edf0f8;
  --muted: #9ba2b5;
  --primary: #897cf5;
  --primary-dark: #a69cff;
  --primary-soft: #2b2848;
  --green: #56d49c;
  --green-soft: #18382d;
  --red: #ff7b83;
  --red-soft: #45262b;
  --amber: #f2bc5c;
  --amber-soft: #3d321e;
  --shadow: 0 14px 35px rgba(0, 0, 0, .24);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; color: var(--text); background: var(--bg); min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
a { color: inherit; text-decoration: none; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 72px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(16px);
}

.brand { display: inline-flex; align-items: center; gap: 11px; width: max-content; }
.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  font-weight: 800;
  background: linear-gradient(140deg, #7868f1, #4b3bc4);
  box-shadow: 0 8px 20px rgba(91, 75, 219, .28);
}
.brand b, .brand small { display: block; }
.brand b { font-size: 14px; letter-spacing: .01em; }
.brand small { color: var(--muted); font-size: 11px; margin-top: 2px; }
.nav { display: flex; align-items: center; gap: 6px; padding: 5px; border-radius: 12px; background: var(--surface-soft); }
.nav-link { padding: 9px 15px; border-radius: 9px; color: var(--muted); font-size: 14px; font-weight: 600; }
.nav-link:hover { color: var(--text); }
.nav-link.active { color: var(--primary); background: var(--surface); box-shadow: 0 2px 8px rgba(30, 35, 50, .06); }
.header-actions { justify-self: end; display: flex; align-items: center; gap: 10px; }
.icon-button, .close-button { border: 1px solid var(--border); color: var(--text); background: var(--surface); }
.icon-button { width: 38px; height: 38px; border-radius: 11px; }
.status { display: inline-flex; align-items: center; gap: 7px; padding: 8px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.status i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 15%, transparent); }
.status-live { color: var(--green); background: var(--green-soft); }
.status-waiting { color: var(--amber); background: var(--amber-soft); }
.status-offline { color: var(--red); background: var(--red-soft); }
.status-manual { color: var(--amber); background: var(--amber-soft); }

.dashboard-shell { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; max-width: 1520px; margin: 0 auto; padding: 22px; }
.stream-panel { min-width: 0; height: calc(100vh - 116px); display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px 14px; }
.panel-heading h1, .page-intro h1 { margin: 2px 0 0; font-size: 22px; letter-spacing: -.02em; }
.eyebrow { margin: 0; color: var(--primary); font-size: 10px; font-weight: 800; letter-spacing: .13em; }
.count-pill { min-width: 30px; height: 26px; display: grid; place-items: center; padding: 0 9px; border-radius: 999px; color: var(--primary); background: var(--primary-soft); font-size: 12px; font-weight: 800; }
.filter-card { margin: 0 14px 12px; padding: 13px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface-soft); }
.filter-card[hidden] { display: none; }
.panel-actions { display: flex; align-items: center; gap: 8px; }
.filter-toggle { height: 30px; padding: 0 12px; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); background: var(--surface-soft); font-size: 13px; font-weight: 750; white-space: nowrap; }
.filter-toggle:hover { color: var(--text); border-color: color-mix(in srgb, var(--primary) 35%, var(--border)); }
.filter-toggle.active { color: var(--primary); background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); }
.filter-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 650; }
label[hidden] { display: none; }
.follow-sound { display: grid; gap: 9px; }
.follow-sound-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.follow-sound-row .secondary-button { min-width: 82px; }
.follow-sound-note { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.user-sound { color: var(--green); font-weight: 700; }
input, select, textarea { font-size: 14px; }
input, select, textarea { width: 100%; border: 1px solid var(--border); border-radius: 10px; outline: none; color: var(--text); background: var(--surface); transition: border-color .16s, box-shadow .16s; }
input, select { height: 40px; padding: 0 11px; }
textarea { padding: 10px 11px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent); }
.check-row { display: flex; gap: 20px; margin: 12px 0; }
.check { display: inline-flex; grid-template-columns: auto auto; align-items: center; gap: 7px; color: var(--text); }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }
.search-box { position: relative; display: block; }
.search-box span { position: absolute; z-index: 1; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 18px; }
.search-box input { padding-left: 36px; }
.stream-list { flex: 1; min-height: 0; padding: 0 14px 12px; overflow-y: auto; scrollbar-color: var(--border) transparent; }

.event-card { margin-bottom: 10px; padding: 14px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface); transition: transform .16s, border-color .16s, box-shadow .16s; }
.event-card:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--primary) 38%, var(--border)); box-shadow: 0 9px 24px rgba(38, 41, 55, .08); }
.event-head { display: flex; gap: 10px; align-items: center; }
.avatar { width: 38px; height: 38px; flex: 0 0 auto; border-radius: 50%; object-fit: cover; background: var(--primary-soft); }
.avatar-fallback { display: grid; place-items: center; color: var(--primary); font-weight: 800; }
.event-identity { min-width: 0; flex: 1; }
.identity-line { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.identity-line strong, .author-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-size: 16px; font-weight: 750; }
a.author-name:hover, a.handle:hover { color: var(--primary); text-decoration: underline; }
.handle { color: var(--muted); font-size: 13px; }
.event-time { margin-left: auto; color: var(--muted); font-size: 14px; font-weight: 600; white-space: nowrap; }
.badge-row { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 4px; }
.badge-row .action-badge { margin-top: 0; }
.source-badge { display: inline-flex; padding: 3px 8px; border-radius: 6px; font-size: 11px; font-weight: 800; letter-spacing: .04em; border: 1px solid transparent; }
.source-gmgn { color: #0f9d63; background: #e3f7ee; border-color: #b9ead3; }
.source-debot { color: #c46a06; background: #fff1de; border-color: #f4d3a6; }
.source-other { color: var(--muted); background: var(--surface-soft); border-color: var(--border); }
:root[data-theme="dark"] .source-gmgn { color: #5fe0a4; background: #15372a; border-color: #23573f; }
:root[data-theme="dark"] .source-debot { color: #f7b45c; background: #3d2c15; border-color: #5e4320; }
.action-badge { display: inline-flex; margin-top: 4px; padding: 3px 8px; border-radius: 999px; color: var(--primary); background: var(--primary-soft); font-size: 12px; font-weight: 750; }
.action-follow { color: var(--green); background: var(--green-soft); }
.action-unfollow, .action-delete_post { color: var(--red); background: var(--red-soft); }
.relation-line { display: flex; align-items: center; gap: 4px; margin-top: 11px; color: var(--primary); font-size: 14px; font-weight: 700; }
.relation-reply { color: #d88913; }
.relation-line strong { color: inherit; }
.event-text { margin: 9px 0 0; color: var(--text); font-size: 15px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.reference-card { margin-top: 10px; padding: 11px; border: 1px solid var(--border); border-left: 3px solid var(--primary); border-radius: 9px; color: var(--text); background: var(--surface-soft); font-size: 14px; line-height: 1.6; }
.reference-clickable { cursor: pointer; }
.reference-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.reference-avatar { width: 31px; height: 31px; }
.reference-identity { min-width: 0; flex: 1; }
.reference-identity strong, .reference-identity span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reference-identity strong { font-size: 14px; }
.reference-identity span { color: var(--muted); font-size: 13px; }
.reference-type { padding: 3px 8px; border-radius: 999px; color: var(--primary); background: var(--primary-soft); font-size: 11px; font-weight: 750; }
.reference-text { margin: 9px 0 0; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
.reference-card .media-grid { margin-top: 9px; }
.media-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; margin-top: 10px; overflow: hidden; border-radius: 10px; background: var(--surface-soft); }
.media-grid:has(:only-child) { grid-template-columns: 1fr; }
.media-grid img, .media-grid video { display: block; width: 100%; min-height: 120px; max-height: 420px; object-fit: contain; background: #090a0e; }
.media-grid img { cursor: zoom-in; }
.media-grid video { aspect-ratio: 16 / 9; }
.media-lightbox { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; color: #fff; background: rgba(8, 9, 13, .94); overflow: hidden; }
.media-lightbox[open] { display: grid; place-items: center; }
.media-lightbox::backdrop { background: rgba(0, 0, 0, .84); }
.media-lightbox figure { width: 100%; height: 100%; margin: 0; padding: 54px 70px 42px; display: grid; grid-template-rows: minmax(0, 1fr) auto; place-items: center; gap: 10px; }
.media-lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; box-shadow: 0 18px 70px rgba(0, 0, 0, .42); transform-origin: 0 0; touch-action: none; user-select: none; -webkit-user-drag: none; cursor: zoom-in; will-change: transform; }
.media-lightbox img.zoomed { cursor: grab; border-radius: 0; }
.media-lightbox img.zoomed:active { cursor: grabbing; }
.media-lightbox figcaption { color: #cdd1dd; font-size: 12px; }
.lightbox-tools { position: absolute; z-index: 2; bottom: 16px; left: 50%; display: flex; align-items: center; gap: 4px; padding: 4px; border: 1px solid rgba(255, 255, 255, .18); border-radius: 12px; background: rgba(25, 27, 35, .82); backdrop-filter: blur(8px); transform: translateX(-50%); }
.lightbox-tools button { min-width: 40px; height: 36px; padding: 0 10px; border: 0; border-radius: 9px; color: #fff; background: transparent; font-size: 18px; font-weight: 700; }
.lightbox-tools button:hover { background: rgba(255, 255, 255, .12); }
#lightboxZoomReset { min-width: 64px; font-size: 13px; font-variant-numeric: tabular-nums; }
.lightbox-close, .lightbox-nav { position: absolute; z-index: 2; display: grid; place-items: center; border: 1px solid rgba(255, 255, 255, .18); color: #fff; background: rgba(25, 27, 35, .76); backdrop-filter: blur(8px); }
.lightbox-close { top: 18px; right: 20px; width: 40px; height: 40px; border-radius: 12px; font-size: 25px; }
.lightbox-nav { top: 50%; width: 46px; height: 58px; border-radius: 13px; transform: translateY(-50%); font-size: 34px; }
.lightbox-previous { left: 18px; }
.lightbox-next { right: 18px; }
.lightbox-nav[hidden] { display: none; }
.target-card { display: flex; gap: 10px; align-items: center; margin-top: 10px; padding: 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-soft); }
.target-card p { margin: 2px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.target-card strong { font-size: 15px; }
.target-info { min-width: 0; flex: 1; }
.target-info strong, .target-info p { overflow: hidden; text-overflow: ellipsis; }
.target-link { color: inherit; transition: border-color .16s, background .16s; }
.target-link:hover { border-color: var(--primary); background: var(--primary-soft); }
.target-arrow { color: var(--muted); font-size: 16px; }
.target-link:hover .target-arrow { color: var(--primary); }

.popover-anchor { position: relative; }
.tool-button { height: 38px; display: inline-flex; align-items: center; gap: 4px; padding: 0 12px; border: 1px solid var(--border); border-radius: 11px; color: var(--text); background: var(--surface); font-size: 13px; font-weight: 700; }
.tool-button:hover, .tool-button[aria-expanded="true"] { border-color: var(--primary); color: var(--primary); }
.tool-button.tool-active { color: var(--primary); background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); }
.tool-count { color: inherit; font-size: 11px; font-weight: 800; }
.type-panel { position: absolute; z-index: 40; top: calc(100% + 8px); right: 0; width: 330px; padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: 0 18px 50px rgba(18, 21, 31, .2); }
.type-panel[hidden] { display: none; }
.type-panel-title { margin: 0 0 10px; color: var(--muted); font-size: 12px; font-weight: 700; }
.type-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 12px; }
.type-check { display: flex; grid-template-columns: none; align-items: center; gap: 8px; color: var(--text); font-size: 13px; font-weight: 650; cursor: pointer; }
.type-check input { width: 17px; height: 17px; flex: 0 0 auto; accent-color: var(--primary); cursor: pointer; }
.notify-switches { display: grid; gap: 9px; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.notify-test { width: 100%; margin-top: 13px; }
.notify-test + .notify-test { margin-top: 8px; }
.sound-unlock { color: var(--amber); background: var(--amber-soft); border-color: color-mix(in srgb, var(--amber) 35%, var(--border)); }
.sound-unlock[hidden] { display: none; }
.tool-button[hidden] { display: none; }

.login-body { display: grid; min-height: 100vh; place-items: center; padding: 20px; }
.login-shell { width: min(400px, 100%); }
.login-card { display: grid; gap: 16px; padding: 28px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.login-brand { display: flex; align-items: center; gap: 11px; }
.login-brand b, .login-brand small { display: block; }
.login-brand b { font-size: 15px; }
.login-brand small { color: var(--muted); font-size: 12px; }
.login-card h1 { margin: 4px 0 0; font-size: 24px; }
.login-card input { height: 46px; font-size: 16px; }
.login-submit { min-height: 46px; font-size: 16px; }
.login-submit:disabled { opacity: .65; cursor: wait; }
.login-error { margin: 0; padding: 10px 12px; border-radius: 10px; color: var(--red); background: var(--red-soft); font-size: 14px; }
.login-error[hidden] { display: none; }
.login-hint { margin: 0; color: var(--muted); font-size: 13px; text-align: center; }

.success-button { min-height: 42px; padding: 0 16px; border: 1px solid transparent; border-radius: 10px; color: #fff; background: #3fbf6e; font-weight: 750; }
.success-button:hover { background: #33a95e; }
.success-button:disabled { opacity: .6; cursor: wait; }
.sound-modal { width: min(560px, calc(100vw - 28px)); }
.sound-modal-body { display: grid; gap: 14px; max-height: calc(100vh - 60px); padding: 21px; overflow-y: auto; }
.sound-hint { margin: -4px 0 0; padding: 10px 12px; border-radius: 10px; color: var(--primary); background: var(--primary-soft); font-size: 12px; line-height: 1.5; }
.sound-form, .sound-voice { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface-soft); }
.sound-form .type-panel-title, .sound-voice .type-panel-title { margin: 0; }
.sound-form input:not([type="file"]), .sound-form select { height: 44px; font-size: 14px; }
.sound-file { gap: 6px; }
.sound-file[hidden] { display: none; }
.sound-file input { height: auto; padding: 8px; background: var(--surface); }
.sound-form-actions { display: grid; grid-template-columns: auto 1fr; gap: 10px; }
.sound-voice-row { display: grid; grid-template-columns: minmax(0, 1fr) 150px; gap: 12px; align-items: center; }
.voice-rate { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.voice-rate input { height: auto; padding: 0; border: 0; accent-color: var(--primary); }
.sound-list { display: grid; gap: 8px; margin-top: -6px; }
.sound-empty { margin: 0; padding: 18px; border: 1px dashed var(--border); border-radius: 11px; color: var(--muted); text-align: center; font-size: 13px; }
.sound-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 7px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); }
.sound-row-info { min-width: 0; }
.sound-row-info strong, .sound-row-info span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sound-row-info strong { font-size: 14px; }
.sound-row-info span { margin-top: 2px; color: var(--muted); font-size: 12px; }
.sound-row button { min-height: 32px; padding: 0 10px; font-size: 12px; }
@media (max-width: 700px) {
  /* 手机上让图片尽量占满屏幕，左右切换按钮缩小 */
  .media-lightbox figure { padding: 60px 8px 96px; }
  .lightbox-nav { top: auto; bottom: 16px; width: 42px; height: 44px; transform: none; font-size: 28px; }
  .lightbox-previous { left: 12px; }
  .lightbox-next { right: 12px; }
}
@media (max-width: 520px) {
  .sound-voice-row { grid-template-columns: 1fr; }
  .sound-row { grid-template-columns: 1fr auto auto; }
  .sound-row .sound-row-info { grid-column: 1 / -1; }
}
.empty-state { min-height: 190px; display: grid; place-items: center; align-content: center; gap: 8px; color: var(--muted); text-align: center; }
.empty-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 15px; color: var(--primary); background: var(--primary-soft); font-size: 22px; }
.empty-state b { color: var(--text); }
.load-more { margin: 0 14px 14px; }

.primary-button, .secondary-button, .danger-button { min-height: 40px; padding: 0 16px; border-radius: 10px; font-weight: 700; border: 1px solid transparent; }
.primary-button { color: #fff; background: var(--primary); box-shadow: 0 7px 18px rgba(91, 75, 219, .18); }
.primary-button:hover { background: var(--primary-dark); }
.secondary-button { color: var(--text); border-color: var(--border); background: var(--surface); }
.secondary-button:hover { border-color: var(--primary); color: var(--primary); }
.danger-button { color: var(--red); border-color: color-mix(in srgb, var(--red) 25%, var(--border)); background: var(--red-soft); }

.management-shell { max-width: 1240px; margin: 0 auto; padding: 34px 24px 50px; }
.page-intro { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.page-intro h1 { font-size: 30px; }
.page-intro > div > p:last-child { margin: 9px 0 0; color: var(--muted); font-size: 14px; }
.primary-actions { display: flex; gap: 10px; }
.management-card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.management-toolbar { display: grid; grid-template-columns: 190px minmax(250px, 1fr) auto; align-items: end; gap: 14px; padding: 18px; border-bottom: 1px solid var(--border); background: var(--surface-soft); }
.search-box.wide { align-self: end; }
.subtle-text { align-self: center; color: var(--muted); font-size: 13px; }
.group-chips { display: flex; gap: 8px; padding: 13px 18px; overflow-x: auto; border-bottom: 1px solid var(--border); }
.group-chip { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; padding: 7px 11px; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); background: var(--surface); font-size: 13px; }
.group-chip i, .group-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--chip-color, var(--primary)); }
.group-chip button { border: 0; padding: 0 2px; color: var(--muted); background: transparent; }
.user-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; min-height: 240px; padding: 16px; }
.provider-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.provider-column { min-width: 0; padding: 16px; }
.provider-column + .provider-column { border-left: 1px solid var(--border); }
.provider-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.provider-heading h2 { margin: 6px 0 2px; font-size: 18px; }
.provider-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.provider-list { display: grid; gap: 10px; }
.provider-empty { min-height: 170px; border: 1px dashed var(--border); border-radius: 13px; }
.quota-pill { padding: 6px 11px; border-radius: 999px; color: #c46a06; background: #fff1de; font-size: 13px; font-weight: 800; white-space: nowrap; }
.quota-pill.quota-full { color: var(--red); background: var(--red-soft); }
:root[data-theme="dark"] .quota-pill { color: #f7b45c; background: #3d2c15; }
.user-placement { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.slot-badge { padding: 3px 8px; border-radius: 6px; color: var(--muted); background: var(--surface-soft); border: 1px solid var(--border); font-size: 11px; font-weight: 700; }
.slot-badge.slot-hot { color: var(--primary); background: var(--primary-soft); border-color: transparent; }
.sync-badge.failed { color: var(--red); background: var(--red-soft); }
.user-note.user-error { color: var(--red); }
.expiry-banner { display: block; margin: 0 0 16px; padding: 12px 16px; border-radius: 12px; color: var(--amber); background: var(--amber-soft); border: 1px solid color-mix(in srgb, var(--amber) 35%, var(--border)); font-size: 14px; font-weight: 700; line-height: 1.5; text-decoration: none; }
.expiry-banner[hidden] { display: none; }
a.expiry-banner { margin: 16px 22px 0; }
.expiry-box { display: grid; gap: 9px; padding: 11px 12px; border-radius: 10px; color: var(--amber); background: var(--amber-soft); font-size: 13px; line-height: 1.5; }
.expiry-box p { margin: 0; font-weight: 700; }
.expiry-box.expiry-expired { color: var(--red); background: var(--red-soft); }
.expiry-actions { display: flex; gap: 8px; }
.user-card-expired { border-color: color-mix(in srgb, var(--red) 45%, var(--border)); }
.user-card-soon { border-color: color-mix(in srgb, var(--amber) 45%, var(--border)); }
.user-filter { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.user-filter-custom { color: var(--primary); font-weight: 700; }
.filter-active { color: var(--primary); border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); background: var(--primary-soft); }
.types-quick { display: flex; gap: 8px; }
.types-quick button { min-height: 32px; padding: 0 12px; font-size: 13px; }
.type-panel-note { margin: 12px 0 0; padding-top: 10px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; line-height: 1.5; }
.type-panel-note[hidden] { display: none; }
.user-card { display: flex; flex-direction: column; gap: 12px; padding: 16px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface); }
.user-card-head { display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; color: var(--primary); background: var(--primary-soft); font-weight: 800; }
.user-card-title { min-width: 0; flex: 1; }
.user-card-title strong, .user-card-title span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-card-title strong { font-size: 16px; }
.user-card-title span { margin-top: 2px; color: var(--muted); font-size: 13px; }
.user-avatar-image { object-fit: cover; flex: 0 0 auto; background: var(--primary-soft); }
.sync-badge { padding: 5px 9px; border-radius: 999px; color: var(--amber); background: var(--amber-soft); font-size: 12px; font-weight: 750; }
.sync-badge.synced { color: var(--green); background: var(--green-soft); }
.user-note { min-height: 20px; margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.user-groups { display: flex; flex-wrap: wrap; gap: 6px; }
.user-group { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 999px; background: var(--surface-soft); color: var(--muted); font-size: 12px; }
.user-card-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 3px; }
.user-card-actions button { min-height: 36px; padding: 0 13px; font-size: 13px; }

.modal { width: min(520px, calc(100vw - 28px)); max-height: calc(100vh - 40px); padding: 0; border: 1px solid var(--border); border-radius: 17px; color: var(--text); background: var(--surface); box-shadow: 0 24px 80px rgba(18, 21, 31, .25); }
.modal::backdrop { background: rgba(17, 19, 27, .54); backdrop-filter: blur(3px); }
.modal form { display: grid; gap: 15px; padding: 21px; overflow-y: auto; }
.small-modal { width: min(420px, calc(100vw - 28px)); }
.modal-heading { display: flex; align-items: start; justify-content: space-between; }
.modal-heading h2 { margin: 3px 0 0; font-size: 20px; }
.close-button { width: 34px; height: 34px; border-radius: 9px; font-size: 20px; }
fieldset { margin: 0; padding: 11px; border: 1px solid var(--border); border-radius: 11px; }
legend { padding: 0 5px; color: var(--muted); font-size: 12px; font-weight: 650; }
.option-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.option-grid label { display: flex; align-items: center; gap: 7px; color: var(--text); }
.option-grid input { width: 15px; height: 15px; accent-color: var(--primary); }
.form-hint { margin: 0; padding: 10px; border-radius: 9px; color: var(--amber); background: var(--amber-soft); font-size: 13px; line-height: 1.5; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; padding-top: 3px; }

.toast { position: fixed; z-index: 100; right: 22px; bottom: 22px; max-width: min(390px, calc(100vw - 44px)); padding: 12px 15px; border-radius: 11px; color: #fff; background: #292d3a; box-shadow: var(--shadow); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s; font-size: 12px; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #b93442; }

@keyframes slide-in { from { opacity: 0; transform: translateY(6px); } }
@media (max-width: 900px) {
  .topbar { grid-template-columns: 1fr auto; padding: 0 16px; }
  .nav { position: fixed; bottom: 14px; left: 50%; z-index: 30; transform: translateX(-50%); box-shadow: var(--shadow); }
  .header-actions .status { display: none; }
  .dashboard-shell { grid-template-columns: 1fr; padding: 14px 12px 82px; }
  .stream-panel { height: min(760px, calc(100vh - 105px)); }
  .management-shell { padding: 24px 14px 86px; }
  .page-intro { align-items: flex-start; flex-direction: column; }
  .management-toolbar { grid-template-columns: 1fr; }
  .user-grid { grid-template-columns: 1fr; }
  .provider-columns { grid-template-columns: 1fr; }
  .provider-column + .provider-column { border-left: 0; border-top: 1px solid var(--border); }
}
@media (max-width: 520px) {
  .brand small { display: none; }
  .tool-button { padding: 0 9px; font-size: 12px; }
  .type-panel { position: fixed; top: 76px; left: 12px; right: 12px; width: auto; }
  .filter-row { grid-template-columns: 1fr; }
  .primary-actions { width: 100%; }
  .primary-actions button { flex: 1; padding: 0 10px; }
  .option-grid { grid-template-columns: 1fr; }
}
