:root {
  --bg: #f3f6fb;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #56617a;
  --line: #d6deed;
  --accent: #2f52e0;
  --accent-dark: #1f3fc1;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, Segoe UI, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.container {
  width: min(1040px, 92vw);
  margin: 32px auto 64px;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  letter-spacing: -0.02em;
}

.eyebrow {
  margin: 0;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}

.subtitle {
  margin: 0 0 8px;
  color: var(--muted);
  line-height: 1.45;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  margin-top: 20px;
  box-shadow: 0 8px 20px rgba(18, 35, 84, 0.05);
}

.controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  align-items: end;
}

.field-group label {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 6px;
  color: var(--muted);
}

input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  height: 42px;
  padding: 0 12px;
}

button.primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  height: 42px;
  padding: 0 16px;
  font-weight: 600;
  cursor: pointer;
}

button.primary:hover {
  background: var(--accent-dark);
}

button.primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  grid-column: 1 / -1;
}

.list {
  margin-top: 22px;
  display: grid;
  gap: 12px;
}

.upload-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}

.upload-item h3 {
  margin: 0 0 12px;
  font-size: 1rem;
}

.doc-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.doc-title {
  margin: 0;
  font-size: 1rem;
}

.help-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.help-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.help-icon:hover,
.help-icon:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.help-popover {
  position: absolute;
  z-index: 20;
  left: 0;
  top: calc(100% + 6px);
  min-width: min(320px, 85vw);
  max-width: min(420px, 92vw);
  padding: 10px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(23, 24, 28, 0.12);
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.45;
}

.alt-row {
  margin: 0 0 10px;
}

.alt-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
}

.alt-select {
  width: auto;
  min-width: 0;
  max-width: 280px;
  height: 34px;
  padding: 0 10px;
  font-size: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  cursor: pointer;
}

.alt-select:focus {
  outline: 2px solid rgba(43, 79, 255, 0.35);
  outline-offset: 1px;
}

.template-banner .muted {
  color: var(--muted);
  font-weight: 400;
}

.deadline-banner {
  border-left: 4px solid var(--accent);
  background: linear-gradient(90deg, rgba(43, 79, 255, 0.06), transparent);
  font-weight: 500;
}

.uploaded-files-collapse {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 14px 12px;
  margin-top: 12px;
}

.uploaded-files-collapse > summary {
  cursor: pointer;
  padding: 12px 0;
  font-weight: 600;
  font-size: 0.95rem;
  list-style: none;
}

.uploaded-files-collapse > summary::-webkit-details-marker {
  display: none;
}

.uploaded-files-body {
  padding-bottom: 8px;
}

.upload-group {
  margin-top: 14px;
}

.upload-group:first-child {
  margin-top: 4px;
}

.upload-group-title {
  margin: 0 0 8px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
}

.upload-file-list-inner {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.9rem;
}

.upload-file-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  list-style: disc;
}

.upload-line-type {
  font-weight: 600;
}

.upload-line-file {
  flex: 1;
  min-width: 120px;
}

.upload-line-file.muted {
  color: var(--muted);
  font-weight: 400;
}

.upload-file-actions {
  flex-shrink: 0;
  white-space: nowrap;
}

.upload-line-comment {
  width: 100%;
  font-size: 0.85rem;
  color: var(--muted);
}

.upload-meta-edit {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(180px, 280px) 1fr auto;
  gap: 8px;
  align-items: center;
  margin-top: 6px;
}

.upload-comment-inline {
  min-height: 46px;
  padding: 8px 10px;
}

.upload-meta-save {
  height: 36px;
  padding: 0 12px;
}

.uploaded-checklist {
  margin-top: 12px;
}

.uploaded-files-body.compact {
  padding-bottom: 0;
}

.checklist-stats {
  margin-bottom: 10px;
  font-size: 0.9rem;
  color: var(--muted);
}

.unclassified-group {
  border: 1px solid #ffd7a8;
  background: #fffaf2;
  border-radius: 10px;
  padding: 10px;
}

.document-checklist {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.check-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 0 10px 8px;
}

.check-item.done {
  border-left: 4px solid #11753f;
}

.check-item.open {
  border-left: 4px solid #c39000;
}

.check-item-summary {
  cursor: pointer;
  padding: 8px 0;
  font-weight: 600;
  list-style: none;
}

.check-item-summary::-webkit-details-marker {
  display: none;
}

.category-upload-box {
  margin: 4px 0 10px;
  padding: 8px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: #f9fbff;
}

.category-upload-row {
  margin-top: 8px;
}

.link-action {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  font-size: 0.85rem;
}

.link-action:hover {
  text-decoration: underline;
}

.btn-inline {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
}

.btn-inline.danger {
  color: #b22222;
}

.btn-inline.danger:hover {
  text-decoration: underline;
}

.doc-card {
  overflow: hidden;
}

.doc-card--open {
  padding: 14px;
}

.doc-heading {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.doc-kind {
  font-size: 1.05rem;
  font-weight: 700;
}

details.upload-item {
  padding: 0;
}

details.upload-item > .doc-summary {
  padding: 12px 14px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  list-style: none;
  background: #f8f9fc;
}

details.upload-item > .doc-summary::-webkit-details-marker {
  display: none;
}

details.upload-item[open] > .doc-summary {
  border-bottom: 1px solid var(--line);
}

details.upload-item > .doc-card-body {
  padding: 14px;
}

.dropzone {
  border: 2px dashed #b7bfd5;
  border-radius: 12px;
  padding: 18px;
  text-align: center;
  color: var(--muted);
  transition: 0.2s border-color, 0.2s background;
}

.dropzone.disabled {
  opacity: 0.45;
  pointer-events: none;
}

.dropzone.dragover {
  border-color: var(--accent);
  background: #eff3ff;
}

.row {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.upload-progress {
  width: min(320px, 100%);
  height: 10px;
  background: #e7ebf5;
  border-radius: 999px;
  overflow: hidden;
}

.upload-progress.hidden {
  display: none;
}

.upload-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #2b4fff, #6f87ff);
  transition: width 0.15s ease;
}

.upload-progress-text {
  font-size: 0.82rem;
  color: var(--muted);
  min-width: 2.8rem;
}

.simple-upload-title {
  margin: 0 0 12px;
  font-size: 1.05rem;
}

.simple-upload-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.upload-comment {
  width: 100%;
  min-height: 72px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  resize: vertical;
}

.status {
  font-size: 0.9rem;
  color: var(--muted);
}

.status.ok {
  color: #11753f;
}

.status.error {
  color: #b22222;
}

.admin-editor {
  width: 100%;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.85rem;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  resize: vertical;
}

.workflow-step {
  margin-bottom: 1.25rem;
}

.workflow-step-title {
  font-size: 1.1rem;
  margin: 0 0 0.5rem;
  color: var(--accent-dark);
}

.workflow-mt {
  margin: 0.75rem 0 0.5rem 0.5rem;
  padding-left: 0.75rem;
  border-left: 3px solid var(--line);
}

.workflow-mt-title {
  font-weight: 600;
  margin: 0 0 0.35rem;
}

.assignee-badge {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: normal;
}

.admin-form-title {
  margin: 0 0 8px;
  font-size: 1.1rem;
}

.workflow-form-root {
  margin-top: 0.5rem;
}

.admin-meta-block {
  margin-bottom: 1.25rem;
}

.admin-section {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.admin-section:last-child {
  border-bottom: none;
}

.admin-section-title {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  color: var(--accent-dark);
}

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 0.35rem 0 0.75rem;
}

.admin-tree-node {
  margin: 0.5rem 0.5rem 0.5rem 0;
  padding: 0.75rem 0.75rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
}

.admin-tree-children {
  margin-left: 1rem;
  padding-left: 0.75rem;
  border-left: 2px solid var(--line);
}

.admin-step-block {
  margin: 1rem 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafbfc;
}

.admin-mt-block {
  margin: 0.75rem 0 0.75rem 0.5rem;
  padding: 0.75rem;
  border-left: 3px solid var(--accent);
  background: var(--card);
}

.admin-subtask-block {
  margin: 0.75rem 0;
  padding: 0.75rem;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.admin-subtask-id-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
}

.admin-subtask-id-row input {
  flex: 1;
  min-width: 200px;
}

.muted-input {
  background: #f0f1f4;
  color: var(--muted);
}

.admin-json-details summary {
  cursor: pointer;
  font-weight: 600;
}
