:root,
body[data-theme="light"] {
  --bg: #eef2f8;
  --surface: #ffffff;
  --surface-2: #f6f9ff;
  --surface-3: #edf2fd;
  --text: #152238;
  --text-muted: #5a6a86;
  --line: #d4deef;
  --line-strong: #b8c7e2;
  --primary: #1f5fd7;
  --primary-soft: #e6efff;
  --success: #1f8a5f;
  --warning: #a66a05;
  --danger: #be324d;
  --overlay: rgba(16, 28, 46, 0.44);
  --shadow-sm: 0 4px 18px rgba(20, 42, 78, 0.06);
  --shadow-lg: 0 12px 34px rgba(20, 42, 78, 0.16);
  --radius-sm: 10px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

body[data-theme="dark"] {
  --bg: #111724;
  --surface: #181f2d;
  --surface-2: #1d2637;
  --surface-3: #253149;
  --text: #e8edf8;
  --text-muted: #9eacc5;
  --line: #2a3550;
  --line-strong: #36486b;
  --primary: #5d96f3;
  --primary-soft: #243b62;
  --success: #5ac08f;
  --warning: #d7a34e;
  --danger: #ef708a;
  --overlay: rgba(0, 0, 0, 0.56);
  --shadow-sm: 0 6px 24px rgba(2, 6, 15, 0.4);
  --shadow-lg: 0 18px 44px rgba(0, 0, 0, 0.48);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Manrope", sans-serif;
  background: radial-gradient(circle at 0 0, rgba(93, 150, 243, 0.12), transparent 28%), var(--bg);
  color: var(--text);
  overflow: hidden;
}

body.drawer-open {
  overflow: hidden;
}

.hidden {
  display: none !important;
}

.mono {
  font-family: "JetBrains Mono", monospace;
}

.muted {
  color: var(--text-muted);
}

.app {
  width: 100%;
  margin: 0;
  padding: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: 86px;
  border-radius: 0;
  border: none;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  box-shadow: none;
  padding: 10px 18px;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(230px, auto) minmax(420px, 1fr) auto;
  align-items: center;
}

.brand-wrap {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 244px;
}

.brand {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  overflow: hidden;
}

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

.brand-title {
  font-size: 0.96rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.brand-subtitle {
  color: var(--text-muted);
  font-size: 0.76rem;
}

.top-center {
  min-width: 0;
  display: flex;
  align-items: center;
}

.top-nav {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: nowrap;
  min-width: 0;
}

.top-nav-btn {
  height: 38px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.87rem;
  font-weight: 600;
  padding: 0 12px;
  cursor: pointer;
  white-space: nowrap;
}

.top-nav-btn:hover {
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--text);
}

.top-nav-btn.active {
  border-color: color-mix(in srgb, var(--primary) 60%, var(--line) 40%);
  background: var(--primary-soft);
  color: var(--text);
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
}

.top-actions > *:not(.search-wrap) {
  flex-shrink: 0;
}

.search-wrap {
  display: block;
  position: relative;
  min-width: 240px;
  flex: 1 1 440px;
  margin-right: 2px;
}

.search-wrap input {
  width: 100%;
  max-width: 760px;
  min-width: 0;
  padding-right: 42px;
}

.search-icon {
  position: absolute;
  right: 11px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.94rem;
  line-height: 1;
  color: var(--text-muted);
  pointer-events: none;
}

.view-root {
  margin-top: 0;
  flex: 1 1 auto;
  min-height: 0;
  border-radius: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  padding: 0;
  overflow: hidden;
}

.section {
  border: none;
  border-radius: 0;
  background: transparent;
  padding: 10px 0;
}

.section h2,
.section h3,
.section h4 {
  margin: 0;
}

.section-title {
  font-size: 1.02rem;
  font-weight: 700;
}

.section-subtitle {
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 0.84rem;
}

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

input,
select,
textarea {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 0.87rem;
}

input,
select {
  height: 38px;
}

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

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--primary) 70%, #fff 30%);
  outline-offset: 2px;
}

.btn {
  height: 38px;
  border-radius: 10px;
  padding: 0 12px;
  border: 1px solid transparent;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
}

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

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

.btn-secondary {
  background: var(--primary-soft);
  border-color: color-mix(in srgb, var(--primary) 50%, var(--line) 50%);
  color: var(--text);
}

.btn-danger {
  background: color-mix(in srgb, var(--danger) 18%, var(--surface) 82%);
  border-color: color-mix(in srgb, var(--danger) 52%, var(--line) 48%);
  color: var(--danger);
}

.btn-warn {
  background: color-mix(in srgb, var(--warning) 20%, var(--surface) 80%);
  border-color: color-mix(in srgb, var(--warning) 56%, var(--line) 44%);
  color: var(--warning);
}

.btn-ghost {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--text);
}

.user-chip {
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface-2);
  min-height: 38px;
  padding: 6px 9px;
  display: grid;
  align-content: center;
  line-height: 1.05;
  min-width: 132px;
}

.user-chip span {
  font-size: 0.82rem;
  font-weight: 700;
}

.user-chip small {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: "JetBrains Mono", monospace;
}

.projects-shell {
  display: grid;
  grid-template-columns: 264px 1fr;
  gap: 0;
  height: 100%;
  min-height: 0;
}

.projects-rail {
  border: none;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  padding: 14px 10px 14px 14px;
  overflow: auto;
  display: grid;
  gap: 8px;
  align-content: start;
  min-height: 0;
}

.rail-title {
  font-size: 0.84rem;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.project-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 9px;
  text-align: left;
  cursor: pointer;
  color: inherit;
}

.project-card:hover {
  border-color: color-mix(in srgb, var(--primary) 45%, var(--line) 55%);
}

.project-card.active {
  border-color: color-mix(in srgb, var(--primary) 70%, var(--line) 30%);
  background: var(--primary-soft);
}

.project-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.project-card-name {
  font-size: 0.84rem;
  font-weight: 700;
}

.project-counters {
  margin-top: 6px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.counter {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 5px;
}

.counter .label {
  display: block;
  color: var(--text-muted);
  font-size: 0.67rem;
  text-transform: uppercase;
}

.counter .value {
  font-family: "JetBrains Mono", monospace;
  font-weight: 600;
  font-size: 0.8rem;
}

.projects-main {
  border: none;
  border-radius: 0;
  background: transparent;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.projects-main-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-toggle-btn {
  min-width: 128px;
}

.projects-filter-panel {
  border: none;
  border-radius: 0;
  background: transparent;
  padding: 6px 0 8px;
  display: grid;
  gap: 8px;
}

.filters-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.chip {
  height: 30px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-muted);
  padding: 0 12px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.chip.active {
  border-color: color-mix(in srgb, var(--primary) 68%, var(--line) 32%);
  background: var(--primary-soft);
  color: var(--text);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}

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

.kpi-card .label {
  color: var(--text-muted);
  font-size: 0.74rem;
}

.kpi-card .value {
  margin-top: 2px;
  font-weight: 700;
  font-size: 1.06rem;
}

.table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  overflow: auto;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--line) 45%, transparent);
}

.ticket-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  min-width: 1360px;
}

.ticket-table th,
.ticket-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  font-size: 0.82rem;
  text-align: left;
  vertical-align: top;
}

.ticket-table th {
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.73rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--surface-2);
  position: sticky;
  top: 0;
  z-index: 2;
}

.ticket-table tr:last-child td {
  border-bottom: none;
}

.ticket-row {
  cursor: pointer;
}

.ticket-row:hover {
  background: color-mix(in srgb, var(--primary) 8%, var(--surface) 92%);
}

.ticket-row.is-active {
  background: color-mix(in srgb, var(--primary) 14%, var(--surface) 86%);
}

.ticket-subject {
  font-weight: 700;
  margin-bottom: 2px;
  line-height: 1.32;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ticket-submeta {
  color: var(--text-muted);
  font-size: 0.73rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ticket-inline-text {
  display: inline-block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.col-id {
  width: 72px;
}

.col-topic {
  width: 29%;
}

.col-status {
  width: 190px;
}

.col-project {
  width: 16%;
}

.col-resource {
  width: 10%;
}

.col-sla {
  width: 170px;
}

.col-links {
  width: 88px;
}

.col-assignee {
  width: 166px;
}

.col-date {
  width: 126px;
}

.date-stack {
  display: inline-grid;
  gap: 2px;
  line-height: 1.05;
}

.date-stack span:first-child {
  font-size: 0.82rem;
}

.date-stack span:last-child {
  color: var(--text-muted);
  font-size: 0.72rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 999px;
  height: 24px;
  padding: 0 8px;
  font-size: 0.72rem;
  font-family: "JetBrains Mono", monospace;
  white-space: nowrap;
}

.status-new {
  background: color-mix(in srgb, #f2b51d 22%, var(--surface) 78%);
  border-color: color-mix(in srgb, #f2b51d 50%, var(--line) 50%);
  color: color-mix(in srgb, #f2b51d 80%, #000 20%);
}

.status-in_progress {
  background: color-mix(in srgb, #35a0ff 20%, var(--surface) 80%);
  border-color: color-mix(in srgb, #35a0ff 48%, var(--line) 52%);
  color: color-mix(in srgb, #35a0ff 80%, #000 20%);
}

.status-expiring {
  background: color-mix(in srgb, #ff5d2c 18%, var(--surface) 82%);
  border-color: color-mix(in srgb, #ff5d2c 52%, var(--line) 48%);
  color: color-mix(in srgb, #ff5d2c 80%, #000 20%);
}

.status-needs_review {
  background: color-mix(in srgb, #8c8c8c 24%, var(--surface) 76%);
  border-color: color-mix(in srgb, #8c8c8c 52%, var(--line) 48%);
  color: color-mix(in srgb, #8c8c8c 90%, #000 10%);
}

.status-response_received {
  background: color-mix(in srgb, #f26acb 20%, var(--surface) 80%);
  border-color: color-mix(in srgb, #f26acb 52%, var(--line) 48%);
  color: color-mix(in srgb, #f26acb 80%, #000 20%);
}

.status-closed {
  background: color-mix(in srgb, #4acb6a 18%, var(--surface) 82%);
  border-color: color-mix(in srgb, #4acb6a 48%, var(--line) 52%);
  color: color-mix(in srgb, #4acb6a 78%, #000 22%);
}

.status-rejected {
  background: color-mix(in srgb, #868686 24%, var(--surface) 76%);
  border-color: color-mix(in srgb, #868686 52%, var(--line) 48%);
  color: color-mix(in srgb, #868686 90%, #000 10%);
}

.badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  height: 24px;
  padding: 0 8px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.badge-alert {
  border-color: color-mix(in srgb, var(--danger) 60%, var(--line) 40%);
  background: color-mix(in srgb, var(--danger) 14%, var(--surface) 86%);
  color: var(--danger);
}

.badge-warn {
  border-color: color-mix(in srgb, var(--warning) 60%, var(--line) 40%);
  background: color-mix(in srgb, var(--warning) 14%, var(--surface) 86%);
  color: var(--warning);
}

.empty-state {
  min-height: 280px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--text-muted);
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
}

.skeleton {
  position: relative;
  overflow: hidden;
  background: color-mix(in srgb, var(--line) 80%, transparent);
  border-radius: 8px;
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.34), transparent);
  animation: shimmer 1.2s infinite;
}

@keyframes shimmer {
  100% {
    transform: translateX(100%);
  }
}

.skeleton-table {
  display: grid;
  gap: 8px;
}

.skeleton-row {
  height: 44px;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 500;
}

.ticket-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(860px, 92vw);
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  z-index: 501;
  display: grid;
  grid-template-rows: auto 1fr;
  animation: drawer-in 0.18s ease-out;
}

@keyframes drawer-in {
  from {
    transform: translateX(18px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.drawer-header {
  border-bottom: 1px solid var(--line);
  padding: 12px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  justify-content: space-between;
}

.drawer-header h3 {
  margin: 0;
  font-size: 1.04rem;
}

.drawer-subline {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.drawer-body {
  overflow: auto;
  padding: 12px;
  display: grid;
  gap: 10px;
}

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

.block h4 {
  margin: 0 0 8px;
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}

.key-value {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 8px;
}

.key-value-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 8px;
}

.key-value-item .k {
  color: var(--text-muted);
  font-size: 0.72rem;
}

.key-value-item .v {
  margin-top: 2px;
  font-size: 0.84rem;
  font-weight: 700;
}

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

.links-list,
.log-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.links-item,
.log-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 8px;
}

.links-item a {
  color: var(--primary);
  text-decoration: none;
  font-size: 0.82rem;
  word-break: break-all;
}

.links-item a:hover {
  text-decoration: underline;
}

.links-item-meta {
  margin-top: 4px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.log-item-meta {
  color: var(--text-muted);
  font-size: 0.71rem;
  font-family: "JetBrains Mono", monospace;
}

.analytics-shell {
  display: grid;
  gap: 10px;
  height: 100%;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.analytics-head {
  background:
    radial-gradient(circle at right top, color-mix(in srgb, var(--primary) 20%, transparent), transparent 44%),
    var(--surface-2);
}

.analytics-toolbar {
  margin-top: 10px;
}

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

.kpi-hero {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(125deg, color-mix(in srgb, var(--primary) 12%, var(--surface) 88%), var(--surface)),
    var(--surface);
}

.kpi-hero::after {
  content: "";
  position: absolute;
  right: -26px;
  top: -32px;
  width: 124px;
  height: 124px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--primary) 20%, transparent);
  filter: blur(2px);
}

.kpi-meta {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 0.73rem;
}

.kpi-trend {
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 2px 8px;
  font-size: 0.72rem;
  font-family: "JetBrains Mono", monospace;
  background: var(--surface);
}

.trend-up {
  border-color: color-mix(in srgb, var(--success) 55%, var(--line) 45%);
  color: var(--success);
}

.trend-down {
  border-color: color-mix(in srgb, var(--danger) 55%, var(--line) 45%);
  color: var(--danger);
}

.trend-neutral {
  border-color: color-mix(in srgb, var(--warning) 55%, var(--line) 45%);
  color: var(--warning);
}

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

.analytics-grid-bottom {
  grid-template-columns: 1.3fr 1fr;
}

.chart-wrap {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 10px;
}

.analytics-main-chart {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--primary) 8%, transparent), transparent 30%),
    var(--surface);
}

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

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

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

.bar-row {
  display: grid;
  grid-template-columns: 110px 1fr 36px;
  gap: 8px;
  align-items: center;
  font-size: 0.78rem;
}

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

.bar-track > span {
  display: block;
  height: 100%;
  background: var(--primary);
}

.risk-cell {
  display: grid;
  grid-template-columns: 28px 1fr 42px;
  align-items: center;
  gap: 8px;
}

.analytics-load-list {
  max-height: 238px;
  overflow: auto;
  padding-right: 4px;
}

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

.table-clean th,
.table-clean td {
  border-bottom: 1px solid var(--line);
  padding: 9px 8px;
  text-align: left;
  font-size: 0.8rem;
}

.table-clean th {
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.7rem;
}

.table-clean tr:last-child td {
  border-bottom: none;
}

.row-link {
  color: var(--primary);
  cursor: pointer;
  text-decoration: none;
}

.row-link:hover {
  text-decoration: underline;
}

.admin-shell {
  display: grid;
  gap: 10px;
  height: 100%;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

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

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

.workload-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 8px;
}

.workload-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 700;
}

.workload-meta {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.74rem;
}

.project-access-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}

.project-access-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 8px;
  display: grid;
  grid-template-columns: 16px 1fr;
  gap: 8px;
  align-items: start;
  font-size: 0.8rem;
}

.project-access-item input {
  margin-top: 2px;
}

.project-access-item small {
  grid-column: 2 / 3;
  font-size: 0.7rem;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 700;
  background: var(--overlay);
  display: grid;
  place-items: center;
  padding: 16px;
}

.modal {
  width: min(760px, 100%);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  padding: 12px;
}

.modal h3 {
  margin: 0;
}

.modal label {
  display: block;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.35;
}

.modal input,
.modal select,
.modal textarea {
  width: 100%;
}

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

.modal-field {
  display: grid;
  gap: 6px;
  align-content: start;
}

.modal-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.tour-overlay {
  position: fixed;
  inset: 0;
  z-index: 760;
  background: rgba(6, 10, 18, 0.5);
}

.tour-center {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  padding: 16px;
}

.tour-highlight {
  position: fixed;
  border-radius: 12px;
  border: 2px solid color-mix(in srgb, var(--primary) 65%, #fff 35%);
  box-shadow: 0 0 0 9999px rgba(6, 10, 18, 0.58);
  pointer-events: none;
}

.tour-floating {
  position: fixed;
  max-width: min(420px, calc(100vw - 24px));
  z-index: 761;
}

.tour-card {
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  padding: 12px;
}

.tour-card h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.tour-card p {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.45;
  font-size: 0.86rem;
}

.tour-progress {
  display: inline-block;
  font-size: 0.73rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.tour-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.toast {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 800;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  padding: 10px 12px;
  font-size: 0.83rem;
  max-width: 360px;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
}

.login-card {
  width: min(520px, 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  padding: 16px;
}

.login-card h1 {
  margin: 0;
  font-size: 1.32rem;
}

.login-card .muted {
  margin-top: 6px;
  margin-bottom: 12px;
  font-size: 0.87rem;
}

.login-actions {
  margin-top: 12px;
}

.login-note {
  margin: 6px 0 0;
  font-size: 0.78rem;
}

@media (max-width: 1280px) {
  .topbar {
    grid-template-columns: 1fr;
    gap: 8px;
    min-height: auto;
  }

  .top-center,
  .top-nav {
    width: 100%;
  }

  .top-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .search-wrap,
  .search-wrap input {
    width: 100%;
    min-width: 0;
  }

  .projects-shell {
    grid-template-columns: 230px 1fr;
  }

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

@media (max-width: 1024px) {
  .app {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .projects-shell {
    grid-template-columns: 1fr;
    height: auto;
  }

  .projects-rail,
  .projects-main {
    max-height: none;
  }

  .view-root {
    overflow: visible;
    min-height: auto;
  }

  .admin-grid,
  .analytics-grid,
  .analytics-kpi-grid,
  .analytics-mini-grid,
  .kpi-grid,
  .key-value {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .app {
    padding: 8px;
  }

  .top-nav {
    justify-content: flex-start;
  }

  .top-nav-btn {
    flex: 1;
  }

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

  .ticket-drawer {
    width: 100vw;
  }

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