:root {
  --bg: #f6f8f5;
  --panel: #ffffff;
  --ink: #17211b;
  --muted: #66736b;
  --line: #dce4dc;
  --green: #0f6b4f;
  --mint: #dff3e8;
  --danger: #a8322d;
}

* {
  box-sizing: border-box;
}

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

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

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

.login-card,
.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 50px rgba(23, 33, 27, .1);
}

.login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  padding: 26px;
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: white;
}

textarea {
  resize: vertical;
}

button {
  border: 0;
  border-radius: 8px;
  padding: 11px 14px;
  color: white;
  background: var(--green);
  font-weight: 800;
  cursor: pointer;
}

.danger-button {
  color: white;
  background: var(--danger);
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 10px 12px;
  color: white;
  background: var(--green);
  font-weight: 800;
  text-decoration: none;
}

.button-link.secondary {
  color: var(--green);
  border: 1px solid var(--line);
  background: white;
}

.oauth-button {
  display: inline-flex;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 14px;
  color: #18436f;
  background: white;
  font-weight: 800;
  text-decoration: none;
}

.oauth-button:hover {
  border-color: #18436f;
}

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

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 18px;
  border-right: 1px solid var(--line);
  background: var(--panel);
}

.sidebar.collapsed {
  width: 68px;
  align-items: center;
  padding: 18px 10px;
  overflow: hidden;
}

.sidebar-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  width: 100%;
}

.sidebar.collapsed .sidebar-head {
  justify-content: center;
}

.sidebar.collapsed .sidebar-head strong {
  display: none;
}

.nav-collapse {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  width: 40px;
  height: 40px;
  padding: 0;
  flex: 0 0 40px;
}

nav {
  display: grid;
  gap: 8px;
  width: 100%;
}

.sidebar.collapsed nav {
  justify-items: center;
}

.nav-item,
.logout {
  width: 100%;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.sidebar.collapsed .nav-item,
.sidebar.collapsed .logout {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  overflow: hidden;
  color: transparent;
  font-size: 0;
}

.sidebar.collapsed .nav-item::before,
.sidebar.collapsed .logout::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--muted);
}

.sidebar.collapsed .nav-item.active::before,
.sidebar.collapsed .nav-item:hover::before {
  background: var(--green);
}

.nav-item.active,
.nav-item:hover {
  color: var(--green);
  background: var(--mint);
}

.sidebar.collapsed .nav-item.active,
.sidebar.collapsed .nav-item:hover {
  color: transparent;
}

.logout {
  margin-top: auto;
  color: var(--danger);
}

.sidebar.collapsed .logout {
  color: transparent;
}

.sidebar.collapsed .logout::before {
  background: var(--danger);
}

.content {
  min-width: 0;
  padding: clamp(20px, 4vw, 46px);
}

.content-head {
  display: grid;
  grid-template-columns: 1fr minmax(260px, 360px);
  gap: 20px;
  align-items: start;
  margin-bottom: 24px;
}

.content-head p,
.muted,
.message {
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 14px;
}

.card {
  padding: 18px;
}

.card h3,
.card p {
  margin-top: 0;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin: 28px 0 12px;
}

.case-filter {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-weight: 800;
}

.switch {
  position: relative;
  width: 54px;
  height: 30px;
  display: inline-block;
}

.switch input {
  position: absolute;
  opacity: 0;
  inset: 0;
}

.switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--line);
  cursor: pointer;
}

.switch span::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: white;
  box-shadow: 0 2px 8px rgba(23, 33, 27, .2);
  transition: transform .2s ease;
}

.switch input:checked + span {
  background: var(--green);
}

.switch input:checked + span::before {
  transform: translateX(24px);
}

.list {
  display: grid;
  gap: 10px;
}

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

.row button {
  color: white;
}

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

.staff-profile {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: white;
}

.staff-profile .message {
  grid-column: 1 / -1;
  margin: 0;
}

.details {
  display: grid;
  gap: 8px;
}

.details div {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 12px;
}

.details dt {
  color: var(--muted);
  font-weight: 800;
}

.details dd {
  margin: 0;
}

.hidden {
  display: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(23, 33, 27, .52);
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: min(920px, 96vw);
  max-height: 90vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  background: white;
  box-shadow: 0 24px 70px rgba(23, 33, 27, .24);
}

.modal-close {
  position: sticky;
  top: 0;
  float: right;
  width: 36px;
  height: 36px;
  padding: 0;
}

.detail-section {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.case-control-form {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
}

.case-control-form button {
  justify-self: start;
}

.payment-status-box {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
}

.payment-status-box span {
  color: var(--muted);
  font-weight: 800;
}

.case-comment-form {
  background: white;
}

.update-list {
  display: grid;
  gap: 10px;
}

.update-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
}

.update-item p {
  white-space: pre-wrap;
}

.update-item small {
  color: var(--muted);
  font-weight: 700;
}

.file-list {
  display: grid;
  gap: 10px;
}

.file-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.file-row p {
  margin: 4px 0 0;
}

.file-name-link {
  color: var(--green);
  font-weight: 800;
  text-decoration: none;
}

.file-name-link:hover {
  text-decoration: underline;
}

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

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

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

  .content-head,
  .staff-profile,
  .details div,
  .file-row,
  .row {
    grid-template-columns: 1fr;
  }
}
