/* iSupplier design tokens (frontend Angular / PrimeNG) */
:root {
  --bg-start: #e5e7ff;
  --bg-end: #faf6f2;
  --surface: #ffffff;
  --ink: #2d2d3e;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-soft: #f1f5f9;
  --primary: #3551f2;
  --primary-600: #3551f2;
  --primary-700: #2c42d6;
  --primary-500: #577dfd;
  --primary-100: #ddedff;
  --primary-50: #edf5ff;
  --primary-soft: #f1f3ff;
  --warn: #b54708;
  --warn-bg: #fffaeb;
  --danger: #d92d20;
  --danger-bg: #fef3f2;
  --ok: #039855;
  --ok-bg: #ecfdf3;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-drawer: 20px;
  --font: "Manrope", system-ui, sans-serif;
  --display: "Instrument Sans", "Manrope", system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "Consolas", monospace;
  --shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.06);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background: radial-gradient(
    135.56% 132% at 6.75% -8.77%,
    var(--bg-start) 25.33%,
    var(--bg-end) 65.43%
  );
}

.shell {
  max-width: 860px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  animation: fadeUp 0.4s ease both;
}

.brand { display: flex; gap: 0.85rem; align-items: center; }
.brand-mark {
  width: 2.75rem;
  height: 2.75rem;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary-600);
  font-family: var(--display);
  font-weight: 700;
  border-radius: 12px;
  letter-spacing: 0.02em;
  font-size: 0.95rem;
}
.brand-name {
  margin: 0;
  font-family: var(--display);
  font-size: 1.35rem;
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -0.02em;
}
.tagline {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}
.docs-link {
  color: var(--primary-600);
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  font-size: 0.85rem;
  box-shadow: var(--shadow-sm);
}
.docs-link:hover {
  background: var(--primary-soft);
  border-color: var(--primary-100);
}

/* Stepper */
.stepper {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-bottom: 1.1rem;
  animation: fadeUp 0.45s ease 0.04s both;
}
.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.7rem 0.4rem;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.45);
  color: var(--muted);
  border-radius: var(--radius);
  cursor: pointer;
  font: inherit;
  transition: background 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.step:disabled { opacity: 0.4; cursor: not-allowed; }
.step:not(:disabled):hover {
  background: rgba(255, 255, 255, 0.75);
  color: var(--ink);
}
.step.is-active {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
  box-shadow: var(--shadow-sm);
}
.step.is-done .step-num {
  background: var(--primary-100);
  color: var(--primary-700);
}
.step-num {
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  font-weight: 700;
  background: #e8ecf4;
  color: var(--muted);
}
.step.is-active .step-num {
  background: var(--primary);
  color: #fff;
}
.step-label { font-size: 0.78rem; font-weight: 600; }

.stage {
  background: var(--surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 1.5rem 1.5rem 1.75rem;
  box-shadow: var(--shadow);
  min-height: 420px;
  border: 1px solid rgba(226, 232, 240, 0.8);
  animation: fadeUp 0.5s ease 0.08s both;
}

.step-pane[hidden] { display: none !important; }
.step-pane.is-active { display: block; animation: paneIn 0.28s ease; }

.pane-title {
  margin: 0;
  font-family: var(--display);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.pane-lead {
  margin: 0.4rem 0 1.15rem;
  color: var(--muted);
  line-height: 1.5;
  max-width: 38rem;
  font-size: 0.95rem;
}
.pane-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.dropzone {
  position: relative;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius-lg);
  padding: 2.2rem 1rem;
  text-align: center;
  background: var(--surface);
  margin-bottom: 1rem;
  transition: border-color 0.2s, background 0.2s;
}
.dropzone.is-drag {
  border-color: var(--primary);
  background: var(--primary-50);
}
.dropzone:hover {
  border-color: var(--primary-500);
  background: var(--primary-50);
}
.dropzone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.drop-title {
  margin: 0;
  font-weight: 600;
  font-size: 1.05rem;
  font-family: var(--display);
}
.drop-sub { margin: 0.35rem 0 0; color: var(--muted); font-size: 0.88rem; }

.field-stack {
  display: grid;
  grid-template-columns: 1fr 7rem;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
@media (max-width: 560px) {
  .field-stack { grid-template-columns: 1fr; }
  .stepper { gap: 0.25rem; }
  .step-label { font-size: 0.68rem; }
  .stage { border-radius: 1rem 1rem 0 0; padding: 1.15rem; }
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.875rem;
  color: var(--ink);
  font-weight: 500;
  line-height: 1.2;
}
label.check {
  flex-direction: row;
  align-items: center;
  gap: 0.55rem;
  color: var(--ink);
  margin: 0.75rem 0;
}

input[type="text"],
input[type="number"],
input[type="date"],
select,
textarea {
  font: inherit;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(53, 81, 242, 0.15);
}

.grid-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 0.85rem;
}
.grid-fields .span-2 { grid-column: span 2; }
@media (max-width: 560px) {
  .grid-fields { grid-template-columns: 1fr; }
  .grid-fields .span-2 { grid-column: span 1; }
}

.edit-block {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.75rem 1rem 1rem;
  margin-bottom: 0.75rem;
  background: var(--surface);
}
.edit-block summary {
  cursor: pointer;
  font-weight: 600;
  font-family: var(--display);
  color: var(--ink);
  padding: 0.25rem 0;
}
.edit-block[open] summary { margin-bottom: 0.75rem; }

.summary-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.7rem;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 600;
}
.chip em {
  font-style: normal;
  color: var(--muted);
  font-weight: 500;
}

/* Line list */
.line-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.line-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem 1rem;
  align-items: center;
  padding: 0.9rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.line-item:hover {
  border-color: var(--primary-100);
  background: var(--primary-50);
  box-shadow: var(--shadow-sm);
}
.line-item-main { min-width: 0; }
.line-item-title {
  margin: 0;
  font-weight: 600;
  font-family: var(--display);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.line-item-details {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.line-item-details .muted { opacity: 0.7; font-style: italic; }
.line-item-meta {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}
.act-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  background: var(--primary-soft);
  color: var(--primary-700);
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 700;
}
.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding-bottom: 0.95rem;
  margin-bottom: 0.35rem;
  border-bottom: 1px solid var(--line);
}
.field-group:last-of-type {
  border-bottom: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}
.field-group-title {
  margin: 0;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 700;
}
.field-hint {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 400;
  margin: -0.05rem 0 0.15rem;
}
.line-item-amount {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
  color: var(--ink);
}
.line-empty {
  padding: 1.5rem;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--line-soft);
}

.totals-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  padding: 0.95rem 1rem;
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--primary-100) 0%, var(--primary-50) 38%, #fff 100%);
  color: var(--ink);
  margin-bottom: 1rem;
  border: 1px solid var(--primary-100);
}
.totals-bar span {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.totals-bar strong {
  font-family: var(--mono);
  font-size: 1.05rem;
  color: var(--primary-700);
}

.pane-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.1rem;
  padding-top: 0.95rem;
  border-top: 1px solid var(--line);
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 0.5rem 0 1rem;
}

button, .link-btn {
  font: inherit;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0.6rem 1rem;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s, filter 0.15s;
}
button.primary, .link-btn.primary {
  background: var(--primary);
  color: #fff;
}
button.primary:hover, .link-btn.primary:hover {
  background: var(--primary-700);
}
button.secondary {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}
button.secondary:hover {
  background: var(--line-soft);
}
button.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}
button.ghost:hover { color: var(--ink); background: var(--line-soft); }
button.danger, .ghost.danger { color: var(--danger); }
.link-btn { display: inline-block; text-decoration: none; margin: 0.75rem 0; }

.review-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin-bottom: 0.75rem;
  font-size: 0.92rem;
  line-height: 1.55;
}
.review-card strong { font-weight: 650; }

.status-block {
  margin: 0.75rem 0;
  padding: 0.8rem 0.9rem;
  border-radius: 8px;
  background: var(--ok-bg);
  border: 1px solid #a7f3d0;
  font-size: 0.86rem;
}
.status-block.has-overrides {
  background: var(--warn-bg);
  border-color: #fecd89;
}
.status-block ul { margin: 0.4rem 0 0; padding-left: 1.1rem; }
.status-block code { font-family: var(--mono); font-size: 0.78rem; }
.scribee-link { margin-top: 0.45rem; }
.scribee-link a {
  color: var(--primary-600);
  font-weight: 600;
  text-decoration: none;
}
.scribee-link a:hover { text-decoration: underline; }

.error-box {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #fecdca;
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  font-size: 0.86rem;
  margin: 0.75rem 0;
}

.hint { font-size: 0.82rem; color: var(--muted); margin: 0.4rem 0; }

.result-panel {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}
#result-summary {
  background: var(--primary-soft);
  border-radius: 8px;
  padding: 0.75rem;
  font-size: 0.9rem;
}
#xml-preview {
  max-height: 280px;
  overflow: auto;
  background: #0f172a;
  color: #e2e8f0;
  padding: 0.75rem;
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 0.7rem;
  white-space: pre-wrap;
}

/* Drawer — floating like shared-drawer */
.drawer-backdrop[hidden],
.drawer[hidden] {
  display: none !important;
}
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  z-index: 40;
  animation: fade 0.2s ease;
}
.drawer {
  position: fixed;
  top: 1rem;
  right: 1rem;
  bottom: 1rem;
  width: min(420px, calc(100vw - 2rem));
  height: auto;
  background: #fff;
  z-index: 50;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-drawer);
  border: 1px solid var(--line);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  animation: slideIn 0.28s ease;
  overflow: hidden;
}
.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
}
.drawer-head h3 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 600;
}
.icon-btn {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--muted);
  padding: 0.2rem 0.45rem;
  cursor: pointer;
  border-radius: 8px;
}
.icon-btn:hover { background: var(--line-soft); color: var(--ink); }
.drawer-body {
  padding: 1rem 1.25rem;
  overflow: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.drawer-foot {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 1rem 1.25rem 1.25rem;
  border-top: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 -0.5rem 0.75rem -0.75rem rgba(0, 0, 0, 0.08);
}
.drawer-foot-right { display: flex; gap: 0.45rem; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes paneIn {
  from { opacity: 0; transform: translateX(8px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideIn {
  from { transform: translateX(16px); opacity: 0.6; }
  to { transform: translateX(0); opacity: 1; }
}
