:root {
  --bg: #e8edf3;
  --panel: #ffffff;
  --panel-soft: #f5f8fb;
  --line: #d6deea;
  --text: #1f2a36;
  --muted: #5d6b79;
  --accent: #0067d8;
  --accent-strong: #0055b2;
  --danger: #b73b3b;
  --success: #237a44;
  --shadow: 0 20px 60px rgba(28, 44, 69, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(0, 103, 216, 0.08), transparent 34%),
    linear-gradient(180deg, #f4f7fa 0%, #e8edf3 100%);
}

.auth-page,
.cabinet-page {
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-layout,
.cabinet-layout {
  width: min(100%, 1280px);
  padding: 24px;
}

.auth-card,
.cabinet-shell,
.menu-card,
.content-card,
.info-card,
.detail-box {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.auth-card {
  width: min(100%, 420px);
  margin: 0 auto;
  padding: 28px;
}

.auth-title,
.cabinet-title,
.panel-title {
  margin: 0;
}

.auth-title {
  font-size: 30px;
  line-height: 1;
}

.cabinet-shell {
  padding: 28px;
}

.brand-header {
  display: flex;
  justify-content: center;
  text-align: center;
}

.home-stack {
  width: min(100%, 520px);
  margin: 24px auto 0;
}

.home-menu-card {
  margin-top: 20px;
}

.greeting-card {
  text-align: center;
}

.greeting-text {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
}

.section-shell {
  margin-top: 24px;
}

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

.cabinet-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

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

.cabinet-title {
  font-size: 32px;
  line-height: 1;
}

.info-card {
  margin-top: 20px;
  padding: 20px;
  background: var(--panel-soft);
}

.info-line {
  margin: 0;
  color: var(--muted);
}

.info-line + .info-line {
  margin-top: 8px;
}

.workspace-grid {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 20px;
  margin-top: 20px;
}

.menu-card,
.content-card {
  padding: 20px;
}

.menu-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.menu-button,
.user-row {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f9fbfd;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.menu-button.active,
.user-row.active {
  border-color: rgba(0, 103, 216, 0.45);
  background: rgba(0, 103, 216, 0.08);
}

.content-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.panel-title {
  font-size: 22px;
}

.panel-text {
  margin: 14px 0 0;
  line-height: 1.6;
  color: var(--muted);
}

.detail-box {
  margin-top: 18px;
  padding: 18px;
}

.detail-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.split-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.user-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.card-list,
.status-grid,
.file-list,
.chat-messages {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.status-card,
.file-row,
.chat-message {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f9fbfd;
}

.status-card .panel-text {
  margin-top: 8px;
}

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

.files-actions {
  margin-top: 14px;
}

.file-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.file-main {
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  color: var(--text);
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
}

.chat-message.user {
  background: rgba(0, 103, 216, 0.08);
  border-color: rgba(0, 103, 216, 0.18);
}

.chat-message.assistant {
  background: #f9fbfd;
}

.chat-message-title {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
}

.chat-message-text {
  margin: 8px 0 0;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-form {
  margin-top: 18px;
}

.chat-input {
  width: 100%;
  min-height: 120px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  resize: vertical;
  background: #f9fbfd;
  outline: none;
  font: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.chat-input:focus {
  border-color: rgba(0, 103, 216, 0.45);
  box-shadow: 0 0 0 4px rgba(0, 103, 216, 0.08);
}

.upload-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.hidden-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.stack-form {
  margin-top: 18px;
}

#login-form {
  margin-top: 24px;
}

.field {
  display: block;
}

.field + .field {
  margin-top: 14px;
}

.field span {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
}

.field input,
.field-select {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f9fbfd;
  outline: none;
  font-size: 16px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field input:focus,
.field-select:focus {
  border-color: rgba(0, 103, 216, 0.45);
  box-shadow: 0 0 0 4px rgba(0, 103, 216, 0.08);
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 18px;
}

.primary-button,
.secondary-button {
  height: 48px;
  border: 0;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.primary-button {
  color: #ffffff;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-strong) 100%);
}

.secondary-button {
  color: var(--accent);
  background: rgba(0, 103, 216, 0.1);
}

.compact-button {
  width: 120px;
  height: 40px;
}

.logout-button {
  width: 140px;
}

.message {
  min-height: 24px;
  margin-top: 16px;
  font-size: 14px;
  color: var(--muted);
}

.message.error {
  color: var(--danger);
}

.message.success {
  color: var(--success);
}

.feature-list {
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.feature-item {
  padding: 10px 0;
  border-top: 1px solid var(--line);
  line-height: 1.5;
}

.token-result {
  margin-top: 18px;
  padding: 16px;
  border-radius: 14px;
  background: var(--panel-soft);
}

.token-value {
  display: block;
  margin-top: 12px;
  padding: 12px;
  border-radius: 12px;
  background: #eef4fb;
  word-break: break-all;
  white-space: pre-wrap;
}

.hidden {
  display: none;
}

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

@media (max-width: 820px) {
  .cabinet-header {
    flex-direction: column;
    align-items: stretch;
  }

  .section-head {
    flex-direction: column;
    align-items: stretch;
  }

  .logout-button {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .auth-layout,
  .cabinet-layout {
    padding: 16px;
  }

  .auth-card,
  .cabinet-shell,
  .menu-card,
  .content-card,
  .detail-box {
    padding: 16px;
    border-radius: 16px;
  }

  .button-row {
    grid-template-columns: 1fr;
  }

  .compact-button {
    width: 100%;
  }

  .file-row {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-row {
    flex-direction: column;
    align-items: stretch;
  }
}
