:root {
  --ink: #121722;
  --muted: #667085;
  --line: #e7e9ee;
  --paper: #fff;
  --canvas: #f6f7f9;
  --accent: #ff4d2e;
  --accent-dark: #df3519;
  --green: #087f5b;
  --red: #b42318;
  --shadow: 0 16px 50px rgba(18, 23, 34, .08);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--ink); background: var(--canvas); }
body { margin: 0; min-width: 320px; }
button, input { font: inherit; }
a { color: inherit; }

.site-header { height: 72px; padding: 0 max(24px, calc((100vw - 1180px) / 2)); display: flex; align-items: center; justify-content: space-between; background: var(--ink); color: #fff; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; text-decoration: none; letter-spacing: -.02em; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; overflow: hidden; background: #f7f8fa; border-radius: 10px; }
.brand-mark img { display: block; width: 100%; height: 100%; object-fit: contain; }
nav { display: flex; gap: 6px; }
nav a { padding: 10px 13px; color: #bdc3ce; text-decoration: none; border-radius: 8px; font-size: .9rem; }
nav a:hover, nav a.active { color: #fff; background: rgba(255,255,255,.09); }
.logout-form { display: flex; margin-left: 4px; padding-left: 10px; border-left: 1px solid rgba(255,255,255,.14); }
.logout-form button { padding: 8px 9px; color: #bdc3ce; background: transparent; border: 0; cursor: pointer; }
.logout-form button:hover { color: #fff; }

.page-shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 46px 0 72px; }
.hero { display: grid; grid-template-columns: 1.5fr 1fr; align-items: end; gap: 48px; padding: 22px 0 50px; }
.eyebrow { margin: 0 0 10px; color: var(--accent); font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .16em; }
.hero h1, .page-heading h1 { margin: 0; font-size: clamp(2.5rem, 6vw, 5.2rem); line-height: .98; letter-spacing: -.06em; }
.hero h1 span { color: var(--accent); }
.hero-copy > p:last-child, .page-heading > div > p:last-child { max-width: 670px; margin: 24px 0 0; color: var(--muted); line-height: 1.65; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid #d9dde5; }
.stats div { padding: 22px 8px 4px; }
.stats strong { display: block; font-size: 2rem; letter-spacing: -.04em; }
.stats span { color: var(--muted); font-size: .82rem; }

.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 28px; }
.create-panel { margin-bottom: 56px; }
.panel-heading { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 24px; }
.panel-heading h2 { margin: 0 0 5px; font-size: 1.2rem; letter-spacing: -.02em; }
.panel-heading p { margin: 0; color: var(--muted); font-size: .9rem; }
.live-dot { width: 10px; height: 10px; margin-top: 7px; flex: 0 0 auto; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 6px rgba(255,77,46,.12); }
.step { display: grid; place-items: center; width: 30px; height: 30px; flex: 0 0 auto; color: #fff; background: var(--ink); border-radius: 9px; font-weight: 800; }

.alert-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 18px; align-items: end; }
.artist-picker, .or-divider, .wide-field { grid-column: 1 / -1; }
label { display: grid; gap: 8px; color: #344054; font-size: .82rem; font-weight: 750; }
input { width: 100%; height: 48px; padding: 0 14px; color: var(--ink); background: #fff; border: 1px solid #cfd4dc; border-radius: 9px; outline: none; }
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,77,46,.13); }
.search-control { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.field-help { margin: 7px 0 0; color: var(--muted); font-size: .78rem; font-weight: 400; }
.or-divider { display: flex; align-items: center; gap: 14px; color: #8b93a2; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }
.or-divider::before, .or-divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }

.artist-results { display: grid; gap: 8px; margin-top: 12px; max-height: 390px; overflow-y: auto; }
.artist-result { display: grid; grid-template-columns: 50px 1fr auto; gap: 13px; align-items: center; width: 100%; padding: 10px; text-align: left; color: var(--ink); background: #fafafa; border: 1px solid var(--line); border-radius: 11px; cursor: pointer; }
.artist-result:hover, .artist-result:focus-visible { border-color: var(--accent); background: #fff7f5; }
.artist-result img, .result-avatar { width: 50px; height: 50px; border-radius: 8px; object-fit: cover; }
.result-avatar { display: grid; place-items: center; color: #fff; background: var(--ink); font-weight: 800; }
.artist-result strong, .artist-result small { display: block; }
.artist-result small { max-width: 720px; margin-top: 3px; color: var(--muted); font-size: .75rem; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.choose-label { padding: 7px 10px; color: var(--accent); font-size: .75rem; font-weight: 800; }
.selected-artist { display: flex; gap: 12px; align-items: center; margin-top: 12px; padding: 13px 15px; color: var(--green); background: #ecfdf3; border: 1px solid #abefc6; border-radius: 10px; }
.selected-artist > span:first-child { font-size: 1.25rem; }
.selected-artist strong, .selected-artist small { display: block; }
.selected-artist small { margin-top: 2px; color: #477564; word-break: break-all; }

.button { min-height: 42px; padding: 0 16px; border: 0; border-radius: 8px; font-weight: 750; cursor: pointer; white-space: nowrap; }
.button:disabled { opacity: .55; cursor: wait; }
.button-primary { color: #fff; background: var(--accent); }
.button-primary:hover { background: var(--accent-dark); }
.button-dark { color: #fff; background: var(--ink); }
.button-secondary { color: var(--ink); background: #f0f2f5; }
.button-danger { color: var(--red); background: #fff0ee; }
.submit-alert { height: 48px; min-width: 130px; }

.section-heading, .page-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 22px; }
.section-heading h2 { margin: 0; font-size: 1.8rem; letter-spacing: -.04em; }
.section-heading > span { color: var(--muted); font-size: .82rem; }
.alert-list { display: grid; gap: 14px; }
.alert-card { overflow: hidden; display: grid; grid-template-columns: 1fr auto; gap: 22px; padding: 22px; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.alert-card.is-paused { opacity: .72; }
.alert-main { display: flex; gap: 16px; min-width: 0; }
.artist-avatar { display: grid; place-items: center; width: 52px; height: 52px; flex: 0 0 auto; color: #fff; background: var(--ink); border-radius: 12px 12px 12px 4px; font-size: 1.25rem; font-weight: 850; }
.alert-info { min-width: 0; }
.alert-title-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.alert-title-row h3 { margin: 0; font-size: 1.1rem; }
.status { padding: 4px 7px; border-radius: 999px; background: #eef1f5; color: #5b6471; font-size: .67rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.status-available { color: #067647; background: #dcfae6; }
.status-error { color: var(--red); background: #fee4e2; }
.status-paused { color: #854a0e; background: #fef0c7; }
.date-range { margin: 7px 0; color: #475467; font-size: .86rem; }
.source-link { color: var(--accent); font-size: .8rem; font-weight: 700; text-decoration: none; }
.last-check { margin: 8px 0 0; color: #8a93a2; font-size: .74rem; }
.error-text { max-width: 680px; margin: 7px 0 0; color: var(--red); font-size: .76rem; }
.alert-actions { display: flex; align-items: flex-start; gap: 7px; }
.event-strip { grid-column: 1 / -1; display: flex; gap: 8px; overflow-x: auto; padding-top: 16px; border-top: 1px solid var(--line); }
.event-strip a { min-width: 210px; padding: 11px 13px; background: #f7f8fa; border-radius: 9px; text-decoration: none; }
.event-strip span, .event-strip strong, .event-strip small { display: block; }
.event-strip span { color: var(--accent); font-size: .68rem; font-weight: 800; }
.event-strip strong { margin: 3px 0; font-size: .82rem; }
.event-strip small { color: var(--muted); font-size: .7rem; }
.empty-state { padding: 58px 20px; text-align: center; background: #fff; border: 1px dashed #cbd0d8; border-radius: 14px; }
.empty-state h3 { margin: 12px 0 6px; }
.empty-state p { margin: 0; color: var(--muted); }
.empty-icon { color: var(--accent); font-size: 2rem; }

.flash { margin: -16px 0 28px; padding: 13px 16px; border-radius: 9px; font-size: .88rem; }
.flash-success { color: #05603a; background: #dcfae6; }
.flash-error { color: var(--red); background: #fee4e2; }
.flash-info { color: #175cd3; background: #eaf2ff; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.settings-single { grid-template-columns: minmax(0, 720px); }
.stack-form { display: grid; gap: 18px; }
.check-row { display: flex; align-items: center; gap: 8px; }
.check-row input { width: 16px; height: 16px; }
.button-row, .inline-form { margin-top: 4px; }
.inline-form { padding-top: 16px; border-top: 1px solid var(--line); }
.command-list { display: grid; gap: 10px; margin: 0 0 20px; }
.command-list div { display: grid; gap: 4px; }
.command-list dt { color: var(--muted); font-size: .72rem; font-weight: 750; text-transform: uppercase; }
.command-list dd { margin: 0; }
code { padding: 3px 6px; color: #f8fafc; background: #252b36; border-radius: 5px; font-size: .78rem; word-break: break-all; }
details { padding: 14px 0; border-top: 1px solid var(--line); }
summary { cursor: pointer; font-weight: 750; }
.code-block { display: block; margin-top: 12px; padding: 12px; line-height: 1.6; }
.notice { margin-top: 16px; padding: 13px; color: #475467; background: #f5f7fa; border-radius: 8px; font-size: .8rem; line-height: 1.5; }
.notice-error { color: var(--red); background: #fee4e2; }
.telegram-connected { display: flex; align-items: center; gap: 13px; padding: 16px; color: #05603a; background: #ecfdf3; border: 1px solid #abefc6; border-radius: 11px; }
.telegram-connected strong, .telegram-connected small { display: block; }
.telegram-connected small { margin-top: 3px; color: #477564; }
.telegram-icon { display: grid; place-items: center; width: 34px; height: 34px; color: #fff; background: var(--green); border-radius: 50%; font-weight: 900; }
.telegram-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.connect-steps { display: grid; gap: 10px; margin: 0; padding-left: 22px; color: #475467; font-size: .88rem; line-height: 1.5; }

.auth-shell { min-height: calc(100vh - 130px); display: grid; align-items: center; }
.auth-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(360px, .8fr); align-items: center; gap: clamp(40px, 8vw, 110px); padding: 20px 0; }
.auth-intro h1 { margin: 0; font-size: clamp(3.5rem, 7vw, 6.5rem); line-height: .92; letter-spacing: -.065em; }
.auth-intro h1 span { color: var(--accent); }
.auth-intro > p:not(.eyebrow) { max-width: 590px; margin: 25px 0; color: var(--muted); font-size: 1rem; line-height: 1.7; }
.auth-points { display: grid; gap: 9px; color: #344054; font-size: .86rem; font-weight: 650; }
.auth-panel { width: 100%; max-width: 470px; justify-self: end; padding: 30px; }
.auth-panel h2 { margin: 26px 0 6px; font-size: 1.65rem; letter-spacing: -.04em; }
.auth-panel > p { margin: 0 0 24px; color: var(--muted); }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; background: #f0f2f5; border-radius: 10px; }
.auth-tabs a { padding: 10px; text-align: center; text-decoration: none; color: var(--muted); border-radius: 7px; font-size: .84rem; font-weight: 750; }
.auth-tabs a.active { color: var(--ink); background: #fff; box-shadow: 0 2px 8px rgba(18,23,34,.08); }
.auth-form .button { height: 48px; margin-top: 4px; }
footer { padding: 24px; color: #9098a5; background: var(--ink); text-align: center; font-size: .75rem; }

@media (max-width: 820px) {
  .page-shell { width: min(100% - 28px, 680px); padding-top: 28px; }
  .site-header { height: auto; min-height: 66px; padding: 12px 16px; }
  .brand > span:last-child { display: none; }
  nav a { padding: 8px; font-size: .78rem; }
  .logout-form { margin-left: 0; padding-left: 2px; }
  .logout-form button { padding: 7px 5px; font-size: .74rem; }
  .hero { grid-template-columns: 1fr; gap: 28px; padding-bottom: 32px; }
  .hero h1 { font-size: clamp(2.55rem, 13vw, 4rem); }
  .stats { max-width: 480px; }
  .panel { padding: 20px; border-radius: 14px; }
  .alert-form { grid-template-columns: 1fr 1fr; }
  .submit-alert { grid-column: 1 / -1; }
  .settings-grid { grid-template-columns: 1fr; }
  .auth-layout { grid-template-columns: 1fr; gap: 34px; }
  .auth-intro h1 { font-size: clamp(3rem, 12vw, 5rem); }
  .auth-panel { max-width: none; justify-self: stretch; }
  .alert-card { grid-template-columns: 1fr; }
  .alert-actions { flex-wrap: wrap; padding-left: 68px; }
}

@media (max-width: 520px) {
  .page-shell { width: calc(100% - 20px); }
  .hero { padding-top: 10px; }
  .hero-copy > p:last-child { font-size: .92rem; }
  .stats div { padding-left: 2px; }
  .stats strong { font-size: 1.55rem; }
  .stats span { font-size: .7rem; }
  .alert-form { grid-template-columns: 1fr; }
  .artist-picker, .or-divider, .wide-field, .submit-alert { grid-column: 1; }
  .search-control { grid-template-columns: 1fr; }
  .artist-result { grid-template-columns: 42px 1fr; }
  .artist-result img, .result-avatar { width: 42px; height: 42px; }
  .choose-label { display: none; }
  .alert-card { padding: 16px; }
  .alert-actions { padding-left: 0; }
  .alert-actions .button { padding: 0 11px; font-size: .76rem; }
  .section-heading { align-items: center; }
  .auth-shell { align-items: start; }
  .auth-intro { padding-top: 8px; }
  .auth-intro h1 { font-size: 3.2rem; }
  .auth-panel { padding: 20px; }
}
