:root {
  --bg: #eff3f9;
  --bg-deep: #e6ecf4;
  --surface: #ffffff;
  --surface-2: #f7fafc;
  --surface-3: #f1f5f9;
  --ink: #0f1e35;
  --ink-2: #1f2c44;
  --muted: #5a6878;
  --muted-2: #94a3b8;
  --line: #dde4ee;
  --line-2: #c7d2e0;
  --rail: #061f3f;
  --rail-2: #0b315f;
  --rail-3: #15539a;
  --rail-glow: #1d6fc7;
  --signal: #37c98b;
  --signal-2: #1aa872;
  --green: #1aa872;
  --teal: #0e9c93;
  --blue: #2563eb;
  --purple: #7558e0;
  --amber: #f59e0b;
  --orange: #ea7621;
  --red: #d4302c;
  --red-2: #b91c1c;
  --gold: #d4a72c;
  --steel: #475569;
  --shadow: 0 6px 18px rgba(13, 25, 48, 0.06);
  --shadow-strong: 0 14px 36px rgba(13, 25, 48, 0.11);
  --shadow-rim: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 0 0 1px rgba(15, 23, 42, 0.04);
  --radius: 10px;
  --radius-sm: 6px;
}

body {
  background:
    radial-gradient(1200px 600px at 110% -10%, rgba(29, 111, 199, 0.06), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(55, 201, 139, 0.05), transparent 60%),
    var(--bg);
  font-feature-settings: "ss01", "cv11";
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

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

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
}

.app-shell[hidden],
.login-shell[hidden] {
  display: none !important;
}

.sidebar {
  background: linear-gradient(180deg, #051a36 0%, #07254a 50%, #061f3f 100%);
  color: #f1f5fb;
  display: flex;
  flex-direction: column;
  padding: 18px 14px 14px;
  gap: 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 4px 0 24px rgba(5, 18, 39, 0.18);
}

.sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(220px 200px at 30% 8%, rgba(55, 201, 139, 0.12), transparent 60%),
    radial-gradient(280px 240px at 80% 102%, rgba(29, 111, 199, 0.12), transparent 60%);
  pointer-events: none;
  opacity: 0.9;
}

.sidebar > * {
  position: relative;
  z-index: 1;
}

.sidebar .nav {
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
}

.sidebar .nav::-webkit-scrollbar {
  width: 6px;
}

.sidebar .nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 6px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  background: transparent;
  border-radius: 12px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.32);
  overflow: hidden;
  flex-shrink: 0;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.brand-mark svg {
  width: 26px;
  height: 26px;
}

.brand > div {
  min-width: 0;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 15px;
  letter-spacing: 0.04em;
  color: #ffffff;
}

.brand span {
  color: #93b1d5;
  font-size: 10.5px;
  font-weight: 700;
  margin-top: 4px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

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

.nav-section-title,
.nav-group summary {
  color: #6f93c0;
  display: block;
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: 0.08em;
  margin: 14px 10px 4px;
  text-transform: uppercase;
}

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

.nav-group summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
  border-radius: 6px;
  padding: 6px 10px;
  transition: background 140ms;
}

.nav-group summary:hover {
  background: rgba(255, 255, 255, 0.04);
}

.nav-group summary::-webkit-details-marker {
  display: none;
}

.nav-group summary::after {
  content: "›";
  float: right;
  font-size: 14px;
  transform: rotate(90deg);
  color: #4f7caf;
  transition: transform 140ms;
}

.nav-group:not([open]) summary::after {
  transform: rotate(0deg);
}

.nav-item {
  border: 0;
  background: transparent;
  color: #d4e1f3;
  text-align: left;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 38px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.005em;
  white-space: nowrap;
  font-family: inherit;
  position: relative;
  transition: background 140ms ease, color 140ms ease, transform 140ms ease;
}

.nav-icon {
  width: 18px;
  height: 18px;
  color: #87a8d2;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  transition: color 140ms;
}

.nav-icon svg {
  width: 18px;
  height: 18px;
}

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

.nav-item:hover .nav-icon {
  color: var(--signal);
}

.nav-item:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 2px;
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(55, 201, 139, 0.18), rgba(29, 111, 199, 0.08));
  color: #ffffff;
  box-shadow: inset 3px 0 0 var(--signal);
  font-weight: 800;
}

.nav-item.active .nav-icon {
  color: var(--signal);
}

.sidebar-meta {
  margin-top: auto;
  display: grid;
  gap: 8px;
  color: #adc2dd;
  font-size: 11.5px;
  padding: 12px 10px 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-meta .meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sidebar-meta .meta-label {
  color: #6f93c0;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.sidebar-meta .meta-row span:last-child {
  color: #e2eaf6;
  font-weight: 700;
}

.workspace {
  min-width: 0;
  padding: 0 26px 28px;
}

.topbar {
  min-height: 84px;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) auto;
  align-items: center;
  gap: 24px;
  background:
    linear-gradient(180deg, #ffffff, var(--surface-2));
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(13, 25, 48, 0.03);
  margin: 0 -26px 20px;
  padding: 14px 26px;
  position: relative;
}

.topbar::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(55, 201, 139, 0.6), rgba(29, 111, 199, 0.6), transparent);
  opacity: 0.6;
}

.topbar-left {
  min-width: 0;
}

.topbar-right {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.shift-chip,
.sync-chip {
  display: flex;
  gap: 10px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 12px 7px 10px;
  min-height: 40px;
  font-size: 12px;
  position: relative;
  box-shadow: var(--shadow);
}

.shift-chip .shift-icon {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 3px rgba(212, 167, 44, 0.16);
}

.shift-chip strong[data-tone="afternoon"] + *,
.shift-chip strong[data-tone="afternoon"] {
  color: var(--ink);
}

.shift-chip:has(strong[data-tone="night"]) .shift-icon {
  background: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

.shift-chip:has(strong[data-tone="morning"]) .shift-icon {
  background: var(--amber);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18);
}

.shift-label,
.sync-label {
  display: block;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.shift-chip strong,
.sync-chip strong {
  display: block;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 800;
  line-height: 1.3;
}

.sync-chip .sync-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--signal);
  box-shadow: 0 0 0 0 rgba(55, 201, 139, 0.6);
  animation: pulse-dot 2.2s infinite;
}

@keyframes pulse-dot {
  0% { box-shadow: 0 0 0 0 rgba(55, 201, 139, 0.55); }
  70% { box-shadow: 0 0 0 8px rgba(55, 201, 139, 0); }
  100% { box-shadow: 0 0 0 0 rgba(55, 201, 139, 0); }
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--rail-3);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.site-label {
  display: block;
  color: var(--muted);
  font-size: 12.5px;
  margin-top: 6px;
  font-weight: 600;
}

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

h1 {
  color: var(--ink);
  margin-bottom: 0;
  font-size: 26px;
  font-weight: 800;
  line-height: 1.18;
  letter-spacing: -0.01em;
}

h2 {
  color: #10284b;
  font-size: 17px;
  margin-bottom: 12px;
}

h3 {
  font-size: 15px;
  margin-bottom: 10px;
}

.actions,
.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.top-control {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  min-width: 130px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.top-control input {
  margin-top: 4px;
  min-height: 36px;
}

.icon-button {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--rail-2);
  cursor: pointer;
  position: relative;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow);
  transition: background 140ms, border-color 140ms, transform 140ms;
}

.icon-button:hover {
  background: var(--surface-3);
  border-color: var(--line-2);
  transform: translateY(-1px);
}

.icon-button svg {
  width: 20px;
  height: 20px;
}

.icon-button.alert-button {
  color: var(--rail-2);
}

.notification-dot {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--red);
  color: #ffffff;
  display: grid;
  place-items: center;
  font-size: 10.5px;
  font-weight: 900;
  padding: 0 5px;
  border: 2px solid #ffffff;
  box-shadow: 0 4px 8px rgba(220, 38, 38, 0.32);
}

.notification-dot.is-hidden {
  display: none;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 6px 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
  position: relative;
  min-height: 48px;
}

.user-chip .user-info strong,
.user-chip .user-info span {
  display: block;
}

.user-chip .user-info {
  min-width: 0;
}

.user-chip .user-info strong {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.user-chip .user-info span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 2px;
}

.user-toggle {
  background: transparent;
  border: 0;
  cursor: pointer;
  color: var(--muted);
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  padding: 0;
}

.user-toggle:hover {
  background: var(--surface-3);
  color: var(--ink);
}

.user-toggle svg {
  width: 16px;
  height: 16px;
}

.user-toggle[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-strong);
  padding: 8px;
  display: grid;
  gap: 4px;
  z-index: 60;
}

.user-menu[hidden] {
  display: none;
}

.user-menu-item {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px 8px;
  border-radius: 8px;
  background: transparent;
  border: 0;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: background 120ms;
}

.user-menu-item:hover {
  background: var(--surface-3);
}

.user-menu-item.is-active {
  background: rgba(29, 111, 199, 0.07);
  outline: 1px solid rgba(29, 111, 199, 0.18);
}

.user-menu-avatar {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #ffffff;
  font-weight: 900;
  font-size: 12px;
  line-height: 1;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(13, 25, 48, 0.18);
}

.user-menu-text {
  min-width: 0;
}

.user-menu-text strong {
  display: block;
  font-size: 13px;
  color: var(--ink);
  font-weight: 800;
}

.user-menu-text span {
  display: block;
  font-size: 11px;
  color: var(--rail-3);
  font-weight: 800;
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.user-menu-text em {
  display: block;
  font-style: normal;
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 3px;
  font-weight: 500;
}

.user-chip .avatar,
.avatar {
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: 50%;
  background: var(--rail-2);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-transform: none;
  font-weight: 900;
  font-size: 13px;
  line-height: 1;
  letter-spacing: 0.02em;
  margin: 0;
  padding: 0;
  flex-shrink: 0;
  box-shadow: 0 6px 14px rgba(11, 49, 95, 0.22), inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.primary-button,
.ghost-button,
.danger-button,
.quick-button {
  border: 1px solid transparent;
  min-height: 38px;
  padding: 8px 13px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
}

.primary-button {
  background: var(--rail);
  color: #ffffff;
}

.ghost-button {
  background: #ffffff;
  color: var(--ink);
  border-color: var(--line);
}

.danger-button {
  background: #fff3f2;
  color: var(--red);
  border-color: #fecaca;
}

.primary-button:hover,
.ghost-button:hover,
.danger-button:hover,
.quick-button:hover {
  filter: brightness(0.98);
}

.filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(140px, 1fr)) minmax(200px, 1.4fr) minmax(140px, 0.9fr) auto;
  gap: 12px;
  margin-bottom: 20px;
}

.filters.is-hidden {
  display: none;
}

.filters.is-compact {
  grid-template-columns: minmax(200px, 1.4fr) auto;
}

.toolbar {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow);
  align-items: end;
}

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

select,
input,
textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 8px 10px;
}

textarea {
  min-height: 86px;
  resize: vertical;
}

.view {
  display: grid;
  gap: 16px;
}

.process-context {
  background: #ffffff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--rail-3);
  border-radius: 10px;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(0, 1.4fr) minmax(220px, auto);
  gap: 16px;
  align-items: center;
  padding: 16px 18px;
}

@media (max-width: 1240px) {
  .process-context {
    grid-template-columns: minmax(0, 1fr);
  }
  .process-actions {
    justify-items: stretch;
  }
}

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

.process-main h2 {
  margin-bottom: 4px;
}

.process-main p {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 0;
}

.stage-badge {
  align-items: center;
  background: #e8f0ff;
  border-radius: 8px;
  color: #1d4ed8;
  display: inline-flex;
  font-size: 12px;
  font-weight: 900;
  min-height: 34px;
  padding: 7px 10px;
  text-transform: uppercase;
}

.process-flow {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.process-flow .workflow-step {
  flex: 1 1 auto;
  min-width: 92px;
}

.workflow-step {
  background: #f1f5f9;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #475569;
  font-size: 12px;
  font-weight: 900;
  padding: 8px 12px;
  text-align: center;
  cursor: pointer;
  font-family: inherit;
  position: relative;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.workflow-step:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
  color: #1e293b;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.08);
}

.workflow-step:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.workflow-step.active {
  background: var(--rail);
  border-color: var(--rail);
  color: #ffffff;
  box-shadow: 0 6px 12px rgba(11, 49, 95, 0.22);
}

.workflow-step.active:hover {
  background: var(--rail-2);
  border-color: var(--rail-2);
  color: #ffffff;
}

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

.pagination-info {
  font-size: 12px;
  color: var(--muted);
  font-weight: 800;
}

.pagination-controls {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
}

.pagination-btn {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 10px;
  min-width: 34px;
  font-size: 12px;
  font-weight: 800;
  color: #475569;
  cursor: pointer;
  font-family: inherit;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}

.pagination-btn:hover:not(:disabled) {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #10284b;
}

.pagination-btn:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.pagination-btn.is-active {
  background: var(--rail);
  border-color: var(--rail);
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(11, 49, 95, 0.18);
}

.pagination-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.pagination-ellipsis {
  padding: 0 6px;
  color: var(--muted);
  font-weight: 800;
}

.process-actions {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.ops-counters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.ops-counters span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.ops-counters strong {
  color: #10284b;
}

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

.dashboard-kpis {
  grid-template-columns: repeat(6, minmax(150px, 1fr));
}

.metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 15px;
  box-shadow: var(--shadow);
  transition: box-shadow 160ms ease, transform 160ms ease, border-color 160ms ease;
}

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

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 25px;
  line-height: 1.1;
}

.metric em {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
}

.kpi-card {
  min-height: 132px;
  position: relative;
  overflow: hidden;
}

.kpi-card:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-strong);
  transform: translateY(-1px);
}

.kpi-card strong {
  font-size: 25px;
}

.kpi-card::after {
  content: "";
  position: absolute;
  right: 16px;
  bottom: 16px;
  width: 70px;
  height: 26px;
  border-bottom: 3px solid currentColor;
  border-right: 3px solid currentColor;
  transform: skewX(-25deg);
  opacity: 0.55;
}

.tone-green {
  color: var(--green);
}

.tone-blue {
  color: var(--blue);
}

.tone-purple {
  color: var(--purple);
}

.tone-amber {
  color: var(--amber);
}

.tone-red {
  color: var(--red);
}

.tone-teal {
  color: var(--teal);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  box-shadow: var(--shadow);
  min-width: 0;
  transition: box-shadow 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.panel:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-strong);
  transform: translateY(-1px);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.dashboard-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 0.7fr);
  gap: 16px;
  min-width: 0;
}

.dashboard-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 0.8fr);
  gap: 16px;
  min-width: 0;
}

@media (max-width: 1600px) {
  .dashboard-main,
  .dashboard-bottom {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (min-width: 1601px) {
  .dashboard-bottom {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, 0.9fr);
  }
}

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 16px;
}

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

.chart {
  width: 100%;
  min-height: 320px;
  display: block;
  opacity: 0;
  animation: chartFadeIn 260ms ease forwards;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(248, 250, 252, 0.72), rgba(255, 255, 255, 0.96));
  cursor: crosshair;
}

.mini-chart {
  width: 100%;
  min-height: 230px;
  display: block;
  opacity: 0;
  animation: chartFadeIn 260ms ease forwards;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(248, 250, 252, 0.66), rgba(255, 255, 255, 0.96));
  cursor: crosshair;
}

.donut-layout {
  display: grid;
  grid-template-columns: minmax(240px, 0.72fr) minmax(360px, 1fr);
  align-items: center;
  gap: 26px;
  min-height: 276px;
  padding: 8px 2px 4px;
}

.donut-chart {
  min-height: 258px;
  cursor: pointer;
}

.legend-table {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.legend-head,
.legend-row {
  display: grid;
  grid-template-columns: 14px minmax(140px, 1fr) minmax(92px, auto) minmax(64px, auto);
  gap: 10px;
  align-items: center;
}

.legend-row {
  border-radius: 8px;
  font-size: 13px;
  min-height: 34px;
  padding: 6px 8px;
  transition: background 150ms ease, transform 150ms ease;
}

.legend-row:hover {
  background: #f8fafc;
  transform: translateX(2px);
}

.legend-head {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  padding: 0 8px 3px;
  text-transform: uppercase;
}

.legend-row strong {
  color: #10284b;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 4px;
}

.legend-value,
.legend-percent {
  color: #334155;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
}

.legend-percent {
  color: var(--muted);
}

.chart-tooltip {
  background: #0f243f;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.22);
  color: #ffffff;
  display: grid;
  gap: 3px;
  opacity: 0;
  padding: 9px 11px;
  pointer-events: none;
  position: fixed;
  transform: translateY(4px);
  transition: opacity 120ms ease, transform 120ms ease;
  z-index: 1000;
  max-width: 260px;
}

.chart-tooltip strong {
  font-size: 13px;
  max-width: 230px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

.chart-tooltip span {
  color: #cbd5e1;
  font-size: 12px;
}

@keyframes chartFadeIn {
  to {
    opacity: 1;
  }
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  background: var(--surface);
}

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

th {
  position: sticky;
  top: 0;
  background: #f1f5f9;
  color: #334155;
  font-weight: 900;
  z-index: 1;
}

tbody tr:hover {
  background: #f8fafc;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #e7f8ef;
  color: #0b7a45;
  font-weight: 900;
  font-size: 12px;
}

.badge.warn {
  background: #fff4db;
  color: #975a16;
}

.badge.red {
  background: #ffe7e5;
  color: #b91c1c;
}

.badge.cyan {
  background: #e5fbf8;
  color: #0f766e;
}

.badge.blue {
  background: #e8f0ff;
  color: #1d4ed8;
}

.split-list {
  display: grid;
  gap: 8px;
}

.list-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(86px, auto);
  gap: 16px;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

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

.list-row > div {
  min-width: 0;
}

.list-row strong {
  display: block;
  color: #10284b;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-row > span {
  color: #10284b;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  text-align: right;
  white-space: nowrap;
}

.list-row small {
  color: var(--muted);
  display: block;
  font-size: 11px;
  font-weight: 800;
  margin-top: 2px;
}

.bar-track {
  height: 8px;
  background: #edf2f7;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 7px;
  position: relative;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--teal), #20b970);
  border-radius: inherit;
  transition: width 420ms cubic-bezier(0.16, 1, 0.3, 1);
}

.heatmap {
  display: grid;
  grid-template-columns: minmax(96px, 110px) repeat(var(--heatmap-cols), minmax(48px, 1fr));
  gap: 5px;
  overflow-x: auto;
  padding: 4px 2px 2px;
  min-width: 0;
}

.heatmap-day,
.heatmap-label,
.heatmap-cell {
  align-items: center;
  border-radius: 6px;
  display: flex;
  min-height: 34px;
}

.heatmap-day {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 900;
  justify-content: center;
  text-transform: uppercase;
}

.heatmap-label {
  color: #10284b;
  font-size: 12px;
  font-weight: 800;
  min-width: 0;
  overflow: hidden;
  padding-right: 6px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.heatmap-cell {
  background: rgba(220, 38, 38, var(--heat));
  border: 1px solid rgba(220, 38, 38, 0.12);
  color: #10284b;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  justify-content: center;
  padding: 0 4px;
  transition: transform 160ms ease, box-shadow 160ms ease;
  white-space: nowrap;
}

.heatmap-cell.hot {
  color: #ffffff;
}

.heatmap-cell:hover {
  box-shadow: 0 12px 22px rgba(15, 23, 42, 0.14);
  transform: translateY(-1px);
}

.alert-list {
  display: grid;
  gap: 10px;
}

.alert-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.alert-item strong {
  display: block;
  font-size: 13px;
  color: var(--ink);
  font-weight: 800;
  margin-bottom: 2px;
  line-height: 1.3;
}

.alert-item > div span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.alert-time {
  align-self: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.alert-icon {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #ffffff;
  font-weight: 900;
  line-height: 1;
  flex-shrink: 0;
}

.alert-icon.red {
  background: var(--red);
}

.alert-icon.amber {
  background: var(--amber);
}

.alert-icon.blue {
  background: var(--blue);
}

.alert-item strong,
.alert-item span {
  display: block;
}

.alert-item strong {
  font-size: 13px;
}

.alert-item span,
.alert-time {
  color: var(--muted);
  font-size: 12px;
}

.quick-actions {
  display: grid;
  gap: 10px;
}

.quick-button {
  width: 100%;
  color: #ffffff;
  min-height: 46px;
  text-align: center;
}

.quick-button.blue {
  background: var(--rail);
}

.quick-button.teal {
  background: var(--teal);
}

.quick-button.purple {
  background: var(--purple);
}

.quick-button.orange {
  background: var(--orange);
}

.status-pill {
  color: #b91c1c;
  background: #fee2e2;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 900;
}

.status-pill.green {
  color: #047857;
  background: #dcfce7;
}

.status-pill.amber {
  color: #9a5b00;
  background: #fef3c7;
}

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

.row-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  white-space: nowrap;
}

.table-action {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--rail);
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  min-height: 28px;
  padding: 4px 8px;
}

.table-action.green {
  color: #047857;
  border-color: #a7f3d0;
}

.table-action.red {
  color: #b91c1c;
  border-color: #fecaca;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
  gap: 16px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.detail-item,
.comment-box,
.indicator-card,
.export-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
}

.detail-item span,
.indicator-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 4px;
}

.detail-item strong {
  color: #10284b;
}

.comment-box {
  color: #334155;
  line-height: 1.5;
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline-item {
  border-left: 3px solid var(--blue);
  padding: 8px 0 8px 12px;
}

.timeline-item strong,
.timeline-item span {
  display: block;
}

.timeline-item span,
.timeline-item p {
  color: var(--muted);
  font-size: 12px;
}

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

.indicator-card strong {
  display: block;
  color: #0f2d55;
  font-size: 24px;
  margin-bottom: 8px;
}

.indicator-card p,
.export-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.export-card {
  display: grid;
  gap: 10px;
}

.switch {
  border: 0;
  border-radius: 999px;
  min-width: 70px;
  min-height: 28px;
  padding: 4px 10px;
  background: #fee2e2;
  color: #b91c1c;
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
}

.switch.is-on {
  background: #dcfce7;
  color: #047857;
}

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

.form-grid .wide {
  grid-column: span 2;
}

.form-grid .full {
  grid-column: 1 / -1;
}

.status-line {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 0;
}

.formula-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 16px;
}

.formula-search {
  margin-bottom: 10px;
}

.formula-code {
  font-family: Consolas, "Courier New", monospace;
  color: #303733;
  word-break: break-word;
}

.pill-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 800;
}

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

.requirement {
  border-left: 4px solid var(--teal);
  background: var(--surface);
  border-radius: 8px;
  padding: 14px;
  box-shadow: var(--shadow);
}

.requirement strong {
  display: block;
  margin-bottom: 6px;
}

.requirement p {
  margin-bottom: 0;
  color: var(--muted);
}

.empty-state {
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
}

@media (max-width: 1320px) {
  .dashboard-kpis {
    grid-template-columns: repeat(3, minmax(170px, 1fr));
  }
}

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

  .sidebar {
    position: static;
    height: auto;
  }

  .nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .nav-section-title {
    grid-column: 1 / -1;
  }

  .metric-grid,
  .filters,
  .process-context,
  .three-col,
  .requirement-grid,
  .formula-layout,
  .two-col,
  .detail-layout,
  .indicator-grid,
  .export-grid,
  .donut-layout {
    grid-template-columns: 1fr;
  }

  .toolbar .actions {
    justify-content: flex-start;
  }

  .process-flow {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .process-actions {
    justify-items: start;
  }
}

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

  .topbar {
    margin: 0 -14px 14px;
    padding: 12px 14px;
    display: grid;
  }

  .topbar-right,
  .panel-head {
    display: grid;
  }

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

  .metric-grid,
  .dashboard-kpis,
  .form-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .form-grid .wide,
  .form-grid .full {
    grid-column: auto;
  }

  .user-chip {
    width: 100%;
  }

  h1 {
    font-size: 24px;
  }
}

/* ===== Command Center hero ===== */

.command-hero {
  position: relative;
  background:
    radial-gradient(600px 240px at 95% 0%, rgba(55, 201, 139, 0.20), transparent 60%),
    radial-gradient(700px 280px at 0% 100%, rgba(29, 111, 199, 0.22), transparent 60%),
    linear-gradient(135deg, #061f3f 0%, #0b315f 60%, #0f4179 100%);
  color: #ffffff;
  border-radius: 14px;
  padding: 22px 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 22px;
  align-items: stretch;
  box-shadow: 0 16px 40px rgba(7, 28, 56, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

@media (min-width: 1280px) {
  .command-hero {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.25fr);
    gap: 28px;
    align-items: center;
  }
}

.command-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.02) 0 1px, transparent 1px 48px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.02) 0 1px, transparent 1px 48px);
  pointer-events: none;
}

.command-hero > * {
  position: relative;
  z-index: 1;
}

.hero-greeting {
  min-width: 0;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--signal);
  padding: 4px 10px;
  background: rgba(55, 201, 139, 0.14);
  border: 1px solid rgba(55, 201, 139, 0.35);
  border-radius: 999px;
}

.hero-greeting h2 {
  color: #ffffff;
  font-size: 22px;
  font-weight: 800;
  margin: 12px 0 6px;
}

.hero-greeting p {
  color: #c4d6ee;
  font-size: 13px;
  margin: 0 0 14px;
}

.hero-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 700;
  color: #d8e4f4;
}

.meta-pill strong {
  color: #ffffff;
  font-weight: 900;
}

.meta-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--signal);
  box-shadow: 0 0 0 2px rgba(55, 201, 139, 0.18);
}

.meta-pill .dot.dot-warn {
  background: var(--gold);
  box-shadow: 0 0 0 2px rgba(212, 167, 44, 0.22);
}

.meta-pill .dot.dot-alert {
  background: var(--red);
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.22);
}

.hero-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
}

@media (min-width: 720px) {
  .hero-kpis {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 1280px) and (max-width: 1500px) {
  .hero-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.hero-kpi {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 14px 16px;
  display: grid;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
}

.hero-kpi-label {
  font-size: 11px;
  font-weight: 800;
  color: #a7bcd9;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hero-kpi-value {
  font-size: 22px;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.hero-kpi-value.tone-ok { color: var(--signal); }
.hero-kpi-value.tone-warn { color: var(--gold); }
.hero-kpi-value.tone-alert { color: #ff6968; }

.hero-kpi-trend {
  font-size: 11px;
  color: #95acca;
  font-weight: 700;
  line-height: 1.3;
}

.hero-kpi-trend.up { color: var(--signal); }
.hero-kpi-trend.down { color: #ff8a86; }

/* ===== Action queue ===== */

.action-queue-panel {
  display: grid;
  gap: 14px;
}

.action-queue {
  display: grid;
  gap: 10px;
}

.action-item {
  display: grid;
  grid-template-columns: 6px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: background 140ms, border-color 140ms, transform 140ms;
}

.action-item:hover {
  background: var(--surface);
  border-color: var(--line-2);
  transform: translateX(2px);
}

.action-marker {
  width: 6px;
  align-self: stretch;
  border-radius: 4px;
  background: var(--line-2);
}

.action-item.priority-high .action-marker { background: var(--red); }
.action-item.priority-med .action-marker { background: var(--amber); }
.action-item.priority-low .action-marker { background: var(--rail-3); }

.action-body strong {
  display: block;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 800;
  margin-bottom: 2px;
}

.action-body p {
  color: var(--muted);
  font-size: 12.5px;
  margin: 0;
}

.action-cta {
  background: var(--rail);
  color: #ffffff;
  border: 0;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: background 140ms, transform 140ms;
}

.action-cta:hover {
  background: var(--rail-2);
  transform: translateY(-1px);
}

/* ===== Segmented control ===== */

.segmented-control {
  display: inline-flex;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 4px;
  gap: 2px;
}

.segment {
  background: transparent;
  border: 0;
  padding: 7px 14px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  transition: background 140ms, color 140ms;
}

.segment:hover {
  color: var(--ink);
}

.segment.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 2px 6px rgba(13, 25, 48, 0.08);
}


@media (max-width: 1050px) {
  .topbar {
    grid-template-columns: 1fr;
  }
  .topbar-right {
    justify-content: flex-start;
  }
}

/* ===== Workflow banner (Trains → Silos → Circuits → Navires) ===== */

.workflow-banner {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr;
  align-items: stretch;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 6px;
  margin-bottom: 18px;
}

.workflow-step-banner {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid transparent;
  min-width: 0;
}

.workflow-step-banner.is-active {
  background: linear-gradient(135deg, rgba(11, 49, 95, 0.06), rgba(55, 201, 139, 0.08));
  border-color: rgba(11, 49, 95, 0.2);
  box-shadow: 0 4px 12px rgba(13, 25, 48, 0.06);
}

.banner-step-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--rail-2);
  color: #ffffff;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 13px;
  flex-shrink: 0;
}

.workflow-step-banner.is-active .banner-step-icon {
  background: var(--signal);
  color: #061f3f;
}

.workflow-step-banner > div strong {
  display: block;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 800;
}

.workflow-step-banner > div span {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
  margin-top: 2px;
}

.banner-arrow {
  align-self: center;
  font-size: 22px;
  color: var(--muted-2);
  font-weight: 300;
  padding: 0 4px;
}

/* ===== Circuit status grid (Command Center) ===== */

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

.circuit-card {
  border: 1px solid var(--line);
  border-left: 4px solid var(--circuit-color, var(--rail-2));
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: grid;
  gap: 12px;
  box-shadow: var(--shadow);
  transition: transform 140ms, box-shadow 140ms;
}

.circuit-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-strong);
}

.circuit-card header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.circuit-id {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.circuit-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.circuit-id strong {
  display: block;
  font-size: 17px;
  color: var(--ink);
  font-weight: 900;
  letter-spacing: 0.04em;
}

.circuit-id span {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
}

.circuit-status {
  font-size: 10.5px;
  font-weight: 900;
  padding: 4px 9px;
  border-radius: 999px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.circuit-status.running {
  background: rgba(26, 168, 114, 0.12);
  color: var(--green);
  border: 1px solid rgba(26, 168, 114, 0.32);
}

.circuit-status.stopped {
  background: rgba(220, 38, 38, 0.12);
  color: var(--red);
  border: 1px solid rgba(220, 38, 38, 0.3);
}

.circuit-kpi {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.circuit-kpi div {
  display: grid;
  gap: 2px;
}

.circuit-kpi span {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.circuit-kpi strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
}

.circuit-card footer {
  display: grid;
  gap: 4px;
  font-size: 11.5px;
  color: var(--muted);
}

.circuit-card footer strong {
  color: var(--ink);
  font-weight: 800;
}

/* ===== Silo cards (Stocks view) ===== */

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

.silo-card {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
}

.silo-card header {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.silo-label {
  display: block;
  font-size: 18px;
  font-weight: 900;
  color: var(--ink);
}

.silo-card header p {
  color: var(--muted);
  font-size: 12px;
  margin: 4px 0 0;
}

.silo-tonnage {
  font-size: 22px;
  font-weight: 900;
  color: var(--rail-3);
}

.silo-card.tone-high .silo-tonnage { color: var(--green); }
.silo-card.tone-mid .silo-tonnage { color: var(--rail-3); }
.silo-card.tone-low .silo-tonnage { color: var(--amber); }

.silo-visual {
  grid-column: 2;
  grid-row: 2;
  display: grid;
  place-items: center;
}

.silo-cylinder {
  width: 90px;
  height: 130px;
  background: linear-gradient(180deg, rgba(11, 49, 95, 0.05), rgba(11, 49, 95, 0.12));
  border: 2px solid var(--line-2);
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  position: relative;
  overflow: hidden;
  box-shadow: inset 2px 0 4px rgba(0, 0, 0, 0.06);
}

.silo-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(180deg, rgba(55, 201, 139, 0.85), rgba(26, 168, 114, 0.95));
  transition: height 600ms;
}

.silo-card.tone-low .silo-fill {
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.85), rgba(234, 118, 33, 0.95));
}

.silo-card.tone-mid .silo-fill {
  background: linear-gradient(180deg, rgba(29, 111, 199, 0.85), rgba(11, 49, 95, 0.95));
}

.silo-percent {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-weight: 900;
  color: var(--ink);
  font-size: 14px;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}

.silo-card footer {
  grid-column: 1;
  grid-row: 2;
  display: grid;
  gap: 8px;
  align-content: start;
}

.silo-flow {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.flow-label {
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.flow-label.in::before { content: "↓ "; color: var(--green); }
.flow-label.out::before { content: "↑ "; color: var(--amber); }

.silo-flow strong {
  font-size: 14px;
  color: var(--ink);
  font-weight: 900;
}

.silo-qualities {
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
}

.silo-qualities span {
  display: inline-block;
  padding: 2px 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  margin-right: 4px;
  margin-top: 4px;
}

/* Quality flow rows */

.quality-flow {
  display: grid;
  gap: 6px;
}

.quality-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 200px;
  gap: 12px;
  align-items: center;
  padding: 8px 4px;
  border-bottom: 1px dashed var(--line);
}

.quality-tag {
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 8px;
  font-weight: 800;
  font-size: 12px;
  color: var(--rail-3);
  text-align: center;
}

.quality-bars {
  display: grid;
  gap: 3px;
}

.quality-bars .bar-track {
  height: 6px;
  background: var(--surface-3);
  border-radius: 3px;
  overflow: hidden;
}

.quality-bars .bar-track.in .bar-fill { background: linear-gradient(90deg, var(--green), var(--signal-2)); }
.quality-bars .bar-track.out .bar-fill { background: linear-gradient(90deg, var(--amber), var(--orange)); }
.quality-bars .bar-track .bar-fill { height: 100%; }

.quality-values {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.value-in { color: var(--green); }
.value-out { color: var(--amber); }

/* Movement list */

.movement-list {
  display: grid;
  gap: 8px;
}

.movement-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.movement-icon {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-weight: 900;
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
}

.movement-icon.in { background: rgba(26, 168, 114, 0.14); color: var(--green); }
.movement-icon.out { background: rgba(245, 158, 11, 0.14); color: var(--amber); }

.movement-item strong {
  display: block;
  font-size: 13px;
  color: var(--ink);
  font-weight: 800;
}

.movement-tonnage {
  font-weight: 900;
  color: var(--rail-3);
  font-size: 14px;
}

/* ===== Ship cards (active ships) ===== */

.ship-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.ship-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 4px solid var(--rail-3);
  border-radius: 10px;
  padding: 14px 16px;
  display: grid;
  gap: 10px;
}

.ship-card header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.ship-card header strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
}

.ship-status {
  font-size: 10.5px;
  font-weight: 900;
  background: rgba(29, 111, 199, 0.14);
  color: var(--rail-3);
  padding: 3px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ship-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 8px 0;
  border-top: 1px dashed var(--line);
  border-bottom: 1px dashed var(--line);
}

.ship-meta div {
  display: grid;
  gap: 2px;
}

.ship-meta span {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
}

.ship-meta strong {
  font-size: 13px;
  color: var(--ink);
  font-weight: 900;
}

.ship-meta strong.tone-ok { color: var(--green); }
.ship-meta strong.tone-warn { color: var(--amber); }

.ship-last-stop {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}

.ship-last-stop strong { color: var(--red); }

/* ===== Synthèse mensuelle document ===== */

.document-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  background: linear-gradient(135deg, var(--rail) 0%, var(--rail-2) 100%);
  color: #ffffff;
  padding: 20px 24px;
  border-radius: 12px;
  margin-bottom: 18px;
  box-shadow: 0 10px 24px rgba(7, 28, 56, 0.18);
}

.document-header h2 {
  color: #ffffff;
  margin: 6px 0;
}

.document-header p {
  color: rgba(255, 255, 255, 0.72);
  margin: 0;
  font-size: 13px;
}

.doc-ref {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--signal);
}

.synthesis-wrap {
  max-height: 480px;
  overflow: auto;
}

.synthesis-table {
  min-width: 1400px;
  font-size: 11.5px;
}

.synthesis-table th,
.synthesis-table td {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.synthesis-table th.sticky,
.synthesis-table td.sticky {
  position: sticky;
  left: 0;
  text-align: left;
  background: var(--surface);
  z-index: 2;
  border-right: 2px solid var(--line);
}

.synthesis-table thead th {
  background: var(--surface-3);
  font-size: 10.5px;
  white-space: nowrap;
  padding: 8px 6px;
}

.synthesis-table td {
  color: var(--muted);
}

.synthesis-table td.has-value {
  color: var(--ink);
  font-weight: 700;
  background: rgba(29, 111, 199, 0.04);
}

.synthesis-table tr.row-total td {
  background: rgba(11, 49, 95, 0.06);
  border-top: 2px solid var(--rail-2);
  color: var(--ink);
}

.synthesis-table tr.row-percent td {
  background: rgba(245, 158, 11, 0.05);
  color: var(--steel);
  font-size: 11px;
}

.synthesis-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 8px;
}

.synth-kpi {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}

.synth-kpi span {
  display: block;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.synth-kpi strong {
  display: block;
  font-size: 17px;
  color: var(--ink);
  font-weight: 900;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

/* ===== Entry view ===== */

.entry-context {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  align-items: center;
  gap: 18px;
}

.entry-context-head h2 {
  margin: 8px 0;
}

.entry-context-head p {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
  max-width: 70ch;
}

.entry-context-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.entry-context-meta .meta-pill {
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--line);
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.template-card {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: background 140ms, border-color 140ms, transform 140ms;
}

.template-card:hover {
  background: var(--surface);
  border-color: var(--rail-3);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.template-family {
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--rail-3);
}

.template-card.scope-global .template-family { color: var(--red); }
.template-card.scope-circuit .template-family { color: var(--rail-3); }
.template-card.scope-ship .template-family { color: var(--purple); }
.template-card.scope-stock .template-family { color: var(--amber); }

.template-card strong {
  font-size: 13px;
  color: var(--ink);
  font-weight: 800;
  line-height: 1.3;
}

.template-meta {
  font-size: 11px;
  color: var(--muted);
}

.entry-form {
  display: grid;
  gap: 16px;
}

.entry-circuits {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  background: var(--surface-2);
}

.entry-circuits legend {
  font-size: 11.5px;
  font-weight: 900;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0 6px;
}

.entry-circuits legend em {
  font-style: normal;
  color: var(--muted);
  font-weight: 600;
  text-transform: none;
}

.circuit-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 6px 0;
}

.circuit-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px 7px 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  font-weight: 800;
  font-size: 12.5px;
  color: var(--muted);
  transition: background 140ms, border-color 140ms, color 140ms;
}

.circuit-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-mark {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: var(--surface-3);
  border: 2px solid var(--line-2);
  display: grid;
  place-items: center;
}

.circuit-toggle input:checked ~ .toggle-mark {
  background: var(--circuit-color, var(--rail-2));
  border-color: var(--circuit-color, var(--rail-2));
}

.circuit-toggle input:checked ~ .toggle-mark::after {
  content: "✓";
  color: #ffffff;
  font-size: 10px;
  font-weight: 900;
}

.circuit-toggle input:checked ~ .toggle-label {
  color: var(--ink);
}

.circuit-toggle:hover {
  border-color: var(--circuit-color, var(--line-2));
  color: var(--ink);
}

.circuit-toggle.is-discharge .toggle-mark {
  border-style: dashed;
}

.entry-helper {
  font-size: 11.5px;
  color: var(--muted);
  margin: 4px 0 0;
}

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

.entry-grid .full {
  grid-column: 1 / -1;
}

.entry-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dot.dot-responsable { background: #0b315f; }
.dot.dot-superviseur { background: #7558e0; }
.dot.dot-chef { background: #0f766e; }
.dot.dot-agent { background: #1d4ed8; }
.dot.dot-admin { background: #dc2626; }

@media (max-width: 1320px) {
  .circuit-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1050px) {
  .workflow-banner {
    grid-template-columns: 1fr;
  }
  .banner-arrow {
    transform: rotate(90deg);
    align-self: center;
    justify-self: center;
    padding: 4px 0;
  }
  .silo-grid {
    grid-template-columns: 1fr;
  }
  .entry-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .entry-context {
    grid-template-columns: 1fr;
  }
}

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

/* ===== Period bar (continuous KPI engine) ===== */

.period-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  flex-wrap: wrap;
}

.period-bar-left,
.period-bar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.period-bar-label {
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.period-toggle {
  padding: 3px;
}

.period-toggle .segment {
  padding: 6px 12px;
  font-size: 11.5px;
}

.period-summary {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 600;
}

.period-summary strong {
  color: var(--ink);
  font-weight: 800;
}

.period-custom {
  min-width: 130px;
}

.period-date {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.period-date input {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 900;
  padding: 6px 10px;
}

.calc-mode {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.calc-mode-label {
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.calc-mode-toggle { padding: 3px; }
.calc-mode-toggle .segment { font-size: 11.5px; padding: 6px 12px; }

.data-quality-panel {
  border-top: 2px solid var(--signal-2);
}

.quality-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.quality-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  display: grid;
  gap: 4px;
}

.quality-card.tone-ok { border-left: 4px solid var(--green); background: rgba(26, 168, 114, 0.04); }
.quality-card.tone-warn { border-left: 4px solid var(--amber); background: rgba(245, 158, 11, 0.04); }
.quality-card.tone-alert { border-left: 4px solid var(--red); background: rgba(220, 38, 38, 0.04); }

.quality-card span {
  font-size: 11px;
  color: var(--muted);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.quality-card strong {
  font-size: 22px;
  color: var(--ink);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  margin: 4px 0;
}

.quality-card.tone-ok strong { color: var(--green); }
.quality-card.tone-warn strong { color: var(--amber); }
.quality-card.tone-alert strong { color: var(--red); }

.quality-card em {
  font-style: normal;
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 500;
}

.quality-details {
  margin-top: 12px;
  border-top: 1px dashed var(--line);
  padding-top: 12px;
}

.quality-details summary {
  cursor: pointer;
  font-weight: 800;
  font-size: 13px;
  color: var(--rail-3);
  padding: 6px 0;
  list-style: none;
}

.quality-details summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 6px;
  transition: transform 140ms;
}

.quality-details[open] summary::before { transform: rotate(90deg); }

.reconciliation-legend {
  display: inline-flex;
  gap: 14px;
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 700;
}

.reconciliation-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.reconciliation-legend .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.reconciliation-legend .dot.ok { background: var(--green); }
.reconciliation-legend .dot.warn { background: var(--amber); }
.reconciliation-legend .dot.alert { background: var(--red); }
.reconciliation-legend .dot.muted { background: var(--muted-2); }

.recon-row.tone-ok td:first-child { border-left: 3px solid var(--green); }
.recon-row.tone-warn td:first-child { border-left: 3px solid var(--amber); }
.recon-row.tone-alert td:first-child { border-left: 3px solid var(--red); }
.recon-row.tone-muted td:first-child { border-left: 3px solid var(--muted-2); }

.formula-doc {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 10px;
}

.formula-doc-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  display: grid;
  gap: 6px;
}

.formula-doc-card header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.formula-doc-card strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.formula-doc-card code {
  display: block;
  font-family: "SFMono-Regular", "Menlo", monospace;
  font-size: 11.5px;
  color: var(--rail-3);
  background: var(--surface);
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  white-space: pre-wrap;
  word-break: break-word;
}

.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(26, 168, 114, 0.08);
  border: 1px solid rgba(26, 168, 114, 0.3);
  color: var(--green);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 11.5px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transition: background 240ms, transform 240ms;
}

.live-indicator .live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(26, 168, 114, 0.5);
  animation: pulse-dot 2.2s infinite;
}

.live-indicator.pulsing {
  background: rgba(26, 168, 114, 0.18);
  transform: scale(1.04);
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.28);
  color: var(--red);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.live-badge .live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.5);
  animation: pulse-dot 1.6s infinite;
}

/* ===== Live feed panel ===== */

.live-feed {
  display: grid;
  gap: 8px;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 6px;
  scrollbar-width: thin;
}

.live-feed-item {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 11px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--rail-3);
  border-radius: 8px;
  transition: transform 140ms, box-shadow 140ms;
}

.live-feed-item:hover {
  transform: translateX(2px);
  box-shadow: var(--shadow);
}

.live-feed-time {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-top: 2px;
}

.live-feed-body {
  min-width: 0;
}

.live-feed-body strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.live-feed-body p {
  color: var(--muted);
  font-size: 12px;
  margin: 4px 0 6px;
}

.live-feed-meta {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  align-items: center;
}

.live-feed-meta .badge {
  font-size: 10.5px;
  padding: 2px 7px;
}

.badge.ok { background: rgba(26, 168, 114, 0.14); color: var(--green); }
.badge.alert { background: rgba(220, 38, 38, 0.14); color: var(--red); }
.badge.warn { background: rgba(245, 158, 11, 0.16); color: var(--amber); }

/* ===== Pace tracker ===== */

.pace-tracker {
  display: grid;
  gap: 14px;
}

.pace-row {
  display: grid;
  gap: 6px;
}

.pace-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 700;
}

.pace-label strong {
  color: var(--ink);
  font-weight: 900;
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}

.pace-bar {
  height: 8px;
  background: var(--surface-3);
  border-radius: 4px;
  overflow: hidden;
}

.pace-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--rail-3), var(--rail-glow));
}

.pace-fill.pace-budget.tone-ok { background: linear-gradient(90deg, var(--signal-2), var(--green)); }
.pace-fill.pace-budget.tone-warn { background: linear-gradient(90deg, var(--amber), var(--orange)); }
.pace-fill.pace-budget.tone-alert { background: linear-gradient(90deg, #ef4444, var(--red)); }

.pace-projection {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.pace-projection div {
  display: grid;
  gap: 2px;
}

.pace-projection span {
  font-size: 10.5px;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.pace-projection strong {
  font-size: 14px;
  color: var(--ink);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.tone-ok { color: var(--green); }
.tone-warn { color: var(--amber); }
.tone-alert { color: var(--red); }

/* ===== Equipment ranking ===== */

.equipment-ranking {
  display: grid;
  gap: 6px;
}

.equipment-rank-row {
  display: grid;
  grid-template-columns: 28px minmax(220px, 1.4fr) minmax(180px, 1.2fr) auto;
  gap: 14px;
  align-items: center;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.equipment-rank-row.tone-alert {
  border-left: 3px solid var(--red);
  background: rgba(220, 38, 38, 0.04);
}

.equipment-rank-row.tone-warn {
  border-left: 3px solid var(--amber);
  background: rgba(245, 158, 11, 0.04);
}

.equipment-rank-row.tone-ok {
  border-left: 3px solid var(--green);
}

.rank-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 50%;
  background: var(--rail);
  color: #ffffff;
  font-weight: 900;
  font-size: 12px;
  line-height: 1;
  flex-shrink: 0;
}

.equipment-rank-row.tone-alert .rank-index { background: var(--red); }
.equipment-rank-row.tone-warn .rank-index { background: var(--amber); }
.equipment-rank-row.tone-ok .rank-index { background: var(--green); }

.rank-body strong {
  display: block;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 900;
}

.rank-body .status-line {
  font-size: 11.5px;
  margin: 2px 0 0;
}

.rank-body em {
  font-style: normal;
  font-weight: 800;
  color: var(--rail-3);
}

.rank-bar {
  height: 6px;
  background: var(--surface-3);
  border-radius: 3px;
  overflow: hidden;
}

.rank-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--rail-3), var(--rail-glow));
}

.equipment-rank-row.tone-alert .rank-fill { background: linear-gradient(90deg, #ef4444, var(--red)); }
.equipment-rank-row.tone-warn .rank-fill { background: linear-gradient(90deg, var(--amber), var(--orange)); }

.rank-values {
  display: grid;
  gap: 2px;
  text-align: right;
}

.rank-time {
  font-weight: 900;
  font-size: 14px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.rank-avail {
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
}

/* ===== Impact preview (entry form) ===== */

.impact-preview {
  background: linear-gradient(135deg, rgba(11, 49, 95, 0.06), rgba(55, 201, 139, 0.06));
  border: 1px solid var(--line);
  border-left: 4px solid var(--rail-3);
  border-radius: 10px;
  padding: 14px 16px;
  display: grid;
  gap: 10px;
}

.impact-title {
  font-size: 11.5px;
  font-weight: 900;
  text-transform: uppercase;
  color: var(--rail-3);
  letter-spacing: 0.06em;
}

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

.impact-grid div {
  display: grid;
  gap: 2px;
}

.impact-grid span {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.impact-grid strong {
  font-size: 16px;
  color: var(--ink);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.impact-note {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}

.meta-pill.projection {
  background: rgba(245, 158, 11, 0.16);
  border-color: rgba(245, 158, 11, 0.36);
  color: var(--amber);
}

.meta-pill.projection.green {
  background: rgba(26, 168, 114, 0.14);
  border-color: rgba(26, 168, 114, 0.34);
  color: var(--green);
}

.meta-pill.projection.warn {
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.34);
  color: var(--amber);
}

.meta-pill.projection.red {
  background: rgba(220, 38, 38, 0.14);
  border-color: rgba(220, 38, 38, 0.34);
  color: var(--red);
}

@media (max-width: 1050px) {
  .impact-grid,
  .pace-projection {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .equipment-rank-row {
    grid-template-columns: 28px minmax(0, 1fr);
    grid-template-rows: auto auto auto;
  }
  .rank-bar, .rank-values { grid-column: 1 / -1; }
}

/* ===== Login screen ===== */

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 18px;
  background:
    radial-gradient(900px 600px at 100% -10%, rgba(55, 201, 139, 0.14), transparent 60%),
    radial-gradient(900px 600px at -10% 110%, rgba(29, 111, 199, 0.18), transparent 60%),
    linear-gradient(180deg, #061f3f 0%, #0a2c52 60%, #04162e 100%);
  color: #ffffff;
}

.login-card {
  width: min(960px, 100%);
  background: rgba(11, 31, 60, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.38);
  padding: 28px;
  display: grid;
  gap: 24px;
  backdrop-filter: blur(20px);
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 56px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 56px);
  pointer-events: none;
}

.login-card > * { position: relative; z-index: 1; }

.login-header {
  display: grid;
  gap: 14px;
}

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

.login-mark {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.42);
  overflow: hidden;
  flex-shrink: 0;
}

.login-mark img,
.login-mark svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.login-brand strong {
  display: block;
  font-size: 20px;
  letter-spacing: 0.05em;
  color: #ffffff;
}

.login-brand span {
  display: block;
  color: #93b1d5;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 3px;
}

.login-tagline {
  color: #b4c9e6;
  font-size: 13px;
  margin: 0;
}

.login-body {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(0, 1.4fr);
  gap: 28px;
  align-items: start;
}

.login-illustration {
  display: grid;
  gap: 10px;
  text-align: left;
  align-content: start;
}

.login-person {
  width: 86px;
  height: 86px;
  color: var(--signal);
  margin-bottom: 8px;
  background: rgba(55, 201, 139, 0.08);
  border-radius: 50%;
  padding: 8px;
  box-sizing: border-box;
  border: 1px solid rgba(55, 201, 139, 0.32);
}

.login-illustration h2 {
  color: #ffffff;
  font-size: 20px;
  margin: 4px 0 6px;
}

.login-illustration p {
  color: #a7bcd9;
  font-size: 13px;
  margin: 0;
  line-height: 1.5;
}

.login-roles {
  display: grid;
  gap: 8px;
}

.role-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: #ffffff;
  transition: background 160ms, border-color 160ms, transform 160ms;
}

.role-card:hover {
  background: rgba(55, 201, 139, 0.08);
  border-color: rgba(55, 201, 139, 0.35);
  transform: translateX(2px);
}

.role-avatar {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #ffffff;
  font-weight: 900;
  font-size: 13px;
  line-height: 1;
  flex-shrink: 0;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35);
}

.role-body strong {
  display: block;
  font-size: 14px;
  color: #ffffff;
  font-weight: 800;
}

.role-body span {
  display: block;
  font-size: 12px;
  color: #b4c9e6;
  margin-top: 1px;
}

.role-body p {
  margin: 4px 0 0;
  font-size: 11.5px;
  color: #93b1d5;
  line-height: 1.45;
}

.role-arrow {
  color: var(--signal);
  font-weight: 900;
  font-size: 18px;
}

.login-footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  color: #93b1d5;
  font-size: 11.5px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.login-footer strong {
  color: #ffffff;
  font-weight: 800;
}

@media (max-width: 760px) {
  .login-body {
    grid-template-columns: 1fr;
  }
  .login-illustration {
    text-align: center;
    place-items: center;
  }
}

/* ===== Month / range picker ===== */

.month-picker {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--ink);
  font-family: inherit;
  min-height: 34px;
  cursor: pointer;
}

.range-picker {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.range-picker[hidden],
.month-picker[hidden] {
  display: none !important;
}

.range-picker label {
  font-size: 10.5px;
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.range-picker input {
  margin-left: 4px;
  min-height: 32px;
  padding: 4px 8px;
}

/* ===== Empty states ===== */

.empty-state-card {
  display: grid;
  place-items: center;
  padding: 56px 24px;
  gap: 14px;
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--line-2);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  background: var(--surface-3);
  border-radius: 50%;
  color: var(--rail-3);
}

.empty-state-icon svg {
  width: 32px;
  height: 32px;
}

.empty-state-card strong {
  font-size: 17px;
  color: var(--ink);
  font-weight: 800;
}

.empty-state-card p {
  color: var(--muted);
  font-size: 13.5px;
  margin: 0;
  max-width: 56ch;
  line-height: 1.55;
}

.empty-inline {
  padding: 24px 12px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  background: var(--surface-2);
  border-radius: 8px;
  border: 1px dashed var(--line-2);
}

/* ===== Workflow banner step circle fix ===== */

.workflow-step-banner .banner-step-icon,
.banner-step-icon {
  width: 32px;
  height: 32px;
  min-width: 32px;
  max-height: 32px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--rail-2);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 13px;
  line-height: 1;
  text-align: center;
  margin: 0;
  padding: 0;
}

/* ===== User menu polish ===== */

.user-menu-section {
  display: block;
  padding: 6px 10px;
  font-size: 10.5px;
  color: var(--muted);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.user-menu-divider {
  height: 1px;
  background: var(--line);
  margin: 6px 0;
}

.user-menu-logout {
  color: var(--red);
}

.user-menu-logout strong {
  color: var(--red) !important;
}

/* ===== Data table polish (alignment, sticky, responsive) ===== */

table.data-table {
  min-width: auto;
}

table.data-table th,
table.data-table td {
  vertical-align: middle;
  white-space: nowrap;
}

table.data-table td.num,
table.data-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Mobile / tablet: hide table-action button labels except detail in active feed */

.live-feed-item .ghost-button {
  padding: 6px 10px;
}

/* Hide global-date when not used (compatibility) */
#global-date { display: none; }
