:root {
  --bg: #f6f8f7;
  --panel: #ffffff;
  --ink: #121817;
  --muted: #62706b;
  --line: #dce3e0;
  --soft: #eef4f1;
  --teal: #047965;
  --teal-2: #d9f3eb;
  --amber: #c87410;
  --red: #b42318;
  --blue: #2f66b3;
  --shadow: 0 16px 50px rgba(24, 38, 34, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 246px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: #111918;
  color: #f7fbf9;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 760;
  letter-spacing: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--teal);
  color: #fff;
  font-size: 14px;
}

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

.nav-item {
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #c9d4d1;
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 42px;
  padding: 0 11px;
  text-align: left;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.icon {
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  color: #9adccf;
  font-weight: 800;
}

.sidebar-note {
  margin-top: auto;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 13px;
  color: #c9d4d1;
  font-size: 13px;
  line-height: 1.45;
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 7px;
  border-radius: 50%;
  background: #23c898;
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}

.topbar h1 {
  margin: 2px 0 0;
  font-size: 29px;
  line-height: 1.15;
  letter-spacing: 0;
}

.section-label {
  margin: 0;
  color: var(--teal);
  font-size: 12px;
  font-weight: 760;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.top-actions,
.button-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.toggle {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  font-size: 14px;
  color: var(--muted);
}

.sync-status,
.queue-count,
.status {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 740;
  color: var(--teal);
  background: var(--teal-2);
  white-space: nowrap;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.board {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(360px, 1.25fr) minmax(280px, 0.85fr);
  gap: 16px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
  min-width: 0;
}

.full-panel {
  min-height: 72vh;
}

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

.panel h2 {
  margin: 2px 0 0;
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: 0;
}

.panel h3 {
  margin: 0;
  font-size: 15px;
}

select,
input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

select,
input {
  min-height: 40px;
  padding: 0 11px;
}

textarea {
  min-height: 172px;
  resize: vertical;
  padding: 12px;
  line-height: 1.45;
}

label {
  display: grid;
  gap: 7px;
  color: #3d4946;
  font-size: 13px;
  font-weight: 720;
}

.ticket-form {
  display: grid;
  gap: 11px;
}

.ticket-form textarea {
  min-height: 88px;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.primary-btn,
.secondary-btn,
.sync-card button {
  border: 0;
  border-radius: 8px;
  min-height: 40px;
  padding: 0 13px;
  font-size: 14px;
  font-weight: 780;
}

.primary-btn {
  background: var(--teal);
  color: #fff;
}

.secondary-btn,
.sync-card button {
  background: var(--soft);
  color: #21302d;
}

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

.note {
  margin-top: 11px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.status.high,
.status.Urgent {
  color: #7a3a00;
  background: #fff1d9;
}

.status.Normal {
  color: var(--blue);
  background: #e5efff;
}

.status.Low {
  color: var(--muted);
  background: #edf0ef;
}

.timeline {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  margin: 14px 0;
}

.timeline span {
  min-height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 740;
  text-align: center;
}

.timeline .done,
#timelineDispatch.done {
  border-color: #b7e4d9;
  color: var(--teal);
  background: #edf9f5;
}

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

.team-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfc;
}

.team-card header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.team-card strong {
  font-size: 14px;
}

.team-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 6px;
}

.team-card li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.sync-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.sync-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.sync-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  min-height: 54px;
  margin: 7px 0 11px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

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

th {
  background: #f1f5f3;
  color: #475551;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

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

.rule-card,
.industry-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfc;
}

.rule-card p,
.industry-card p {
  color: var(--muted);
  line-height: 1.45;
  font-size: 14px;
  margin: 8px 0 0;
}

.industry-card strong {
  display: block;
  margin-top: 10px;
  color: var(--teal);
  font-size: 13px;
}

.export-layout {
  display: grid;
  gap: 14px;
  max-width: 920px;
}

pre {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  padding: 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #101716;
  color: #d9f3eb;
  font-size: 13px;
  line-height: 1.5;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  border-radius: 8px;
  background: #111918;
  color: #fff;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  transition: 180ms ease;
  max-width: 360px;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 5;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
  }

  .nav {
    display: flex;
  }

  .sidebar-note {
    display: none;
  }

  .board,
  .rules-grid,
  .industry-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .workspace {
    padding: 16px;
  }

  .topbar,
  .panel-head {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar h1 {
    font-size: 24px;
  }

  .field-grid,
  .sync-grid,
  .timeline {
    grid-template-columns: 1fr;
  }
}
