/* ── Variables ─────────────────────────────────────────────────────────────── */
:root {
  --bg:            #0c0c10;
  --surface:       #13131a;
  --card:          #1b1b24;
  --card-hover:    #202030;
  --border:        #26263a;
  --border-mid:    #32324a;
  --border-light:  #3e3e58;
  --text:          #e0e0f0;
  --text-muted:    #7070a0;
  --text-dim:      #40405a;
  --accent:        #e8534a;
  --accent-hover:  #d44840;
  --accent-soft:   rgba(232,83,74,0.12);
  --success:       #3ecf8e;
  --success-soft:  rgba(62,207,142,0.12);
  --blue:          #5b9cf6;
  --blue-soft:     rgba(91,156,246,0.12);
  --amber:         #f0a843;
  --amber-soft:    rgba(240,168,67,0.12);
  --radius:        10px;
  --radius-sm:     6px;
  --shadow:        0 4px 24px rgba(0,0,0,0.4);
  --shadow-lg:     0 16px 60px rgba(0,0,0,0.6);
  --t:             0.16s ease;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Header ────────────────────────────────────────────────────────────────── */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

.logo {
  font-size: 2rem;
  line-height: 1;
  flex-shrink: 0;
}

h1 {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.header-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}

.header-stats {
  display: flex;
  gap: 1.5rem;
}

.stat { text-align: right; }

.stat-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
  line-height: 1;
}

.stat-label {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Tabs ───────────────────────────────────────────────────────────────────── */
.tabs-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
  position: sticky;
  top: 65px;
  z-index: 99;
}

.tabs-bar::-webkit-scrollbar { display: none; }

.tab-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0.75rem 1.125rem;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color var(--t), border-color var(--t);
  font-family: inherit;
}

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

.tab-btn.active {
  color: var(--text);
  border-bottom-color: var(--tab-color, var(--accent));
}

.tab-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 20px;
  background: var(--border);
  color: var(--text-muted);
  transition: background var(--t), color var(--t);
}

.tab-btn.active .tab-pill {
  background: var(--accent-soft);
  color: var(--accent);
}

/* ── Main ───────────────────────────────────────────────────────────────────── */
main {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* ── Section header ─────────────────────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.section-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.section-name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

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

.section-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Progress bar */
.progress-wrap {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  margin-bottom: 1rem;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  border-radius: 2px;
  transition: width 0.45s cubic-bezier(0.4,0,0.2,1);
}

/* ── Items list ─────────────────────────────────────────────────────────────── */
.items-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 0.875rem;
}

/* ── Item card ──────────────────────────────────────────────────────────────── */
.item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  transition: background var(--t), border-color var(--t), opacity var(--t);
}

.item:hover {
  background: var(--card-hover);
  border-color: var(--border-mid);
}

.item.done {
  opacity: 0.45;
}

.item.done .item-label {
  text-decoration: line-through;
  color: var(--text-muted);
}

/* Custom checkbox */
.check-box {
  width: 19px;
  height: 19px;
  border: 1.5px solid var(--border-light);
  border-radius: 5px;
  flex-shrink: 0;
  margin-top: 1px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--t), border-color var(--t);
  user-select: none;
}

.check-box:hover { border-color: var(--success); }

.check-box.done {
  background: var(--success);
  border-color: var(--success);
}

.check-box.done::after {
  content: '';
  display: block;
  width: 5px;
  height: 9px;
  border: 2px solid #0c0c10;
  border-top: none;
  border-left: none;
  transform: rotate(45deg) translate(-1px, -1px);
}

/* Item content */
.item-content { flex: 1; min-width: 0; }

.item-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.item-label {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
  line-height: 1.4;
}

.item-cost {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--blue-soft);
  color: var(--blue);
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.item-note {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
  line-height: 1.4;
}

/* Item action buttons */
.item-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity var(--t);
}

.item:hover .item-actions { opacity: 1; }

.act-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  line-height: 1;
  text-decoration: none;
  transition: background var(--t), color var(--t);
  font-family: inherit;
}

.act-btn:hover {
  background: var(--border-mid);
  color: var(--text);
}

.act-btn.del:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.act-btn.lnk:hover {
  background: var(--blue-soft);
  color: var(--blue);
}

/* ── Add item button ─────────────────────────────────────────────────────────── */
.btn-add-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px;
  background: transparent;
  border: 1px dashed var(--border-mid);
  border-radius: var(--radius);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t);
  font-family: inherit;
}

.btn-add-item:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

/* ── Delete section ──────────────────────────────────────────────────────────── */
.btn-del-section {
  padding: 4px 10px;
  font-size: 11px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--t);
  font-family: inherit;
}

.btn-del-section:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-mid);
  background: transparent;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t);
  font-family: inherit;
  line-height: 1;
}

.btn-icon:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.btn-primary {
  padding: 8px 20px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t), transform var(--t);
  font-family: inherit;
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  padding: 8px 16px;
  background: transparent;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--t);
  font-family: inherit;
}

.btn-secondary:hover {
  border-color: var(--border-light);
  color: var(--text);
}

/* ── Modal ───────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
  padding: 1rem;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--card);
  border: 1px solid var(--border-mid);
  border-radius: 14px;
  width: 460px;
  max-width: 100%;
  box-shadow: var(--shadow-lg);
  animation: modal-in 0.18s ease;
}

.modal-sm { width: 360px; }

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.125rem 1.375rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 15px;
  font-weight: 600;
}

.modal-close {
  width: 26px;
  height: 26px;
  border: none;
  background: var(--border);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t);
  font-family: inherit;
}

.modal-close:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.modal-body {
  padding: 1.25rem 1.375rem;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.modal-body label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.modal-body input[type="text"],
.modal-body input[type="url"] {
  background: var(--surface);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.875rem;
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color var(--t);
  font-family: inherit;
  width: 100%;
}

.modal-body input:focus {
  border-color: var(--accent);
}

.color-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-body input[type="color"] {
  width: 40px;
  height: 32px;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  padding: 2px;
}

.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 1rem 1.375rem;
  border-top: 1px solid var(--border);
}

/* ── Toast ───────────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--card);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  padding: 0.7rem 1.125rem;
  font-size: 13px;
  color: var(--text);
  z-index: 2000;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ── Empty state ─────────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-dim);
  font-size: 13px;
}

/* ── Booking Order timeline ──────────────────────────────────────────────────── */
.booking-order {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.phase-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 0.625rem;
}

.phase-name {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.phase-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.badge-critical { background: rgba(232,83,74,0.18);  color: var(--accent); }
.badge-high     { background: rgba(240,168,67,0.18); color: var(--amber); }
.badge-medium   { background: rgba(91,156,246,0.18); color: var(--blue); }
.badge-low      { background: rgba(62,207,142,0.12); color: var(--success); }

.phase-items {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.phase-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  transition: background var(--t), border-color var(--t);
}

.phase-item:hover {
  background: var(--card-hover);
  border-color: var(--border-mid);
}

.phase-item-content { flex: 1; min-width: 0; }

.phase-item-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.phase-link {
  opacity: 0;
  transition: opacity var(--t);
  flex-shrink: 0;
}

.phase-item:hover .phase-link { opacity: 1; }

/* ── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  header { padding: 0.875rem 1rem; }
  .header-sub { display: none; }
  .header-stats { gap: 1rem; }
  main { padding: 1rem; }
  .tabs-bar { padding: 0 1rem; }
  .modal { border-radius: 12px; }

  /* items: show actions always on mobile (no hover) */
  .item-actions { opacity: 1; }
  .phase-link { opacity: 1; }

  /* tighten item padding on small screens */
  .item,
  .phase-item { padding: 0.7rem 0.75rem; gap: 0.6rem; }

  /* modal full-width on phone */
  .modal, .modal-sm { width: 100%; border-radius: 14px 14px 0 0; }
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
}
