:root {
  --bg: #f4efe6;
  --bg-strong: #eadfce;
  --surface: rgba(255, 252, 247, 0.82);
  --surface-strong: #fffaf3;
  --text: #1f1a17;
  --muted: #6a5f56;
  --line: rgba(71, 49, 28, 0.12);
  --primary: #c86c31;
  --primary-deep: #8f4419;
  --accent: #1f6b63;
  --shadow: 0 20px 60px rgba(82, 48, 19, 0.14);
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(200, 108, 49, 0.18), transparent 30%),
    radial-gradient(circle at bottom right, rgba(31, 107, 99, 0.18), transparent 24%),
    linear-gradient(160deg, #f8f4ec 0%, var(--bg) 55%, #efe3d2 100%);
}

button,
input,
textarea {
  font: inherit;
}

.app-shell {
  width: min(100%, 480px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 20px 16px;
  display: flex;
  align-items: stretch;
}

.toast {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  width: min(calc(100% - 28px), 420px);
  padding: 14px 16px;
  border-radius: 16px;
  background: #b42318;
  color: #fff7f6;
  box-shadow: 0 18px 36px rgba(123, 25, 18, 0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 999;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.screen {
  display: none;
  width: 100%;
  animation: rise 320ms ease;
}

.screen.active {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.screen-splash {
  min-height: calc(100vh - 40px);
  justify-content: center;
  align-items: flex-start;
  padding: 28px;
  border-radius: 34px;
  background:
    linear-gradient(180deg, rgba(255, 249, 242, 0.9), rgba(247, 235, 221, 0.94)),
    var(--surface);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.screen-splash::after {
  content: "";
  position: absolute;
  inset: auto -40px -90px auto;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: rgba(31, 107, 99, 0.12);
}

.brand-mark {
  width: 88px;
  height: 88px;
  border-radius: 28px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--primary), var(--primary-deep));
  color: #fff;
  font-weight: 800;
  font-size: 2rem;
  box-shadow: 0 18px 30px rgba(143, 68, 25, 0.26);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  display: block;
}

.splash-copy h1,
.hero-panel h2,
.topbar h2,
.section-head h3 {
  margin: 6px 0 0;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--primary-deep);
}

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

.loading-bar {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(31, 26, 23, 0.08);
  overflow: hidden;
  margin-top: 12px;
}

.loading-bar span {
  display: block;
  height: 100%;
  width: 42%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--primary));
  animation: loading 2.2s ease infinite;
}

.panel {
  background: var(--surface);
  backdrop-filter: blur(18px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.screen-login,
.screen-dashboard,
.screen-verify {
  padding-bottom: 22px;
}

.hero-panel,
.login-form,
.list-panel,
.verify-form {
  padding: 22px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.field span {
  font-weight: 600;
}

.form-message {
  margin: -2px 0 16px;
  font-size: 0.92rem;
}

.field input,
.field textarea {
  width: 100%;
  border: 1px solid rgba(31, 26, 23, 0.12);
  background: #fffdf9;
  border-radius: 16px;
  padding: 14px 16px;
  color: var(--text);
  outline: none;
}

.field input:focus,
.field textarea:focus {
  border-color: rgba(200, 108, 49, 0.7);
  box-shadow: 0 0 0 4px rgba(200, 108, 49, 0.12);
}

.primary-btn,
.ghost-btn,
.verify-btn {
  border: 0;
  cursor: pointer;
  transition: transform 180ms ease, opacity 180ms ease, background 180ms ease;
}

.primary-btn:hover,
.ghost-btn:hover,
.verify-btn:hover {
  transform: translateY(-1px);
}

.primary-btn {
  width: 100%;
  padding: 15px 18px;
  border-radius: 18px;
  color: #fff;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  box-shadow: 0 14px 26px rgba(143, 68, 25, 0.24);
}

.ghost-btn {
  padding: 11px 16px;
  border-radius: 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid var(--line);
}

.topbar,
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar.compact {
  align-items: flex-start;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.summary-card {
  padding: 18px 16px;
}

.summary-card strong {
  display: block;
  margin-top: 6px;
  font-size: 1.8rem;
}

.summary-card.accent {
  background: linear-gradient(160deg, rgba(31, 107, 99, 0.95), rgba(18, 76, 69, 0.9));
  color: #fff;
}

.summary-label,
.chip {
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.user-badge {
  margin: 8px 0 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.chip {
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(31, 107, 99, 0.12);
  color: var(--accent);
}

.filter-row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.filter-btn {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, color 180ms ease, border-color 180ms ease;
}

.filter-btn.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  color: #fff;
  border-color: transparent;
}

.case-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 18px;
}

.case-card {
  position: relative;
  padding: 18px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(31, 26, 23, 0.08);
}

.status-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.status-badge.completed {
  background: rgba(22, 163, 74, 0.14);
  color: #166534;
}

.status-badge.pending {
  background: rgba(200, 108, 49, 0.14);
  color: var(--primary-deep);
}

.case-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.meta-pill {
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(200, 108, 49, 0.1);
  color: var(--primary-deep);
  font-size: 0.82rem;
  font-weight: 600;
}

.case-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  flex-wrap: nowrap;
}

.case-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-left: auto;
}

.case-footer .muted {
  flex: 1;
  min-width: 0;
}

.case-footer-note {
  display: block;
}

.case-info {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

.case-info p {
  margin: 0;
}

.verify-btn {
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--text);
  color: #fff;
  font-weight: 700;
}

.call-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(31, 107, 99, 0.12);
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
  border: 1px solid rgba(31, 107, 99, 0.18);
}

.call-icon {
  font-size: 0.95rem;
  line-height: 1;
}

.case-brief {
  padding: 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(200, 108, 49, 0.08), rgba(31, 107, 99, 0.08));
  border: 1px solid rgba(31, 26, 23, 0.08);
  margin-bottom: 16px;
}

.case-brief h3 {
  margin: 0 0 12px;
}

.case-brief-grid {
  display: grid;
  gap: 8px;
}

.case-brief-grid p {
  margin: 0;
  color: var(--muted);
}

.upload-box {
  position: relative;
  border: 1.5px dashed rgba(31, 107, 99, 0.38);
  background: rgba(31, 107, 99, 0.06);
  border-radius: 20px;
  padding: 22px 18px;
}

.upload-box input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-copy strong {
  display: block;
  margin-bottom: 4px;
}

.camera-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 12px 16px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), #15544e);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.camera-icon {
  font-size: 1rem;
  line-height: 1;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 6px 0 18px;
}

.preview-item {
  min-height: 92px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(31, 26, 23, 0.08);
  display: flex;
  align-items: flex-end;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--muted);
}

@keyframes loading {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(260%);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 700px) {
  .app-shell {
    width: min(100%, 1100px);
    padding: 28px;
  }

  .screen-dashboard.active,
  .screen-verify.active {
    max-width: 920px;
    margin: 0 auto;
  }

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

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

  .preview-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 420px) {
  .app-shell {
    padding: 14px;
  }

  .screen-splash,
  .hero-panel,
  .login-form,
  .list-panel,
  .verify-form {
    padding: 18px;
  }

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

  .topbar,
  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .verify-btn,
  .ghost-btn {
    width: 100%;
  }

  .case-footer {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .case-footer .muted,
  .case-footer-note {
    flex: none;
    width: 100%;
  }

  .case-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    margin-left: 0;
    gap: 10px;
  }

  .case-actions .verify-btn,
  .case-actions .call-btn {
    width: 100%;
    min-width: 0;
  }

  .filter-btn {
    flex: 1 1 100%;
  }
}
