:root {
  color-scheme: dark;
  --bg: #101414;
  --panel: #181f1f;
  --panel-2: #202828;
  --text: #eef5f2;
  --muted: #8fa09b;
  --line: #30403c;
  --accent: #4fb477;
  --accent-2: #d7b55c;
  --danger: #df675f;
  --radius: 8px;
  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: var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: var(--radius);
  cursor: pointer;
}

button:active {
  transform: translateY(1px);
}

.app-shell {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 16px;
}

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

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.1;
}

h2 {
  font-size: 18px;
}

h3 {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  margin: 18px 0 8px;
  text-transform: uppercase;
}

.topbar p {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.icon-button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  font-size: 22px;
}

.auth-panel {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.auth-panel p {
  color: var(--muted);
  margin: 8px 0 12px;
}

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

input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  background: #0b0f0f;
  color: var(--text);
  border-radius: var(--radius);
  padding: 11px 12px;
}

select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  background: #0b0f0f;
  color: var(--text);
  border-radius: var(--radius);
  padding: 10px 12px;
}

.search-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-bottom: 10px;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 0.8fr auto;
  gap: 8px;
  margin-bottom: 12px;
}

.settings-grid label {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  gap: 5px;
}

.checkbox-label {
  align-content: end;
  grid-template-columns: auto 1fr;
  align-items: center;
  padding-bottom: 10px;
}

.inline-status {
  color: var(--muted);
  font-size: 13px;
  min-height: 18px;
  margin-bottom: 8px;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.status-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  min-height: 88px;
}

.status-card strong {
  display: block;
  font-size: 13px;
  color: var(--muted);
}

.status-card span {
  display: block;
  font-size: 24px;
  margin-top: 8px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 10px 0 14px;
}

.tab {
  height: 38px;
  color: var(--muted);
}

.tab.active {
  color: #06100a;
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 700;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.section-title,
.action-row,
.transfer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.section-title {
  margin-bottom: 10px;
}

.small-button {
  min-height: 34px;
  padding: 0 10px;
  background: var(--accent);
  border-color: var(--accent);
  color: #06100a;
  font-weight: 700;
}

.small-button.muted {
  color: var(--text);
  background: var(--panel-2);
  border-color: var(--line);
}

.transfer-row {
  flex-wrap: wrap;
  justify-content: flex-start;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 10px;
}

.pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 9px;
  background: #0b0f0f;
}

.list {
  display: grid;
  gap: 8px;
}

.item {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius);
  padding: 12px;
}

.result-layout {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.result-body {
  min-width: 0;
  flex: 1;
}

.poster {
  width: 52px;
  height: 76px;
  object-fit: cover;
  background: #0b0f0f;
  border-radius: 4px;
  border: 1px solid var(--line);
  flex: 0 0 auto;
}

.overview {
  color: var(--muted);
  display: -webkit-box;
  font-size: 13px;
  line-height: 1.35;
  margin-top: 8px;
  overflow: hidden;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.item-head {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  justify-content: space-between;
}

.item-title {
  min-width: 0;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.item-meta {
  color: var(--muted);
  font-size: 13px;
  margin-top: 6px;
}

.progress {
  height: 8px;
  border-radius: 999px;
  background: #0a0d0d;
  overflow: hidden;
  margin-top: 10px;
}

.progress > div {
  height: 100%;
  background: var(--accent);
}

.state {
  flex: 0 0 auto;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 700;
}

.alerts {
  display: grid;
  gap: 8px;
}

.alert {
  border: 1px solid #68403d;
  color: #ffd9d4;
  background: #291817;
  border-radius: var(--radius);
  padding: 10px;
  font-size: 13px;
}

.empty {
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}

.hidden {
  display: none;
}

@media (max-width: 700px) {
  .app-shell {
    padding: 12px;
  }

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

  .section-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .action-row {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .small-button {
    min-width: 0;
  }

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

  .settings-grid,
  .search-form {
    grid-template-columns: 1fr;
  }
}
