:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #657282;
  --line: #dde3ea;
  --accent: #0d766e;
  --accent-strong: #095f59;
  --warn: #b7791f;
  --danger: #b42318;
  --ok: #137333;
  --blue: #2563eb;
  --shadow: 0 12px 30px rgba(23, 32, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

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

.sidebar {
  background: #111827;
  color: #fff;
  padding: 24px 18px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 34px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

.brand span {
  display: block;
  margin-top: 2px;
  color: #aab4c2;
  font-size: 13px;
}

nav {
  display: grid;
  gap: 8px;
}

nav button {
  border: 0;
  border-radius: 8px;
  padding: 12px 14px;
  background: transparent;
  color: #cbd5e1;
  text-align: left;
}

nav button.active,
nav button:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

main {
  padding: 28px;
  min-width: 0;
}

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

.top-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

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

h1 {
  margin-bottom: 6px;
  font-size: 28px;
}

h2 {
  font-size: 20px;
}

h3 {
  font-size: 16px;
}

p {
  color: var(--muted);
  line-height: 1.6;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.primary,
.secondary,
.ghost,
.danger,
.link-button {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 14px;
  white-space: nowrap;
}

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

.primary:hover {
  background: var(--accent-strong);
}

.secondary {
  background: #e7f3f1;
  color: var(--accent-strong);
  border-color: #b8dbd6;
}

.ghost {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}

.danger {
  background: #fff2f0;
  color: var(--danger);
  border-color: #ffd0cc;
}

.link-button,
.mini-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.link-button {
  margin-top: 12px;
  background: #fff;
  color: var(--accent-strong);
  border-color: #b8dbd6;
  font-weight: 700;
}

.mini-link {
  min-height: 30px;
  margin-top: 8px;
  padding: 5px 9px;
  border-radius: 8px;
  background: #eef8f6;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
}

.task .mini-link {
  margin-top: 0;
  margin-right: 8px;
}

.grid {
  display: grid;
  gap: 16px;
}

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

.stat,
.panel,
.task,
.channel,
.empty {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.stat {
  padding: 18px;
}

.stat strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
}

.panel {
  padding: 20px;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 18px;
}

form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 6px;
  color: #334155;
  font-size: 13px;
  font-weight: 650;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13, 118, 110, 0.12);
}

.task-list,
.channel-list,
.activity-list {
  display: grid;
  gap: 12px;
}

.account-form {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
}

.account-form label:nth-of-type(6) {
  grid-column: span 2;
}

.account-list {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.account-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.account-row b,
.account-row span,
.account-row small {
  display: block;
}

.account-row span,
.account-row small {
  margin-top: 3px;
  color: var(--muted);
}

.account-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.small-button {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 800;
}

.account-empty {
  margin: 0;
}

.account-inline {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-right: 8px;
  vertical-align: middle;
}

.account-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 5px 9px;
  border-radius: 8px;
  background: #eef2f7;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}

.account-chip small {
  color: var(--muted);
  font-weight: 700;
}

.account-chip.disabled {
  background: #fff7e6;
  color: var(--warn);
}

.task,
.channel {
  padding: 16px;
}

.task-head,
.channel-head,
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.muted {
  color: var(--muted);
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #eef2f7;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
}

.pill.online,
.pill.approved,
.pill.configured {
  background: #e7f6ec;
  color: var(--ok);
}

.pill.reviewing,
.pill.submitted,
.pill.api {
  background: #eaf1ff;
  color: var(--blue);
}

.pill.rejected,
.pill.not_configured {
  background: #fff0ee;
  color: var(--danger);
}

.pill.draft,
.pill.browser,
.pill.manual,
.pill.paused {
  background: #fff7e6;
  color: var(--warn);
}

.task-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.task-grid label {
  min-width: 0;
}

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

.check-card {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.check-card input {
  width: auto;
  margin-top: 3px;
}

.activity-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.activity-item:last-child {
  border-bottom: 0;
}

.empty {
  padding: 42px;
  text-align: center;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 10;
  max-width: 360px;
  border-radius: 8px;
  background: #111827;
  color: #fff;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}

.login-page {
  display: grid;
  min-height: 100vh;
  background: #111827;
}

.login-shell {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.login-card {
  width: min(100%, 420px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: #fff;
  padding: 28px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.26);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 26px;
}

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

.login-card h1 {
  margin-bottom: 8px;
}

.login-card form {
  margin-top: 20px;
}

.form-error {
  min-height: 22px;
  color: var(--danger);
  font-weight: 700;
}

@media (max-width: 980px) {
  #app {
    display: block;
    min-height: 100vh;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 5;
    padding: 14px;
  }

  .brand {
    margin-bottom: 12px;
  }

  nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  nav button {
    text-align: center;
  }

  main {
    padding: 18px;
  }

  .stats,
  .split,
  .task-grid,
  .channel-picker,
  .account-form {
    grid-template-columns: 1fr;
  }

  .account-form label:nth-of-type(6) {
    grid-column: auto;
  }

  .topbar,
  .top-actions,
  .task-head,
  .channel-head,
  .row {
    align-items: flex-start;
    flex-direction: column;
  }
}
