:root {
  --bg: #f3f6fc;
  --paper: #fff;
  --ink: #172640;
  --muted: #52637d;
  --line: #dce4ef;
  --blue: #2258d4;
  --nav: #142440;
  --soft: #eaf0ff;
  --red: #a82e41;
  --round: 14px;
  font-family: Inter, system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100dvh;
}
a {
  color: var(--blue);
  text-decoration: none;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
:focus-visible {
  outline: 3px solid #5481f0;
  outline-offset: 2px;
}
button,
.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper);
  color: var(--ink);
  padding: 0.64rem 0.85rem;
  min-height: 42px;
  font-size: 0.9rem;
  font-weight: 650;
  cursor: pointer;
}
button:hover,
.button:hover {
  background: var(--soft);
}
.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
}
.primary:hover {
  background: #1d49ac;
}
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 248px;
  background: var(--nav);
  color: white;
  display: flex;
  flex-direction: column;
  padding: 25px 17px;
  gap: 22px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 1.15rem;
  font-weight: 800;
  color: inherit;
  line-height: 1.15;
}
.brand small,
.profile small {
  display: block;
  font-weight: 500;
  font-size: 0.8rem;
  margin-top: 5px;
  color: inherit;
  opacity: 0.77;
}
.logo {
  display: grid;
  place-items: center;
  width: 41px;
  height: 41px;
  border-radius: 11px;
  background: #3e6deb;
  color: white;
  font-size: 1.3rem;
  flex: none;
}
.accent {
  color: #7ca5ff;
}
.sidebar nav {
  display: grid;
  gap: 5px;
  margin-top: 10px;
}
.sidebar nav a {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 11px 9px;
  border-radius: 9px;
  color: #d6e3fa;
  font-weight: 600;
  font-size: 0.9rem;
}
.sidebar nav a:hover,
.sidebar nav a.active {
  background: #263e67;
  color: white;
}
.nav-icon {
  width: 19px;
  text-align: center;
  font-size: 1.12rem;
}
.profile {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.87rem;
}
.logout {
  background: transparent;
  color: #e2ebfa;
  border-color: #53709d;
  min-height: 36px;
}
.logout:hover {
  background: #263e67;
}
.workspace {
  margin-left: 248px;
  padding: 32px clamp(18px, 3vw, 48px) 64px;
  max-width: 1600px;
}
.heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 22px;
}
h1,
h2,
p {
  margin: 0;
}
h1 {
  font-size: clamp(1.65rem, 4vw, 2.25rem);
  line-height: 1.13;
  letter-spacing: -0.04em;
  overflow-wrap: anywhere;
}
h2 {
  font-size: 1.12rem;
}
.heading p {
  color: var(--muted);
  margin-top: 0.55rem;
}
.card {
  border: 1px solid var(--line);
  border-radius: var(--round);
  background: var(--paper);
  box-shadow: 0 2px 6px #22365d07;
  margin-bottom: 16px;
}
.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 3px 3px 9px;
  margin: 0 -3px 8px;
}
.tabs a {
  flex: none;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  background: var(--paper);
  font-size: 0.88rem;
  font-weight: 650;
}
.tabs a small {
  display: block;
  color: var(--muted);
  margin-top: 3px;
  font-weight: 500;
}
.tabs a.chosen,
.segmented a.chosen {
  background: var(--soft);
  border-color: #bdceff;
  color: #1947b4;
}
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}
.segmented {
  display: flex;
  gap: 5px;
}
.segmented a {
  color: var(--muted);
  border-radius: 7px;
  padding: 8px 10px;
  font-weight: 650;
  font-size: 0.88rem;
}
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  padding: 14px 18px;
}
.filters.standalone {
  padding: 0 0 15px;
}
.filters .search {
  flex: 1;
  min-width: min(220px, 100%);
}
label {
  display: grid;
  gap: 5px;
  font-size: 0.88rem;
  font-weight: 650;
}
label small,
.muted,
.table-note,
.message-copy small,
.message-meta small,
.letter small {
  color: var(--muted);
}
input,
select,
textarea {
  border: 1px solid #cbd6e8;
  background: #fff;
  padding: 9px 10px;
  border-radius: 8px;
  min-height: 42px;
  min-width: 0;
  max-width: 100%;
  font-size: 1rem;
}
input[type="checkbox"] {
  min-height: 0;
}
.check {
  display: flex;
  align-items: center;
  min-height: 42px;
}
textarea {
  width: 100%;
  resize: vertical;
}
.message-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  border-top: 1px solid var(--line);
  color: var(--ink);
}
.message-row:hover {
  background: #f1f5ff;
}
.message-row.unread strong {
  color: #123ca0;
}
.avatar {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 50%;
  background: #e6edff;
  color: #214baa;
  font-weight: 750;
}
.avatar.inline {
  display: inline-grid;
  width: 30px;
  height: 30px;
  margin-right: 8px;
  vertical-align: middle;
}
.message-copy {
  min-width: 0;
}
.message-copy strong,
.message-copy small {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.message-copy small {
  margin-top: 5px;
  font-size: 0.82rem;
}
.message-meta {
  display: grid;
  justify-items: end;
  gap: 4px;
  font-size: 0.85rem;
  text-align: right;
}
.chip {
  display: inline-flex;
  color: #694300;
  background: #fff0cb;
  border-radius: 99px;
  padding: 4px 8px;
  font-weight: 700;
  font-size: 0.79rem;
}
.chip.danger {
  color: var(--red);
  background: #ffe8ed;
}
.empty,
.table-note {
  padding: 18px;
}
.back {
  display: inline-block;
  font-size: 0.9rem;
  margin-bottom: 14px;
  font-weight: 650;
}
.actionbar,
.letter header,
.letter footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.actionbar {
  margin-bottom: 14px;
}
.actionbar form {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.letter {
  padding: 17px 20px;
}
.letter small {
  display: block;
  margin-top: 6px;
  overflow-wrap: anywhere;
}
.letter header strong {
  overflow-wrap: anywhere;
}
.letter header time {
  color: var(--muted);
  font-size: 0.85rem;
}
.letter-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 19px 0;
  line-height: 1.55;
}
.letter footer {
  justify-content: flex-start;
  margin-top: 12px;
  font-weight: 650;
  font-size: 0.9rem;
}
.stack {
  display: grid;
  gap: 15px;
}
.stack button {
  justify-self: start;
}
.form-panel {
  padding: 20px;
  max-width: 760px;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.metric {
  margin: 0;
  padding: 16px;
  min-height: 100px;
  display: grid;
  align-content: center;
  gap: 6px;
}
.metric span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
}
.metric strong {
  font-size: 2rem;
  letter-spacing: -0.04em;
}
.metric small {
  font-size: 0.9rem;
}
.red {
  color: var(--red);
}
.overflow {
  overflow-x: auto;
}
table {
  border-collapse: collapse;
  width: 100%;
  text-align: left;
  font-size: 0.9rem;
}
th,
td {
  padding: 12px 15px;
  border-bottom: 1px solid var(--line);
}
thead {
  background: #f6f8fd;
  color: var(--muted);
  white-space: nowrap;
}
.settings {
  padding: 13px 16px;
}
summary {
  cursor: pointer;
  font-weight: 650;
}
.login-layout {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 16px;
  background: radial-gradient(ellipse at 70% 15%, #dbe7ff, var(--bg) 60%);
}
.login-panel {
  padding: 28px;
  width: min(100%, 430px);
}
.login-panel h1 {
  margin: 22px 0 16px;
}
.login-panel details {
  margin-top: 20px;
  color: var(--muted);
  font-size: 0.9rem;
}
.login-panel details p {
  margin-top: 8px;
  overflow-wrap: anywhere;
}
@media (max-width: 850px) {
  .sidebar {
    position: static;
    width: auto;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 14px;
  }
  .sidebar nav {
    display: flex;
    flex-wrap: wrap;
    margin: 0;
    order: 3;
    width: 100%;
    gap: 4px;
  }
  .sidebar nav a {
    font-size: 0.83rem;
    padding: 8px;
  }
  .profile {
    margin: 0 0 0 auto;
  }
  .workspace {
    margin: 0;
    padding: 22px 14px 40px;
  }
}
@media (max-width: 500px) {
  .profile div {
    display: none;
  }
  .heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }
  .filters,
  .toolbar {
    padding-left: 11px;
    padding-right: 11px;
  }
  .filters label:not(.check) {
    flex: 1 1 125px;
  }
  .message-row {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 12px 10px;
    gap: 6px;
  }
  .message-row .avatar {
    display: none;
  }
  .message-copy small,
  .message-meta {
    font-size: 0.76rem;
  }
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .metric {
    padding: 12px;
  }
}
