:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none; color: #1d1d1f; background: #f5f5f7;
  --ink: #1d1d1f; --muted: #696970; --line: #dcdce1; --line-soft: #ededf0;
  --surface: #fff; --canvas: #f5f5f7; --blue: #0066d6; --blue-dark: #0054b0; --blue-soft: #eaf2ff;
  --red: #bc302a; --red-soft: #fff0ee; --amber: #946018; --green: #218044;
  --radius: 16px; --ease: cubic-bezier(.2, .8, .2, 1);
}
.install-layout { max-width: 720px; margin: 40px auto; padding: 28px; }
.install-layout .login-brand { margin-bottom: 32px; }
.install-checks { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); padding: 0; margin: 24px 0; list-style: none; gap: 8px; color: var(--green); }
.install-error { color: var(--red); }
.cron-settings { margin-bottom: 28px; }
.cron-settings input { width: 100%; min-width: 0; }
.cron-settings p { margin-top: 12px; }
@media (max-width:600px) { .install-layout { margin: 16px auto; padding: 20px; } .install-checks { grid-template-columns: minmax(0,1fr); } }
* { box-sizing: border-box; letter-spacing: 0; }
body { margin: 0; min-width: 320px; font-size: 14px; line-height: 1.5; }
button, input, select { font: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: wait; opacity: .5; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: 30px; line-height: 1.25; font-weight: 700; }
h2 { margin-bottom: 0; font-size: 17px; line-height: 1.5; font-weight: 650; }
p { line-height: 1.6; }
.muted, .page-heading p, .field-note { color: var(--muted); }
[hidden] { display: none !important; }
img { display: block; }
.app-shell { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: 100dvh; }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; height: 100dvh; min-width: 0; padding: 32px 16px 20px; background: #fafafc; border-right: 1px solid var(--line); }
.brand, .login-brand { display: flex; align-items: center; gap: 12px; font-size: 17px; font-weight: 650; line-height: 1.25; }
.brand { padding: 0 8px 42px; }
.brand small, .login-brand small { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; font-weight: 500; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 12px; background: var(--blue); }
.brand-mark img { width: 23px; height: 23px; filter: invert(1); }
.nav-caption { padding: 0 14px 10px; color: var(--muted); font-size: 11px; font-weight: 600; }
.nav { display: grid; gap: 6px; }
.nav-link { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 46px; padding: 11px 14px; border: 0; border-radius: 10px; background: transparent; color: #53535b; text-align: left; white-space: nowrap; font-size: 14px; transition: background .18s, color .18s; }
.nav-link:hover { background: #ededf2; color: var(--ink); }
.nav-link.active { background: var(--blue-soft); color: var(--blue); font-weight: 650; }
.nav-link img { width: 19px; height: 19px; opacity: .66; }
.nav-link.active img, .text-action img, .secondary img, .subtle img { filter: invert(28%) sepia(93%) saturate(2558%) hue-rotate(202deg) brightness(88%); opacity: 1; }
.sidebar-bottom { margin-top: auto; padding-top: 20px; border-top: 1px solid var(--line); }
.admin-profile { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 0 12px 14px; }
.admin-avatar { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 50%; background: #e9e9ef; }
.admin-avatar img { width: 17px; height: 17px; opacity: .65; }
.admin-profile > div { min-width: 0; }
.admin-email { font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.admin-profile small { color: var(--muted); font-size: 11px; }
#logout { font-size: 13px; }
.workspace { min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 68px; padding: 0 40px; border-bottom: 1px solid var(--line-soft); font-size: 12px; }
.topbar-title { display: flex; gap: 12px; align-items: center; }
#breadcrumb { font-weight: 600; }
.topbar-prefix, .topbar-separator { color: var(--muted); }
.topbar-right { display: flex; align-items: center; gap: 7px; color: var(--muted); }
.live-dot { width: 6px; height: 6px; flex: none; border-radius: 50%; background: var(--green); }
.page { max-width: 1400px; margin: 0 auto; padding: 38px 40px 72px; }
.page-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 30px; }
.page-heading > div { min-width: 0; }
.page-heading p { margin-bottom: 0; font-size: 13px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 10px 18px; border: 0; border-radius: 11px; font-size: 13px; font-weight: 600; white-space: nowrap; transition: background .18s, opacity .18s; }
.button:active, .icon-button:active { opacity: .65; }
.button img, .icon-button img { width: 18px; height: 18px; flex: none; }
.primary { color: #fff; background: var(--blue); }
.primary:hover { background: var(--blue-dark); }
.primary img { filter: invert(1); }
.secondary { color: var(--blue); background: #eaeaf0; }
.subtle { color: var(--blue); background: transparent; padding: 10px 12px; }
.secondary:hover, .subtle:hover { background: #e0e8f5; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 32px 2px 14px; }
.section-subtitle { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.text-action { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 44px; padding: 8px 2px 8px 8px; border: 0; background: transparent; color: var(--blue); font-size: 13px; }
.text-action img { width: 15px; height: 15px; }
.text-action:hover { text-decoration: underline; }
.metrics { display: grid; grid-template-columns: 1.3fr repeat(3, 1fr); padding: 24px 0; background: var(--surface); border-radius: var(--radius); }
.metric { min-width: 0; padding: 0 26px; border-left: 1px solid var(--line-soft); }
.metric:first-child { border-left: 0; }
.metric-label { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.metric-label img { width: 16px; height: 16px; opacity: .65; }
.metric-value { margin: 10px 0 4px; font-size: 32px; line-height: 1.15; font-weight: 650; font-variant-numeric: tabular-nums; }
.metric-detail { color: var(--muted); font-size: 11px; }
.metric.bad .metric-value { color: var(--red); }
.metric.warn .metric-value { color: var(--amber); }
.metric.good .metric-value { color: var(--green); }
.event-list { overflow: hidden; border-radius: var(--radius); background: var(--surface); }
.source-list { display: grid; gap: 12px; }
.source-row { display: grid; grid-template-columns: minmax(150px, 1.4fr) minmax(120px, .85fr) minmax(90px, .7fr) minmax(120px, .85fr); align-items: center; gap: 20px; min-height: 96px; padding: 22px 24px; border: 1px solid #cfd5e0; border-radius: var(--radius); background: var(--surface); }
.source-row strong { display: block; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.source-row small { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.balance { color: var(--ink); font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.balance small { font-weight: 400; }
.source-meta { color: var(--muted); font-size: 12px; }
.status { display: inline-flex; align-items: center; justify-self: start; gap: 6px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; flex: none; border-radius: 50%; background: currentColor; }
.status.healthy { color: var(--green); }
.status.low, .status.error { color: var(--red); }
.status.unknown { color: var(--muted); }
.event { display: flex; align-items: flex-start; gap: 14px; padding: 22px 24px; border-top: 1px solid var(--line-soft); font-size: 13px; }
.event:first-child { border-top: 0; }
.event > img { flex: none; width: 19px; height: 19px; margin-top: 2px; opacity: .6; }
.event-main { min-width: 0; flex: 1; }
.event-main strong { font-weight: 600; }
.event-main p { margin: 6px 0 0; color: var(--muted); overflow-wrap: anywhere; }
.event-main small { display: block; margin-top: 8px; color: var(--green); }
.event-time { flex: none; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.empty { display: grid; justify-items: center; gap: 10px; padding: 48px 24px; color: var(--muted); text-align: center; font-size: 13px; }
.empty img { width: 28px; height: 28px; opacity: .35; }
.action-group { display: flex; justify-content: flex-end; gap: 2px; }
.icon-button { display: inline-grid; place-items: center; width: 34px; height: 36px; flex: none; padding: 0; border: 0; border-radius: 9px; background: transparent; transition: background .18s; }
.icon-button img { width: 16px; height: 16px; opacity: .6; }
.icon-button:hover { background: var(--blue-soft); }
.icon-button.danger:hover { background: var(--red-soft); }
.icon-button:hover img { opacity: 1; }
.notice { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 30; width: max-content; max-width: calc(100vw - 32px); padding: 14px 22px; border-radius: 14px; background: #fff; color: var(--ink); box-shadow: 0 8px 40px #19192326; font-size: 13px; line-height: 1.5; }
.notice.error { color: var(--red); }
.settings-form { max-width: 880px; }
.settings-section { margin-bottom: 28px; padding: 0; }
.settings-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 0 2px 16px; }
.settings-title { display: flex; align-items: center; gap: 12px; }
.setting-icon { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 10px; background: var(--blue); }
.setting-icon img { width: 19px; height: 19px; filter: invert(1); }
.setting-icon.telegram { background: #087d9d; }
.settings-heading p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.settings-section > .form-grid { padding: 24px; background: var(--surface); border-radius: var(--radius); }
label { display: flex; flex-direction: column; gap: 8px; min-width: 0; color: var(--ink); font-size: 13px; font-weight: 500; }
label small { color: var(--muted); font-size: 11px; font-weight: 400; line-height: 1.6; }
input:not([type="checkbox"]):not([type="radio"]), select { width: 100%; min-width: 0; min-height: 46px; padding: 11px 13px; color: var(--ink); border: 1px solid #e3e3e8; border-radius: 10px; background: #fafafc; font-size: 14px; font-weight: 400; transition: border-color .18s, background .18s; }
input::placeholder { color: #73737c; opacity: 1; }
input:focus, select:focus { outline: 2px solid var(--blue); outline-offset: 1px; background: #fff; }
input:disabled { opacity: .5; cursor: not-allowed; }
.wide { grid-column: 1 / -1; }
.switch-line { flex-direction: row; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; font-size: 12px; font-weight: 400; }
.switch-line input { appearance: none; position: relative; flex: none; width: 44px; height: 26px; padding: 0; margin: 0; border: 1px solid #b4b4bc; border-radius: 20px; background: #d2d2d8; cursor: pointer; transition: background .2s var(--ease), border-color .2s; }
.switch-line input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 2px 3px #0002; transition: transform .2s var(--ease); }
.switch-line input:checked { background: #268c48; border-color: #268c48; }
.switch-line input:checked::after { transform: translateX(18px); }
.switch-line input:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.field-switch { align-self: end; min-height: 46px; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 24px; }
.form-actions.right { justify-content: flex-end; }
.security-layout { display: grid; grid-template-columns: minmax(280px, 520px) minmax(200px, 300px); gap: 32px; align-items: start; }
.narrow { display: grid; gap: 22px; padding: 28px; background: var(--surface); border-radius: var(--radius); }
.narrow .form-actions { margin-top: 0; }
.security-note { display: flex; align-items: flex-start; gap: 12px; padding: 22px 0; color: var(--muted); font-size: 12px; }
.security-note img { width: 22px; height: 22px; flex: none; opacity: .6; }
.security-note strong { color: var(--ink); font-size: 13px; font-weight: 500; }
.security-note p { margin: 8px 0 0; }
.field-note { margin: 18px 0 0; font-size: 11px; line-height: 1.7; }
.form-error { color: var(--red); font-size: 13px; overflow-wrap: anywhere; }
.form-error:empty { display: none; }
.notification-result { margin: 18px 0 0; color: var(--green); font-size: 13px; overflow-wrap: anywhere; }
.notification-result.error { color: var(--red); }
#source-error { margin: 16px 0 0; }
[data-color="blue"] { --marker: #266ac0; --marker-bg: #f0f6ff; }
[data-color="purple"] { --marker: #8053b8; --marker-bg: #f8f3ff; }
[data-color="cyan"] { --marker: #117985; --marker-bg: #edf8f9; }
[data-color="amber"] { --marker: #916315; --marker-bg: #fff8e9; }
[data-color="rose"] { --marker: #b53e6b; --marker-bg: #fff2f7; }
[data-color="green"] { --marker: #26734c; --marker-bg: #f0f8f2; }
.source-row[data-color], .source-card[data-color] { background: var(--marker-bg); border-color: color-mix(in srgb, var(--marker) 35%, #dce0e8); }
.source-row[data-color] .marked-name, .source-card[data-color] .marked-name { color: var(--marker); }
.account-marker { display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 3px; background: var(--marker); vertical-align: 1px; }
.color-field { min-width: 0; margin: 0; padding: 0; border: 0; }
.color-field legend { margin-bottom: 6px; padding: 0; font-size: 13px; font-weight: 500; }
.color-options { display: flex; flex-wrap: wrap; gap: 4px; }
.color-option { position: relative; display: grid; place-items: center; width: 44px; height: 44px; cursor: pointer; }
.color-option input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.color-swatch { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--marker, #fff); border: 1px solid var(--marker, #888891); }
.color-swatch img { width: 15px; height: 15px; }
.color-option[data-color] img { visibility: hidden; filter: invert(1); }
.color-option input:checked + .color-swatch { outline: 2px solid var(--marker, #73737c); outline-offset: 4px; }
.color-option input:checked + .color-swatch img { visibility: visible; }
.color-option input:focus-visible + .color-swatch { outline: 3px solid var(--ink); outline-offset: 4px; }
dialog { width: min(620px, calc(100% - 40px)); max-width: none; max-height: calc(100dvh - 48px); margin: auto; padding: 0; border: 0; border-radius: 22px; color: var(--ink); background: #fff; box-shadow: 0 24px 100px #17172440; overscroll-behavior: contain; }
dialog::backdrop { background: #24242d66; backdrop-filter: blur(5px); }
dialog[open] { animation: sheet-in .22s var(--ease); }
.dialog-body { padding: 0 28px 24px; }
.dialog-heading { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 0 -28px 22px; padding: 24px 28px 18px; background: #fffffff5; border-bottom: 1px solid var(--line-soft); }
.dialog-heading h2 { font-size: 21px; }
.dialog-heading p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.dialog-heading .icon-button { width: 36px; height: 36px; border-radius: 50%; background: #f0f0f4; }
.dialog-body > .form-actions { position: sticky; bottom: 0; z-index: 1; margin: 22px -28px -24px; padding: 18px 28px 24px; background: #fffffff5; border-top: 1px solid var(--line-soft); }
.login-shell { min-height: 100dvh; display: grid; place-items: center; padding: 40px 24px; }
.login-panel { width: min(100%, 380px); }
.login-brand { justify-content: center; margin-bottom: 34px; }
.login-brand .brand-mark { width: 48px; height: 48px; border-radius: 14px; }
.login-brand .brand-mark img { width: 27px; height: 27px; }
.login-divider { height: 1px; background: var(--line); margin-bottom: 32px; }
.login-panel h1 { font-size: 27px; text-align: center; margin-bottom: 10px; }
.login-panel > p { text-align: center; font-size: 13px; margin-bottom: 30px; }
.stack { display: grid; gap: 20px; }
.login-panel input:not([type="checkbox"]):not([type="radio"]) { background: #fff; min-height: 50px; }
.login-panel .primary { margin-top: 6px; min-height: 48px; font-size: 15px; }
.login-panel .form-error { margin-bottom: 0; text-align: center; }
@keyframes sheet-in { from { opacity: .65; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 1200px) {
  .app-shell { grid-template-columns: 200px minmax(0, 1fr); }
  .sidebar { padding-left: 12px; padding-right: 12px; }
  .brand { gap: 8px; font-size: 16px; }
  .page { padding: 32px 28px 64px; }
  .topbar { padding: 0 28px; }
  .metric { padding: 0 18px; }
  .source-row { grid-template-columns: minmax(140px, 1.4fr) minmax(100px, 1fr) minmax(90px, .8fr); gap: 14px; }
  .source-meta { grid-column: 1 / -1; display: flex; justify-content: space-between; padding-top: 8px; }
  .source-meta small { margin: 0; }
  .action-group { gap: 8px; }
  .icon-button { width: 44px; height: 44px; }
  .action-group .icon-button { background: #ffffff90; }
  .security-layout { grid-template-columns: minmax(0, 1fr); gap: 8px; max-width: 600px; }
}
@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: relative; height: auto; padding: 16px 20px 0; border: 0; background: var(--canvas); flex-direction: row; align-items: center; justify-content: space-between; }
  .brand { padding: 0; font-size: 15px; }
  .brand-mark { width: 32px; height: 32px; border-radius: 10px; }
  .brand-mark img { width: 19px; height: 19px; }
  .brand small, .nav-caption, .admin-profile, #logout span { display: none; }
  .sidebar-bottom { padding: 0; margin: 0; border: 0; }
  #logout { width: 44px; padding: 10px; justify-content: center; }
  .nav { position: fixed; inset: auto 0 0; z-index: 10; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; padding: 7px max(6px, env(safe-area-inset-right)) max(7px, env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left)); border-top: 1px solid #dcdce1b3; background: #fcfcfded; backdrop-filter: blur(18px); }
  .nav-link { flex-direction: column; justify-content: center; gap: 4px; min-height: 52px; padding: 6px 2px; font-size: 10px; border-radius: 8px; }
  .nav-link.active { background: transparent; }
  .nav-link img { width: 21px; height: 21px; }
  .topbar { min-height: 38px; padding: 0 22px; border: 0; font-size: 10px; }
  .topbar-prefix, .topbar-separator { display: none; }
  .page { padding: 22px 20px calc(102px + env(safe-area-inset-bottom)); }
  h1 { font-size: 28px; }
  .page-heading { align-items: flex-start; gap: 12px; margin-bottom: 26px; }
  .page-heading p { font-size: 12px; }
  .page-heading .primary { padding: 10px 13px; margin-top: 1px; flex: none; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 0; }
  .metric { padding: 20px; }
  .metric:nth-child(3) { border-left: 0; }
  .metric:nth-child(n+3) { border-top: 1px solid var(--line-soft); }
  .metric-value { font-size: 30px; }
  .metric-detail { font-size: 10px; }
  .section-heading { margin-top: 28px; }
  .source-row { padding: 20px; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; }
  .source-row > div:first-child { grid-column: 1 / -1; }
  .source-row .balance { grid-column: 1; font-size: 22px; }
  .source-row .status { justify-self: end; }
  .source-meta { font-size: 11px; padding-top: 0; flex-wrap: wrap; gap: 4px 12px; }
  .source-meta small { font-size: 11px; }
  .event { padding: 20px; gap: 10px; flex-wrap: wrap; }
  .event-time { width: 100%; padding-left: 29px; }
  .settings-heading { gap: 12px; }
  .settings-heading .switch-line span { display: none; }
  .settings-title { gap: 10px; }
  .settings-section > .form-grid { padding: 22px 20px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .wide { grid-column: auto; }
  input:not([type="checkbox"]):not([type="radio"]), select { font-size: 16px; }
  .narrow { padding: 24px 20px; }
  .security-note { padding: 20px 4px; }
  .form-actions { gap: 10px; }
  dialog { width: 100%; max-height: calc(100dvh - 24px); margin: auto 0 0; border-radius: 22px 22px 0 0; }
  .dialog-body { padding: 0 22px 22px; }
  .dialog-heading { margin: 0 -22px 22px; padding: 20px 22px; }
  .dialog-heading .icon-button { width: 44px; height: 44px; }
  .dialog-body > .form-actions { margin: 22px -22px -22px; padding: 16px 22px max(20px, env(safe-area-inset-bottom)); }
  .dialog-body > .form-actions .button { flex: 1; }
  .color-options { gap: 0; }
}
@media (max-width: 560px) {
  .page-heading .primary { font-size: 12px; }
}
@media (max-width: 360px) {
  .page { padding-left: 16px; padding-right: 16px; }
  .page-heading { flex-wrap: wrap; }
  .page-heading .primary { margin-top: 0; }
  .metric { padding: 18px 15px; }
  .metric-detail { line-height: 1.7; }
  .dialog-body { padding-right: 18px; padding-left: 18px; }
  .dialog-heading { margin-right: -18px; margin-left: -18px; padding-right: 18px; padding-left: 18px; }
  .dialog-body > .form-actions { margin-right: -18px; margin-left: -18px; padding-right: 18px; padding-left: 18px; }
  .color-options { gap: 3px; }
}
.source-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.source-grid > .empty { grid-column: 1 / -1; }
.source-card { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(180px, .85fr) 164px; align-items: center; gap: 12px 24px; padding: 16px 20px; border: 1px solid #c8cfdd; border-radius: 16px; background: var(--surface); transition: border-color .18s, box-shadow .18s; }
.source-card:hover, .source-card:focus-within { border-color: #91afd8; box-shadow: 0 5px 16px #2438560b; }
.card-heading { display: flex; align-items: center; gap: 12px; min-width: 0; }
.source-icon { display: grid; place-items: center; flex: none; width: 42px; height: 42px; border: 1px solid #d4deed; border-radius: 12px; background: #eff4fc; }
.source-icon img { width: 21px; height: 21px; opacity: .65; }
.source-icon img.site-logo { width: 28px; height: 28px; object-fit: contain; opacity: 1; }
.source-card[data-color] .source-icon { border-color: color-mix(in srgb, var(--marker) 25%, white); background: var(--marker-bg); }
.card-name { flex: 1; min-width: 0; }
.card-title { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 8px; }
.card-name a { min-width: 0; color: var(--ink); font-size: 14px; font-weight: 650; text-decoration: none; overflow-wrap: anywhere; }
.card-name a:hover { text-decoration: underline; text-underline-offset: 3px; }
.card-name small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.system-tag { flex: none; padding: 2px 6px; border-radius: 6px; background: #eceff5; color: #535d6d; font-size: 10px; font-weight: 600; }
.card-balance-row { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-balance { min-width: 0; }
.card-balance small { display: block; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.card-balance strong { display: block; margin: 2px 0; font-size: 22px; line-height: 1.3; font-weight: 650; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.source-card .status { padding: 6px 10px; border-radius: 8px; background: #eff3f0; }
.source-card .status.low, .source-card .status.error { background: #ffebe7; }
.source-card .status.unknown { background: #efeff3; }
.card-footer { min-width: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.card-checked { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 2px 6px; color: var(--muted); font-size: 10px; }
.card-checked time { font-size: 11px; font-variant-numeric: tabular-nums; }
.source-card .action-group { gap: 8px; margin-left: auto; }
.source-card .icon-button { width: 38px; height: 38px; border: 1px solid #cdd5e2; background: #fff; border-radius: 10px; }
.source-card .icon-button:hover { border-color: #88aada; background: var(--blue-soft); }
.source-card .icon-button:active { background: #dce9fb; }
.source-card .icon-button.danger:hover { border-color: #db9b95; background: var(--red-soft); }
.source-card .card-check { color: var(--blue); background: #f4f8ff; }
.card-check img { filter: invert(28%) sepia(93%) saturate(2558%) hue-rotate(202deg) brightness(88%); opacity: 1; }
.card-error { grid-column: 1 / -1; margin: 0; padding-top: 10px; border-top: 1px solid var(--line-soft); color: var(--red); font-size: 12px; overflow-wrap: anywhere; }
.source-tag { display: inline-flex; align-items: center; gap: 7px; min-width: 0; max-width: 100%; padding: 5px 10px; border: 1px solid color-mix(in srgb, var(--marker) 28%, white); border-radius: 7px; background: color-mix(in srgb, var(--marker) 11%, white); color: var(--marker); font-size: 12px; font-weight: 650; line-height: 1.5; }
.source-tag::before { content: ''; flex: none; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.source-tag > span { min-width: 0; overflow-wrap: anywhere; }
.source-card.has-tag { grid-template-columns: minmax(0, 1fr) minmax(180px, .85fr); }
.source-card.has-tag .card-footer { grid-column: 1 / -1; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px 18px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
.has-tag .card-checked { justify-content: flex-start; }
.has-tag .card-footer > .source-tag { justify-self: start; }
.tag-settings { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 16px 0; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.tag-color-field .color-options { gap: 4px; }
.tag-preview { min-height: 30px; }
.alert-policy { margin: 0 0 24px; border-bottom: 1px solid var(--line); }
.alert-policy summary { display: flex; align-items: center; gap: 14px; min-height: 54px; padding: 0 0 18px; cursor: pointer; list-style: none; }
.alert-policy summary::-webkit-details-marker { display: none; }
.policy-title { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 14px; font-weight: 600; white-space: nowrap; }
.policy-title img, .policy-chevron { width: 18px; height: 18px; }
.policy-chevron { margin-left: auto; transition: transform .18s; }
.alert-policy[open] .policy-chevron { transform: rotate(180deg); }
#policy-summary { color: var(--muted); font-size: 12px; }
#alert-policy-form { padding: 8px 0 24px; }
.policy-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.25fr); gap: 22px; }
.repeat-settings { min-width: 0; }
.repeat-settings .switch-line { min-height: 27px; margin-bottom: 10px; }
.interval-control { display: grid; grid-template-columns: minmax(0, 1fr) 90px; gap: 10px; }
.policy-footer { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-top: 22px; }
.policy-footer p { max-width: 65ch; margin: 0; color: var(--muted); font-size: 12px; }
@media (max-width: 1100px) {
  .source-card { gap: 12px 16px; padding: 14px 16px; }
  .policy-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .repeat-settings { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: end; gap: 16px; }
  .interval-control { flex: 1; }
}
@media (min-width: 761px) and (max-width: 950px) {
  .source-card { grid-template-columns: minmax(0, 1fr) minmax(180px, .85fr); }
  .card-footer { grid-column: 1 / -1; flex-direction: row-reverse; align-items: center; justify-content: space-between; padding-top: 10px; border-top: 1px solid var(--line-soft); }
  .source-card .action-group { margin-left: 0; }
  .card-checked { justify-content: flex-start; }
}
@media (max-width: 760px) {
  .source-card { grid-template-columns: minmax(0, 1fr) minmax(150px, .8fr); padding: 14px; }
  .source-card .icon-button { min-width: 44px; min-height: 44px; }
  .card-heading { gap: 10px; }
  .card-footer { grid-column: 1 / -1; flex-direction: row-reverse; align-items: center; justify-content: space-between; gap: 10px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
  .card-checked { justify-content: flex-start; }
  .source-card .action-group { margin-left: 0; }
  .alert-policy summary { flex-wrap: wrap; gap: 6px 12px; position: relative; padding-right: 26px; }
  .policy-chevron { position: absolute; right: 0; top: 4px; }
  #policy-summary { width: 100%; padding-left: 26px; font-size: 11px; }
  .policy-grid { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .repeat-settings { display: block; }
  .policy-footer { align-items: stretch; flex-direction: column; gap: 16px; }
}
@media (max-width: 480px) {
  .source-card, .source-card.has-tag { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .source-card.has-tag .card-footer { grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
  .has-tag .card-footer > .source-tag { grid-column: 1 / -1; grid-row: 1; }
  .tag-color-field .color-options { gap: 0; }
  .source-icon { width: 36px; height: 36px; }
  .card-balance { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: baseline; gap: 2px 10px; }
  .card-balance strong { font-size: 20px; }
  .card-balance small:nth-child(n+3) { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
