:root {
  --bg: #f5f7f8;
  --panel: #ffffff;
  --ink: #1e2a32;
  --muted: #64717b;
  --line: #dce3e7;
  --blue: #1464a5;
  --green: #1f7a4d;
  --amber: #9a6200;
  --red: #a83232;
  --shadow: 0 10px 30px rgba(23, 43, 54, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, "Microsoft YaHei", sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
.primary {
  border: 0;
  background: var(--blue);
  color: #fff;
  min-height: 38px;
  padding: 0 16px;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 11px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}

textarea {
  resize: vertical;
}

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

main {
  margin-left: 260px;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 260px;
  background: #15242d;
  color: #f7fbfc;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #f2bc57;
  color: #172832;
  display: grid;
  place-items: center;
  font-weight: 800;
}

.brand small {
  display: block;
  color: #b9c7ce;
  margin-top: 3px;
}

nav {
  display: grid;
  gap: 8px;
}

nav a,
.views a {
  border-radius: 6px;
  padding: 10px 12px;
  color: #d5e1e6;
}

nav a.active,
nav a:hover {
  background: #243944;
  color: #fff;
}

.side-stats {
  margin-top: auto;
  display: grid;
  gap: 10px;
}

.side-stats span {
  display: flex;
  justify-content: space-between;
  background: #20343f;
  padding: 10px 12px;
  border-radius: 6px;
}

.topbar {
  height: 70px;
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  position: sticky;
  top: 0;
  z-index: 5;
}

.search {
  display: flex;
  gap: 10px;
  flex: 1;
}

.workspace {
  display: grid;
  grid-template-columns: 330px minmax(480px, 1fr) 300px;
  gap: 18px;
  padding: 18px;
}

.ticket-list,
.ticket-detail,
.right-panel section,
.panel,
.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.ticket-list {
  overflow: hidden;
}

.views {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.views a {
  color: var(--muted);
  background: #edf2f4;
  font-size: 13px;
  padding: 7px 9px;
}

.views a.active {
  color: #fff;
  background: var(--blue);
}

.ticket-row {
  display: grid;
  gap: 6px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
}

.ticket-row:hover,
.ticket-row.active {
  background: #eef6fb;
}

.ticket-row span {
  color: var(--muted);
  font-size: 13px;
}

.ticket-meta {
  color: #48606c;
}

.badges {
  display: flex;
  gap: 6px;
}

.badge {
  width: fit-content;
  padding: 4px 8px;
  border-radius: 999px;
  background: #e8eef1;
  color: #36454d;
  font-size: 11px;
}

.badge.open {
  background: #e9f3ff;
  color: var(--blue);
}

.badge.pending {
  background: #fff5df;
  color: var(--amber);
}

.badge.solved {
  background: #e5f6ee;
  color: var(--green);
}

.ticket-detail {
  padding: 18px;
}

.detail-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.title-input {
  border: 0;
  padding-left: 0;
  font-size: 24px;
  font-weight: 800;
}

.grid {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

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

.grid.compact {
  grid-template-columns: repeat(5, minmax(110px, 1fr));
}

.checks {
  display: flex;
  gap: 18px;
  margin: 10px 0 18px;
}

.checks label,
.form-stack label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checks input,
.form-stack input[type="checkbox"] {
  width: auto;
}

.panel {
  padding: 18px;
}

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

h1,
h2 {
  margin: 0 0 12px;
}

h1 {
  font-size: 22px;
}

h2 {
  font-size: 16px;
}

.history {
  margin-top: 18px;
}

.message {
  border-left: 4px solid var(--blue);
  background: #f7fafb;
  padding: 12px;
  margin-bottom: 10px;
  border-radius: 6px;
}

.message.internal {
  border-left-color: var(--amber);
  background: #fff9ec;
}

.message.client {
  border-left-color: var(--green);
}

.message p {
  margin-bottom: 0;
}

.right-panel {
  display: grid;
  gap: 14px;
  align-content: start;
}

.right-panel section {
  padding: 16px;
}

dl {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 8px;
  margin: 12px 0;
}

dt {
  color: var(--muted);
  font-weight: 700;
}

dd {
  margin: 0;
}

.content-grid,
.reports,
.guide {
  padding: 22px;
}

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

.card {
  display: grid;
  gap: 7px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.card span,
.card p {
  color: var(--muted);
  margin: 0;
}

.form-stack {
  display: grid;
  gap: 10px;
}

.reports {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 18px;
}

.metric {
  padding: 18px;
  display: grid;
  gap: 8px;
}

.metric span {
  color: var(--muted);
}

.metric b {
  font-size: 34px;
}

.wide {
  grid-column: 1 / -1;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 11px;
  border-bottom: 1px solid var(--line);
}

th {
  color: var(--muted);
  font-size: 13px;
}

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

.guide article {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
}

@media (max-width: 1200px) {
  .workspace {
    grid-template-columns: 300px 1fr;
  }

  .right-panel {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

@media (max-width: 860px) {
  .sidebar {
    position: static;
    width: auto;
  }

  main {
    margin-left: 0;
  }

  .workspace,
  .content-grid,
  .reports,
  .guide-grid,
  .right-panel {
    grid-template-columns: 1fr;
  }

  .grid.two,
  .grid.compact {
    grid-template-columns: 1fr;
  }

  .topbar {
    height: auto;
    align-items: stretch;
    flex-direction: column;
  }
}
