:root {
  --bg: #eef2f7;
  --ink: #0e1118;
  --muted: #647084;
  --line: #d8e0eb;
  --panel: #ffffff;
  --dark: #101725;
  --dark-2: #0b111d;
  --red: #f11218;
  --red-dark: #c90d13;
  --green: #0f9f6e;
  --blue: #2563eb;
  --amber: #c47b10;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(241, 18, 24, .09), transparent 28%),
    linear-gradient(180deg, #f8fafc 0%, var(--bg) 48%, #e8edf5 100%);
  color: var(--ink);
}

.hidden {
  display: none !important;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 26% 20%, rgba(241, 18, 24, .38), transparent 24%),
    radial-gradient(circle at 80% 74%, rgba(37, 99, 235, .22), transparent 24%),
    linear-gradient(145deg, #080c14 0%, #121a2a 62%, #090d15 100%),
    #0d1320;
}

.auth-card {
  width: min(440px, 100%);
  padding: 28px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .96);
  border: 1px solid rgba(255, 255, 255, .36);
  box-shadow: 0 32px 110px rgba(0, 0, 0, .42);
}

.auth-brand {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 14px;
  align-items: center;
  margin-bottom: 20px;
}

.auth-brand img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 10px 26px rgba(15, 23, 42, .16);
}

.auth-brand strong {
  display: block;
  font-size: 28px;
}

.auth-brand span {
  color: var(--muted);
  font-weight: 800;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.auth-tabs button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f3f6fb;
  font-weight: 900;
}

.auth-tabs button.active {
  color: #fff;
  background: linear-gradient(135deg, var(--red), #b90f15);
  border-color: var(--red);
  box-shadow: 0 10px 22px rgba(241, 18, 24, .24);
}

.auth-form {
  display: grid;
  gap: 12px;
}

button, input, select, textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px;
  background:
    linear-gradient(180deg, rgba(241, 18, 24, .10), transparent 18%),
    #0d1320;
  color: #fff;
  border-right: 1px solid #222c3f;
  box-shadow: 18px 0 60px rgba(15, 23, 42, .08);
}

.brand {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 12px;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid #263247;
}

.brand img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 12px 26px rgba(0, 0, 0, .2);
}

.brand strong {
  display: block;
  font-size: 24px;
  line-height: 1;
}

.brand span,
.sidebar-card span,
.eyebrow,
small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.brand span {
  color: #b7c1d4;
  letter-spacing: .12em;
}

.nav-group {
  display: grid;
  gap: 8px;
}

.nav-item,
.ghost-btn,
.secondary-btn,
.primary-btn {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  font-weight: 800;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 14px;
  background: transparent;
  color: #c9d2e3;
  text-align: left;
  border: 1px solid transparent;
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}

.nav-item span {
  width: 24px;
  color: #fff;
}

.nav-item:hover,
.nav-item.active {
  background: #1d2738;
  border-color: #334057;
  color: #fff;
  transform: translateX(2px);
}

.sidebar-card {
  margin-top: auto;
  padding: 16px;
  background:
    linear-gradient(135deg, rgba(241, 18, 24, .16), transparent),
    #151d2c;
  border: 1px solid #263247;
  border-radius: 8px;
}

.sidebar-card strong {
  display: block;
  margin-top: 4px;
}

.ghost-btn {
  background: transparent;
  color: #fff;
  border: 1px solid #38465d;
  transition: background .16s ease, border-color .16s ease;
}

.ghost-btn:hover {
  background: #1d2738;
  border-color: #5b6a84;
}

.workspace {
  min-width: 0;
  padding: 30px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 22px;
}

h1, h2, p {
  margin: 0;
}

h1 {
  font-size: 36px;
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  font-size: 21px;
}

.profile-strip {
  display: flex;
  gap: 10px;
  align-items: center;
}

.profile-strip select,
input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(241, 18, 24, .55);
  box-shadow: 0 0 0 4px rgba(241, 18, 24, .10);
}

textarea {
  min-height: 96px;
  resize: vertical;
}

.view {
  display: none;
}

.active-view {
  display: block;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 46px rgba(16, 24, 40, .08);
}

.metric {
  position: relative;
  overflow: hidden;
  padding: 20px;
}

.metric::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--red);
}

.metric span {
  color: var(--muted);
  font-weight: 800;
}

.metric strong {
  display: block;
  margin: 10px 0 4px;
  font-size: 32px;
  line-height: 1;
}

.split-layout,
.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr);
  gap: 18px;
}

.panel {
  padding: 20px;
  min-width: 0;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 16px;
}

.dark-panel {
  background:
    linear-gradient(135deg, rgba(241, 18, 24, .10), transparent 32%),
    var(--dark);
  color: #fff;
  border-color: #263247;
}

.dark-panel input,
.dark-panel select,
.dark-panel textarea {
  background: #0b111d;
  color: #fff;
  border-color: #2c3a51;
}

.primary-btn {
  padding: 0 18px;
  color: #fff;
  background: linear-gradient(135deg, var(--red), #bf0f15);
  box-shadow: 0 10px 20px rgba(241, 18, 24, .18);
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}

.primary-btn:hover {
  background: linear-gradient(135deg, #ff1d24, var(--red-dark));
  box-shadow: 0 14px 28px rgba(241, 18, 24, .25);
  transform: translateY(-1px);
}

.secondary-btn {
  padding: 0 14px;
  color: var(--ink);
  background: #eef2f7;
  border: 1px solid #d8e0ec;
  transition: background .16s ease, transform .16s ease, border-color .16s ease;
}

.secondary-btn:hover,
.row-actions button:hover,
.text-btn:hover {
  background: #fff;
  border-color: #b9c4d4;
  transform: translateY(-1px);
}

.pill,
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 8px;
  background: #edf2f8;
  color: #3d485a;
  font-size: 12px;
  font-weight: 900;
  border: 1px solid #dbe3ee;
}

.dark-panel .pill {
  background: #273247;
  color: #dce5f5;
}

.release-list,
.ticket-list,
.timeline,
.connector-list,
.connector-preview {
  display: grid;
  gap: 10px;
}

.release-card,
.ticket-card,
.transaction,
.connector-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.release-card:hover,
.ticket-card:hover,
.transaction:hover,
.connector-card:hover,
.plan-card:hover {
  border-color: #c3ccd9;
  box-shadow: 0 16px 34px rgba(15, 23, 42, .09);
  transform: translateY(-1px);
}

.dark-panel .connector-card,
.dark-panel .release-card {
  background: #0b111d;
  border-color: #2b3850;
}

.release-card {
  grid-template-columns: 56px minmax(0, 1fr) auto;
  align-items: center;
}

.cover {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  background: #eef2f7;
  border: 1px solid #e3e8f0;
}

.title-block strong {
  display: block;
}

.title-block span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.row-actions button,
.text-btn {
  min-height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  transition: background .16s ease, transform .16s ease, border-color .16s ease;
}

.danger {
  color: #fff !important;
  background: linear-gradient(135deg, #dc2626, #991b1b) !important;
  border-color: #b91c1c !important;
}

.form-panel,
.mini-form,
.connector-form {
  display: grid;
  gap: 12px;
}

.artist-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

label {
  display: grid;
  gap: 7px;
  color: #465163;
  font-weight: 800;
  font-size: 14px;
}

.check,
.checklist label {
  display: flex;
  align-items: center;
  gap: 10px;
}

input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
  accent-color: var(--red);
}

.checklist {
  display: grid;
  gap: 12px;
}

.upload-preview {
  margin-top: 18px;
  display: grid;
  gap: 12px;
}

.data-table {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

th, td {
  padding: 13px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
  background: #f8fafc;
}

tbody tr:hover td {
  background: #fbfcff;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.admin-session {
  display: grid;
  grid-template-columns: minmax(240px, 360px) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}

.wide {
  grid-column: 1 / -1;
}

.connector-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.connector-form button {
  grid-column: 1 / -1;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.plan-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, #ffffff, #fbfcff);
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.plan-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.plan-top h3 {
  margin: 9px 0 0;
  font-size: 20px;
}

.plan-top strong {
  text-align: right;
  font-size: 20px;
}

.limit-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.limit-grid span {
  min-height: 52px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.limit-grid b {
  display: block;
  color: var(--ink);
  font-size: 18px;
}

dialog {
  width: min(760px, calc(100vw - 28px));
  border: 0;
  padding: 0;
  border-radius: 8px;
  box-shadow: 0 28px 90px rgba(0, 0, 0, .34);
}

dialog::backdrop {
  background: rgba(7, 12, 22, .62);
}

.modal-card {
  position: relative;
  padding: 24px;
  display: grid;
  gap: 14px;
}

.close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 24px;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.meta-item {
  padding: 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.meta-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  margin-bottom: 4px;
}

#toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: 360px;
  padding: 12px 16px;
  border-radius: 8px;
  background: linear-gradient(135deg, #111827, #202b3d);
  color: #fff;
  opacity: 0;
  transform: translateY(12px);
  transition: .2s ease;
  pointer-events: none;
  font-weight: 800;
  box-shadow: 0 18px 48px rgba(15, 23, 42, .25);
}

#toast.show {
  opacity: 1;
  transform: translateY(0);
}

.status {
  font-weight: 900;
  display: inline-flex !important;
  width: fit-content;
  min-height: 24px;
  align-items: center;
  padding: 3px 8px;
  border-radius: 8px;
}

.status.approved {
  color: #047857;
  background: #dcfce7;
}

.status.pending {
  color: #92400e;
  background: #fef3c7;
}

.status.rejected {
  color: #991b1b;
  background: #fee2e2;
}

@media (max-width: 1040px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .metric-grid,
  .split-layout,
  .form-grid,
  .admin-grid,
  .connector-form,
  .plan-grid,
  .artist-grid {
    grid-template-columns: 1fr;
  }

  .wide {
    grid-column: auto;
  }

  .admin-session {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .workspace,
  .sidebar {
    padding: 16px;
  }

  .topbar,
  .profile-strip,
  .panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .auth-card {
    padding: 20px;
  }

  .auth-brand {
    grid-template-columns: 52px 1fr;
  }

  .auth-brand img {
    width: 52px;
    height: 52px;
  }

  h1 {
    font-size: 28px;
  }

  .release-card {
    grid-template-columns: 48px 1fr;
  }

  .limit-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .release-card .row-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}
