:root {
  color-scheme: dark;
  --bg: #090b12;
  --bg-soft: #10141f;
  --panel: rgba(24, 29, 43, 0.78);
  --panel-strong: rgba(32, 38, 55, 0.94);
  --line: rgba(255, 255, 255, 0.11);
  --text: #f4f7fb;
  --muted: #98a2b8;
  --accent: #55e0d1;
  --accent-2: #8ed766;
  --danger: #ff6b7a;
  --warn: #f6c85f;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 54% 0%, rgba(35, 130, 132, 0.32), transparent 34%),
    radial-gradient(circle at 16% 100%, rgba(96, 126, 178, 0.22), transparent 30%),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #06100f;
  cursor: pointer;
  font-weight: 750;
  min-height: 38px;
  padding: 0 14px;
}

button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.8);
  opacity: 0.55;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(7, 10, 18, 0.72);
  color: var(--text);
  outline: 0;
  padding: 11px 12px;
}

textarea {
  resize: vertical;
}

a {
  color: var(--accent);
  text-decoration: none;
}

.shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
  min-height: 100vh;
  padding: 18px;
}

.sidebar,
.workspace {
  min-width: 0;
}

.sidebar {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(13, 17, 27, 0.86);
  box-shadow: var(--shadow);
  padding: 16px;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #4a76ff);
  color: #06100f;
  font-weight: 900;
}

.brand small,
.field span,
.limit-control span,
.status-card small,
.drop-zone small {
  color: var(--muted);
  font-size: 12px;
}

.panel,
.tool-panel,
.chat-panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}

.soft {
  padding: 12px;
}

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

.section-head h2,
.tool-panel h2 {
  margin: 0;
  font-size: 16px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.field {
  display: grid;
  gap: 7px;
}

.compact input {
  min-height: 38px;
}

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

.project-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.project-item {
  display: grid;
  gap: 4px;
  min-height: 54px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  padding: 9px 10px;
  text-align: start;
}

.project-item small {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-item.active {
  border-color: rgba(85, 224, 209, 0.58);
  background: rgba(85, 224, 209, 0.1);
}

.icon-btn,
.ghost-btn,
.secondary {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
}

.icon-btn {
  width: 34px;
  min-height: 34px;
  padding: 0;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
}

.workspace {
  display: grid;
  min-height: calc(100vh - 36px);
}

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

.upload-btn {
  display: grid;
  place-items: center;
  width: 42px;
  min-height: 42px;
  padding: 0;
  color: var(--text);
}

.upload-btn svg {
  display: block;
}

.file-hint {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  max-width: 180px;
  overflow: hidden;
  padding: 6px 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.045);
  padding: 11px;
}

.project-status {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 8, 15, 0.72);
  padding: 12px 16px;
}

.project-status__icon {
  display: grid;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  place-items: center;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 800;
}

.project-status__text {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.project-status__text strong {
  font-size: 14px;
}

.project-status__text small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.project-status--uploading .project-status__icon,
.project-status--processing .project-status__icon {
  background: rgba(246, 200, 95, 0.18);
  color: var(--warn);
}

.project-status--ready .project-status__icon {
  background: rgba(142, 215, 102, 0.18);
  color: var(--accent-2);
}

.project-status--idle .project-status__icon {
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
}

.chat-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: calc(100vh - 36px);
  overflow: hidden;
}

.chat-log {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: auto;
  padding: 16px;
}

.message {
  max-width: min(760px, 92%);
  white-space: pre-wrap;
}

.message.user {
  align-self: flex-end;
  border-color: rgba(85, 224, 209, 0.32);
  background: rgba(85, 224, 209, 0.11);
}

.message.assistant {
  align-self: flex-start;
}

.message.clarification {
  align-self: flex-start;
  border-color: rgba(246, 200, 95, 0.42);
  background: rgba(246, 200, 95, 0.1);
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  border-top: 1px solid var(--line);
  background: rgba(5, 8, 15, 0.55);
  padding: 14px;
}

[dir="rtl"] body {
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
}

[dir="rtl"] .project-item,
[dir="rtl"] input,
[dir="rtl"] textarea {
  text-align: right;
}

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

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