:root {
  --bg: #f3f6f8;
  --bg-soft: #eaf0f2;
  --panel: #ffffff;
  --panel-soft: #f8fafb;
  --ink: #17212f;
  --muted: #627084;
  --line: #d8e0e7;
  --line-strong: #c2ced8;
  --primary: #126782;
  --primary-dark: #0a4659;
  --accent: #c58a22;
  --accent-soft: #fff4df;
  --success: #16805a;
  --danger: #b42318;
  --sidebar: #101720;
  --sidebar-soft: #1a2431;
  --shadow: 0 16px 46px rgba(23, 33, 47, 0.09);
  --shadow-soft: 0 8px 24px rgba(23, 33, 47, 0.07);
  font-family: Inter, Segoe UI, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82) 0, rgba(243, 246, 248, 0.94) 240px),
    var(--bg);
  color: var(--ink);
  overflow-x: hidden;
  font-size: 14px;
  line-height: 1.45;
}

body.locked {
  overflow: hidden;
}

body.menu-open {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  align-items: stretch;
  background:
    linear-gradient(90deg, var(--sidebar) 0, #162333 260px, transparent 260px);
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  place-items: center;
  padding: 20px;
  background:
    linear-gradient(145deg, rgba(16, 23, 32, 0.96), rgba(18, 103, 130, 0.86)),
    #101720;
}

.login-screen.active {
  display: grid;
}

.login-panel {
  width: min(420px, 100%);
  display: grid;
  gap: 18px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 30px;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.32);
}

.login-brand {
  color: var(--ink);
}

.login-brand p {
  color: var(--muted);
}

.login-error {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 8;
  width: 260px;
  align-self: start;
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  max-height: none;
  background:
    linear-gradient(180deg, var(--sidebar) 0, #162333 100%);
  color: #f9fafb;
  padding: 26px 18px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  overflow-y: auto;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.mobile-menu-button,
.menu-overlay {
  display: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  background: #f4bf5f;
  color: #17212f;
  border-radius: 10px;
  font-weight: 900;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.16);
}

.brand p {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0;
  font-weight: 700;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
  font-weight: 700;
}

.brand p {
  color: #aeb8c7;
}

.brand strong {
  display: block;
  line-height: 1.1;
  letter-spacing: 0;
}

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

.nav-group {
  display: grid;
  gap: 5px;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 42px;
  border: 0;
  border-radius: 10px;
  padding: 10px 12px 10px 14px;
  background: transparent;
  color: #c7d2df;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  font-weight: 750;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 999px;
  background: #f4bf5f;
}

.nav-item:hover {
  transform: translateX(2px);
}

.nav-submenu {
  display: grid;
  gap: 4px;
  margin: -2px 0 4px 16px;
  padding-left: 12px;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
}

.nav-subitem {
  display: flex;
  align-items: center;
  min-height: 32px;
  border-radius: 8px;
  padding: 7px 10px;
  color: #aeb8c7;
  text-decoration: none;
  font-size: 13px;
  font-weight: 750;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.nav-subitem:hover,
.nav-subitem.active {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  transform: translateX(2px);
}

.nav-subitem-child {
  margin-left: 14px;
  padding-left: 20px;
  font-size: 12px;
  color: rgba(238, 242, 255, 0.68);
  position: relative;
}

.nav-subitem-child::before {
  content: "";
  position: absolute;
  left: 8px;
  width: 6px;
  height: 1px;
  background: rgba(238, 242, 255, 0.44);
}

.settings-nav {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.workspace {
  grid-column: 2;
  width: 100%;
  min-width: 0;
  padding: 30px;
}

.topbar,
.panel-header,
.form-footer,
.line-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 4;
  margin: -30px -30px 24px;
  padding: 22px 30px;
  background: rgba(243, 246, 248, 0.88);
  border-bottom: 1px solid rgba(216, 224, 231, 0.72);
  backdrop-filter: blur(14px);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 31px;
  line-height: 1.12;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 21px;
  line-height: 1.2;
}

h3 {
  margin-bottom: 6px;
  font-size: 16px;
  line-height: 1.25;
}

.top-actions,
.segmented,
.inline-actions,
.report-controls,
.section-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 22px;
  min-width: 0;
}

.panel {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.panel-header {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 20px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 16px;
}

.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.metric::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

.metric span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 29px;
  line-height: 1;
}

.report-panel {
  box-shadow: none;
}

.month-control {
  min-width: 210px;
}

.report-controls {
  justify-content: flex-end;
}

.section-heading {
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}

.primary-button,
.ghost-button,
.icon-button,
.segment,
.action-button {
  border: 1px solid transparent;
  border-radius: 10px;
  min-height: 38px;
  padding: 9px 13px;
  cursor: pointer;
  font-weight: 700;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(18, 103, 130, 0.18);
}

.primary-button:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.ghost-button,
.segment,
.action-button {
  background: #f0f6f8;
  color: var(--primary-dark);
  border-color: #cbdfe7;
}

.ghost-button:hover,
.segment:hover,
.action-button:hover,
.icon-button:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.segment.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.icon-button {
  width: 42px;
  padding: 0;
  background: #edf2f6;
  color: var(--ink);
  border-color: var(--line);
}

.notification-button {
  position: relative;
}

.notification-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  padding: 0 5px;
  background: var(--danger);
  color: #ffffff;
  font-size: 11px;
  font-weight: 900;
}

.notification-panel {
  position: fixed;
  top: 76px;
  right: 24px;
  z-index: 60;
  width: min(380px, calc(100vw - 32px));
  max-height: min(560px, calc(100vh - 96px));
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(23, 33, 47, 0.22);
}

.notification-head {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.notification-list {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.notification-item {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: var(--panel-soft);
}

.notification-item p,
.notification-item span {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.bid-alert-toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 65;
  width: min(360px, calc(100vw - 32px));
  display: none;
  gap: 8px;
  border: 1px solid #f0d8a8;
  border-radius: 12px;
  padding: 14px;
  background: var(--accent-soft);
  box-shadow: 0 18px 54px rgba(23, 33, 47, 0.2);
}

.bid-alert-toast.active {
  display: grid;
}

.bid-alert-toast p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.inline-form,
.quote-form {
  display: grid;
  gap: 12px;
}

.inline-form {
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  align-items: end;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  min-height: 42px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 12px;
  background: #ffffff;
  color: var(--ink);
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(18, 103, 130, 0.72);
  box-shadow: 0 0 0 3px rgba(18, 103, 130, 0.12);
}

textarea {
  min-height: 96px;
  padding: 12px;
  resize: vertical;
}

.vendor-tools {
  display: grid;
  grid-template-columns: minmax(220px, 320px) 160px auto;
  gap: 10px;
  align-items: center;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.vendor-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.smtp-form {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.smtp-table td strong,
.smtp-table td small {
  display: block;
}

.smtp-table td small {
  margin-top: 4px;
  color: var(--muted);
  font-weight: 700;
}

.danger-action {
  color: var(--danger);
  border-color: #f3c6c2;
  background: #fff5f4;
}

.status-select {
  min-width: 132px;
  min-height: 36px;
  font-weight: 800;
  background: #f8fafb;
}

.price-sheet-form {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-top: 16px;
}

.price-sync-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr)) auto;
  gap: 12px;
  align-items: stretch;
  margin-top: 16px;
}

.price-search {
  width: min(360px, 100%);
}

.price-sheet-panel {
  min-height: 620px;
  padding: 0;
  overflow: hidden;
}

.price-sheet-frame {
  display: block;
  width: 100%;
  min-height: 720px;
  border: 0;
  background: #ffffff;
}

.price-sheet-empty {
  min-height: 420px;
  display: grid;
  place-content: center;
  gap: 8px;
  padding: 24px;
  text-align: center;
}

.price-sheet-empty p {
  max-width: 560px;
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.price-sheet-fallback {
  min-height: 420px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  padding: 42px 24px;
  text-align: center;
  background:
    linear-gradient(135deg, rgba(20, 184, 166, 0.08), rgba(15, 23, 42, 0.02)),
    #ffffff;
}

.price-sheet-fallback h3 {
  margin: 0;
  font-size: 1.35rem;
}

.price-sheet-fallback p {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.6;
}

.gem-bids-panel {
  display: grid;
  gap: 18px;
}

.gem-bids-header {
  align-items: flex-start;
}

.gem-bids-header h2 {
  margin: 2px 0 6px;
  font-size: 28px;
}

.gem-bid-tools {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(140px, 0.5fr)) auto auto auto;
  gap: 12px;
  align-items: end;
}

.gem-sync-strip {
  grid-template-columns: minmax(220px, 1fr) minmax(130px, 0.55fr) minmax(360px, 1.35fr) minmax(220px, 0.9fr);
}

.gem-sync-strip .vendor-stat {
  min-height: 78px;
  padding: 10px 12px;
}

.gem-sync-strip .vendor-stat span {
  font-size: 10px;
}

.gem-sync-strip .vendor-stat strong {
  margin-top: 6px;
  font-size: 14px;
  line-height: 1.3;
}

.gem-bid-list {
  display: grid;
  gap: 20px;
}

.gem-bid-card {
  display: grid;
  gap: 10px;
  padding: 12px 14px 14px;
  border: 1px solid var(--line);
  border-top: 3px solid #0f6fdf;
  border-radius: 2px;
  background: #ffffff;
  box-shadow: 0 2px 7px rgba(15, 23, 42, 0.12);
}

.gem-bid-not_participated {
  border-top-color: #0f6fdf;
}

.gem-bid-participated {
  border-top-color: #16a34a;
}

.gem-bid-in_process {
  border-top-color: #f59e0b;
}

.gem-bid-cannot_participate {
  border-top-color: #dc2626;
}

.gem-bid-main {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.gem-bid-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.gem-bid-main h3 {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
}

.gem-bid-main h3 span {
  color: #111827;
  font-weight: 900;
}

.gem-bid-main h3 a,
.gem-corrigendum-link {
  color: #00659b;
  font-weight: 800;
  text-decoration: none;
}

.gem-bid-status {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #eaf6f1;
  color: #0f6b4f;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.gem-bid-main p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.gem-bid-meta {
  display: grid;
  grid-template-columns: 1.2fr 1.2fr 0.9fr;
  gap: 28px;
  align-items: start;
}

.gem-bid-meta span {
  min-width: 0;
  padding: 4px 0;
  color: #111827;
  font-size: 12px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.gem-bid-meta strong {
  display: inline;
  margin-right: 4px;
  color: var(--ink);
  font-size: 12px;
  text-transform: none;
}

.date-start {
  color: #16a34a;
  font-style: normal;
  font-weight: 800;
}

.date-end {
  color: #f97316;
  font-style: normal;
  font-weight: 800;
}

.gem-bid-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.gem-bid-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  padding-top: 4px;
}

.gem-bid-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  color: #111827;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.6;
}

.gem-bid-facts span {
  white-space: nowrap;
}

.gem-bid-facts strong {
  font-weight: 900;
}

.gem-bid-actions .status-select {
  min-width: 170px;
  width: 170px;
  min-height: 32px;
  padding: 6px 28px 6px 10px;
  font-size: 11px;
}

.gem-bid-comment {
  width: 220px;
  min-height: 32px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
  background: #fff;
}

.gem-bid-actions .primary-button,
.gem-bid-actions .action-button {
  min-height: 32px;
  padding: 7px 12px;
  font-size: 12px;
}

.vendor-stat {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: var(--panel-soft);
}

.vendor-stat span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.vendor-stat strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
}

.vendor-name {
  display: grid;
  gap: 4px;
}

.vendor-name small,
.muted {
  color: var(--muted);
}

.vendor-form {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.checkbox-section {
  display: grid;
  gap: 10px;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.checkbox-grid label {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: #ffffff;
  color: var(--ink);
  font-size: 13px;
}

.checkbox-grid input {
  width: 16px;
  min-height: 16px;
}

.single-check {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: #ffffff;
  color: var(--ink);
}

.single-check input {
  width: 18px;
  min-height: 18px;
}

input[type="file"] {
  padding: 8px;
}

.file-upload-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: end;
  border: 1px solid var(--primary);
  border-radius: 10px;
  padding: 10px 14px;
  background: var(--primary);
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(18, 103, 130, 0.18);
}

.file-upload-button input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.document-upload-row {
  display: grid;
  grid-template-columns: minmax(240px, 360px) minmax(0, 1fr);
  gap: 12px;
  align-items: end;
}

.upload-status {
  min-height: 40px;
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.upload-status.success {
  border-color: #b7e2c7;
  background: #edf9f1;
  color: var(--success);
}

.upload-status.warn {
  border-color: #f4d48c;
  background: #fff8e7;
  color: #8a5a00;
}

.rma-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 24px;
  border: 1px solid #cbdfe7;
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(18, 103, 130, 0.08), rgba(197, 138, 34, 0.12)),
    #ffffff;
  box-shadow: var(--shadow);
}

.rma-hero h2 {
  margin-bottom: 8px;
  font-size: 28px;
}

.rma-hero p:last-child {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 650;
}

.rma-hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.rma-filter-bar {
  justify-content: flex-end;
}

.rma-filter-bar select {
  min-width: 160px;
}

.rma-filter-bar input[type="number"] {
  max-width: 110px;
}

.rma-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.rma-layout {
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  align-items: start;
}

.rma-form {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.rma-side-panel {
  display: grid;
  gap: 18px;
}

.rma-steps {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: rma-step;
}

.rma-steps li {
  position: relative;
  display: grid;
  gap: 4px;
  min-height: 64px;
  padding: 12px 12px 12px 52px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
}

.rma-steps li::before {
  counter-increment: rma-step;
  content: counter(rma-step);
  position: absolute;
  left: 12px;
  top: 12px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--primary);
  color: #ffffff;
  font-weight: 900;
}

.rma-steps span,
.rma-service-card p,
.rma-table small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.rma-service-card {
  display: grid;
  gap: 10px;
  border: 1px solid #f0d8a8;
  border-radius: 12px;
  padding: 14px;
  background: var(--accent-soft);
}

.rma-service-card p {
  margin: 0;
}

.rma-table {
  min-width: 1180px;
}

.rma-table td {
  vertical-align: top;
}

.rma-table td strong,
.rma-table td small {
  display: block;
}

.bom-spec-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.bom-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) repeat(3, minmax(120px, 170px));
  gap: 12px;
  align-items: end;
}

.bom-table-wrap {
  margin-top: 12px;
}

.bom-table {
  min-width: 900px;
}

.bom-table th:nth-child(1),
.bom-table td:nth-child(1) {
  width: 190px;
}

.bom-table th:nth-child(3),
.bom-table td:nth-child(3) {
  width: 150px;
}

.bom-table th:nth-child(5),
.bom-table td:nth-child(5) {
  width: 82px;
  text-align: center;
}

.bom-table input {
  min-height: 36px;
  border-color: transparent;
  background: #f8fafb;
}

.bom-row-action {
  min-height: 34px;
  width: 34px;
  font-size: 16px;
  line-height: 1;
}

.bom-table input:focus {
  background: #ffffff;
}

.bom-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.bom-total-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: var(--panel-soft);
}

.bom-total-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.bom-total-card strong {
  display: block;
  margin-top: 6px;
  font-size: 22px;
}

.bom-spec-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: var(--panel-soft);
}

.bom-spec-card label {
  color: var(--ink);
}

.bom-spec-card small {
  color: var(--muted);
  font-weight: 700;
}

.spec-source {
  max-height: 56px;
  overflow: auto;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.danger-action {
  background: #fee4e2;
  border-color: #fecaca;
  color: var(--danger);
}

.line-item-row {
  justify-content: stretch;
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 90px 130px 120px;
}

.table-wrap {
  max-width: 100%;
  min-width: 0;
  width: 100%;
  overflow-x: auto;
  contain: layout paint;
  margin-top: 18px;
}

.compact {
  margin-top: 0;
}

table {
  width: 100%;
  min-width: 740px;
  border-collapse: separate;
  border-spacing: 0;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 13px 12px;
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafb;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

td {
  font-size: 14px;
  background: #ffffff;
}

tbody tr:hover td {
  background: #f8fbfc;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #edf4f7;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 800;
  border: 1px solid transparent;
}

.badge.success {
  background: #dff3e8;
  color: var(--success);
}

.badge.warn {
  background: #fff2d8;
  color: #8a5a00;
}

.badge.danger {
  background: #fee4e2;
  color: var(--danger);
}

.cards-grid,
.catalogue-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.vendor-card,
.catalogue-card,
.order-card,
.summary-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 15px;
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.vendor-card p,
.catalogue-card p,
.order-card p,
.summary-item p {
  color: var(--muted);
  margin-bottom: 8px;
  font-size: 13px;
}

.pipeline,
.summary-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.pipeline-row {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr) 42px;
  gap: 12px;
  align-items: center;
}

.bar {
  height: 10px;
  overflow: hidden;
  background: #e8eef4;
  border-radius: 999px;
}

.bar span {
  display: block;
  height: 100%;
  background: var(--primary);
}

.order-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.order-column {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  min-height: 220px;
}

.order-column h3 {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
}

.order-card {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.order-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 24px;
  border: 1px solid #cbdfe7;
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(18, 103, 130, 0.08), rgba(197, 138, 34, 0.12)),
    #ffffff;
  box-shadow: var(--shadow);
}

.order-hero h2 {
  margin-bottom: 8px;
  font-size: 28px;
}

.order-hero p:last-child {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 650;
}

.order-hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.order-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.order-form {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.order-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.order-card-head h3 {
  margin-bottom: 4px;
}

.order-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.order-meta-grid span {
  display: grid;
  gap: 3px;
  min-height: 50px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.order-meta-grid strong {
  color: var(--ink);
  font-size: 12px;
  line-height: 1.2;
}

.order-progress {
  height: 8px;
  margin: 2px 0;
}

.search {
  max-width: 320px;
}

dialog {
  width: min(980px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0;
  box-shadow: 0 24px 80px rgba(17, 24, 39, 0.28);
}

dialog::backdrop {
  background: rgba(17, 24, 39, 0.42);
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: #f8fafb;
}

#dialogBody {
  padding: 16px;
}

.profile-section {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.profile-section:first-child {
  margin-top: 0;
}

.profile-section h3 {
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.profile-filter {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.document-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 12px;
}

.document-item {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: var(--panel-soft);
}

.signature-panel {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  background: var(--panel-soft);
}

.signature-panel strong {
  font-size: 18px;
}

.signature-panel span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.generated-doc-grid {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.generated-doc-card {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 15px;
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.doc-number {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #edf6f8;
  color: var(--primary-dark);
  font-weight: 900;
}

.generated-doc-card h3 {
  margin-bottom: 4px;
  border: 0;
  padding: 0;
}

.generated-doc-card p {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.doc-card-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.static-cert-grid {
  margin-top: 18px;
}

.warning-note {
  margin: 14px 0 0;
  border: 1px solid #f4d48c;
  border-radius: 10px;
  padding: 12px;
  background: #fff8e7;
  color: #8a5a00;
  font-size: 13px;
  font-weight: 700;
}

.empty {
  color: var(--muted);
  padding: 18px 0;
}

.hidden {
  display: none;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
    background: transparent;
  }

  .workspace {
    grid-column: 1;
  }

  .sidebar {
    position: fixed;
    top: 0;
    right: auto;
    bottom: 0;
    left: calc(-1 * min(310px, 84vw));
    z-index: 30;
    width: min(310px, 84vw);
    height: 100dvh;
    min-height: 100vh;
    padding: 20px 16px;
    overflow-y: auto;
    overscroll-behavior: contain;
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transform: none;
    transition: left 220ms ease, opacity 180ms ease, visibility 220ms ease;
    box-shadow: 24px 0 60px rgba(16, 23, 32, 0.28);
  }

  .nav {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .nav-item {
    text-align: left;
  }

  body.menu-open .sidebar {
    left: 0;
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
  }

  .mobile-menu-button {
    position: relative;
    z-index: 35;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    min-width: 42px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #ffffff;
    color: var(--ink);
    cursor: pointer;
    box-shadow: var(--shadow-soft);
  }

  .mobile-menu-button span,
  .mobile-menu-button::before,
  .mobile-menu-button::after {
    content: "";
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
    transition: transform 180ms ease, opacity 180ms ease;
  }

  .mobile-menu-button {
    flex-direction: column;
    gap: 4px;
  }

  body.menu-open .mobile-menu-button span {
    opacity: 0;
  }

  body.menu-open .mobile-menu-button::before {
    transform: translateY(6px) rotate(45deg);
  }

  body.menu-open .mobile-menu-button::after {
    transform: translateY(-6px) rotate(-45deg);
  }

  .menu-overlay {
    position: fixed;
    inset: 0 0 0 min(310px, 84vw);
    z-index: 25;
    display: block;
    pointer-events: none;
    background: rgba(16, 23, 32, 0);
    opacity: 0;
    transition: opacity 200ms ease, background 200ms ease;
  }

  body.menu-open .menu-overlay {
    pointer-events: auto;
    background: rgba(16, 23, 32, 0.42);
    opacity: 1;
  }

  .topbar {
    z-index: 40;
    align-items: flex-start;
    justify-content: flex-start;
  }

  .topbar > div:first-of-type {
    min-width: 0;
    flex: 1;
  }

  .metrics,
  .rma-kpis,
  .order-kpis,
  .split-layout,
  .cards-grid,
  .catalogue-grid,
  .order-board,
  .form-grid,
  .bom-toolbar,
  .bom-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .inline-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .workspace {
    padding: 18px;
  }

  .topbar {
    margin: -18px -18px 20px;
    padding: 18px;
  }

  .topbar,
  .rma-hero,
  .order-hero,
  .panel-header,
  .form-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .metrics,
  .rma-kpis,
  .order-kpis,
  .split-layout,
  .cards-grid,
  .catalogue-grid,
  .order-board,
  .form-grid,
    .profile-filter,
    .document-grid,
    .document-upload-row,
    .bom-toolbar,
    .bom-summary-grid,
    .vendor-tools,
    .settings-grid,
    .price-sheet-form,
    .gem-bid-tools,
    .gem-sync-strip,
    .gem-bid-meta,
    .gem-bid-footer,
    .inline-form,
    .line-item-row,
    .generated-doc-card {
    grid-template-columns: 1fr;
  }

  th {
    position: static;
  }

  .nav-item {
    text-align: left;
    padding-inline: 14px;
  }

  .panel,
  .metric {
    box-shadow: none;
  }
}
