/* =============================================================
   Transmodal UI kit — ops dashboard surface
   Layered on top of colors_and_type.css. Tokens come from the
   design system; this file only assembles them into shell layout.
   ============================================================= */

html, body, #root { height: 100%; margin: 0; }

.tm-shell {
  display: grid;
  grid-template-columns: 240px 360px 1fr;
  height: 100vh;
  background: var(--bg);
  color: var(--fg);
}
@media (max-width: 1100px) {
  .tm-shell { grid-template-columns: 72px 320px 1fr; }
  .tm-sidebar__label, .tm-sidebar__user-meta { display: none; }
  .tm-sidebar__brand img { width: 36px; }
}
@media (max-width: 820px) {
  .tm-shell { grid-template-columns: 1fr; grid-template-rows: auto auto 1fr; }
  .tm-sidebar { flex-direction: row; height: auto; padding: var(--space-2) var(--space-3); }
  .tm-sidebar__nav { flex-direction: row; gap: var(--space-1); flex: 1; overflow-x: auto; }
  .tm-sidebar__foot { display: none; }
}

/* ---------- Sidebar ---------- */
.tm-sidebar {
  background: var(--brand-navy-900);
  color: #fff;
  border-right: 1px solid var(--brand-navy-700);
  display: flex;
  flex-direction: column;
  padding: var(--space-5) var(--space-3);
  gap: var(--space-5);
}
.tm-sidebar__brand { padding: 0 var(--space-2) var(--space-3); border-bottom: 1px solid var(--brand-navy-700); }
.tm-sidebar__brand img { width: 140px; height: auto; display: block; }
.tm-sidebar__nav { display: flex; flex-direction: column; gap: 2px; }
.tm-sidebar__item {
  display: flex; align-items: center; gap: var(--space-3);
  padding: 10px 12px;
  background: transparent;
  border: 0;
  color: rgba(255,255,255,0.78);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: var(--font-sans); font-size: var(--type-body-sm); font-weight: 500;
  text-align: left;
  transition: background var(--dur-fast) var(--ease-standard);
}
.tm-sidebar__item:hover { background: var(--brand-navy-800); color: #fff; }
.tm-sidebar__item.is-active {
  background: color-mix(in oklab, var(--brand-blue-600) 26%, transparent);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--brand-blue-500);
}
.tm-sidebar__icon { width: 20px; text-align: center; color: var(--brand-blue-300); }
.tm-sidebar__item.is-active .tm-sidebar__icon { color: var(--accent); }

.tm-sidebar__foot { margin-top: auto; border-top: 1px solid var(--brand-navy-700); padding-top: var(--space-3); }
.tm-sidebar__user { display: flex; gap: var(--space-3); align-items: center; }
.tm-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--brand-blue-600); color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 13px; letter-spacing: 0.03em;
}
.tm-sidebar__user-name { font-weight: 600; font-size: var(--type-body-sm); }
.tm-sidebar__user-role { font-size: var(--type-caption); color: rgba(255,255,255,0.55); text-transform: uppercase; letter-spacing: var(--tracking-caption); }

/* ---------- Shipments rail ---------- */
.tm-list {
  background: var(--brand-navy-800);
  color: #fff;
  border-right: 1px solid var(--brand-navy-700);
  display: flex; flex-direction: column;
  min-width: 0;
}
.tm-list__head {
  padding: var(--space-5) var(--space-4);
  display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-3);
  border-bottom: 1px solid var(--brand-navy-700);
}
.tm-list__head h2 { color: #fff; }
.tm-list__filter { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--brand-navy-700); }
.tm-list__filter .input { background: var(--brand-navy-900); color: #fff; border-color: var(--brand-navy-700); }
.tm-list__filter .input::placeholder { color: rgba(255,255,255,0.45); }
.tm-list__items { list-style: none; margin: 0; padding: var(--space-2); display: grid; gap: 2px; overflow-y: auto; }
.tm-list__item {
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  color: #fff;
  text-align: left;
  font-family: var(--font-sans);
  display: grid; gap: 4px;
  transition: background var(--dur-fast) var(--ease-standard), border-color var(--dur-fast) var(--ease-standard);
}
.tm-list__item:hover { background: color-mix(in oklab, var(--brand-blue-600) 16%, transparent); }
.tm-list__item.is-active { background: color-mix(in oklab, var(--brand-blue-600) 28%, transparent); border-color: var(--brand-blue-500); }
.tm-list__row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.tm-route { font-weight: 600; font-size: var(--type-body-sm); }
.tm-list__row2 { display: flex; justify-content: space-between; font-size: var(--type-mono); font-family: var(--font-mono); color: rgba(255,255,255,0.7); }
.tm-list__row3 { display: flex; justify-content: space-between; font-size: var(--type-body-sm); color: rgba(255,255,255,0.6); }

/* ---------- Detail ---------- */
.tm-detail {
  background: var(--bg);
  color: var(--fg);
  display: grid;
  grid-template-rows: auto auto auto 1fr auto;
  min-width: 0;
}
.tm-detail--empty { place-items: center; padding: var(--space-9); text-align: center; }

.tm-detail__head {
  padding: var(--space-6) var(--space-7);
  display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-5);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.tm-detail__meta { margin-top: var(--space-3); display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; color: var(--muted); }
.tm-detail__actions { display: flex; gap: var(--space-2); }

.tm-detail__kpis {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-4);
  padding: var(--space-5) var(--space-7);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
@media (max-width: 1100px) { .tm-detail__kpis { grid-template-columns: repeat(2, 1fr); } }
.tm-kpi { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-4); display: grid; gap: 4px; }
.tm-kpi .lbl { color: var(--muted); }
.tm-kpi .num { font-size: 28px; font-weight: 700; line-height: 1.1; }
.tm-kpi .num small { color: var(--muted); font-size: 14px; font-weight: 500; }

.tm-stepper {
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 0 var(--space-7);
  margin-top: var(--space-5);
}
.tm-stepper__step { padding: var(--space-3) var(--space-3); border-top: 3px solid var(--border); display: grid; gap: 2px; }
.tm-stepper__step.done { border-color: var(--success); }
.tm-stepper__step.now  { border-color: var(--accent); }
.tm-stepper__step .lbl { color: var(--muted); }
.tm-stepper__step .name { font-weight: 600; font-size: var(--type-body-sm); }

/* ---------- Timeline ---------- */
.tm-timeline { padding: var(--space-6) var(--space-7); overflow-y: auto; }
.tm-timeline h3 { margin: 0 0 var(--space-4); }
.tm-timeline__list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-4); }
.tm-event { display: grid; grid-template-columns: 32px 1fr; gap: var(--space-3); }
.tm-event__gutter { display: grid; grid-template-rows: 16px 1fr; justify-items: center; padding-top: 4px; }
.tm-event__dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--brand-blue-500);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--brand-blue-500) 26%, transparent);
}
.tm-event__dot.tone-success { background: var(--success); box-shadow: 0 0 0 3px color-mix(in oklab, var(--success) 26%, transparent); }
.tm-event__dot.tone-warning { background: var(--warning); box-shadow: 0 0 0 3px color-mix(in oklab, var(--warning) 26%, transparent); }
.tm-event__dot.tone-danger  { background: var(--danger);  box-shadow: 0 0 0 3px color-mix(in oklab, var(--danger)  26%, transparent); }
.tm-event__line { width: 1px; background: var(--border); margin-top: 4px; }
.tm-event__body {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  display: grid; gap: var(--space-2);
  box-shadow: var(--shadow-1);
}
.tm-event.is-system .tm-event__body { background: var(--surface-2); }
.tm-event__head { display: flex; align-items: baseline; gap: var(--space-3); flex-wrap: wrap; }
.tm-event__author { font-weight: 600; }
.tm-event__role  { color: var(--muted); }
.tm-event__time  { color: var(--muted); margin-left: auto; }
.tm-event__text  { font-size: var(--type-body); line-height: 1.55; }
.tm-event__attach {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-md);
}

/* ---------- Composer (QuickActionBar) ---------- */
.tm-detail__foot { padding: var(--space-4) var(--space-7) var(--space-6); border-top: 1px solid var(--border); background: var(--surface); }
.tm-composer { display: grid; gap: var(--space-3); }
.tm-composer__row { display: grid; grid-template-columns: 44px 1fr; gap: var(--space-2); align-items: stretch; }
.tm-composer__attach {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 18px;
  color: var(--brand-blue-600);
  cursor: pointer;
}
.tm-composer__field {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--fg);
  padding: var(--space-3);
  font: 400 var(--type-body)/1.5 var(--font-sans);
  resize: vertical;
}
.tm-composer__field:focus { outline: 2px solid var(--brand-blue-500); outline-offset: 2px; border-color: var(--brand-blue-500); }
.tm-composer__foot { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.tm-composer__quick { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.tm-composer__send { display: flex; align-items: center; gap: var(--space-3); }
