:root {
  --bg: #090c12;
  --panel: #121722;
  --panel-soft: #171d2a;
  --line: rgba(226, 232, 240, 0.12);
  --line-strong: rgba(226, 232, 240, 0.22);
  --text: #f8fafc;
  --muted: #98a2b3;
  --muted-strong: #cbd5e1;
  --accent: #e2e8f0;
  --blue: #7aa7ff;
  --green: #85d6a3;
  --yellow: #e7c873;
  --red: #ef8f8f;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 12% 0%, rgba(122, 167, 255, 0.14), transparent 30%),
    radial-gradient(circle at 88% 12%, rgba(133, 214, 163, 0.08), transparent 28%),
    linear-gradient(180deg, #0d111a 0%, var(--bg) 54%, #080a0f 100%);
}

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

button {
  cursor: pointer;
}

.is-hidden {
  display: none !important;
}

.app-shell {
  width: min(100% - 32px, 1280px);
  margin: 0 auto;
}

.login-view {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 48px 0;
}

.login-panel {
  width: min(100%, 560px);
  padding: clamp(28px, 5vw, 46px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.025)), rgba(18, 23, 34, 0.92);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--muted-strong);
  font-size: 0.75rem;
  font-weight: 850;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

.login-panel h1,
.dashboard-header h1 {
  margin-bottom: 14px;
  font-size: clamp(2.15rem, 6vw, 4.6rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.login-copy {
  max-width: 420px;
  color: var(--muted-strong);
  line-height: 1.6;
}

.login-form {
  display: grid;
  gap: 12px;
  margin-top: 28px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted-strong);
  font-size: 0.92rem;
  font-weight: 760;
}

.password-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
  color: var(--text);
  background: rgba(255,255,255,0.055);
  padding: 12px 13px;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: var(--line-strong);
  background: rgba(255,255,255,0.075);
  box-shadow: 0 0 0 4px rgba(226, 232, 240, 0.06);
}

.btn,
.icon-btn,
.status-tabs button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text);
  font-weight: 850;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  white-space: nowrap;
}

.btn:hover,
.icon-btn:hover,
.status-tabs button:hover {
  transform: translateY(-1px);
}

.btn-primary {
  color: #091018;
  background: var(--accent);
}

.btn-secondary,
.icon-btn,
.status-tabs button {
  border-color: var(--line);
  background: rgba(255,255,255,0.055);
}

.btn[disabled] {
  cursor: wait;
  opacity: 0.62;
  transform: none;
}

.form-message {
  min-height: 22px;
  margin: 0;
  color: var(--red);
  font-weight: 800;
}

.form-message.is-success {
  color: var(--green);
}

.dashboard-view {
  padding: 28px 0 48px;
}

.dashboard-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 0 24px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  padding: 0;
}

.stats-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stats-strip div {
  min-height: 100px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(18, 23, 34, 0.84);
}

.stats-strip span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.stats-strip strong {
  display: block;
  margin-top: 10px;
  font-size: 2.1rem;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(230px, 1fr) auto;
  gap: 14px;
  align-items: end;
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(18, 23, 34, 0.84);
}

.search-wrap {
  min-width: 0;
}

.status-tabs {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.status-tabs button {
  min-height: 38px;
  padding: 0 12px;
  color: var(--muted-strong);
}

.status-tabs button.is-active {
  color: #091018;
  background: var(--accent);
}

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

.client-list {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(18, 23, 34, 0.78);
  box-shadow: var(--shadow);
}

.list-head,
.client-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.25fr) minmax(140px, 0.7fr) 150px minmax(200px, 1fr) 190px;
  gap: 14px;
  align-items: center;
}

.list-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 850;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.client-row {
  min-height: 104px;
  padding: 16px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.08);
}

.client-row:last-child {
  border-bottom: 0;
}

.client-main {
  min-width: 0;
}

.client-main strong {
  display: block;
  margin-bottom: 7px;
  font-size: 1rem;
}

.client-title {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 7px;
}

.client-title strong {
  margin-bottom: 0;
}

.platform-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted-strong);
  background: rgba(255,255,255,0.045);
  font-size: 0.72rem;
  font-weight: 880;
}

.client-main a,
.discord-link {
  display: block;
  width: fit-content;
  max-width: 100%;
  color: var(--muted-strong);
  font-size: 0.88rem;
  overflow-wrap: anywhere;
}

.client-main a:hover,
.discord-link:hover {
  color: #ffffff;
}

.audience {
  display: grid;
  gap: 6px;
  color: var(--muted-strong);
  font-size: 0.9rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 880;
}

.status-todo {
  color: var(--blue);
}

.status-waiting {
  color: var(--yellow);
}

.status-sold {
  color: var(--green);
}

.status-refused {
  color: var(--red);
}

.notes {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

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

.row-actions .btn {
  min-height: 36px;
  padding: 0 11px;
  font-size: 0.84rem;
}

.empty-state {
  padding: 58px 20px;
  text-align: center;
}

.empty-state h2 {
  margin-bottom: 8px;
}

.empty-state p {
  margin-bottom: 0;
  color: var(--muted);
}

.client-modal {
  width: min(100% - 30px, 820px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: #101620;
  box-shadow: var(--shadow);
}

.client-modal::backdrop {
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(8px);
}

.client-form {
  padding: clamp(20px, 4vw, 30px);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.modal-head h2 {
  margin-bottom: 0;
  font-size: clamp(1.5rem, 4vw, 2.25rem);
}

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

.platform-field,
.notes-field {
  grid-column: 1 / -1;
}

.input-action-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.btn-inline {
  min-height: 46px;
  padding: 0 13px;
}

.is-platform-hidden {
  display: none !important;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

@media (max-width: 980px) {
  .stats-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toolbar {
    grid-template-columns: 1fr;
  }

  .actions {
    justify-content: flex-start;
  }

  .list-head {
    display: none;
  }

  .client-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .row-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 22px, 1280px);
  }

  .password-row,
  .stats-strip,
  .form-grid,
  .input-action-row {
    grid-template-columns: 1fr;
  }

  .btn {
    width: 100%;
  }

  .actions,
  .modal-actions {
    flex-direction: column;
  }
}
