/* TS Pharm EDI Portal — shared styles */

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #f3f4f6;
  color: #1f2937;
  font-size: 14px;
  line-height: 1.5;
}

.topnav {
  display: flex;
  align-items: center;
  background: #1d5220;
  color: #f1f5f9;
  padding: 0 24px;
  height: 56px;
  gap: 4px;
}
.topnav .brand a {
  color: #f8fafc;
  font-weight: 700;
  text-decoration: none;
  font-size: 16px;
  margin-right: 24px;
  display: inline-flex;
  align-items: center;
}
.topnav .brand-logo {
  height: 38px;
  width: auto;
  display: block;
  background: #ffffff;
  padding: 5px 12px;
  border-radius: 6px;
}
.topnav a {
  color: #cbd5e1;
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  transition: background 0.15s;
}
.topnav a:hover { background: #2d7a28; color: #fff; }
.topnav a.active { background: #327c20; color: #fff; }
.topnav .spacer { flex: 1; }
.topnav .muted { color: #94a3b8; font-size: 13px; margin-right: 12px; }

.container {
  max-width: 1400px;
  margin: 24px auto;
  padding: 0 24px;
}

h1 {
  margin-top: 0;
  font-size: 22px;
  font-weight: 600;
  color: #1a1a1a;
}
h2 {
  font-size: 16px;
  font-weight: 600;
  margin: 24px 0 12px;
  color: #1a1a1a;
}

.card {
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  margin-bottom: 16px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat {
  background: #fff;
  border-radius: 8px;
  padding: 16px 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.stat .label { font-size: 12px; color: #6b7280; text-transform: uppercase; letter-spacing: 0.05em; }
.stat .value { font-size: 26px; font-weight: 600; color: #1a1a1a; margin-top: 4px; }
.stat .sub { font-size: 12px; color: #6b7280; margin-top: 4px; }

table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 auto;   /* horizontally centered within its container */
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
table th {
  background: #f8fafc;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0;
}
table td {
  padding: 12px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
table tr:last-child td { border-bottom: 0; }
table tr:hover td { background: #f8fafc; }

.badge {
  display: inline-block;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.04em;
}

button, .btn {
  background: #327c20;
  color: #fff;
  border: 0;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button:hover, .btn:hover { background: #256628; }
button:disabled { background: #cbd5e1; cursor: not-allowed; }
button.secondary, .btn.secondary { background: #475569; }
button.secondary:hover, .btn.secondary:hover { background: #1d5220; }
button.danger, .btn.danger { background: #dc2626; }
button.danger:hover, .btn.danger:hover { background: #b91c1c; }
button.small, .btn.small { padding: 4px 10px; font-size: 12px; }

/* Distinct accent colours for action buttons used across the staff portal
   (Settings / Products / Edit) so multiple row actions don't read as one
   wall of green. */
button.btn-settings, .btn.btn-settings { background:#7c3aed; }
button.btn-settings:hover, .btn.btn-settings:hover { background:#6d28d9; }
button.btn-products, .btn.btn-products { background:#0d9488; }
button.btn-products:hover, .btn.btn-products:hover { background:#0f766e; }

input[type="text"], input[type="password"], input[type="email"], input[type="number"],
input[type="url"], select, textarea {
  border: 1px solid #cbd5e1;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 13px;
  width: 100%;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid #327c20;
  outline-offset: -1px;
  border-color: #327c20;
}
label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.form-grid .full { grid-column: 1 / -1; }

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.toolbar select, .toolbar input { width: auto; min-width: 160px; }

pre.raw {
  background: #1a1a1a;
  color: #e2e8f0;
  padding: 16px;
  border-radius: 6px;
  font-size: 12px;
  font-family: "SF Mono", Consolas, monospace;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 400px;
  overflow-y: auto;
}

.empty {
  padding: 40px 20px;
  text-align: center;
  color: #94a3b8;
}

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.5);
  display: none;
  align-items: center; justify-content: center;
  z-index: 50;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: #fff;
  border-radius: 8px;
  padding: 24px;
  max-width: 720px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;     /* scroll only as a fallback on short screens */
  position: relative;   /* anchor for the top-right X */
}
.modal h2 { margin-top: 0; padding-right: 32px; }  /* leave room for the X */

/* Modals that should never show an inner scrollbar. The page can scroll if
   the screen is truly too short, but the modal itself grows to fit. */
.modal.no-scroll { max-height: none; overflow-y: visible; }

/* Top-right close button injected into every modal by enhanceModals(). */
.modal-x {
  position: absolute;
  top: 10px; right: 12px;
  width: 30px; height: 30px;
  padding: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; line-height: 1;
  background: transparent;
  color: #64748b;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}
.modal-x:hover { background: #f1f5f9; color: #0f172a; }

/* Red Cancel buttons (class added by enhanceModals). */
button.cancel-red, .btn.cancel-red {
  background: #dc2626;
  color: #fff;
}
button.cancel-red:hover, .btn.cancel-red:hover { background: #b91c1c; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.flash {
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 14px;
  font-size: 13px;
}
.flash.ok { background: #d1fae5; color: #065f46; }
.flash.error { background: #fee2e2; color: #991b1b; }

.muted { color: #94a3b8; }
.nowrap { white-space: nowrap; }
.mono { font-family: "SF Mono", Consolas, monospace; font-size: 12px; }

/* ---- notification bell ---- */
.nav-bell {
  position: relative;
  cursor: pointer;
  padding: 4px 8px;
  display: inline-flex;
  align-items: center;
}
.nav-bell .bell-icon { font-size: 18px; line-height: 1; filter: grayscale(0.2); }
.bell-badge {
  position: absolute;
  top: 0; right: 2px;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  background: #dc2626; color: #fff;
  font-size: 10px; font-weight: 700;
  border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
}
.bell-badge.running { background: #f59e0b; }
.bell-panel {
  position: absolute;
  top: 32px; right: 0;
  width: 320px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15,23,42,0.18);
  z-index: 100;
  padding: 6px;
  cursor: default;
}
.bell-empty { padding: 18px; text-align: center; color: #94a3b8; font-size: 13px; }
.bell-item { display: flex; gap: 10px; padding: 10px; border-radius: 8px; }
.bell-item:hover { background: #f8fafc; }
.bell-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; flex: none; }
.bell-body { flex: 1; }
.bell-title { font-weight: 600; font-size: 13px; color: #0f172a; }
.bell-detail { font-size: 12px; color: #64748b; margin-top: 2px; line-height: 1.35; }
.bell-actions { margin-top: 6px; display: flex; gap: 10px; align-items: center; }
.bell-link { font-size: 12px; color: #327c20; text-decoration: none; font-weight: 600; }
.bell-link:hover { text-decoration: underline; }
.bell-sub { font-size: 11px; color: #94a3b8; }
