:root {
  --bg: #F7F4F1;
  --surface: #FFFFFF;
  --text: #32281F;
  --text-muted: #5C5249;
  --accent: #D2622A;
  --accent-light: #F4B99D;
  --border: #E8E1D8;
  --high: #D2622A;
  --medium: #A88A68;
  --low: #7D695D;
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 12px;
}

header {
  background: var(--surface);
  padding: 16px 16px 20px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
}

h1 {
  font-size: 26px;
  font-weight: 700;
  margin: 0;
  line-height: 1;
}

.subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin: 2px 0 0;
}

.header-right {
  text-align: right;
}

.open-count {
  background: var(--accent);
  color: white;
  padding: 4px 14px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.open-count .count-label {
  font-size: 13px;
  font-weight: 400;
  opacity: 0.9;
}

main {
  padding: 20px 0;
}

.add-section {
  background: var(--surface);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 22px;
  box-shadow: 0 1px 2px rgba(50, 40, 31, 0.06);
}

.add-section h2 {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 14px;
  color: var(--text);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-field {
  margin-bottom: 14px;
}

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

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}

input[type="text"],
input[type="tel"] {
  width: 100%;
  padding: 14px;
  font-size: 17px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.1s ease;
}

input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(210, 98, 42, 0.1);
}

.urgency-buttons {
  display: flex;
  gap: 8px;
}

.urgency-btn {
  flex: 1;
  padding: 10px 0;
  font-size: 15px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  cursor: pointer;
  color: var(--text);
  transition: all 0.1s ease;
}

.urgency-btn[aria-pressed="true"] {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.urgency-btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(210, 98, 42, 0.2);
}

.btn {
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  padding: 14px 22px;
  border-radius: 8px;
  cursor: pointer;
  border: none;
  transition: transform 0.05s ease, background 0.1s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn:active {
  transform: scale(0.985);
}

.btn-primary {
  background: var(--accent);
  color: white;
  width: 100%;
  font-size: 17px;
  margin-top: 6px;
}

.btn-primary:disabled {
  opacity: .6;
}

.btn-ghost {
  background: none;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 10px;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-sm {
  font-size: 13px;
  padding: 5px 10px;
  font-weight: 500;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding: 0 4px;
}

.section-header h2 {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}

.callback-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.callback-card {
  background: var(--surface);
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: 0 1px 3px rgba(50, 40, 31, 0.05);
  font-size: 14.5px;
  border: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  align-items: start;
}

.card-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.card-name {
  font-weight: 700;
  font-size: 17px;
  margin-right: 8px;
  color: var(--text);
}

.card-phone {
  font-size: 15px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.card-phone:hover {
  text-decoration: underline;
}

.card-need {
  font-size: 14px;
  line-height: 1.3;
  margin-top: 4px;
  color: var(--text);
  word-break: break-word;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 12.5px;
}

.urgency-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 1px 9px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.urgency-badge.high { background: #f4e6dc; color: var(--high); }
.urgency-badge.medium { background: #f0e8dd; color: var(--medium); }
.urgency-badge.low { background: #e8e4df; color: var(--low); }

.time-ago {
  color: var(--text-muted);
  font-size: 12px;
}

.card-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
  margin-top: 2px;
}

.mark-done {
  background: var(--accent);
  color: white;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 13px;
  border-radius: 9999px;
  white-space: nowrap;
}

.action-btn {
  background: none;
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
  padding: 3px 7px;
  border-radius: 4px;
  cursor: pointer;
}

.action-btn.danger {
  color: #9B664F;
  border-color: #D9C9B6;
}

.hidden {
  display: none !important;
}

.list-section {
  margin-bottom: 22px;
}

.section-toggle {
  background: none;
  border: 0;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  padding: 4px 0;
}

.section-toggle:hover {
  color: var(--accent);
}

.chevron {
  font-weight: 400;
  display: inline-block;
  transition: transform 0.15s ease;
  font-size: 19px;
  line-height: 1;
}

.section-toggle[aria-expanded="true"] .chevron {
  transform: rotate(90deg);
}

#done-list {
  margin-top: 6px;
}

.empty-state {
  text-align: center;
  padding: 26px 20px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 14px;
}

.toast {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: #33291D;
  color: #fff;
  font-size: 14px;
  padding: 10px 20px;
  border-radius: 9999px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  max-width: 320px;
  text-align: center;
  z-index: 100;
}

.toast.show {
  opacity: 1;
  pointer-events: auto;
}

/* Mobile */
@media (max-width: 520px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
  
  .card-actions {
    flex-direction: row;
    justify-content: flex-end;
    width: 100%;
    margin-top: 8px;
  }
  
  .action-btn {
    flex: 1;
  }
}