:root {
  --bg: #f3f6fb;
  --card: #fff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --soft: #f8fafc;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --shadow: 0 12px 30px rgba(15, 23, 42, .08);
}

* {
  box-sizing: border-box;
}

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

.app {
  max-width: 880px;
  margin: 0 auto;
  padding: 18px 14px 32px;
}

.hero {
  background: linear-gradient(135deg, #111827, #334155);
  color: #fff;
  border-radius: 26px;
  padding: 22px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}

.hero p {
  margin: 0 0 7px;
  color: #cbd5e1;
  font-size: 14px;
}

.hero h1 {
  margin: 0;
  font-size: 25px;
  line-height: 1.15;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
}

button {
  border: 0;
  border-radius: 14px;
  padding: 12px 14px;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
}

.primary {
  background: var(--primary);
  color: #fff;
}

.primary:active {
  background: var(--primary-dark);
}

.secondary {
  background: rgba(255, 255, 255, .14);
  color: #fff;
}

.logout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  text-decoration: none;
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.logout-btn:hover {
  background: rgba(255, 255, 255, .22);
}

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

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 16px;
  box-shadow: var(--shadow);
}

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

.card-head h2,
.totals-panel h2 {
  margin: 0;
  font-size: 19px;
}

.delete-btn {
  background: #fee2e2;
  color: #991b1b;
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 13px;
}

.grid-three,
.grid-two {
  display: grid;
  gap: 10px;
}

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

.grid-two {
  grid-template-columns: repeat(2, 1fr);
  margin-bottom: 14px;
}

.field {
  display: block;
  margin-bottom: 10px;
}

.field span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 6px;
}

.field input,
.field select {
  width: 100%;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--soft);
  padding: 0 13px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.field select {
  font-size: 16px;
}

.field input:focus,
.field select:focus {
  outline: 3px solid rgba(37, 99, 235, .17);
  border-color: var(--primary);
  background: #fff;
}

.summary-list {
  border-top: 1px solid var(--line);
  margin-top: 8px;
  padding-top: 8px;
}

.summary-list div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #f1f5f9;
}

.summary-list div:last-child {
  border-bottom: 0;
}

.summary-list span {
  color: var(--muted);
  font-size: 14px;
}

.summary-list strong {
  font-size: 17px;
  text-align: right;
}

.summary-list.compact {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 14px;
}

.summary-list.compact .accent {
  grid-column: 1 / -1;
  background: #f8fafc;
  border-radius: 14px;
  padding: 12px;
  margin-top: 4px;
}

.totals-panel {
  margin-top: 14px;
}

.final-card {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.final-card div {
  background: #0f172a;
  color: #fff;
  border-radius: 20px;
  padding: 16px;
}

.final-card span {
  display: block;
  color: #cbd5e1;
  font-size: 13px;
  margin-bottom: 8px;
}

.final-card strong {
  display: block;
  font-size: 28px;
  line-height: 1.05;
}

.final-card div:nth-child(2) {
    background: #ecfdf5;
    border: 2px solid #22c55e;
    color: #14532d;
}

.final-card div:nth-child(2) span {
    color: #15803d;
}

.final-card div:nth-child(2) strong {
    color: #166534;
}

@media (max-width: 640px) {
  .app {
    padding: 12px 10px 24px;
  }

  .hero {
    border-radius: 22px;
    padding: 18px;
  }

  .hero h1 {
    font-size: 21px;
  }

  .hero-actions {
    position: sticky;
    top: 8px;
    z-index: 5;
  }

  .hero-actions button {
    flex: 1;
  }

  .logout-btn {
    margin-left: 0;
    padding: 12px 6px;
    font-size: 14px;
  }

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

  .grid-two,
  .final-card {
    grid-template-columns: 1fr;
  }

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

  .panel {
    border-radius: 20px;
    padding: 14px;
  }

  .field input,
  .field select {
    height: 46px;
    font-size: 17px;
  }

  .final-card strong {
    font-size: 26px;
  }
}
