:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #111827;
  background: #f5f7fa;
}

* { box-sizing: border-box; }
body { margin: 0; }
a { color: inherit; text-decoration: none; }

.tom-body { min-height: 100vh; background: #f5f7fa; }
.tom-shell { display: flex; min-height: 100vh; }
.tom-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: 270px;
  border-right: 1px solid #e5e7eb;
  background: #fff;
}

.tom-brand {
  display: flex;
  align-items: center;
  height: 70px;
  padding: 0 24px;
  border-bottom: 1px solid #eef0f3;
}

.tom-brand a, .tom-login-brand { display: flex; align-items: center; gap: 12px; }
.tom-brand-mark {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: #fff;
  font-size: 19px;
  font-weight: 800;
  background: #1b84ff;
}

.tom-brand-name { font-size: 18px; font-weight: 750; letter-spacing: .04em; }
.tom-menu { padding: 10px 14px 20px; }
.tom-menu-section { margin-top: 18px; }
.tom-menu-section-title {
  margin: 0 14px 6px;
  color: #9ca3af;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.tom-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 9px;
  color: #4b5563;
  font-size: 14px;
  font-weight: 600;
}

.tom-menu-item:hover, .tom-menu-item.is-active { color: #1b84ff; background: #eff6ff; }
.tom-menu-icon { font-size: 19px; }
.tom-wrapper { display: flex; flex: 1; flex-direction: column; min-width: 0; margin-left: 270px; }
.tom-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  height: 70px;
  padding: 0 30px;
  border-bottom: 1px solid #e5e7eb;
  background: rgb(255 255 255 / 92%);
  backdrop-filter: blur(12px);
}

.tom-header-title { font-weight: 650; }
.tom-user { display: flex; align-items: center; gap: 16px; margin-left: auto; color: #4b5563; font-size: 14px; }
.tom-menu-toggle { display: none; margin-right: 12px; border: 0; background: transparent; font-size: 22px; }
.tom-content { flex: 1; padding: 32px; }
.tom-container { width: 100%; max-width: 1280px; margin: 0 auto; }
.tom-page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.tom-page-heading h1, .tom-login-card h1 { margin: 6px 0; font-size: clamp(28px, 4vw, 42px); line-height: 1.1; }
.tom-page-heading p, .tom-login-card p { margin: 0; color: #6b7280; }
.tom-eyebrow { color: #1b84ff !important; font-size: 12px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
.tom-status {
  padding: 8px 12px;
  border: 1px solid #dbeafe;
  border-radius: 999px;
  color: #2563eb;
  font-size: 12px;
  background: #eff6ff;
}

.tom-card, .tom-login-card {
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 8px 30px rgb(17 24 39 / 5%);
}

.tom-card-content { padding: 28px; }
.tom-card-content h2 { margin-top: 0; }
.tom-card-content p { max-width: 760px; color: #6b7280; line-height: 1.7; }
.tom-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  margin-top: 12px;
  padding: 0 18px;
  border: 0;
  border-radius: 9px;
  color: #fff;
  font-weight: 650;
  background: #1b84ff;
  cursor: pointer;
}

.tom-button-compact { min-height: 38px; margin-top: 0; }
.tom-stack { display: grid; gap: 20px; }
.tom-stack > .tom-page-heading { margin-bottom: 8px; }
.tom-section-card { min-width: 0; padding: 24px; overflow-x: auto; }
.tom-section-card > h2:first-child { margin-top: 0; }
.tom-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}
.tom-section-heading h2, .tom-section-heading p { margin: 0; }
.tom-section-heading p { margin-top: 5px; color: #6b7280; }
.tom-empty-state { padding: 28px; color: #6b7280; }
.tom-tabs { display: flex; gap: 6px; border-bottom: 1px solid #dfe3e8; }
.tom-tab { padding: 12px 16px; border-bottom: 3px solid transparent; color: #6b7280; font-weight: 650; }
.tom-tab:hover, .tom-tab.is-active { border-color: #1b84ff; color: #1b84ff; }
.tom-context-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.tom-context-summary span { display: grid; gap: 5px; padding: 16px; border-radius: 10px; background: #eaf3ff; }
.tom-context-summary strong { color: #52606d; font-size: 12px; text-transform: uppercase; }
.tom-notice { padding: 14px 16px; border: 1px solid #fde68a; border-radius: 10px; color: #854d0e; background: #fffbeb; }
.tom-operational-context .tom-section-card > form, .tom-upload-form {
  display: grid;
  gap: 14px;
  max-width: 760px;
  margin-bottom: 22px;
}
.tom-operational-context form label { display: grid; gap: 7px; color: #374151; font-size: 13px; font-weight: 650; }
.tom-operational-context input:not([type="hidden"]),
.tom-operational-context select,
.tom-operational-context textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  font: inherit;
}
.tom-operational-context article { padding: 16px 0; border-bottom: 1px solid #eef0f3; }
.tom-operational-context article:last-child { border-bottom: 0; }
.tom-operational-context article p { max-width: 900px; line-height: 1.55; }
.tom-operational-context .tom-inline-form { display: inline-flex; gap: 8px; align-items: center; margin: 6px 12px 6px 0; }
.tom-state-flow {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  min-width: 650px;
  margin: 30px 0 0;
  padding: 0;
  list-style: none;
}
.tom-state-node { position: relative; display: grid; justify-items: center; gap: 8px; padding: 0 7px; text-align: center; }
.tom-state-node::before {
  position: absolute;
  top: 17px;
  right: 50%;
  left: -50%;
  height: 3px;
  background: #e5e7eb;
  content: '';
}
.tom-state-node:first-child::before { display: none; }
.tom-state-node.is-past::before, .tom-state-node.is-current::before, .tom-state-node.is-allowed::before {
  background: #93c5fd;
}
.tom-state-marker {
  z-index: 1;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 3px solid #e5e7eb;
  border-radius: 50%;
  color: #9ca3af;
  background: #fff;
  font-size: 12px;
  font-weight: 750;
}
.tom-state-node.is-past .tom-state-marker { border-color: #60a5fa; color: #fff; background: #60a5fa; }
.tom-state-node.is-current .tom-state-marker { border-color: #1b84ff; color: #1b84ff; box-shadow: 0 0 0 5px #dbeafe; }
.tom-state-node.is-paused .tom-state-marker { border-color: #8b5cf6; color: #7c3aed; box-shadow: 0 0 0 5px #ede9fe; }
.tom-state-label, .tom-state-control { color: #6b7280; font: inherit; font-size: 13px; font-weight: 650; }
.tom-state-node.is-current .tom-state-label { color: #111827; }
.tom-state-control { padding: 3px 6px; border: 0; color: #1b84ff; background: transparent; cursor: pointer; }
.tom-state-control:hover { text-decoration: underline; }
.tom-state-control:focus-visible { border-radius: 4px; outline: 3px solid #bfdbfe; outline-offset: 2px; }
.tom-state-node small { color: #9ca3af; font-size: 10px; text-transform: uppercase; }
.tom-incident-branch {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  min-width: 650px;
  margin: 4px 0 20px;
}
.tom-incident-line {
  grid-column: var(--incident-column);
  justify-self: center;
  width: 3px;
  height: 28px;
  background: #ddd6fe;
}
.tom-incident-state, .tom-button-incident {
  border: 1px solid #c4b5fd;
  color: #6d28d9;
  background: #f5f3ff;
}
.tom-incident-state { padding: 10px 16px; border-radius: 9px; font-size: 13px; font-weight: 700; }
.tom-incident-state, .tom-incident-branch > .tom-button-incident {
  grid-column: var(--incident-column);
  justify-self: center;
}
.tom-incident-state.is-disabled { border-color: #e5e7eb; color: #9ca3af; background: #f9fafb; }
.tom-button-incident { margin-top: 0; }
.tom-dialog { width: min(92vw, 560px); padding: 0; border: 0; border-radius: 14px; box-shadow: 0 24px 80px rgb(17 24 39 / 28%); }
.tom-dialog::backdrop { background: rgb(17 24 39 / 50%); backdrop-filter: blur(2px); }
.tom-dialog form { display: grid; gap: 16px; max-width: none; margin: 0; padding: 24px; }
.tom-dialog form > p { margin: 0; color: #6b7280; line-height: 1.5; }
.tom-dialog-heading, .tom-dialog-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tom-dialog-heading h3 { margin: 0; }
.tom-dialog-close { padding: 4px 8px; border: 0; color: #6b7280; background: transparent; font-size: 26px; cursor: pointer; }
.tom-dialog-actions { justify-content: flex-end; }
.tom-dialog-actions .tom-button { margin: 0; }
.tom-button-secondary { border: 1px solid #d1d5db; color: #374151; background: #fff; }
.tom-form .tom-check { display: flex; flex-direction: row; align-items: center; gap: 10px; }
.tom-form .tom-check input { width: 18px; height: 18px; }
.tom-help { margin-top: -12px !important; font-size: 13px; }

.tom-link { color: #1b84ff; font-weight: 600; }
.tom-action-icon {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  color: #1b84ff;
  background: #eff6ff;
}
.tom-action-icon:hover { border-color: #93c5fd; background: #dbeafe; }
.tom-action-icon svg { width: 19px; height: 19px; }
.tom-footer { display: flex; justify-content: space-between; padding: 22px 32px; color: #6b7280; font-size: 13px; }
.tom-login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  background: radial-gradient(circle at top left, #e8f2ff, #f5f7fa 45%);
}

.tom-login-card { width: min(100%, 440px); padding: 36px; }
.tom-login-brand { margin-bottom: 34px; }
.tom-login-brand div { display: flex; flex-direction: column; }
.tom-login-brand span:last-child { color: #6b7280; font-size: 12px; }
.tom-login-card form { display: grid; gap: 10px; margin-top: 28px; }
.tom-login-card label { margin-top: 8px; font-size: 13px; font-weight: 650; }
.tom-login-card input {
  width: 100%;
  height: 44px;
  padding: 0 13px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font: inherit;
}

.tom-alert { margin-top: 20px; margin-bottom: 24px; padding: 12px 14px; border: 1px solid #fecaca; border-radius: 8px; color: #b91c1c; background: #fef2f2; }
.tom-alert-success { border-color: #bbf7d0; color: #166534; background: #f0fdf4; }
.tom-narrow { max-width: 760px; }
.tom-filters { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 16px; align-items: end; margin-bottom: 20px; padding: 20px; }
.tom-form { display: grid; gap: 18px; margin-bottom: 20px; padding: 28px; }
.tom-form h2, .tom-form p { margin: 0; }
.tom-form p { color: #6b7280; }
.tom-form label, .tom-filters label { display: grid; gap: 7px; color: #374151; font-size: 13px; font-weight: 650; }
.tom-form input, .tom-form select, .tom-form textarea, .tom-filters input, .tom-filters select {
  width: 100%; height: 42px; padding: 0 12px; border: 1px solid #d1d5db; border-radius: 8px; background: #fff; font: inherit;
}
.tom-form textarea { height: auto; min-height: 130px; padding: 10px 12px; resize: vertical; }
.tom-preserve-lines { white-space: pre-wrap; }
.tom-form .tom-button, .tom-filters .tom-button { margin-top: 0; justify-self: start; }
.tom-table-wrap { overflow-x: auto; }
.tom-table { width: 100%; border-collapse: collapse; }
.tom-table th, .tom-table td { padding: 15px 18px; border-bottom: 1px solid #eef0f3; text-align: left; }
.tom-table th { color: #6b7280; font-size: 12px; text-transform: uppercase; }
.tom-actions { display: flex; gap: 14px; align-items: center; }
.tom-actions form { margin: 0; }
.tom-link-button { padding: 0; border: 0; color: #1b84ff; background: transparent; font: inherit; font-weight: 600; cursor: pointer; }
.tom-badge { display: inline-flex; padding: 5px 9px; border-radius: 999px; color: #6b7280; background: #f3f4f6; font-size: 12px; }
.tom-badge.is-active { color: #166534; background: #dcfce7; }
.tom-pagination { display: flex; gap: 8px; margin-top: 20px; }
.tom-pagination a { padding: 8px 12px; border: 1px solid #d1d5db; border-radius: 7px; background: #fff; }
.tom-pagination a.is-current { border-color: #1b84ff; color: #fff; background: #1b84ff; }
.tom-config-help { margin: 0 0 16px; color: #4b5563; }
.tom-config-help p { margin: 4px 0; }
.tom-config-copy-status { min-height: 20px; color: #1d4ed8; font-size: 13px; font-weight: 650; }
.tom-config-row { display: grid; grid-template-columns: 1.4fr .6fr 1fr 1fr minmax(145px, auto); gap: 14px; align-items: end; margin-bottom: 14px; padding: 18px; }
.tom-config-row > div { display: grid; gap: 4px; }
.tom-config-row > div span { color: #6b7280; font-size: 13px; }
.tom-config-row label { display: grid; gap: 6px; color: #374151; font-size: 12px; font-weight: 650; }
.tom-config-row input, .tom-config-row select { height: 42px; padding: 0 10px; border: 1px solid #d1d5db; border-radius: 8px; background: #fff; }
.tom-config-row .tom-button { margin: 0; }
.tom-config-row .tom-config-actions { gap: 7px; }
.tom-campaign-tabs { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 22px; }
.tom-campaign-tabs .tom-button { margin: 0; }
.tom-dashboard-filters { grid-template-columns: repeat(4, minmax(150px, 1fr)) auto; }
.tom-dashboard-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.tom-metric-card { display: grid; gap: 8px; padding: 20px; }
.tom-metric-card span { color: #6b7280; font-size: 13px; font-weight: 650; }
.tom-metric-card strong { font-size: 28px; }
.tom-metric-card small { color: #6b7280; }
.tom-metric-card.is-danger { border-color: #fecaca; background: #fff7f7; }
.tom-metric-card.is-warning { border-color: #fde68a; background: #fffdf2; }
progress { width: 100%; height: 8px; accent-color: #1b84ff; }
.tom-dashboard-section { margin-bottom: 20px; padding: 24px; }
.tom-dashboard-section-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.tom-dashboard-section-heading h2, .tom-dashboard-section-heading p { margin: 0; }
.tom-dashboard-section-heading small { color: #6b7280; }
.tom-deadline-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.tom-deadline { display: grid; gap: 5px; padding: 16px; border-left: 4px solid #93c5fd; border-radius: 8px; background: #f8fafc; }
.tom-deadline > span:first-child, .tom-deadline time { color: #6b7280; font-size: 12px; }
.tom-deadline.is-near { border-color: #fbbf24; }
.tom-deadline.is-critical, .tom-deadline.is-overdue { border-color: #ef4444; background: #fff7f7; }
.tom-dashboard-columns { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 20px; }
.tom-priority-list { display: grid; gap: 10px; }
.tom-priority { display: grid; gap: 3px; padding: 12px; border-left: 3px solid #fbbf24; background: #f8fafc; }
.tom-priority.is-overdue { border-color: #ef4444; }
.tom-priority.is-incident { border-color: #8b5cf6; }
.tom-priority span, .tom-priority small { color: #6b7280; font-size: 12px; }
.tom-visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 860px) {
  .tom-sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  .tom-sidebar-open .tom-sidebar { transform: translateX(0); }
  .tom-wrapper { margin-left: 0; }
  .tom-menu-toggle { display: inline-flex; }
  .tom-header-title, .tom-user span { display: none; }
  .tom-content { padding: 24px 18px; }
  .tom-page-heading { align-items: flex-start; flex-direction: column; }
  .tom-filters { grid-template-columns: 1fr; }
  .tom-config-row { grid-template-columns: 1fr; }
  .tom-dashboard-filters, .tom-dashboard-grid, .tom-dashboard-columns { grid-template-columns: 1fr; }
  .tom-context-summary { grid-template-columns: 1fr; }
  .tom-section-card { padding: 18px; }
  .tom-tabs { overflow-x: auto; }
  .tom-tab { white-space: nowrap; }
  .tom-state-flow {
    grid-template-columns: 1fr;
    min-width: 0;
    gap: 0;
    margin-left: 4px;
  }
  .tom-state-node { justify-items: start; grid-template-columns: 36px 1fr; min-height: 66px; text-align: left; }
  .tom-state-node::before { top: -30px; bottom: auto; left: 24px; width: 3px; height: 48px; }
  .tom-state-node:first-child::before { display: none; }
  .tom-state-node form, .tom-state-node .tom-state-label { align-self: center; }
  .tom-state-node small { grid-column: 2; margin-top: -15px; }
  .tom-incident-branch { grid-template-columns: 1fr; min-width: 0; }
  .tom-incident-branch > * { grid-column: 1 !important; }
}
