:root {
  --ink: #101828;
  --ink-soft: #344054;
  --muted: #667085;
  --line: #e4e7ec;
  --surface: #ffffff;
  --canvas: #f4f6fa;
  --violet: #6b4eff;
  --violet-dark: #5437ec;
  --violet-soft: #efedff;
  --green: #12b76a;
  --green-soft: #eafbf3;
  --amber: #f79009;
  --amber-soft: #fff5e5;
  --red: #d92d20;
  --shadow: 0 12px 32px rgba(16, 24, 40, .08);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
a { color: inherit; text-decoration: none; }
button, a { -webkit-tap-highlight-color: transparent; }

.topbar {
  height: 76px;
  padding: 0 max(24px, calc((100vw - 1440px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255,255,255,.94);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(18px);
}
.brand { display: inline-flex; gap: 12px; align-items: center; }
.brand > span:last-child { display: grid; letter-spacing: .03em; line-height: 1; }
.brand strong { font-size: 17px; }
.brand small { font-size: 9px; color: var(--violet); letter-spacing: .32em; margin-top: 5px; }
.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: white;
  background: linear-gradient(145deg, #806bff, #4c2fe6);
  box-shadow: 0 8px 20px rgba(107,78,255,.32);
  transform: rotate(-7deg);
}
.brand-mark span { font-size: 19px; font-weight: 900; transform: rotate(7deg); }
.brand-mark-large { width: 58px; height: 58px; border-radius: 17px; }
.brand-mark-large span { font-size: 28px; }
.topbar-status { display: flex; align-items: center; gap: 18px; }
.system-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid #b7ebd0;
  color: #087443;
  background: var(--green-soft);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.system-pill.warning { color: #9a5b00; border-color: #fbd8a4; background: var(--amber-soft); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 3px rgba(247,144,9,.14); }
.status-dot.online { background: var(--green); box-shadow: 0 0 0 3px rgba(18,183,106,.14); }
.profile { border: 0; background: transparent; display: flex; align-items: center; gap: 9px; padding: 5px; cursor: pointer; color: var(--ink); }
.profile > span:last-child { display: grid; text-align: left; }
.profile strong { font-size: 12px; }
.profile small { color: var(--muted); font-size: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: white; font-weight: 800; }

.page { width: min(1440px, calc(100% - 48px)); margin: 0 auto; padding: 42px 0 56px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.heading-actions { display: flex; gap: 10px; align-items: center; }
.page-heading h1 { margin: 5px 0 8px; font-size: clamp(30px, 4vw, 46px); letter-spacing: -.045em; line-height: 1.05; }
.page-heading p { margin: 0; }
.eyebrow { margin: 0; font-size: 10px; font-weight: 800; letter-spacing: .2em; color: rgba(255,255,255,.56); }
.eyebrow.purple { color: var(--violet); }
.muted { color: var(--muted); }

.button {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 11px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 750;
  font-size: 13px;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.button:hover { transform: translateY(-1px); }
.button:focus-visible, input:focus-visible, summary:focus-visible { outline: 3px solid rgba(107,78,255,.24); outline-offset: 2px; }
.button-primary { color: white; background: var(--violet); box-shadow: 0 9px 20px rgba(107,78,255,.25); }
.button-primary:hover { background: var(--violet-dark); }
.button-ghost { background: white; border-color: var(--line); box-shadow: 0 5px 14px rgba(16,24,40,.04); }
.button-excel { color: #087443; background: var(--green-soft); border-color: #b7ebd0; }
.button-word { color: #175cd3; background: #eff8ff; border-color: #b2ddff; }
.button-wide { width: 100%; min-height: 50px; }

.report-panel, .table-card, .queue-card, .operation-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 5px 20px rgba(16,24,40,.035); }
.report-panel { padding: 18px; margin-bottom: 18px; }
.period-form { display: flex; align-items: flex-end; gap: 12px; }
.date-field { display: grid; gap: 7px; min-width: 180px; }
.date-field label, .credit-form label > span { color: var(--muted); font-size: 11px; font-weight: 700; }
input[type="date"], input[type="search"], .credit-form input, .login-form input {
  min-height: 44px;
  border: 1px solid #d0d5dd;
  border-radius: 10px;
  background: white;
  color: var(--ink);
  padding: 0 13px;
}
.date-arrow { color: #98a2b3; font-size: 18px; padding-bottom: 11px; }
.quick-periods { display: flex; gap: 4px; margin-left: auto; padding: 4px; border-radius: 11px; background: #f2f4f7; }
.quick-periods button { border: 0; background: transparent; color: var(--ink-soft); padding: 8px 10px; border-radius: 8px; font-size: 11px; font-weight: 700; cursor: pointer; }
.quick-periods button:hover { background: white; }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-bottom: 18px; }
.metric-card { min-height: 128px; display: flex; align-items: center; gap: 15px; padding: 21px; background: white; border: 1px solid var(--line); border-radius: 16px; }
.metric-card.attention { border-color: #fedf89; }
.metric-card.dark-card { color: white; background: linear-gradient(135deg, #111827, #1f2937); border-color: transparent; box-shadow: var(--shadow); }
.metric-card > div { display: grid; gap: 3px; }
.metric-card small { color: var(--muted); font-size: 11px; font-weight: 650; }
.dark-card small, .dark-card span { color: rgba(255,255,255,.58); }
.metric-card strong { font-size: 30px; letter-spacing: -.04em; }
.metric-card span { color: #98a2b3; font-size: 10px; }
.metric-icon { flex: 0 0 auto; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: rgba(255,255,255,.11); color: white; font-weight: 900; }
.metric-icon.violet { background: var(--violet-soft); color: var(--violet); }
.metric-icon.green { background: var(--green-soft); color: var(--green); }
.metric-icon.amber { background: var(--amber-soft); color: var(--amber); }

.table-card { overflow: hidden; margin-bottom: 18px; }
.table-toolbar { padding: 20px 22px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); }
.table-toolbar h2 { margin: 3px 0 0; font-size: 20px; letter-spacing: -.025em; }
.toolbar-actions { display: flex; align-items: center; gap: 8px; }
.search-box { position: relative; display: flex; align-items: center; }
.search-box span { position: absolute; left: 13px; color: #98a2b3; font-size: 20px; }
.search-box input { width: 240px; padding-left: 39px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { padding: 11px 16px; text-align: left; color: var(--muted); background: #f9fafb; border-bottom: 1px solid var(--line); font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
td { padding: 15px 16px; border-bottom: 1px solid #eef0f3; vertical-align: middle; }
tbody tr:hover { background: #fbfaff; }
tbody tr[hidden] { display: none; }
.credit-cell { color: var(--ink-soft); max-width: 260px; }
.number-cell { text-align: center; }
.play-count { min-width: 34px; height: 28px; padding: 0 9px; border-radius: 8px; display: inline-grid; place-items: center; background: #f2f4f7; color: var(--ink); font-weight: 800; }
.badge { display: inline-flex; align-items: center; min-height: 26px; padding: 0 9px; border-radius: 999px; font-size: 9px; font-weight: 800; white-space: nowrap; font-style: normal; }
.badge-ready { color: #087443; background: var(--green-soft); }
.badge-review { color: #b54708; background: var(--amber-soft); }
.badge-missing { color: #5925dc; background: var(--violet-soft); }
.empty-state { padding: 46px 20px; display: grid; place-items: center; gap: 5px; color: var(--muted); }
.empty-state span { font-size: 34px; color: var(--violet); }
.empty-state strong { color: var(--ink); font-size: 15px; }
.table-footer { padding: 13px 20px; display: flex; justify-content: flex-end; gap: 24px; color: var(--muted); background: #fcfcfd; font-size: 11px; }
.table-footer strong { color: var(--ink); }

.operations-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.operation-card { padding: 20px; }
.operation-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.operation-heading h3 { margin: 0 0 3px; font-size: 14px; }
.operation-heading p { margin: 0; font-size: 10px; color: var(--muted); }
.status-list { margin: 0; display: grid; gap: 9px; }
.status-list > div { display: flex; justify-content: space-between; gap: 12px; padding-top: 9px; border-top: 1px solid #eef0f3; }
.status-list dt { color: var(--muted); font-size: 10px; }
.status-list dd { margin: 0; font-size: 10px; font-weight: 800; text-align: right; }
.operation-empty, .operation-footnote { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.collector-setup { margin-top: 14px; padding-top: 12px; border-top: 1px solid #eef0f3; display: grid; gap: 8px; }
.text-button { width: fit-content; padding: 0; border: 0; background: transparent; color: var(--violet); font-size: 10px; font-weight: 800; cursor: pointer; }
.collector-setup code { padding: 8px; border-radius: 8px; background: #f2f4f7; color: var(--ink); font-size: 9px; overflow-wrap: anywhere; user-select: all; }
.night-time { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 12px; background: #f9fafb; margin-bottom: 12px; }
.night-time strong { font-size: 25px; letter-spacing: -.05em; }
.night-time span { font-size: 9px; color: var(--muted); line-height: 1.4; }

.queue-card { overflow: hidden; }
.queue-count { color: var(--violet); background: var(--violet-soft); padding: 7px 10px; border-radius: 999px; font-size: 10px; font-weight: 800; }
.queue-list { display: grid; }
.queue-item { border-bottom: 1px solid var(--line); }
.queue-item:last-child { border-bottom: 0; }
.queue-item summary { list-style: none; cursor: pointer; padding: 14px 22px; display: flex; justify-content: space-between; gap: 18px; align-items: center; }
.queue-item summary::-webkit-details-marker { display: none; }
.queue-item summary > span:first-child { display: grid; gap: 3px; }
.queue-item summary small { color: var(--muted); }
.queue-meta { display: flex; align-items: center; gap: 12px; }
.queue-meta b { font-size: 10px; }
.credit-form { padding: 18px 22px 22px; display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; background: #f9fafb; align-items: end; }
.search-empty { margin: 0; padding: 18px 24px; color: var(--muted); text-align: center; border-top: 1px solid var(--line); }
.review-note { margin: 0; padding: 14px 22px 0; color: var(--ink-soft); background: #f9fafb; }
.evidence-list { padding: 12px 22px 0; display: grid; gap: 7px; background: #f9fafb; }
.evidence-list a { color: var(--purple); overflow-wrap: anywhere; }
.credit-form label { display: grid; gap: 7px; }

.alert { margin: 0 0 18px; padding: 12px 14px; border-radius: 10px; font-size: 12px; font-weight: 650; }
.alert-error { color: #b42318; background: #fef3f2; border: 1px solid #fecdca; }
.alert-success { color: #087443; background: var(--green-soft); border: 1px solid #abefc6; }
.track-dialog { width: min(620px, calc(100% - 28px)); padding: 0; border: 0; border-radius: 20px; box-shadow: 0 28px 90px rgba(16,24,40,.32); }
.track-dialog::backdrop { background: rgba(16,24,40,.58); backdrop-filter: blur(4px); }
.add-track-form { padding: 25px; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.dialog-heading, .dialog-help, .dialog-actions { grid-column: 1 / -1; }
.dialog-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.dialog-heading h2 { margin: 4px 0 0; font-size: 24px; letter-spacing: -.035em; }
.dialog-close { width: 36px; height: 36px; border: 0; border-radius: 10px; background: #f2f4f7; color: var(--ink-soft); font-size: 24px; cursor: pointer; }
.dialog-help { margin: -3px 0 1px; font-size: 12px; line-height: 1.5; }
.add-track-form label { display: grid; gap: 7px; color: var(--ink-soft); font-size: 11px; font-weight: 700; }
.add-track-form label:nth-of-type(1), .add-track-form label:nth-of-type(2) { grid-column: 1 / -1; }
.add-track-form input { min-height: 46px; border: 1px solid #d0d5dd; border-radius: 10px; padding: 0 13px; color: var(--ink); }
.add-track-form small { color: var(--muted); font-size: 9px; font-weight: 500; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; padding-top: 4px; }
.footer { width: min(1440px, calc(100% - 48px)); margin: 0 auto; padding: 24px 0 36px; display: flex; justify-content: space-between; color: #98a2b3; font-size: 9px; letter-spacing: .08em; }

.login-body { min-height: 100vh; background: #0c111d; display: grid; place-items: center; overflow: hidden; }
.login-shell { width: min(1020px, calc(100% - 40px)); min-height: 610px; display: grid; grid-template-columns: 1.15fr .85fr; background: white; border-radius: 26px; overflow: hidden; box-shadow: 0 36px 100px rgba(0,0,0,.42); }
.login-brand { position: relative; padding: 58px; display: flex; flex-direction: column; justify-content: space-between; color: white; background: radial-gradient(circle at 78% 18%, rgba(107,78,255,.65), transparent 35%), linear-gradient(145deg, #111827, #080b12); overflow: hidden; }
.login-brand h1 { margin: 14px 0 18px; font-size: clamp(38px, 5vw, 59px); line-height: .98; letter-spacing: -.055em; }
.login-lead { max-width: 440px; margin: 0; color: rgba(255,255,255,.62); line-height: 1.6; font-size: 14px; }
.signal-grid { display: flex; height: 75px; align-items: flex-end; gap: 8px; opacity: .72; }
.signal-grid span { width: 9px; border-radius: 9px; background: linear-gradient(to top, var(--violet), #b7adff); animation: pulse 2.4s ease-in-out infinite alternate; }
.signal-grid span:nth-child(1) { height: 22%; }
.signal-grid span:nth-child(2) { height: 58%; animation-delay: -.4s; }
.signal-grid span:nth-child(3) { height: 92%; animation-delay: -.9s; }
.signal-grid span:nth-child(4) { height: 47%; animation-delay: -.2s; }
.signal-grid span:nth-child(5) { height: 73%; animation-delay: -.7s; }
.signal-grid span:nth-child(6) { height: 34%; animation-delay: -1.1s; }
@keyframes pulse { to { transform: scaleY(.6); opacity: .58; } }
.login-card { padding: 64px 52px; display: flex; flex-direction: column; justify-content: center; }
.login-card-heading { display: flex; align-items: center; gap: 13px; }
.login-card h2 { margin: 4px 0 0; font-size: 27px; letter-spacing: -.04em; }
.secure-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; color: var(--violet); background: var(--violet-soft); font-size: 22px; }
.login-card > .muted { margin: 12px 0 25px; font-size: 12px; }
.login-form { display: grid; gap: 16px; }
.login-form label { display: grid; gap: 7px; }
.login-form label span { font-size: 11px; color: var(--ink-soft); font-weight: 700; }
.security-note { margin-top: 25px; padding-top: 18px; border-top: 1px solid var(--line); display: flex; justify-content: center; align-items: center; gap: 9px; color: var(--muted); font-size: 9px; }

@media (max-width: 1050px) {
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .period-form { flex-wrap: wrap; }
  .quick-periods { margin-left: 0; }
  .operations-grid { grid-template-columns: 1fr 1fr; }
  .schedule-card { grid-column: 1 / -1; }
  .credit-form { grid-template-columns: 1fr 1fr; }
  .credit-form .button { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .topbar { height: 66px; padding: 0 16px; }
  .system-pill { display: none; }
  .page { width: min(100% - 24px, 1440px); padding-top: 26px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .page-heading .button { width: 100%; }
  .heading-actions { width: 100%; flex-direction: column; }
  .period-form, .toolbar-actions { align-items: stretch; flex-direction: column; }
  .date-field, .search-box input { width: 100%; }
  .date-arrow { display: none; }
  .quick-periods { width: 100%; }
  .quick-periods button { flex: 1; }
  .metrics { grid-template-columns: 1fr; }
  .metric-card { min-height: 105px; }
  .table-toolbar { align-items: flex-start; flex-direction: column; }
  .toolbar-actions { width: 100%; }
  .operations-grid { grid-template-columns: 1fr; }
  .schedule-card { grid-column: auto; }
  .credit-form { grid-template-columns: 1fr; }
  .credit-form .button { grid-column: auto; }
  .queue-item summary { align-items: flex-start; }
  .queue-meta { align-items: flex-end; flex-direction: column; }
  .footer { width: calc(100% - 24px); flex-direction: column; gap: 8px; }
  .login-shell { grid-template-columns: 1fr; min-height: 0; }
  .login-brand { display: none; }
  .login-card { padding: 46px 28px; min-height: 540px; }
  .add-track-form { grid-template-columns: 1fr; padding: 20px; }
  .add-track-form label { grid-column: 1 / -1; }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions .button { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
