:root {
  --black: #101114;
  --red: #c8102e;
  --red-dark: #990d24;
  --line: #e6e8ec;
  --soft: #f5f6f8;
  --text: #252932;
}

body {
  margin: 0;
  background: var(--soft);
  color: var(--text);
}

a {
  color: var(--red);
  text-decoration: none;
}

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

.sidebar {
  background: var(--black);
  color: #fff;
  padding: 22px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  font-size: 1.2rem;
  font-weight: 800;
  margin-bottom: 28px;
}

.brand img {
  width: 46px;
  height: 46px;
  object-fit: contain;
  background: #fff;
  border-radius: 8px;
  padding: 5px;
}

.sidebar .nav-link {
  color: rgba(255, 255, 255, 0.78);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar .nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-user {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  padding-top: 16px;
}

.content {
  padding: 30px;
  min-width: 0;
}

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

.page-heading h1 {
  margin: 0;
  font-size: 2rem;
  font-weight: 800;
}

.page-heading p {
  margin: 4px 0 0;
  color: #69707d;
}

.panel,
.metric {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(16, 17, 20, 0.06);
}

.panel {
  padding: 22px;
}

.panel h2 {
  font-size: 1.05rem;
  margin: 0 0 16px;
  font-weight: 800;
}

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

.panel-header h2 {
  margin: 0;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
}

.metric {
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.metric span {
  display: block;
  color: #69707d;
  font-size: 0.88rem;
}

.metric strong {
  display: block;
  font-size: 2rem;
  margin-top: 6px;
}

.metric i {
  position: absolute;
  right: 18px;
  bottom: 12px;
  font-size: 2.5rem;
  color: rgba(200, 16, 46, 0.14);
}

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

.span-2 {
  grid-column: span 2;
}

.action-row {
  display: flex;
  justify-content: flex-end;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-bottom: 18px;
}

.receipt-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 160px 160px auto;
  gap: 10px;
  margin-bottom: 14px;
}

.receipt-total {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-bottom: 10px;
  color: #69707d;
}

.receipt-total strong {
  color: var(--red);
}

.pdf-preview-panel {
  padding: 0;
  overflow: hidden;
}

.pdf-preview-frame {
  display: block;
  width: 100%;
  min-height: calc(100vh - 170px);
  border: 0;
  background: #fff;
}

.detail-list {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 8px 12px;
}

.detail-list dt {
  color: #69707d;
  font-weight: 600;
}

.notes {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.table thead th {
  color: #69707d;
  font-size: 0.78rem;
  text-transform: uppercase;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  background: #f1f2f5;
  color: #313744;
  padding: 2px 10px;
  font-size: 0.8rem;
  font-weight: 700;
}

.empty {
  color: #69707d;
  margin: 0;
}

.timeline {
  display: grid;
  gap: 16px;
}

.timeline-item {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--red);
  border-radius: 8px;
  padding: 18px;
}

.timeline.compact .timeline-item {
  box-shadow: none;
}

.timeline-item time {
  color: #69707d;
  font-size: 0.85rem;
  font-weight: 700;
}

.timeline-item h3 {
  font-size: 1rem;
  margin: 5px 0 8px;
  font-weight: 800;
}

.timeline-item p:last-child {
  margin-bottom: 0;
}

.attachment-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quote-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 120px 160px 140px 42px;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.quote-head {
  color: #69707d;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.quote-summary {
  margin-left: auto;
  margin-top: 18px;
  max-width: 360px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.quote-summary div {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
}

.quote-summary div:last-child {
  color: var(--red);
  font-size: 1.2rem;
}

.danger-zone {
  margin-top: 16px;
  text-align: right;
}

.toast-stack {
  position: fixed;
  z-index: 20;
  right: 24px;
  top: 18px;
  width: min(420px, calc(100vw - 32px));
}

.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #101114 0%, #1d2027 58%, #c8102e 100%);
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

.login-brand {
  background: var(--black);
  color: #fff;
  padding: 56px;
}

.login-brand img {
  width: 120px;
  height: 120px;
  object-fit: contain;
  background: #fff;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 28px;
}

.login-brand h1 {
  font-size: 2.6rem;
  font-weight: 900;
}

.login-brand p {
  color: rgba(255, 255, 255, 0.72);
  max-width: 420px;
}

.login-card {
  padding: 56px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-card h2 {
  font-weight: 800;
  margin-bottom: 24px;
}

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

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

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

@media (max-width: 720px) {
  .content {
    padding: 18px;
  }

  .page-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .metric-grid,
  .form-grid,
  .receipt-filters,
  .login-panel {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: span 1;
  }

  .quote-row {
    grid-template-columns: 1fr;
    border-bottom: 1px solid var(--line);
    padding-bottom: 12px;
  }

  .quote-head {
    display: none;
  }
}
