* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, sans-serif;
  background: #f8fafc;
  color: #0f172a;
}

.hidden {
  display: none !important;
}

.topbar {
  height: 56px;
  padding: 0 1rem;
  border-bottom: 1px solid #e2e8f0;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-chip {
  font-size: 13px;
  color: #475569;
}

.container {
  width: min(720px, calc(100% - 2rem));
  margin: 1.25rem auto;
  display: grid;
  gap: 1rem;
}

.card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1rem;
}

.card h2 {
  margin: 0 0 0.75rem;
  font-size: 16px;
}

.document-form {
  display: grid;
  gap: 0.85rem;
}

.field-row {
  display: grid;
  gap: 0.85rem;
}

@media (min-width: 560px) {
  .field-row {
    grid-template-columns: 1fr 1fr;
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.field span {
  font-size: 12px;
  color: #475569;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0 0.65rem;
  font: inherit;
  color: #0f172a;
  background: #fff;
}

.field input,
.field select {
  height: 36px;
}

.field select {
  cursor: pointer;
}

.field textarea {
  padding: 0.55rem 0.65rem;
  resize: vertical;
  min-height: 120px;
  line-height: 1.45;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #94a3b8;
}

.field-label-required::after {
  content: " *";
  color: #dc2626;
}

.field-hint {
  margin: 0;
  font-size: 12px;
  color: #64748b;
}

.field-error {
  font-size: 12px;
  color: #991b1b;
}

.field-invalid > input,
.field-invalid > select,
.field-invalid > textarea,
.field-invalid .multi-select-trigger {
  border-color: #ef4444;
}

.field-invalid .multi-select-trigger[aria-expanded="true"] {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 0.25rem;
}

.form-feedback {
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  border: 1px solid transparent;
  font-size: 13px;
}

.form-feedback.error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.form-feedback.success {
  background: #f0fdf4;
  border-color: #86efac;
  color: #166534;
}

.form-feedback.wip {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
  font-weight: 600;
  text-align: center;
}

.field input[type="file"] {
  height: auto;
  padding: 0.5rem 0.65rem;
  cursor: pointer;
}

.multi-select {
  position: relative;
}

.multi-select-trigger {
  width: 100%;
  height: 36px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0 0.65rem;
  background: #fff;
  color: #0f172a;
  font: inherit;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  cursor: pointer;
  text-align: left;
}

.multi-select-trigger:hover {
  border-color: #94a3b8;
}

.multi-select-trigger[aria-expanded="true"] {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.multi-select-trigger span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.multi-select-chevron {
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid #64748b;
  border-bottom: 2px solid #64748b;
  transform: rotate(45deg);
  flex-shrink: 0;
  margin-top: -0.15rem;
  transition: transform 0.15s ease;
}

.multi-select-trigger[aria-expanded="true"] .multi-select-chevron {
  transform: rotate(-135deg);
  margin-top: 0.15rem;
}

.multi-select-panel {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  z-index: 20;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
  overflow: hidden;
}

.multi-select-search {
  width: 100%;
  height: 36px;
  border: 0;
  border-bottom: 1px solid #e2e8f0;
  padding: 0 0.65rem;
  font: inherit;
  color: #0f172a;
  background: #f8fafc;
}

.multi-select-search:focus {
  outline: none;
  background: #fff;
}

.multi-select-options {
  max-height: 240px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.35rem;
}

.multi-select-option {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.45rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.35;
  color: #0f172a;
}

.multi-select-option:hover {
  background: #f1f5f9;
}

.multi-select-option:has(input:checked) {
  background: #eff6ff;
}

.multi-select-option input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  min-width: 1rem;
  margin: 0.1rem 0 0;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: #2563eb;
}

.multi-select-option span {
  flex: 1;
  min-width: 0;
  word-break: break-word;
}

.multi-select-option.hidden {
  display: none;
}

.multi-select-empty {
  padding: 0.65rem 0.5rem;
  font-size: 13px;
  color: #64748b;
}

.btn {
  height: 36px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 0.85rem;
  cursor: pointer;
  font-weight: 600;
}

.btn-primary {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

.btn-outline {
  background: #fff;
  border-color: #cbd5e1;
  color: #0f172a;
}

.login-main {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.login-card {
  width: min(420px, 100%);
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1.25rem;
  display: grid;
  gap: 0.65rem;
}

.login-card h1 {
  margin: 0;
  font-size: 20px;
}

.login-card p {
  margin: 0;
  color: #475569;
}
