* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f4f6f9;
  color: #1e293b;
  min-height: 100vh;
}

/* ===== VIEWS ===== */
.view {
  display: none;
  max-width: 600px;
  margin: 0 auto;
  padding: 16px;
}
.view.active {
  display: block;
}
.hidden {
  display: none !important;
}

/* ===== HEADER ===== */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: #1e40af;
}

.header-right {
  display: flex;
  gap: 8px;
}

/* ===== BUTTONS ===== */
.btn-primary {
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 0.9rem;
  cursor: pointer;
  font-weight: 600;
}
.btn-primary:hover { background: #1d4ed8; }

.btn-secondary {
  background: #e2e8f0;
  color: #334155;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 0.9rem;
  cursor: pointer;
  font-weight: 600;
}
.btn-secondary:hover { background: #cbd5e1; }

.btn-danger {
  background: #ef4444;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 0.9rem;
  cursor: pointer;
  font-weight: 600;
}
.btn-danger:hover { background: #dc2626; }

.btn-back {
  background: none;
  border: none;
  color: #2563eb;
  font-size: 0.95rem;
  cursor: pointer;
  font-weight: 600;
  padding: 4px 0;
}
.btn-back:hover { text-decoration: underline; }

.btn-sm {
  padding: 6px 12px;
  font-size: 0.82rem;
}

/* ===== CUSTOMER LIST ===== */
.customer-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.customer-card {
  background: #fff;
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  transition: box-shadow 0.15s;
  border-left: 4px solid #2563eb;
}
.customer-card:hover {
  box-shadow: 0 3px 10px rgba(0,0,0,0.12);
}
.customer-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.customer-card .card-sub {
  font-size: 0.82rem;
  color: #64748b;
  margin-bottom: 4px;
}
.customer-card .card-action {
  font-size: 0.8rem;
  color: #dc2626;
  font-weight: 600;
}
.customer-card .card-action.done {
  color: #16a34a;
}

/* ===== EMPTY MSG ===== */
.empty-msg {
  text-align: center;
  color: #94a3b8;
  font-size: 0.9rem;
  margin-top: 30px;
}

/* ===== MODAL ===== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.modal-content {
  background: #fff;
  border-radius: 14px;
  padding: 24px;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.modal-content h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 4px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.87rem;
  font-weight: 600;
  color: #475569;
}

input[type="text"],
input[type="date"] {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.95rem;
  width: 100%;
  outline: none;
  transition: border 0.15s;
}
input:focus {
  border-color: #2563eb;
}

.required {
  color: #ef4444;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

/* ===== DETAIL VIEW ===== */
.customer-info {
  background: #fff;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}
.customer-info h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: #1e40af;
  margin-bottom: 6px;
}
.sub-info {
  font-size: 0.88rem;
  color: #64748b;
  margin-top: 2px;
}

.section {
  background: #fff;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}
.section h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: #334155;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 6px;
}

/* Next action */
.next-action-display {
  background: #fef9c3;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.9rem;
  margin-bottom: 10px;
  min-height: 36px;
  color: #713f12;
}
.next-action-display.empty {
  color: #94a3b8;
  background: #f8fafc;
  font-style: italic;
}

.action-input-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.action-input-row input[type="text"] {
  flex: 1;
  min-width: 120px;
}
.action-input-row input[type="date"] {
  width: 140px;
  flex-shrink: 0;
}

/* History */
.history-input-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.history-input-row input[type="date"] {
  width: 140px;
  flex-shrink: 0;
}
.history-input-row input[type="text"] {
  flex: 1;
  min-width: 120px;
}

.history-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  background: #f8fafc;
  border-radius: 8px;
  padding: 10px 12px;
  gap: 8px;
}
.history-item .history-text {
  flex: 1;
  font-size: 0.88rem;
}
.history-item .history-date {
  font-size: 0.78rem;
  color: #64748b;
  white-space: nowrap;
}
.history-item .delete-history {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 2px;
  flex-shrink: 0;
}
.history-item .delete-history:hover {
  color: #ef4444;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
  .action-input-row input[type="date"],
  .history-input-row input[type="date"] {
    width: 100%;
  }
}
