/* Pure Delights FSCS — minimal but functional UI. Tablet-friendly defaults. */
:root {
  --pd-primary: #1f6feb;
  --pd-bg: #f6f7f9;
  --pd-card: #ffffff;
  --pd-border: #d8dde3;
  --pd-text: #1a1f29;
  --pd-muted: #5b6573;
  --pd-ok: #1a7f37;
  --pd-bad: #b91c1c;
  --pd-warn: #b45309;
  --pd-na: #6b7280;
  --pd-amber: #d97706;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--pd-bg);
  color: var(--pd-text);
}
.container { max-width: 1300px; margin: 0 auto; padding: 16px; }
.muted { color: var(--pd-muted); }
.small { font-size: 12px; }

/* Topbar */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 16px;
  background: #0f172a; color: white;
  position: sticky; top: 0; z-index: 10;
  flex-wrap: nowrap;
}
.topbar .brand { 
  color: white; 
  text-decoration: none; 
  font-weight: 700; 
  font-size: 18px; 
  display: flex;        /* add this */
  align-items: center;  /* add this */
  gap: 10px;            /* add this */
}
.topbar .brand .brand-name {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.topbar .brand .muted { color: #94a3b8; font-weight: 400; font-size: 12px; }
.topbar nav { display: flex; gap: 12px; flex-wrap: nowrap; flex: 1; flex: 1;  
  font-size: 13px;  }
.topbar nav a { color: #cbd5e1; text-decoration: none; padding: 4px 6px; border-radius: 4px; font-size: 12.5px;  white-space: nowrap; 
  font-size: 13px;  }
.topbar nav a:hover { background: #1e293b; color: white; }
.topbar .sep { color: #475569; }
.topbar .user { display: flex; align-items: center; gap: 12px; }
.topbar .user .role { font-size: 11px; padding: 2px 6px; border-radius: 3px; background: #334155; }
.topbar .user .role-administrator { background: #7c2d12; }
.topbar .user .role-supervisor    { background: #1e3a8a; }
.topbar .user .role-operator      { background: #14532d; }
.btn-link { background: none; border: none; color: white; cursor: pointer; padding: 0; text-decoration: underline; }
.btn-link.danger { color: var(--pd-bad); }
.bell { color: white; position: relative; text-decoration: none; }
.bell .badge { position: absolute; top: -8px; right: -10px; background: var(--pd-bad); color: white; font-size: 10px; padding: 1px 5px; border-radius: 8px; }

h1 { font-size: 22px; margin: 18px 0 10px; }
h2 { font-size: 16px; margin: 18px 0 10px; }
h3 { font-size: 14px; margin: 14px 0 8px; }

/* Cards */
.card {
  background: var(--pd-card); border: 1px solid var(--pd-border);
  border-radius: 8px; padding: 16px; margin: 12px 0;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.login-card { max-width: 400px; margin: 60px auto; }

/* Forms */
label { display: block; margin: 8px 0; }
label > input, label > select, label > textarea {
  display: block; width: 100%; padding: 8px 10px;
  border: 1px solid var(--pd-border); border-radius: 5px;
  background: white; font: inherit; max-width: 500px;
}
label.notes textarea { max-width: 100%; }
.req { color: var(--pd-bad); }

/* Filterbar */
.filterbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; padding: 12px; background: white; border: 1px solid var(--pd-border); border-radius: 8px; margin: 12px 0; }
.filterbar label { margin: 0; flex: 1 1 160px; }

/* Buttons */
.btn {
  display: inline-block; padding: 8px 14px; border: 1px solid var(--pd-border);
  background: white; color: var(--pd-text); border-radius: 5px; cursor: pointer;
  text-decoration: none; font: inherit;
}
.btn:hover { background: #f0f3f7; }
.btn.primary { background: var(--pd-primary); color: white; border-color: var(--pd-primary); }
.btn.primary:hover { background: #1657c2; }
.btn.danger { background: var(--pd-bad); color: white; border-color: var(--pd-bad); }
.btn.big { padding: 12px 20px; font-size: 15px; }
.btn.btn-sm { padding: 4px 8px; font-size: 12px; }

form.inline { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
form.inline input, form.inline select { width: auto; }

/* KPIs */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 12px 0; }
.kpi { background: white; border-radius: 8px; padding: 16px; border: 1px solid var(--pd-border); text-align: center; }
.kpi.bad { background: #fef2f2; border-color: #fecaca; }
.kpi.warn { background: #fffbeb; border-color: #fde68a; }
.kpi-n { font-size: 26px; font-weight: 700; }
.kpi-l { font-size: 12px; color: var(--pd-muted); margin-top: 2px; }

/* Tables */
table.data { width: 100%; border-collapse: collapse; background: white; border-radius: 6px; overflow: hidden; }
table.data th, table.data td { padding: 8px 10px; text-align: left; border-bottom: 1px solid #e8ecf1; vertical-align: top; }
table.data th { background: #f1f5f9; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: #475569; }
table.data tr.ooc { background: #fef2f2; }
table.data tr.correction { background: #fefce8; }
table.data.compact th, table.data.compact td { padding: 4px 8px; font-size: 12px; }

/* Pills */
.pill { display: inline-block; padding: 2px 8px; border-radius: 12px; background: #e2e8f0; color: #1e293b; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.pill-ok { background: #dcfce7; color: var(--pd-ok); }
.pill-bad { background: #fee2e2; color: var(--pd-bad); }
.pill-na { background: #e5e7eb; color: var(--pd-muted); }
.pill.ccp { background: #fce7f3; color: #9d174d; }
.pill.ai { background: #ddd6fe; color: #5b21b6; }
.pill.atp-pass { background: #dcfce7; color: var(--pd-ok); }
.pill.atp-marginal { background: #fef3c7; color: var(--pd-amber); }
.pill.atp-fail { background: #fee2e2; color: var(--pd-bad); }

/* Bars */
.bar { background: #e2e8f0; height: 16px; border-radius: 4px; position: relative; max-width: 300px; }
.bar-fill { background: linear-gradient(to right, var(--pd-ok), #22c55e); height: 100%; border-radius: 4px; }
.bar span { position: absolute; top: -1px; left: 8px; font-size: 11px; color: #1a1f29; font-weight: 600; }

/* Form fill rows */
.row-card {
  border: 1px solid var(--pd-border); border-radius: 6px; padding: 12px;
  margin: 12px 0; background: #fafbfc;
}
.row-card legend { font-weight: 600; padding: 0 6px; }
.field { margin: 8px 0; }
.field.ooc { background: #fef2f2; padding: 6px; border-radius: 4px; }
.field .hint { color: var(--pd-muted); font-size: 11px; margin-left: 8px; }
.section-h { margin: 14px 0 4px; padding: 4px 0; border-bottom: 1px dashed var(--pd-border); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--pd-muted); }
.row-status-pill { padding: 4px 8px; }

/* Flash */
.flash { padding: 10px 14px; border-radius: 6px; margin: 10px 0; }
.flash-success { background: #dcfce7; color: var(--pd-ok); border: 1px solid #bbf7d0; }
.flash-warn { background: #fef3c7; color: var(--pd-warn); border: 1px solid #fde68a; }
.flash-error { background: #fee2e2; color: var(--pd-bad); border: 1px solid #fecaca; }

.meta-strip { display: flex; gap: 18px; flex-wrap: wrap; padding: 8px 12px; background: white; border: 1px solid var(--pd-border); border-radius: 6px; margin-bottom: 12px; font-size: 13px; }

.audit-json { font-size: 10px; max-width: 400px; max-height: 80px; overflow: auto; background: #f1f5f9; padding: 4px; border-radius: 3px; margin: 0; }

.footer { text-align: center; color: var(--pd-muted); padding: 24px; font-size: 12px; }

details summary { cursor: pointer; padding: 4px 0; }

.user-logo {
  display: flex;
  flex-direction: column;  /* stack vertically */
  align-items: center;
  gap: 4px;
}

.brand-logo {
  height: 42px;
  width: 46px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
}
.user-right {
  display: flex;
  flex-direction: column;  /* stack vertically */
  align-items: flex-end;   /* align to right */
  gap: 4px;
}

.user-top {
  display: flex;
  align-items: center;
  gap: 8px;
}
.user-right form {
  margin-right: 16px; /* adjust this value as needed */
}
/* Dropdown */
.nav-dropdown {
  position: relative;
  display: inline-block;
}

.nav-dropdown-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: #cbd5e1;
  font-size: 13px;
  padding: 4px 6px;
  border-radius: 4px;
  font-family: inherit;
  white-space: nowrap;
}

.nav-dropdown-toggle:hover {
  background: #1e293b;
  color: white;
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  min-width: 160px;
  z-index: 9999;
  overflow: visible;
}

.nav-dropdown-menu a {
  display: block;
  padding: 9px 14px;
  color: #cbd5e1;
  text-decoration: none;
  font-size: 13px;
  white-space: nowrap;
  border-radius: 0;
}

.nav-dropdown-menu a:first-child { border-radius: 6px 6px 0 0; }
.nav-dropdown-menu a:last-child  { border-radius: 0 0 6px 6px; }

.nav-dropdown-menu a:hover {
  background: #334155;
  color: white;
}

.nav-dropdown.open .nav-dropdown-menu {
  display: block;
}