/* === Reset & Base === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --bg: #f3f4f6;
  --card-bg: #ffffff;
  --text: #1f2937;
  --text-light: #6b7280;
  --border: #e5e7eb;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

/* === Privacy Banner === */
#privacy-banner {
  background: var(--accent);
  color: #fff;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  font-size: 0.875rem;
  text-align: center;
}

#privacy-banner.hidden {
  display: none;
}

#dismiss-banner {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.25rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  opacity: 0.8;
  flex-shrink: 0;
}

#dismiss-banner:hover {
  opacity: 1;
}

/* === Header === */
header {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 24px 20px;
  text-align: center;
}

.header-inner h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
}

.subtitle {
  color: var(--text-light);
  font-size: 0.875rem;
  margin-top: 2px;
}

/* === Main === */
main {
  max-width: 800px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

/* === Cards === */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.card h2 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-header h2 {
  margin-bottom: 0;
}

.card-actions {
  display: flex;
  gap: 8px;
}

/* === Fields === */
.field {
  margin-bottom: 14px;
}

.field:last-child {
  margin-bottom: 0;
}

.field label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-light);
  margin-bottom: 4px;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9375rem;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  transition: border-color 0.15s;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.field textarea {
  resize: vertical;
}

/* === Grid === */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 500px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

/* === Buttons === */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 32px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-small {
  padding: 6px 14px;
  font-size: 0.8125rem;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  border: none;
  transition: background 0.15s;
}

.btn-small:hover {
  background: var(--accent-hover);
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.btn-outline:hover {
  background: rgba(37, 99, 235, 0.06);
  color: var(--accent-hover);
}

/* === Items Table === */
.items-table-wrap {
  overflow-x: auto;
  margin-bottom: 14px;
  -webkit-overflow-scrolling: touch;
}

#items-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 480px;
}

#items-table th {
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-light);
  padding: 8px 6px;
  border-bottom: 2px solid var(--border);
}

#items-table td {
  padding: 6px;
  vertical-align: top;
}

#items-table td input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
}

#items-table td input:focus {
  outline: none;
  border-color: var(--accent);
}

.col-desc { width: 42%; }
.col-qty { width: 12%; }
.col-price { width: 18%; }
.col-total { width: 18%; }
.col-action { width: 10%; }

.item-total-display {
  font-size: 0.9rem;
  padding: 7px 10px;
  color: var(--text);
  font-weight: 500;
  white-space: nowrap;
}

.btn-remove {
  background: none;
  border: none;
  color: #ef4444;
  cursor: pointer;
  font-size: 1.2rem;
  padding: 6px 8px;
  border-radius: 4px;
  transition: background 0.15s;
}

.btn-remove:hover {
  background: #fef2f2;
}

/* === Totals === */
.totals {
  margin-top: 16px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  max-width: 300px;
  margin-left: auto;
}

.totals-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 0.9375rem;
}

.totals-grand {
  border-top: 2px solid var(--text);
  margin-top: 6px;
  padding-top: 10px;
  font-weight: 700;
  font-size: 1.05rem;
}

/* === Actions === */
.actions {
  text-align: center;
  margin-top: 8px;
}

/* === Footer === */
footer {
  text-align: center;
  padding: 24px 16px;
  color: var(--text-light);
  font-size: 0.8125rem;
}

/* === Responsive === */
@media (max-width: 600px) {
  .card {
    padding: 16px;
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  main {
    padding: 16px 10px 40px;
  }

  header {
    padding: 18px 16px;
  }

  .header-inner h1 {
    font-size: 1.25rem;
  }

  .btn-primary {
    width: 100%;
  }
}
