:root {
  color-scheme: light;
  --ink: #18252f;
  --muted: #65727d;
  --line: #d9e0e5;
  --brand: #176b87;
  --brand-dark: #10546b;
  --soft: #f4f8fa;
  --ok: #18794e;
  --error: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  padding: 24px;
  background: linear-gradient(145deg, #edf7fa, #f8fbfc 50%, #e8f1f4);
  color: var(--ink);
  font: 16px/1.45 Inter, ui-sans-serif, system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.portal {
  width: min(100%, 760px);
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid rgb(23 107 135 / 15%);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 20px 60px rgb(22 59 72 / 13%);
}

.portal-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 28px 32px 20px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  display: grid;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 14px;
  background: var(--brand);
  color: #fff;
  font-size: 24px;
  font-weight: 800;
}

h1 {
  margin: 0 0 4px;
  font-size: clamp(24px, 4vw, 32px);
  line-height: 1.15;
}

p {
  margin: 0;
  color: var(--muted);
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 16px 32px;
  border-bottom: 1px solid var(--line);
  background: var(--soft);
}

.tab {
  min-height: 48px;
  border: 1px solid #b9cbd3;
  border-radius: 11px;
  background: #fff;
  color: var(--ink);
  font-weight: 750;
  cursor: pointer;
}

.tab:hover {
  border-color: var(--brand);
}

.tab[aria-selected="true"] {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.tab:focus-visible,
.submit:focus-visible,
.file:focus-within,
a:focus-visible {
  outline: 3px solid rgb(23 107 135 / 30%);
  outline-offset: 3px;
}

.panel[hidden] {
  display: none;
}

.invoice-frame {
  display: block;
  width: 100%;
  height: 680px;
  border: 0;
  background: #fff;
}

.frame-fallback {
  padding: 12px 24px 18px;
  text-align: center;
  font-size: 13px;
}

a {
  color: var(--brand-dark);
  font-weight: 650;
}

form {
  padding: 28px 32px 32px;
}

.steps {
  display: grid;
  gap: 16px;
  margin-bottom: 22px;
}

.file {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 94px;
  padding: 18px;
  border: 2px dashed #b9cbd3;
  border-radius: 14px;
  background: var(--soft);
  cursor: pointer;
  transition: border-color 180ms, background 180ms;
}

.file:hover,
.file:focus-within {
  border-color: var(--brand);
  background: #eef8fb;
}

.number {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 18px;
  font-weight: 750;
}

.file-copy {
  min-width: 0;
}

.file strong,
.file small {
  display: block;
}

.file strong {
  margin-bottom: 3px;
}

.file small {
  overflow-wrap: anywhere;
  color: var(--muted);
}

.pick {
  padding: 9px 12px;
  border: 1px solid #b4c2c9;
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font-weight: 650;
  white-space: nowrap;
}

input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.submit {
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 12px;
  background: var(--brand);
  color: #fff;
  font-weight: 750;
  cursor: pointer;
}

.submit:hover:not(:disabled) {
  background: var(--brand-dark);
}

.submit:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.status {
  display: none;
  margin-top: 18px;
  padding: 16px;
  border-radius: 12px;
  white-space: pre-wrap;
}

.status.show {
  display: block;
}

.status.loading {
  color: var(--ink);
  background: #eef5f7;
}

.status.success {
  color: var(--ok);
  background: #ecf8f2;
}

.status.error {
  color: var(--error);
  background: #fff1f0;
}

.note {
  margin-top: 14px;
  text-align: center;
  font-size: 13px;
}

.noscript {
  width: min(100%, 760px);
  margin: 14px auto 0;
  padding: 12px 16px;
  border-radius: 10px;
  background: #fff1f0;
  color: var(--error);
  text-align: center;
}

@media (max-width: 560px) {
  body {
    padding: 12px;
  }

  .portal-header,
  .tabs,
  form {
    padding-left: 20px;
    padding-right: 20px;
  }

  .brand-mark {
    flex-basis: 42px;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    font-size: 21px;
  }

  .file {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .number {
    width: 38px;
    height: 38px;
  }

  .pick {
    grid-column: 2;
    justify-self: start;
  }

  .invoice-frame {
    height: 740px;
  }
}

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

/* ---------- Servicii & dozatoare ---------- */
.fields {
  display: grid;
  gap: 16px;
  margin-bottom: 20px;
}

.field {
  display: grid;
  gap: 6px;
}

.field > span {
  font-weight: 650;
}

.field input:not([type="file"]),
.field select {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid #b4c2c9;
  border-radius: 12px;
  background: var(--soft);
  color: var(--ink);
  transition: border-color 180ms, background 180ms;
}

.field input:focus,
.field select:focus {
  outline: 3px solid rgb(23 107 135 / 30%);
  outline-offset: 2px;
  border-color: var(--brand);
  background: #fff;
}

.field small {
  color: var(--muted);
  font-size: 13px;
}

.summary {
  display: grid;
  gap: 8px;
  margin-bottom: 20px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
}

.summary[hidden] {
  display: none;
}

.summary > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.summary .total {
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 18px;
}

.summary .total strong {
  color: var(--brand-dark);
}
