/* Same face for Latin + Cyrillic (Segoe UI Cyrillic reads larger optically) */
@font-face {
  font-family: "Noto Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/noto-sans-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Noto Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/noto-sans-cyrillic-400-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Noto Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/noto-sans-latin-600-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Noto Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/noto-sans-cyrillic-600-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

:root {
  /*
   * Brand refs from portamaris.com.ua (navy / steel / teal), but primary UI
   * stays on the darker teal — site CTA #67a4d4 is too bright for dense forms.
   */
  --bg: #e8eef4;
  --ink: #15253c;
  --muted: #5b6b7c;
  --card: #ffffff;
  --line: #c9d5e3;
  --accent: #0b5f7a;
  --accent-soft: #0b5f7a;  /* same as accent; keep var for call sites */
  --accent-2: #5a9e92;     /* muted site teal (not the bright CTA) */
  --ok: #1b6b3a;
  --err: #9b1c1c;
  --shadow: 0 12px 40px rgba(21, 37, 60, 0.08);
  --font-ui: "Noto Sans", "Segoe UI", system-ui, sans-serif;
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.45;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 1rem;
  line-height: 1.45;
  background:
    radial-gradient(1200px 500px at 10% -10%, #d7e8f3 0%, transparent 55%),
    radial-gradient(900px 400px at 100% 0%, #e8eef2 0%, transparent 50%),
    var(--bg);
  min-height: 100vh;
}

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

.header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1.25rem;
}

.header-brand {
  min-width: 0;
  flex: 1;
}

.header-tools {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0.75rem;
  flex-shrink: 0;
}

.user-panel {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.75rem;
  max-width: 26rem;
  padding: 0.55rem 0.85rem;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.user-meta {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--muted);
  text-align: left;
  line-height: 1.35;
  min-width: 0;
}

.user-meta strong {
  display: block;
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 600;
  word-break: break-word;
}

.lang {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  font-family: var(--font-ui);
  color: var(--muted);
  padding: 0.4rem 0.75rem;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  white-space: nowrap;
  align-self: flex-start;
  height: fit-content;
}

.lang select {
  min-width: 4.5rem;
}

#logout {
  flex-shrink: 0;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
  padding: 0.5rem 1rem;
  min-height: 2.25rem;
  box-sizing: border-box;
}

.tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 1rem;
  padding: 0.3rem;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--line);
  border-radius: 999px;
  width: fit-content;
  max-width: 100%;
}

.tab {
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 0.55rem 1.1rem;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.tab.active {
  background: var(--accent-soft);
  color: #fff;
}

.tab-panel[hidden] {
  display: none !important;
}

.tab-panel.active {
  display: block;
}

main {
  display: block;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.panel-head h2 {
  margin: 0;
}

button.compact {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
}

@media (max-width: 720px) {
  .header {
    flex-direction: column;
    align-items: stretch;
  }

  .header-tools {
    width: 100%;
    flex-wrap: wrap;
    align-items: stretch;
  }

  .user-panel {
    max-width: none;
    flex: 1;
  }

  .lang {
    flex: 0 0 auto;
  }

  .tabs {
    width: 100%;
  }

  .tab {
    flex: 1;
  }
}

.eyebrow {
  margin: 0 0 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  color: var(--accent);
  font-family: var(--font-ui);
}

/* Cyrillic + wide letter-spacing reads like a bigger UI; tighten for UA */
html:lang(uk) .eyebrow {
  letter-spacing: 0.04em;
}

h1 {
  margin: 0;
  font-family: var(--font-ui);
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.sub {
  margin: 0.5rem 0 0;
  color: var(--muted);
  max-width: 42rem;
  font-family: var(--font-ui);
  font-size: 0.95rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.25rem 1.35rem 1.5rem;
  box-shadow: var(--shadow);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

label, legend {
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 600;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="datetime-local"],
select,
input[type="file"] {
  box-sizing: border-box;
  width: 100%;
  min-height: 2.6rem;
  font: inherit;
  font-family: var(--font-ui);
  font-size: 0.95rem;
  line-height: 1.35;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  color: inherit;
}

input[type="datetime-local"],
input[type="number"] {
  max-width: 22rem;
  width: 100%;
}

input[type="file"] {
  padding: 0.55rem;
  min-height: 0;
  max-width: none;
}

.party-grid input[type="text"],
.party-grid input[type="email"] {
  max-width: none;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-family: var(--font-ui);
}

.field-msg {
  margin: 0;
  color: var(--err);
  font-size: 0.8rem;
  font-family: var(--font-ui);
}

.field.invalid input[type="text"],
.field.invalid input[type="email"],
.field.invalid input[type="password"],
.field.invalid input[type="number"],
.field.invalid input[type="datetime-local"],
.field.invalid select,
.field.invalid textarea {
  border-color: var(--err);
  background: #fff7f7;
}

.field.invalid .file-picker {
  outline: 1px solid var(--err);
  border-radius: 8px;
  padding: 0.35rem;
}

.repeater {
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 0.85rem 1rem 1rem;
}

.notify-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

button {
  font-family: var(--font-ui);
  border: none;
  border-radius: 999px;
  padding: 0.7rem 1.2rem;
  background: var(--accent-soft);
  color: white;
  font-weight: 600;
  cursor: pointer;
}

button.secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.actions { margin-top: 0.5rem; }

.google-auth {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.btn-google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  width: 100%;
  min-height: 2.75rem;
  padding: 0.65rem 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(21, 37, 60, 0.06);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.btn-google:hover {
  background: #f4f7fb;
  border-color: #c5d0de;
}

.btn-google-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 4px;
  background: #4285f4;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.25rem 0 1rem;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 0.8rem;
  text-transform: lowercase;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.error {
  color: var(--err);
  font-family: var(--font-ui);
  margin: 0.75rem 0 0;
}

.ok {
  color: var(--ok);
  font-family: var(--font-ui);
  margin: 0.75rem 0 0;
}

.table-wrap {
  margin-top: 0.75rem;
  overflow-x: auto;
  font-family: var(--font-ui);
  font-size: 0.85rem;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  text-align: left;
  padding: 0.45rem 0.35rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th { color: var(--muted); font-weight: 600; }

.page.narrow { max-width: 560px; }

.user-line {
  margin-top: 0.65rem !important;
}

button.linkish,
.linkish {
  background: none;
  border: none;
  color: var(--accent-2);
  padding: 0 0 0 0.5rem;
  font: inherit;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}

.file-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.file-native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.file-name {
  font-family: var(--font-ui);
  font-size: 0.9rem;
  color: var(--muted);
}

.form-section {
  margin: 0 0 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
}

.form-section:last-of-type {
  border-bottom: none;
}

.form-section h3 {
  margin: 0 0 0.85rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--accent);
}

label.required::after {
  content: " *";
  color: var(--err);
}

.party-block {
  margin: 0.75rem 0 1rem;
  padding: 0.75rem 1rem 1rem;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: #f7fafc;
}

.party-block.invalid {
  border-color: var(--err);
}

.party-block legend {
  font-weight: 600;
  padding: 0 0.25rem;
}

.party-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem 0.85rem;
}

.party-field {
  margin: 0;
}

.party-span-2 {
  grid-column: 1 / -1;
}

textarea {
  box-sizing: border-box;
  width: 100%;
  min-height: 5.5rem;
  font-family: var(--font-ui);
  font-size: 0.95rem;
  line-height: 1.4;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  resize: vertical;
}

@media (max-width: 640px) {
  .party-grid {
    grid-template-columns: 1fr;
  }
  .party-span-2 {
    grid-column: auto;
  }
}


/* —— Intake pipeline —— */
.pipeline {
  margin: 0 0 1.25rem;
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.pipeline-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.15rem;
  align-items: flex-start;
  justify-content: space-between;
}

.pipeline-steps > li {
  flex: 1 1 0;
  min-width: 4.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  position: relative;
  text-align: center;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 600;
}

.pipeline-steps > li:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 0.55rem;
  left: calc(50% + 0.7rem);
  right: calc(-50% + 0.7rem);
  height: 2px;
  background: var(--line);
  z-index: 0;
}

.pipeline-steps > li.is-done:not(:last-child)::after,
.pipeline-steps > li.is-active:not(:last-child)::after {
  background: var(--accent);
}

.pipeline-dot {
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: #fff;
  z-index: 1;
  box-sizing: border-box;
}

.pipeline-steps > li.is-done .pipeline-dot {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: inset 0 0 0 3px #fff;
}

.pipeline-steps > li.is-active .pipeline-dot,
.pipeline-steps > li.is-retrying .pipeline-dot {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(11, 95, 122, 0.18);
  animation: pulse-dot 1.1s ease-in-out infinite;
}

.pipeline-steps > li.is-error .pipeline-dot {
  border-color: var(--err);
  background: var(--err);
}

.pipeline-steps > li.is-active,
.pipeline-steps > li.is-retrying {
  color: var(--accent);
}

.pipeline-steps > li.is-done {
  color: var(--ink);
}

.pipeline-steps > li.is-error {
  color: var(--err);
}

@keyframes pulse-dot {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

.pipeline-steps-modal > li {
  font-size: 0.8rem;
  min-width: 5rem;
}

.intake-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.intake-modal[hidden] {
  display: none !important;
}

.intake-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(19, 32, 51, 0.45);
}

.intake-modal-card {
  position: relative;
  z-index: 1;
  width: min(36rem, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(19, 32, 51, 0.22);
  padding: 1.35rem 1.4rem 1.25rem;
  font-family: var(--font-ui);
}

.intake-modal-card h2 {
  margin: 0 0 0.35rem;
  font-size: 1.25rem;
  font-weight: 600;
}

.intake-modal-id {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.intake-modal-progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  margin: 1.1rem 0 0.75rem;
  min-height: 4.5rem;
}

.spinner {
  width: 2rem;
  height: 2rem;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner.is-done {
  animation: none;
  border-color: var(--ok);
  border-top-color: var(--ok);
  background: var(--ok);
  position: relative;
}

.spinner.is-done::after {
  content: "";
  position: absolute;
  inset: 0.35rem;
  border-radius: 50%;
  background: #fff;
}

.spinner.is-error {
  animation: none;
  border-color: var(--err);
  border-top-color: var(--err);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.intake-modal-msg {
  margin: 0;
  text-align: center;
  font-size: 0.95rem;
  color: var(--ink);
  max-width: 28rem;
}

.intake-modal-retry {
  margin: 0;
  text-align: center;
  font-size: 0.85rem;
  color: var(--accent-2);
  font-weight: 600;
}

.intake-modal-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

body.intake-busy {
  overflow: hidden;
}

body.intake-busy #intake-form {
  pointer-events: none;
  opacity: 0.55;
}

@media (max-width: 640px) {
  .pipeline-steps > li {
    font-size: 0.65rem;
    min-width: 3.2rem;
  }
  .pipeline-label {
    max-width: 4.5rem;
  }
}

