:root {
  --ink: #071a1f;
  --muted: #5d737c;
  --line: #d7e4e8;
  --soft: #eef7fa;
  --panel: #ffffff;
  --blue: #02a8df;
  --blue-dark: #0077a8;
  --danger: #b3261e;
  --warning: #8a5f00;
  --ok: #0b6b3a;
}

* {
  box-sizing: border-box;
}

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

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

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.app-shell.nav-collapsed {
  grid-template-columns: 88px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px;
  border-right: 1px solid var(--line);
  background: var(--panel);
  transition: width 180ms ease;
}

.sidebar.collapsed {
  width: 88px;
}

.sidebar.collapsed .nav-link {
  justify-content: center;
  font-size: 0;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 26px;
}

.brand-row img {
  width: 150px;
  max-width: 100%;
}

.sidebar.collapsed .brand-row img {
  display: none;
}

.icon-button,
.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  cursor: pointer;
}

.side-nav {
  display: grid;
  gap: 8px;
}

.nav-link {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 850;
  text-align: left;
  cursor: pointer;
}

.nav-link.active,
.nav-link:hover {
  border-color: var(--line);
  background: var(--soft);
  color: var(--blue-dark);
}

.main-panel {
  min-width: 0;
  padding: 26px clamp(18px, 3vw, 42px);
}

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

h1,
h2,
h3 {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1;
}

h2 {
  font-size: clamp(1.35rem, 2.6vw, 2.2rem);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue-dark);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-weight: 850;
  text-decoration: none;
  cursor: pointer;
}

.button.primary {
  border-color: var(--blue);
  background: var(--blue);
  color: white;
}

.button.danger {
  border-color: #f3c6c3;
  color: var(--danger);
}

.session-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.session-user {
  color: var(--muted);
  font-weight: 800;
}

.login-panel,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 48px rgba(7, 26, 31, 0.06);
}

.login-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
  padding: 28px;
}

.login-panel p {
  max-width: 760px;
  color: var(--muted);
  line-height: 1.65;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.stack {
  display: grid;
  gap: 20px;
}

.panel {
  padding: 20px;
}

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

.panel-heading.compact {
  margin-bottom: 14px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.segmented button {
  min-height: 38px;
  border: 0;
  border-right: 1px solid var(--line);
  padding: 0 12px;
  background: white;
  color: var(--muted);
  font-weight: 850;
  cursor: pointer;
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button.active {
  background: var(--soft);
  color: var(--blue-dark);
}

input,
select,
textarea {
  min-height: 40px;
  border: 1px solid #c9dce2;
  border-radius: 8px;
  padding: 9px 11px;
  background: white;
  color: var(--ink);
}

select {
  appearance: none;
  padding-right: 38px;
  background:
    linear-gradient(45deg, transparent 50%, var(--blue-dark) 50%) calc(100% - 20px) 50% / 7px 7px no-repeat,
    linear-gradient(135deg, var(--blue-dark) 50%, transparent 50%) calc(100% - 15px) 50% / 7px 7px no-repeat,
    white;
}

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

.table-list,
.message-list {
  display: grid;
  gap: 10px;
}

.row-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfe;
}

.row-card h3 {
  margin-bottom: 6px;
  font-size: 1.05rem;
}

.row-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 850;
}

.pill.done {
  color: var(--ok);
}

.pill.warn {
  color: var(--warning);
}

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

.support-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-right: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 850;
  vertical-align: middle;
}

.support-status span {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  box-shadow: 0 0 0 3px rgba(7, 26, 31, 0.06);
}

.support-status.ok span {
  background: #18a058;
}

.support-status.blocked span {
  background: var(--danger);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.empty-state {
  margin: 0;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
}

.message-item {
  padding: 14px;
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  background: #fbfdfe;
}

.message-item.warn {
  border-left-color: #d69e00;
}

.message-item.error {
  border-left-color: var(--danger);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(7, 26, 31, 0.58);
}

.modal-backdrop.hidden,
.hidden {
  display: none !important;
}

.modal {
  position: relative;
  width: min(980px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 28px;
  border-radius: 8px;
  background: white;
  box-shadow: 0 30px 80px rgba(7, 26, 31, 0.28);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
}

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

.detail-box,
.form-grid {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfdfe;
}

.detail-box strong {
  display: block;
  margin-bottom: 4px;
}

.form-grid {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.case-update-form {
  gap: 16px;
  margin-top: 18px;
}

.case-update-form h3 {
  margin-bottom: 2px;
}

.field-label {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-weight: 850;
}

.field-label textarea,
.field-label select,
.field-label input {
  margin-top: 2px;
}

.modern-select {
  min-height: 46px;
  border-color: #bdd5dc;
  background-color: white;
  box-shadow: 0 1px 0 rgba(7, 26, 31, 0.03);
  font-weight: 750;
}

.range-field {
  gap: 10px;
}

.range-field span {
  color: var(--muted);
  font-weight: 800;
}

.form-grid input[type="range"] {
  padding: 0;
  accent-color: var(--blue);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

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

  .app-shell.nav-collapsed {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .topbar,
  .panel-heading,
  .login-panel,
  .row-card {
    grid-template-columns: 1fr;
    align-items: flex-start;
    flex-direction: column;
  }

  .filters,
  .row-actions,
  .session-box {
    justify-content: flex-start;
  }

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