:root {
  --ink: #1b251f;
  --muted: #6b766f;
  --line: #dce2de;
  --line-strong: #c8d1cb;
  --brand: #587640;
  --brand-dark: #405a2e;
  --brand-soft: #edf2e9;
  --danger: #b42318;
  --danger-soft: #fff1f0;
  --success: #2c6b3f;
  --success-soft: #eaf5ed;
  --canvas: #f4f5f3;
  --surface: #ffffff;
  --shadow: 0 16px 45px rgba(29, 42, 34, .07);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 3%, rgba(88, 118, 64, .08), transparent 25rem),
    var(--canvas);
  font: 16px/1.5 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .68; }

.shell {
  width: min(1040px, calc(100% - 40px));
  margin: 0 auto;
  padding: 34px 0 48px;
}

body.is-loading .auth-view,
body.is-ready .auth-view,
body.is-locked .app-view { display: none; }
body.is-ready .app-view,
body.is-locked .auth-view { display: block; }

.topbar {
  display: flex;
  min-height: 66px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 56px;
  padding: 0 22px;
  border-radius: 14px;
  background: #252c28;
  box-shadow: 0 10px 30px rgba(27, 37, 31, .14);
}

.brand { display: inline-flex; align-items: center; }
.brand img { display: block; width: 168px; height: auto; }

.user { display: flex; align-items: center; gap: 10px; color: #eef1ef; }
.user > span:not(.user-dot) {
  max-width: 250px;
  overflow: hidden;
  font-size: 14px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9bc875;
  box-shadow: 0 0 0 4px rgba(155, 200, 117, .13);
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 0;
  border-radius: 9px;
  padding: 0 17px;
  font-size: 14px;
  font-weight: 700;
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}
.button:hover { transform: translateY(-1px); }
.button--ghost { border: 1px solid var(--line); color: var(--ink); background: var(--surface); }
.topbar .button--ghost { border-color: rgba(255, 255, 255, .16); color: #fff; background: rgba(255, 255, 255, .07); }
.topbar .button--ghost:hover { background: rgba(255, 255, 255, .13); }
.button--primary {
  min-width: 210px;
  min-height: 50px;
  color: #fff;
  background: var(--brand);
  box-shadow: 0 8px 18px rgba(64, 90, 46, .2);
}
.button--primary:hover { background: var(--brand-dark); }
.button svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.button.is-loading svg { animation: pulse 1s infinite alternate; }

.page-heading { max-width: 700px; margin: 0 0 30px; }
.eyebrow {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.page-heading h1 {
  margin: 0;
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 720;
  letter-spacing: -.035em;
  line-height: 1.08;
}
.page-heading > p:last-child { margin: 14px 0 0; color: var(--muted); font-size: 17px; }

.request-form { display: grid; gap: 18px; }
.form-card {
  border: 1px solid rgba(200, 209, 203, .82);
  border-radius: 16px;
  padding: 28px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.section-heading {
  display: flex;
  align-items: flex-start;
  gap: 15px;
  margin-bottom: 25px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.section-number {
  display: inline-flex;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  color: var(--brand-dark);
  background: var(--brand-soft);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .05em;
}
.section-heading h2 { margin: 0; font-size: 20px; line-height: 1.25; }
.section-heading p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

.fields-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.field { position: relative; display: grid; align-content: start; gap: 7px; }
.field--wide { grid-column: 1 / -1; }
.field > label { color: #344039; font-size: 14px; font-weight: 700; }
.required { color: var(--danger); }

input, textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  color: var(--ink);
  background: #fff;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
input { height: 48px; padding: 0 13px; }
textarea { min-height: 108px; resize: vertical; padding: 12px 13px; }
input::placeholder, textarea::placeholder { color: #9aa39d; }
input:focus, textarea:focus {
  border-color: var(--brand);
  outline: none;
  box-shadow: 0 0 0 3px rgba(88, 118, 64, .13);
}
input.has-error, textarea.has-error { border-color: var(--danger); background: #fffafa; }

.input-wrap { position: relative; }
.input-wrap > svg {
  position: absolute;
  top: 14px;
  left: 14px;
  width: 20px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.8;
  stroke-linecap: round;
}
.input-wrap input { padding-right: 42px; padding-left: 43px; }
.input-loader {
  position: absolute;
  top: 16px;
  right: 15px;
  width: 16px;
  height: 16px;
  border: 2px solid var(--line);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.input-suffix { position: relative; }
.input-suffix input { padding-right: 48px; }
.input-suffix span { position: absolute; top: 13px; right: 14px; color: var(--muted); font-size: 14px; }
.field-hint, .field-error { min-height: 18px; margin: 0; font-size: 12px; }
.field-hint { color: var(--muted); }
.field-error { color: var(--danger); }

.options {
  position: absolute;
  z-index: 20;
  top: 78px;
  right: 0;
  left: 0;
  max-height: 310px;
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  padding: 6px;
  background: #fff;
  box-shadow: 0 16px 38px rgba(27, 37, 31, .14);
}
.option {
  display: grid;
  width: 100%;
  gap: 2px;
  border: 0;
  border-radius: 7px;
  padding: 10px 11px;
  color: var(--ink);
  background: transparent;
  text-align: left;
}
.option:hover, .option:focus { outline: none; background: var(--brand-soft); }
.option span { font-weight: 650; }
.option small { color: var(--muted); }
.option--custom { margin-top: 5px; border-top: 1px solid var(--line); border-radius: 0 0 7px 7px; padding-top: 12px; color: var(--brand-dark); }

.selected-client {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-radius: 8px;
  padding: 9px 11px;
  color: var(--brand-dark);
  background: var(--brand-soft);
  font-size: 13px;
  font-weight: 650;
}
.selected-client button { border: 0; padding: 0 3px; color: var(--brand-dark); background: none; font-size: 22px; line-height: 1; }

.file-drop {
  display: grid;
  min-height: 168px;
  place-items: center;
  align-content: center;
  gap: 7px;
  border: 1px dashed #aebbb2;
  border-radius: 12px;
  padding: 24px;
  color: var(--muted);
  background: #fafbfa;
  text-align: center;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease;
}
.file-drop:hover, .file-drop.is-dragging { border-color: var(--brand); background: var(--brand-soft); }
.file-drop svg { width: 32px; fill: none; stroke: var(--brand); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.file-drop strong { color: var(--brand-dark); }
.file-drop small { font-size: 12px; }
.file-drop input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.file-selected {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 16px;
  background: #fafbfa;
}
.file-selected div { display: grid; gap: 2px; min-width: 0; }
.file-selected strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-selected span { color: var(--muted); font-size: 13px; }
.file-selected button { border: 0; padding: 5px; color: var(--danger); background: none; font-size: 13px; font-weight: 700; }

.form-actions { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 12px 2px 0; }
.form-actions p { margin: 0; color: var(--muted); font-size: 13px; }
.form-message { border-radius: 10px; padding: 13px 15px; font-size: 14px; font-weight: 650; }
.form-message--info { color: #345164; background: #edf5fa; }
.form-message--error { color: var(--danger); background: var(--danger-soft); }
.form-message--success { color: var(--success); background: var(--success-soft); }

.footer { padding: 32px 0 0; color: #8a948e; font-size: 12px; text-align: center; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { to { transform: translateX(3px); } }

@media (max-width: 720px) {
  .shell { width: min(100% - 24px, 1040px); padding-top: 12px; }
  .topbar { min-height: 58px; margin-bottom: 36px; padding: 0 14px; border-radius: 0 0 12px 12px; }
  .brand img { width: 122px; }
  .user > span:not(.user-dot), .user-dot { display: none; }
  .page-heading h1 { font-size: 34px; }
  .page-heading > p:last-child { font-size: 15px; }
  .form-card { padding: 20px; border-radius: 13px; }
  .fields-grid { grid-template-columns: 1fr; gap: 18px; }
  .field--wide { grid-column: auto; }
  .form-actions { align-items: stretch; flex-direction: column-reverse; }
  .button--primary { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
