:root {
  --bg: #f6f6f8;
  --card: #ffffff;
  --sidebar: #f7f7f8;
  --text: #101116;
  --muted: #9a9ca5;
  --line: #e6e6ea;
  --brand: #7264ff;
  --brand-dark: #5b4ee8;
  --danger: #ef4444;
  --shadow: 0 30px 70px rgba(12, 16, 27, 0.12);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(114, 100, 255, .08), transparent 34%),
    var(--bg);
}

.topbar {
  width: min(1080px, calc(100% - 48px));
  margin: 34px auto 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  text-decoration: none;
  color: #5d72ff;
  line-height: .72;
  font-style: italic;
  letter-spacing: -1px;
  transform: rotate(-2deg);
}
.brand span { display: block; font-size: 24px; font-weight: 800; margin-left: 42px; }
.brand strong { display: block; font-size: 34px; font-weight: 900; }
.topbar nav { display: flex; gap: clamp(18px, 4vw, 58px); align-items: center; }
.topbar nav a { color: #333743; text-decoration: none; font-size: 14px; }
.topbar nav .login { color: #5d72ff; font-weight: 700; }

.shell {
  width: min(960px, calc(100% - 48px));
  min-height: 438px;
  margin: 120px auto 50px;
  background: var(--card);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 76px 1fr;
}
.side-nav { background: var(--sidebar); display: flex; flex-direction: column; align-items: center; }
.side-icon {
  width: 76px;
  height: 94px;
  border: 0;
  background: transparent;
  color: #9b9da4;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: .2s ease;
}
.side-icon.active, .side-icon:hover { background: #fff; color: var(--brand); }
.side-icon span { display: block; width: 28px; height: 4px; margin: 3px 0; border-radius: 999px; background: currentColor; }
.file-icon { margin-top: 0; }

.panel { display: none; padding: 34px 40px 50px; min-height: 438px; }
.active-panel { display: block; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; }
.eyebrow { margin: 0 0 4px; color: var(--brand); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .16em; }
h1 { margin: 0; font-size: clamp(42px, 5vw, 52px); letter-spacing: .12em; font-weight: 800; }
.save-state, .upload-state { color: var(--muted); font-size: 14px; margin-top: 14px; }
.save-state.saving { color: var(--brand); font-weight: 700; }
.save-state.saved { color: #16a34a; font-weight: 700; }
.save-state.error { color: var(--danger); font-weight: 700; }
.upload-state.saving { color: var(--brand); font-weight: 700; }
.upload-state.saved { color: #16a34a; font-weight: 700; }
.upload-state.error { color: var(--danger); font-weight: 700; }

.upload-progress {
  width: 100%;
  height: 8px;
  border: 1px solid var(--line);
  background: #f3f3f6;
  overflow: hidden;
  margin-top: 8px;
}
.upload-progress-bar {
  width: 0%;
  height: 100%;
  background: var(--brand);
  transition: width .18s ease;
}


textarea {
  width: 100%;
  min-height: 210px;
  height: auto;
  resize: none;
  overflow: hidden;
  margin-top: 32px;
  border: 0;
  outline: 0;
  color: #343741;
  font-size: 22px;
  line-height: 1.6;
  background: transparent;
}
textarea::placeholder { color: #a5a7af; }
.actions { display: flex; justify-content: flex-end; gap: 14px; margin-top: 20px; flex-wrap: wrap; }
.btn {
  min-width: 160px;
  height: 54px;
  border: 1px solid transparent;
  background: var(--brand);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  border-radius: 0;
  cursor: pointer;
  transition: .18s ease;
}
.btn:hover { transform: translateY(-1px); background: var(--brand-dark); }
.btn.secondary { background: #fff; border-color: #c8c8cf; color: #4b4d56; }
.btn.secondary:hover { background: #f6f6f8; }
.btn.danger { background: #fff; border-color: #fecaca; color: var(--danger); }
.btn.danger:hover { background: #fff1f2; }
.btn.small { min-width: 178px; height: 46px; }

.dropzone {
  min-height: 284px;
  border: 1px dashed #d7d7de;
  margin-top: 24px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: .2s ease;
}
.dropzone.dragover { border-color: var(--brand); background: rgba(114,100,255,.04); }
.drop-content { color: #9da0a9; display: grid; place-items: center; gap: 8px; text-align: center; }
.drop-content svg { color: var(--brand); margin-bottom: 8px; }
.drop-content strong { color: #6b6f7c; font-size: 16px; }
.drop-content span { font-size: 14px; }
.file-list { display: grid; gap: 12px; margin-top: 22px; }
.file-card {
  border: 1px solid var(--line);
  padding: 14px;
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
}
.file-details { min-width: 0; }
.attachment-preview {
  width: 64px;
  height: 64px;
  border: 1px solid var(--line);
  background: #fafafa;
  display: grid;
  place-items: center;
  overflow: hidden;
  flex: 0 0 64px;
}
.attachment-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.doc-preview {
  color: var(--brand);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
}
.file-name { font-weight: 800; color: #30333d; word-break: break-word; }
.file-meta { color: var(--muted); font-size: 13px; margin-top: 5px; }
.file-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.file-actions a, .file-actions button {
  border: 1px solid #d5d5dc;
  background: #fff;
  color: #444753;
  padding: 9px 12px;
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
}
.file-actions button { color: var(--danger); border-color: #fecaca; }
.empty { color: var(--muted); text-align: center; border: 1px dashed var(--line); padding: 24px; }
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  background: #12131a;
  color: #fff;
  padding: 12px 16px;
  border-radius: 10px;
  box-shadow: 0 20px 40px rgba(0,0,0,.2);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: .22s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 760px) {
  .topbar { margin-top: 22px; }
  .topbar nav { display: none; }
  .shell { margin-top: 48px; grid-template-columns: 60px 1fr; width: min(100% - 24px, 960px); }
  .side-icon { width: 60px; }
  .panel { padding: 28px 22px 38px; }
  h1 { letter-spacing: .06em; }
  .panel-head { flex-direction: column; }
  .actions { justify-content: stretch; }
  .btn { flex: 1; min-width: 140px; }
  .file-card { grid-template-columns: 64px 1fr; }
  .file-actions { justify-content: flex-start; grid-column: 2; }
}

.selected-files {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  color: #6b6f7c;
  display: grid;
  gap: 4px;
}
.selected-files strong { color: #30333d; }
.selected-file-grid { display: grid; gap: 10px; margin-top: 6px; }
.selected-file-item {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}
.selected-file-item .attachment-preview { width: 48px; height: 48px; flex-basis: 48px; }
.selected-file-details { min-width: 0; display: grid; gap: 3px; }
.selected-file-name { font-size: 13px; word-break: break-word; color: #30333d; font-weight: 700; }
.selected-file-details small { color: var(--muted); font-size: 12px; }
.file-save-actions { justify-content: flex-start; margin-top: 16px; }
button:disabled { opacity: .6; cursor: not-allowed; transform: none !important; }
