:root {
  --bg: #f5f0eb;
  --surface-1: #ede8e3;
  --surface-2: #ffffff;
  --border: #e0dbd5;
  --border-strong: #ccc5bc;
  --text-primary: #1a1a1a;
  --text-secondary: #6b6560;
  --text-muted: #9c9590;
  --text-danger: #c45454;
  --accent-green: #4a8c5c;
  --accent-amber: #c49032;
  --accent-red: #c45454;
  --accent-gray: #9c9590;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.08);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 24px;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}

.title {
  font-size: 22px;
  font-weight: 500;
  margin: 0 0 12px;
}

.tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tab {
  padding: 6px 14px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: var(--font);
}

.tab:hover {
  color: var(--text-primary);
}

.tab.active {
  background: var(--surface-1);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.header-right {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

/* Stat cards */
.stat-card {
  background: var(--surface-1);
  border-radius: var(--radius);
  padding: 10px 16px;
  min-width: 120px;
  display: flex;
  flex-direction: column;
}

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

.stat-value {
  font-size: 20px;
  font-weight: 500;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 13px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn i {
  font-size: 16px;
}

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

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

.btn-secondary {
  background: var(--surface-1);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border);
}

.btn-danger {
  background: transparent;
  color: var(--text-danger);
  border: 1px solid var(--border);
  padding: 8px 12px;
  min-width: 36px;
  justify-content: center;
}

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

.btn-flex {
  flex: 1;
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  color: var(--text-secondary);
  font-size: 16px;
  border-radius: 6px;
  transition: background 0.15s;
}

.btn-icon:hover {
  background: var(--surface-1);
}

/* Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

/* Card */
.card {
  background: var(--surface-2);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.card:hover {
  box-shadow: var(--shadow);
  border-color: var(--border-strong);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.card-name {
  font-size: 14px;
  font-weight: 500;
}

.badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
  background: var(--surface-1);
  color: var(--text-secondary);
  border: 0.5px solid var(--border-strong);
}

.card-price {
  font-size: 18px;
  font-weight: 500;
  margin-bottom: 2px;
}

.card-perday {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

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

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 48px;
  margin-bottom: 12px;
  display: block;
}

/* Overlay */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}

.overlay.open {
  display: flex;
}

.modal {
  background: var(--surface-2);
  border-radius: 12px;
  border: 0.5px solid var(--border);
  padding: 1.25rem 1.5rem;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
}

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

.modal-title {
  font-size: 16px;
  font-weight: 500;
}

.modal-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
}

/* Detail table */
.detail-table {
  width: 100%;
  font-size: 13px;
  margin-bottom: 12px;
  border-collapse: collapse;
}

.detail-label {
  color: var(--text-secondary);
  padding: 4px 0;
  white-space: nowrap;
}

.detail-label i {
  font-size: 15px;
  vertical-align: -2px;
  margin-right: 6px;
}

.detail-value {
  text-align: right;
  padding: 4px 0;
  font-variant-numeric: tabular-nums;
}

/* Notes */
.notes-label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.notes-wrapper {
  position: relative;
  margin-bottom: 8px;
}

.notes-textarea {
  width: 100%;
  font-size: 13px;
  font-family: var(--font);
  padding: 8px 40px 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  resize: vertical;
  background: var(--surface-1);
  color: var(--text-primary);
}

.btn-copy {
  position: absolute;
  top: 6px;
  right: 6px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 16px;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.15s;
}

.btn-copy:hover {
  color: var(--text-primary);
}

/* Form */
.form-group {
  margin-bottom: 14px;
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-row .form-group {
  flex: 1;
}

.form-label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.form-input,
.form-textarea {
  width: 100%;
  font-size: 14px;
  font-family: var(--font);
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-1);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s;
}

.form-input:focus,
.form-textarea:focus {
  border-color: var(--border-strong);
}

.form-textarea {
  resize: vertical;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--text-primary);
  color: var(--surface-2);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  opacity: 0;
  transition: all 0.25s ease;
  z-index: 200;
  pointer-events: none;
}

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

/* Responsive */
@media (max-width: 640px) {
  .container {
    padding: 20px 16px;
  }

  .header {
    flex-direction: column;
  }

  .header-right {
    width: 100%;
  }

  .stat-card {
    flex: 1;
    min-width: 0;
  }

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

  .form-row {
    flex-direction: column;
    gap: 0;
  }
}

/* Login */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  background: var(--surface-2);
  border: 0.5px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  width: 100%;
  max-width: 340px;
  text-align: center;
}

.login-title {
  font-size: 24px;
  font-weight: 600;
  margin: 0 0 4px;
}

.login-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0 0 24px;
}

.login-input {
  text-align: center;
  font-size: 16px;
  padding: 12px;
}

.login-btn {
  width: 100%;
  padding: 10px;
  font-size: 14px;
}

.login-error {
  color: var(--text-danger);
  font-size: 13px;
  min-height: 20px;
  margin: 0 0 8px;
}
