:root {
  color-scheme: dark;
  --bg: #0d0f14;
  --surface: #151820;
  --surface-2: #1d2230;
  --surface-3: #252b3b;
  --text: #f5f7fb;
  --muted: #9ca7ba;
  --line: #30384b;
  --green: #31d67b;
  --green-soft: #123624;
  --amber: #f4b84a;
  --amber-soft: #3b2b13;
  --red: #ff6b6b;
  --blue: #66a6ff;
  --blue-soft: #162840;
  --violet: #a98cff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
}

a { color: inherit; }

.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 26px;
  border-bottom: 1px solid var(--line);
  background: #121621;
  position: sticky;
  top: 0;
  z-index: 2;
}

.brand {
  font-size: 24px;
  font-weight: 850;
}

.nav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.nav .muted {
  font-size: 16px;
  font-weight: 700;
}

.nav a,
button,
.button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--text);
  padding: 8px 14px;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.nav a:hover,
button:hover,
.button:hover {
  background: var(--surface-3);
}

button.primary,
.button.primary {
  background: var(--green);
  color: #06150c;
}

button.primary:hover {
  background: #47e08d;
}

button.warn {
  background: var(--amber);
  color: #211504;
}

button.danger {
  background: var(--red);
  color: #280707;
}

.page {
  width: min(1680px, 100%);
  margin: 0 auto;
  padding: 28px;
}

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

.login-box {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .28);
}

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

h1 { font-size: 26px; }

h2 {
  font-size: 16px;
  color: var(--muted);
  text-transform: uppercase;
}

.dashboard-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 18px;
}

.dashboard-title p {
  margin-top: 4px;
  color: var(--muted);
  font-weight: 700;
}

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

.summary span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 800;
}

.summary strong {
  color: var(--text);
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.section {
  min-width: 0;
  min-height: 430px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
}

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

.count {
  min-width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  font-weight: 900;
  color: var(--text);
  background: var(--surface-3);
}

.count.chat { background: var(--blue-soft); color: var(--blue); }
.count.phone { background: var(--green-soft); color: var(--green); }
.count.none { background: #2c2638; color: var(--violet); }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}

.card {
  position: relative;
  overflow: hidden;
  min-height: 142px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 14px 26px rgba(0, 0, 0, .14);
}

.card.break {
  border-color: rgba(244, 184, 74, .95);
  background: linear-gradient(180deg, #2d2418 0%, #231f1f 100%);
  box-shadow: 0 0 0 2px rgba(244, 184, 74, .2), 0 18px 36px rgba(244, 184, 74, .12);
}

.card.break::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: var(--amber);
}

.card.mine {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(102, 166, 255, .22), 0 18px 34px rgba(0, 0, 0, .22);
}

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.avatar {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #11151e;
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
}

.person {
  min-width: 0;
}

.name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
  font-weight: 900;
}

.meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.card-state {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.status-pill,
.channel-pill {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 900;
}

.status-pill.ok {
  background: var(--green-soft);
  color: var(--green);
}

.status-pill.break {
  background: var(--amber-soft);
  color: var(--amber);
  border: 1px solid rgba(244, 184, 74, .6);
  font-size: 14px;
  letter-spacing: 0;
  padding-inline: 12px;
  box-shadow: 0 0 22px rgba(244, 184, 74, .2);
}

.channel-pill {
  background: #11151e;
  color: var(--muted);
  border: 1px solid var(--line);
}

.channel-pill.chat {
  color: var(--blue);
  border-color: rgba(102, 166, 255, .35);
}

.channel-pill.phone {
  color: var(--green);
  border-color: rgba(49, 214, 123, .35);
}

.channel-pill.none {
  color: var(--violet);
  border-color: rgba(169, 140, 255, .34);
}

.break-time {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.break-banner {
  width: 100%;
  min-height: 34px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--amber);
  color: #211504;
  font-size: 14px;
  font-weight: 950;
}

.actions {
  margin-top: auto;
  display: grid;
  gap: 8px;
}

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

.inline {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

input,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #10141d;
  color: var(--text);
  padding: 8px 10px;
  font: inherit;
  font-weight: 700;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

form.stack,
.stack {
  display: grid;
  gap: 12px;
}

.notice,
.error {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 10px;
}

.notice {
  background: var(--blue-soft);
  border: 1px solid rgba(102, 166, 255, .34);
}

.error {
  background: #351820;
  border: 1px solid #6d303d;
}

.empty {
  min-height: 84px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--muted);
  font-weight: 800;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

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

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.split {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 16px;
  align-items: start;
}

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

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

  .section {
    min-height: auto;
  }
}

@media (max-width: 760px) {
  .topbar,
  .dashboard-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .page {
    padding: 18px;
  }

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

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