@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=DM+Mono:wght@400;500&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue:        #1a6496;
  --blue-dark:   #154e78;
  --blue-light:  #e8f1f8;
  --green:       #1e7a4e;
  --text-main:   #1a1a2e;
  --text-muted:  #6b7280;
  --text-light:  #9ca3af;
  --border:      #e2e5ea;
  --border-mid:  #d1d5db;
  --bg-page:     #f5f6f8;
  --bg-white:    #ffffff;
  --bg-header:   #1a3a5c;
  --accent:      #f59e0b;
  --radius:      8px;
  --max-width:   1520px;
}

html, body {
  min-height: 100%;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  background-color: var(--bg-page);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
}

body.ion-login-page {
  min-height: 100vh;
  display: block;
  background: #f3f4f6;
}

.ion-login-content {
  min-height: calc(100vh - 85px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 36px 20px;
}

.ion-login-wrap {
  width: min(560px, 92vw);
}

.ion-login-title {
  text-align: center;
  font-size: 48px;
  font-weight: 500;
  color: #111827;
  margin-bottom: 28px;
}

.ion-login-form {
  max-width: 100%;
  margin: 0 auto;
}

.ion-login-form label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #7b7b7b;
  letter-spacing: 0.3px;
  margin-top: 14px;
  margin-bottom: 6px;
}

.ion-login-form select,
.ion-login-form input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid #a7b0bf;
  background: #e4e8f0;
  border-radius: 4px 4px 0 0;
  padding: 10px 12px;
  font-size: 14px;
  color: #111827;
  outline: none;
}

.ion-login-form select {
  padding-right: 36px;
}

.ion-login-error {
  margin-top: 12px;
  color: #b91c1c;
  font-size: 18px;
}

.ion-login-actions {
  margin-top: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ion-login-btn {
  border: 0;
  border-radius: 5px;
  background: #2f79d0;
  color: #fff;
  min-width: 120px;
  padding: 9px 20px;
  font-size: 13px;
  letter-spacing: 0.5px;
  font-weight: 700;
  cursor: pointer;
}

.ion-login-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ═══════════════════════════════════════════════════
   SHELL LAYOUT
════════════════════════════════════════════════════ */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg-page);
}

/* ── Header ── */
.app-header {
  background: var(--bg-header);
  border-bottom: 3px solid var(--accent);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 16px rgba(0,0,0,0.22);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 28px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 82px;
}

.brand-row {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 42px;
}

.menu-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 38px;
  width: 100%;
  position: relative;
}

.menu-left {
  flex: 1;
  min-width: 0;
}

.menu-right {
  margin-left: auto;
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ═══════════════════════════════════════════════════
   USER MENU (Settings + Logout) - Top Right
════════════════════════════════════════════════════ */
.user-menu-item {
  position: relative;
}

.user-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.85);
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  text-decoration: none;
}

.user-menu-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.user-menu-btn.active {
  background: rgba(245, 158, 11, 0.25);
  color: var(--accent);
}

.user-menu-btn.logout-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

.user-menu-icon {
  font-size: 16px;
  line-height: 1;
}

.notification-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  background: #ef4444;
  color: white;
  font-size: 10px;
  font-weight: 700;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.notification-badge-inline {
  background: #ef4444;
  color: white;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 8px;
  margin-left: auto;
}

.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 260px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.18), 0 4px 12px rgba(15, 23, 42, 0.08);
  padding: 8px;
  display: none;
  z-index: 500;
}

.user-menu-item:hover .user-menu-dropdown,
.user-menu-item:focus-within .user-menu-dropdown {
  display: block;
}

.user-dropdown-header {
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
  padding: 10px 12px 8px 12px;
  border-bottom: 1px solid #e2e5ea;
  margin-bottom: 4px;
}

.user-menu-dropdown a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  color: #334155;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s ease;
}

.user-menu-dropdown a:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.user-menu-dropdown a.active {
  background: #e7efff;
  color: #1d4ed8;
  font-weight: 600;
}

.user-menu-dropdown .nav-icon {
  font-size: 14px;
  opacity: 0.85;
}

/* ── Nav (left column) ── */
nav {
   display: flex;
   align-items: center;
   gap: 48px;
   justify-content: flex-start;
   flex-wrap: wrap;
   width: 100%;
   padding-right: 128px;
   padding-left: 16px;
}

.nav-group {
   position: relative;
   display: flex;
   align-items: center;
   margin: 0 12px;
   padding: 0 8px;
}

.nav-group-trigger {
   display: flex;
   align-items: center;
   gap: 8px;
   font-family: 'DM Sans', sans-serif;
   font-size: 14px;
   font-weight: 500;
   color: rgba(255,255,255,0.65);
   background: transparent;
   border: 0;
   border-bottom: 3px solid transparent;
   padding: 6px 28px;
   height: 38px;
   margin-bottom: -3px;
   letter-spacing: 0.2px;
   white-space: nowrap;
   cursor: pointer;
   transition: all 0.2s ease;
   border-radius: 4px 4px 0 0;
   min-width: max-content;
}

.nav-group:hover .nav-group-trigger,
.nav-group:focus-within .nav-group-trigger {
   color: rgba(255,255,255,0.95);
   background: rgba(255,255,255,0.10);
   transform: translateY(-1px);
}

.nav-group.active .nav-group-trigger {
   color: #ffffff;
   border-bottom-color: var(--accent);
   font-weight: 600;
   background: rgba(255,255,255,0.08);
}

.nav-dropdown {
   position: absolute;
   top: calc(100% + 8px);
   left: 0;
   min-width: 240px;
   background: #ffffff;
   border: 1px solid var(--border);
   border-radius: 8px;
   box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
   padding: 8px;
   display: none;
   z-index: 300;
}

.nav-group:hover .nav-dropdown,
.nav-group:focus-within .nav-dropdown {
   display: block;
	animation: slideDown 0.15s ease-out;
}

@keyframes slideDown {
   from {
       opacity: 0;
       transform: translateY(-8px);
   }
   to {
       opacity: 1;
       transform: translateY(0);
   }
}

.nav-dropdown a {
   margin-bottom: 0;
   height: 36px;
   border-bottom: 0;
   color: #334155;
   border-radius: 6px;
   padding: 0 12px;
   display: flex;
   align-items: center;
   gap: 8px;
   font-size: 14px;
   transition: all 0.15s ease;
}

.nav-dropdown a:hover {
   color: #0f172a;
   background: #f1f5f9;
   padding-left: 14px;
}

.nav-dropdown a.active {
   color: #1d4ed8;
   background: #e7efff;
   border-bottom: 0;
   font-weight: 700;
}

nav a {
   display: flex;
   align-items: center;
   gap: 8px;
   font-family: 'DM Sans', sans-serif;
   font-size: 14px;
   font-weight: 500;
   color: rgba(255,255,255,0.65);
   text-decoration: none;
   padding: 6px 18px;
   border-bottom: 3px solid transparent;
   height: 38px;
   margin-bottom: -3px;
   transition: all 0.2s ease;
   letter-spacing: 0.2px;
   white-space: nowrap;
   border-radius: 4px 4px 0 0;
}

nav a:hover {
   color: rgba(255,255,255,0.95);
   background: rgba(255,255,255,0.10);
   transform: translateY(-1px);
}

nav a.active {
   color: #ffffff;
   border-bottom-color: var(--accent);
   font-weight: 600;
   background: rgba(255,255,255,0.08);
}

.nav-icon { font-size: 14px; }

/* ── Brand (center column) ── */
.brand {
   display: flex;
   align-items: center;
   justify-content: center;
   gap: 8px;
   font-family: 'DM Sans', sans-serif;
   font-size: 20px;
   font-weight: 700;
   letter-spacing: 0.5px;
   color: #fff;
   padding: 0 12px;
}

.brand-logo {
   font-size: 32px;
   display: flex;
   align-items: center;
   justify-content: center;
   line-height: 1;
}

.brand-ion   { color: var(--accent); font-size: 26px; letter-spacing: 3px; font-weight: 800; }
.brand-sep   { color: rgba(255,255,255,0.28); font-weight: 300; margin: 0 8px; font-size: 20px; }
.brand-label { color: rgba(255,255,255,0.85); font-weight: 500; font-size: 18px; letter-spacing: 0.3px; }


/* ── Page Body ── */
.page-body {
  flex: 1;
  padding: 32px 28px 56px;
  display: flex;
  justify-content: center;
}

.content-wrapper {
  width: 100%;
  max-width: var(--max-width);
}

/* ── Footer ── */
.app-footer {
  background: #f0f2f5;
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 14px 24px;
  font-size: 11.5px;
  color: var(--text-light);
  letter-spacing: 0.3px;
}

/* ═══════════════════════════════════════════════════
   PAGE HEADING
════════════════════════════════════════════════════ */
.page-heading {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.page-heading h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.4px;
  line-height: 1.2;
}

.page-heading p {
  margin-top: 6px;
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ═══════════════════════════════════════════════════
   CARDS
════════════════════════════════════════════════════ */
.card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.card h2 {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 20px;
  text-transform: uppercase;
  letter-spacing: 1.6px;
}

.login-card {
  max-width: 760px;
}

/* ═══════════════════════════════════════════════════
   FORM ELEMENTS
════════════════════════════════════════════════════ */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 4px;
}

@media (max-width: 640px) {
  .form-row { grid-template-columns: 1fr; }
}

.form-group { margin-bottom: 18px; }

.form-group label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 7px;
}

.label-hint {
  font-weight: 400;
  font-size: 11px;
  color: var(--text-light);
  text-transform: none;
  letter-spacing: 0;
}

.form-group select,
.form-group textarea,
.form-group input[type="text"] {
  width: 100%;
  background: var(--bg-white);
  border: 1.5px solid var(--border-mid);
  border-radius: 6px;
  color: var(--text-main);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  padding: 9px 12px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
  -webkit-appearance: none;
}

.form-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7280' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-group select:focus,
.form-group textarea:focus,
.form-group input[type="text"]:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(26,100,150,0.12);
}

.form-group select option { background: #fff; color: var(--text-main); }

.form-group textarea {
  resize: vertical;
  min-height: 150px;
  line-height: 1.65;
  font-family: 'DM Mono', monospace;
  font-size: 12.5px;
}

.char-counter {
  text-align: right;
  font-size: 11px;
  color: var(--text-light);
  margin-top: 5px;
  font-family: 'DM Mono', monospace;
}

/* ── File Input (custom styled) ── */
.file-input-wrapper {
  position: relative;
}

.file-input-wrapper input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  z-index: -1;
}

.file-input-label {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 1.5px dashed var(--border-mid);
  border-radius: 6px;
  padding: 10px 14px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: #fafbfc;
}

.file-input-label:hover {
  border-color: var(--blue);
  background: var(--blue-light);
}

.file-btn-text {
  flex-shrink: 0;
  background: var(--blue);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 4px;
  white-space: nowrap;
}

.file-name-display {
  font-size: 13px;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.file-name-display.muted { color: var(--text-muted); font-style: italic; }

/* ── Form Actions (button row) ── */
.form-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding-top: 8px;
  margin-top: 4px;
  border-top: 1px solid var(--border);
}

/* ═══════════════════════════════════════════════════
   BUTTONS
════════════════════════════════════════════════════ */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 10px 26px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.3px;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  box-shadow: 0 1px 4px rgba(26,100,150,0.25);
}

.btn-primary:hover:not(:disabled) {
  background: var(--blue-dark);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(26,100,150,0.3);
}

.btn-primary:active:not(:disabled) { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }

/* ── File Type Tabs ── */
.file-type-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  border-radius: 6px;
  border: 1.5px solid var(--border-mid);
  background: var(--bg-white);
  color: var(--text-muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.tab-btn:hover { background: #f8f9fb; border-color: #94a3b8; color: var(--text-main); }

.tab-btn.active {
  background: var(--blue-light);
  border-color: var(--blue);
  color: var(--blue);
  font-weight: 700;
}

/* ═══════════════════════════════════════════════════
   SPINNER
════════════════════════════════════════════════════ */
.spinner-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0;
  color: var(--text-muted);
  font-size: 13px;
}

.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--border-mid);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════════
   MESSAGES
════════════════════════════════════════════════════ */
.error-msg {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  border-radius: 6px;
  padding: 12px 16px;
  font-size: 13px;
  margin: 12px 0;
  line-height: 1.5;
}

/* ── Validation Result Banner ── */
.result-section { margin-top: 4px; }

.result-banner {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 22px;
  border-radius: 8px;
  border: 1.5px solid;
  margin-top: 16px;
}

.result-banner.success {
  background: #f0fdf4;
  border-color: #86efac;
  color: #15803d;
}

.result-banner.error {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #9f1239;
}

.result-icon {
  font-size: 20px;
  flex-shrink: 0;
  margin-top: 1px;
}

.result-body { flex: 1; min-width: 0; }

.result-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.2px;
  margin-bottom: 6px;
}

.result-detail {
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  opacity: 0.9;
}

.validation-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.validation-meta-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 6px;
  background: rgba(255,255,255,0.55);
  border: 1px solid rgba(148,163,184,0.2);
}

.validation-meta-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  opacity: 0.7;
}

.validation-meta-value {
  font-size: 13px;
  font-weight: 600;
  word-break: break-word;
}

.validation-summary {
  margin-top: 8px;
}

.validation-header-section {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(148,163,184,0.22);
}

.validation-section-title {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 10px;
  opacity: 0.78;
}

.validation-header-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.validation-header-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.72);
  border: 1px solid rgba(148,163,184,0.24);
  color: var(--text-main);
  font-size: 12px;
  line-height: 1.35;
}

/* ═══════════════════════════════════════════════════
   ORDER RESULTS
════════════════════════════════════════════════════ */
.order-result-section { margin-top: 4px; }

.result-count-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 12px;
}

.result-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
  font-size: 14px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.empty-icon { font-size: 36px; margin-bottom: 14px; }

/* ── Order Table ── */
.order-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

table.order-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12.5px;
  font-family: 'DM Sans', sans-serif;
}

table.order-table th,
table.order-table td {
  border: 1px solid var(--border);
  text-align: left;
  padding: 9px 12px;
  color: var(--text-main);
  vertical-align: middle;
}

table.order-table th {
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  background: #f4f6f9;
}

.th-base {
  background: #eef1f5;
  color: var(--text-muted);
  text-align: center;
  vertical-align: middle;
}

.th-sap-group {
  background: var(--blue);
  color: #ffffff;
  text-align: center;
  font-size: 12px;
  letter-spacing: 1px;
  vertical-align: middle;
}

.th-order-group {
  background: var(--green);
  color: #ffffff;
  text-align: center;
  font-size: 12px;
  letter-spacing: 1px;
  vertical-align: middle;
}

.th-sap,
.th-order {
  color: var(--text-muted);
  text-align: center;
  background: #f4f6f9;
}

.td-id {
  text-align: center;
  font-family: 'DM Mono', monospace;
  font-size: 11.5px;
  word-break: break-all;
  color: var(--blue);
}

.td-sap,
.td-sap-failed,
.td-order { font-size: 12.5px; line-height: 1.5; }

.td-center { text-align: center; }

/* ── Status row colours ── */
tr.row-green td           { background: #f0fdf4; }
tr.row-green:hover td     { background: #dcfce7; }
tr.row-red td             { background: #fef2f2; }
tr.row-red:hover td       { background: #fee2e2; }
tr.row-yellow td          { background: #fffbeb; }
tr.row-yellow:hover td    { background: #fef3c7; }
tr.row-cancelled td       { background: #ffffff; }
tr.row-cancelled:hover td { background: #f8f9fb; }

/* ── Export Bar ── */
.export-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-export {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 5px;
  border: 1.5px solid var(--border-mid);
  background: var(--bg-white);
  color: var(--text-muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-export:hover        { background: #f8f9fb; border-color: #94a3b8; }
.btn-export.csv          { border-color: #16a34a; color: #16a34a; }
.btn-export.csv:hover    { background: #f0fdf4; }
.btn-export.xlsx         { border-color: var(--blue); color: var(--blue); }
.btn-export.xlsx:hover   { background: var(--blue-light); }

/* ═══════════════════════════════════════════════════
   ORCHESTRATION LOGS
════════════════════════════════════════════════════ */
.orchestration-section {
  margin-top: 8px;
}

.orchestration-env-badge {
  display: inline-block;
  margin-bottom: 14px;
  font-size: 12px;
  font-weight: 700;
  color: #4b5563;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 999px;
  padding: 5px 12px;
}

.orchestration-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.orchestration-search {
  width: 100%;
  max-width: 420px;
  background: var(--bg-white);
  border: 1.5px solid var(--border-mid);
  border-radius: 6px;
  color: var(--text-main);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  padding: 8px 12px;
  outline: none;
}

.orchestration-search:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(26,100,150,0.12);
}

.orchestration-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.orch-chip {
  border: 1px solid #b7b4dd;
  background: #f5f4ff;
  color: #4a4780;
  border-radius: 4px;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.orch-chip.active {
  background: #6a63d5;
  color: #ffffff;
  border-color: #6a63d5;
}

.orch-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  border-radius: 4px;
  background: #6a63d5;
  color: #ffffff;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.3px;
}

.orch-btn:hover {
  background: #5a54c3;
}

.orch-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.result-count-bar .orch-btn {
  margin-left: 10px;
}

.orchestration-process-select {
  display: flex;
  align-items: center;
  gap: 8px;
}

.orchestration-process-select label {
  font-size: 12px;
  font-weight: 700;
  color: #4b5563;
}

.orchestration-process-select select {
  min-width: 280px;
  border: 1px solid var(--border-mid);
  border-radius: 4px;
  padding: 6px 9px;
  font-size: 12px;
}

.orchestration-sort {
  display: flex;
  align-items: center;
  gap: 8px;
}

.orchestration-sort label {
  font-size: 12px;
  font-weight: 700;
  color: #4b5563;
}

.orchestration-sort select {
  border: 1px solid var(--border-mid);
  border-radius: 4px;
  padding: 6px 9px;
  font-size: 12px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.status-complete {
  color: #15803d;
  background: #dcfce7;
}

.status-error {
  color: #b91c1c;
  background: #fee2e2;
}

.status-pending {
  color: #b45309;
  background: #fef3c7;
}

.status-neutral {
  color: #475569;
  background: #e2e8f0;
}

.orchestration-table {
  table-layout: fixed;
  width: 100%;
}

.orchestration-table th,
.orchestration-table td {
  white-space: normal;
  word-break: break-word;
}

.table-filter-row th {
  background: #f8fafc;
  padding: 6px;
}

.table-filter-row input,
.table-filter-row select {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  padding: 5px 7px;
  font-size: 11px;
}

.orch-link-btn {
  border: 1px solid #cbd5e1;
  background: #e7efff;
  color: #2563eb;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 10px;
  cursor: pointer;
}

.trace-row td {
  background: #f8fafc;
}

.trace-row-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.trace-row-title {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}

.trace-close-btn {
  background: #ef4444;
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s;
}

.trace-close-btn:hover {
  background: #b91c1c;
}

.trace-json {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 6px;
  padding: 12px;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  line-height: 1.45;
  max-height: 320px;
  overflow: auto;
}

.orchestration-context {
  margin-top: 16px;
}

.context-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 20px;
}

.context-modal {
  width: min(1100px, 95vw);
  max-height: 86vh;
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.25);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.context-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.context-modal-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: #1e293b;
}

.context-close-btn {
  border: 0;
  background: #ef4444;
  color: #ffffff;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-weight: 700;
  cursor: pointer;
}

.context-json {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 6px;
  padding: 14px;
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  line-height: 1.5;
  overflow-x: auto;
  max-height: calc(86vh - 80px);
}

.ssl-validation-card {
  margin-top: 14px;
}

.ssl-kv-grid {
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.ssl-kv-row {
  display: grid;
  grid-template-columns: minmax(180px, 260px) 1fr;
  border-bottom: 1px solid var(--border);
}

.ssl-kv-row:last-child {
  border-bottom: 0;
}

.ssl-kv-key {
  background: #f8fafc;
  font-size: 12px;
  font-weight: 700;
  color: #334155;
  padding: 9px 11px;
}

.ssl-kv-value {
  font-size: 12.5px;
  color: var(--text-main);
  padding: 9px 11px;
  word-break: break-word;
}

.ssl-cname-form-row {
  grid-template-columns: 1fr;
}

.ssl-cname-result {
  margin-top: 12px;
}

/* ═══════════════════════════════════════════════════
   DATA GRID (file validator)
════════════════════════════════════════════════════ */
.grid-section     { margin-top: 24px; }
.grid-section h3  {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: 12px;
}

.grid-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

table.data-grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data-grid thead tr { background: #f8f9fb; }
table.data-grid thead th {
  padding: 10px 13px;
  text-align: left;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.data-grid tbody tr { border-bottom: 1px solid var(--border); transition: background 0.1s; }
table.data-grid tbody tr:last-child { border-bottom: none; }
table.data-grid tbody tr:hover { background: #f8fafc; }
table.data-grid tbody td { padding: 9px 13px; color: var(--text-main); vertical-align: top; }
table.data-grid tbody td:first-child {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: var(--blue);
}

/* ═══════════════════════════════════════════════════
   STEP DETAILS MODAL (Orchestration Logs)
════════════════════════════════════════════════════ */
.step-details-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.step-details-modal {
  width: min(900px, 98vw);
  max-height: 90vh;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.step-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  background: linear-gradient(135deg, #1a3a5c 0%, #2a5a8c 100%);
  border-bottom: 1px solid #d1d5db;
  flex-shrink: 0;
}

.step-modal-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
}

.step-close-btn {
  border: 0;
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 24px;
  font-weight: 300;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.step-close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.step-modal-body {
  overflow-y: auto;
  flex: 1;
  padding: 0;
}

.step-section {
  border-bottom: 1px solid #e2e5ea;
  background: #ffffff;
}

.step-section:last-child {
  border-bottom: none;
}

.step-metadata-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0;
  padding: 20px 24px;
  background: #f8fafc;
}

.step-meta-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.step-meta-label {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.step-meta-value {
  font-size: 13px;
  color: #1a1a2e;
  font-family: 'DM Mono', monospace;
  word-break: break-all;
}

.step-collapsible {
  background: #ffffff;
}

.step-section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  background: #f1f5f9;
  border-bottom: 1px solid #e2e5ea;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease;
}

.step-section-header:hover {
  background: #e8f0f7;
}

.step-section-header h4 {
  font-size: 14px;
  font-weight: 600;
  color: #1a1a2e;
  margin: 0;
}

.step-section-toggle {
  display: inline-block;
  font-size: 14px;
  color: #64748b;
  transition: transform 0.2s ease;
  width: 16px;
  text-align: center;
}

.step-section-toggle.expanded {
  transform: rotate(90deg);
}

.step-section-content {
  padding: 16px 24px;
  background: #ffffff;
  border-bottom: 1px solid #e2e5ea;
}

.step-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  padding: 6px 12px;
  background: #e8f1f8;
  border: 1px solid #bcd4e1;
  border-radius: 6px;
  color: #1a6496;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.step-copy-btn:hover {
  background: #d4e9f5;
  border-color: #94bfd4;
}

.step-json {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 6px;
  padding: 12px 14px;
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  line-height: 1.6;
  overflow-x: auto;
  margin: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* ═══════════════════════════════════════════════════
   SETTINGS DROPDOWN WITH SECTION HEADERS
════════════════════════════════════════════════════ */
.settings-dropdown {
  min-width: 280px;
  max-height: 400px;
  overflow-y: auto;
}

.dropdown-section-header {
  font-size: 10px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 12px 14px 6px 14px;
  margin-top: 4px;
  border-top: 1px solid #e2e5ea;
}

.dropdown-section-header:first-of-type {
  margin-top: 0;
  border-top: none;
  padding-top: 6px;
}

/* ═══════════════════════════════════════════════════
   BOOTSTRAP CSS OVERRIDES - Prevent Bootstrap from breaking custom layout
═════════════════════════════════════════════════════ */

/* Override Bootstrap's default button styles that might affect menu */
.menu-row button,
.menu-left button,
.menu-right button {
  margin: 0 !important;
  padding: initial !important;
}

/* Override Bootstrap's default list styles */
nav ul, nav ol {
  margin-bottom: 0 !important;
}

/* Ensure menu layout stays intact */
.menu-row {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
}

.menu-left {
  flex: 1 !important;
  min-width: 0 !important;
}

.menu-right {
  margin-left: auto !important;
  position: absolute !important;
  right: 0 !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  display: flex !important;
  align-items: center !important;
  gap: 4px !important;
}

/* Prevent Bootstrap container styles from affecting header */
.app-header {
  width: 100% !important;
}

.header-inner {
  display: flex !important;
  flex-direction: column !important;
  max-width: var(--max-width) !important;
}

/* Override nav element default Bootstrap styling */
nav {
  margin: 0 !important;
  padding: 0 !important;
}

/* Ensure nav items are properly aligned */
.nav-group {
  display: inline-flex !important;
  align-items: center !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Fix user menu items alignment */
.user-menu-item {
  display: inline-flex !important;
  align-items: center !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Prevent Bootstrap from adding margins to form elements in modals */
.modal-body input,
.modal-body select,
.modal-body textarea {
  margin-bottom: 0 !important;
}

/* Override Bootstrap table styles if they conflict */
.credentials-table {
  margin-bottom: 0 !important;
}


.settings-dropdown a {
  padding-left: 16px !important;
}

/* ═══════════════════════════════════════════════════
   FIX BOOTSTRAP FORM ELEMENT SIZING
═════════════════════════════════════════════════════ */

/* Ensure form elements outside modals display correctly */
textarea:not(.modal textarea),
input:not(.modal input):not(.modal-body input),
select:not(.modal select):not(.modal-body select) {
  width: 100% !important;
  max-width: 100% !important;
}

/* Fix textarea sizing for Get Order Status and Orchestration Logs */
.page-body textarea,
.content-wrapper textarea {
  width: 100% !important;
  max-width: 100% !important;
  min-height: 150px;
  box-sizing: border-box;
}

/* Ensure tables outside credentials-management display correctly */
table:not(.credentials-table) {
  width: 100% !important;
  table-layout: auto;
}

/* Fix Bootstrap overrides affecting input fields */
.page-body input[type="text"],
.page-body input[type="email"],
.page-body input[type="password"],
.page-body input[type="number"],
.page-body select,
.page-body textarea {
  width: 100% !important;
  max-width: 100% !important;
}

/* Restore proper spacing for form groups outside credentials-management */
.page-body .form-group {
  margin-bottom: 1rem;
}

/* Ensure dropdown/select elements display properly */
select {
  width: 100% !important;
  max-width: 100% !important;
}

/* ═══════════════════════════════════════════════════
   FIX FORM LAYOUT FOR GET ORDER STATUS AND ORCHESTRATION LOGS
═════════════════════════════════════════════════════ */

/* Fix form-row to allow button alignment */
.form-row {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 1.5rem !important;
  align-items: flex-start !important;
  margin-bottom: 1rem !important;
}

/* Ensure form groups stretch properly */
.form-group {
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
}

/* Fix first form-group (environment/select) to take smaller width */
.form-row .form-group:first-child {
  flex: 0 0 auto !important;
  min-width: 250px !important;
  max-width: 300px !important;
}

/* Fix second form-group (textarea) to expand */
.form-row .form-group:nth-child(2) {
  flex: 1 !important;
  min-width: 350px !important;
}

/* Fix form-actions alignment - Place button properly */
.form-actions {
  display: flex !important;
  align-items: flex-end !important;
  gap: 1rem !important;
  padding: 0 !important;
}

.form-actions button {
  padding: 12px 24px !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  height: fit-content !important;
}

/* Ensure textarea takes proper height */
textarea {
  flex: 1 !important;
  min-height: 240px !important;
  resize: vertical !important;
}

/* Ensure select/dropdown sizing */
select {
  width: 100% !important;
  min-height: 44px !important;
}

/* Label styling */
label {
  margin-bottom: 0.5rem !important;
  font-weight: 500 !important;
  display: block !important;
}

/* Char counter styling */
.char-counter {
  font-size: 0.85rem !important;
  color: #64748b !important;
  margin-top: 0.25rem !important;
}

/* ═══════════════════════════════════════════════════
   API CREDENTIALS GRID/TABLE VIEW
═════════════════════════════════════════════════════ */

/* Make credentials table more readable */
.credentials-table tbody tr {
  border: 1px solid #e2e8f0 !important;
}

.credentials-table td {
  padding: 14px !important;
  vertical-align: middle !important;
}

/* Fix action buttons in table */
.credentials-table .btn-sm {
  white-space: nowrap !important;
  padding: 6px 10px !important;
  font-size: 0.85rem !important;
}

/* Ensure table columns are responsive */
@media (max-width: 1200px) {
  .form-row {
    grid-template-columns: 1fr !important;
  }

  .form-actions {
    flex-direction: column !important;
    width: 100% !important;
  }

  .form-actions button {
    width: 100% !important;
  }
}


