:root {
  color-scheme: dark;
  --bg: #080706;
  --surface: #15110f;
  --surface-2: #201915;
  --line: #332820;
  --text: #fff7ef;
  --muted: #b9aaa0;
  --orange: #ff7a1a;
  --orange-2: #ffb15d;
  --danger: #ff5b5b;
  --ok: #4ee59a;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 0%, rgba(255, 122, 26, 0.28), transparent 30%),
    linear-gradient(180deg, #100b08, #080706 42%);
}

button,
input {
  font: inherit;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  padding: 0 16px;
  background: var(--surface-2);
  color: var(--text);
  font-weight: 800;
}

input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0e0b09;
  color: var(--text);
  padding: 0 14px;
  outline: none;
}

input:focus {
  border-color: rgba(255, 122, 26, 0.8);
  box-shadow: 0 0 0 4px rgba(255, 122, 26, 0.12);
}

.primary {
  background: linear-gradient(135deg, var(--orange), #ff4f12);
  color: #190b02;
}

.ghost {
  border: 1px solid var(--line);
  background: transparent;
}

.danger {
  background: rgba(255, 91, 91, 0.14);
  color: #ff8d8d;
}

.authView {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 22px;
}

.authCard {
  width: min(430px, 100%);
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(21, 17, 15, 0.92);
  padding: 24px;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.42);
}

.logoMark {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 22px;
  background:
    linear-gradient(145deg, #ffb15d, #ff6a13 56%, #1f1410);
  box-shadow: 0 18px 38px rgba(255, 122, 26, 0.22);
}

.logoMark span {
  font-size: 38px;
  font-weight: 950;
  color: #120700;
}

.logoMark.small {
  width: 48px;
  height: 48px;
  border-radius: 16px;
}

.logoMark.small span {
  font-size: 25px;
}

.eyebrow {
  margin: 0;
  color: var(--orange-2);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(30px, 9vw, 44px);
  line-height: 1;
}

h2 {
  font-size: 18px;
}

.muted {
  color: var(--muted);
  line-height: 1.5;
}

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

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

.errorText {
  color: #ff8d8d;
  min-height: 20px;
}

.appView {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 14px calc(88px + env(safe-area-inset-bottom));
}

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

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

.brand h1 {
  font-size: 25px;
}

.statusCluster {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 11px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--danger);
}

.dot.online {
  background: var(--ok);
  box-shadow: 0 0 0 5px rgba(78, 229, 154, 0.12);
}

.statusGrid {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}

.statusCard,
.panel,
.uploadBox {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(21, 17, 15, 0.88);
  padding: 16px;
}

.statusCard span {
  color: var(--orange-2);
  font-size: 12px;
  font-weight: 900;
}

.statusCard strong {
  display: block;
  margin-top: 5px;
  font-size: 18px;
}

.statusCard p,
.statusCard small {
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.45;
}

.tabs {
  position: sticky;
  top: 0;
  z-index: 4;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 14px 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(8, 7, 6, 0.88);
  backdrop-filter: blur(12px);
}

.tab {
  min-height: 40px;
  border-radius: 12px;
  padding: 0 8px;
  color: var(--muted);
}

.tab.active {
  background: var(--orange);
  color: #180900;
}

.tabPanel {
  display: none;
}

.tabPanel.active {
  display: grid;
  gap: 14px;
}

.messages {
  display: grid;
  gap: 10px;
  min-height: 44vh;
  align-content: end;
}

.message {
  max-width: 86%;
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  padding: 12px;
}

.message.user {
  justify-self: end;
  background: linear-gradient(135deg, rgba(255, 122, 26, 0.22), rgba(255, 79, 18, 0.1));
  border-color: rgba(255, 122, 26, 0.36);
}

.message p {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.fileChips,
.pickedFiles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.fileChip {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--orange-2);
  padding: 7px 10px;
  font-size: 12px;
  text-decoration: none;
}

.composer {
  position: sticky;
  bottom: env(safe-area-inset-bottom);
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(21, 17, 15, 0.96);
  backdrop-filter: blur(16px);
}

.attachBtn {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--orange-2);
  font-size: 26px;
  line-height: 1;
}

.sendBtn {
  min-width: 76px;
}

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

.actionCard {
  min-height: 116px;
  display: grid;
  align-content: space-between;
  justify-items: start;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  padding: 14px;
  text-align: left;
}

.actionCard strong {
  font-size: 16px;
}

.actionCard small {
  color: var(--muted);
  line-height: 1.35;
}

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

.taskList,
.fileList {
  display: grid;
  gap: 10px;
}

.taskItem,
.fileItem {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #0f0c0a;
  padding: 12px;
}

.taskItem strong,
.fileItem strong {
  display: block;
  overflow-wrap: anywhere;
}

.taskItem small,
.fileItem small {
  display: block;
  color: var(--muted);
  margin-top: 5px;
}

.taskLog {
  max-height: 130px;
  overflow: auto;
  margin: 10px 0 0;
  color: #d6c5b8;
  white-space: pre-wrap;
  font-size: 12px;
}

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

.toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 20;
  border: 1px solid rgba(255, 122, 26, 0.34);
  border-radius: 16px;
  background: #21140d;
  color: var(--text);
  padding: 13px 14px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.38);
}

@media (min-width: 760px) {
  .appView {
    padding-inline: 24px;
  }

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

  .actionGrid {
    grid-template-columns: repeat(4, 1fr);
  }

  .messages {
    min-height: 52vh;
  }
}
