@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;1,300;1,400&family=DM+Sans:wght@300;400;500&display=swap');

/* ── Brand Tokens ─────────────────────────────────────── */
:root {
  --linen:        #eceae3;
  --linen-dark:   #e0ddd5;
  --white:        #ffffff;
  --navy:         #2b2d42;
  --navy-light:   #4a4d6a;
  --plum:         #8b2252;
  --steel:        #5b9db7;
  --steel-dark:   #4a8aa3;
  --steel-light:  #d6eaf2;
  --sage:         #7a9e7e;
  --critical:     #c0392b;
  --critical-bg:  #fdf0ef;
  --sell-green:   #2d6a4f;
  --sell-bg:      #d8f3dc;
  --storage-blue: #1d3557;
  --storage-bg:   #dbe9f4;
  --text-primary: #2b2d42;
  --text-secondary: #6b6f8a;
  --text-muted:   #9a9db8;
  --border:       #d8d5cc;
  --shadow-sm:    0 1px 3px rgba(43,45,66,0.08);
  --shadow-md:    0 4px 16px rgba(43,45,66,0.12);
  --shadow-lg:    0 8px 32px rgba(43,45,66,0.16);
  --radius-sm:    8px;
  --radius-md:    12px;
  --radius-lg:    16px;
  --radius-xl:    24px;
  --nav-height:   64px;
  --bottom-nav:   72px;
}

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

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--linen);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Typography ───────────────────────────────────────── */
h1, h2, h3 {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 400;
  line-height: 1.2;
}

h1 { font-size: clamp(1.8rem, 4vw, 2.4rem); }
h2 { font-size: clamp(1.3rem, 3vw, 1.6rem); }
h3 { font-size: 1.1rem; font-weight: 500; }

p, li { line-height: 1.6; }

/* ── App Shell ────────────────────────────────────────── */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-bottom: var(--bottom-nav);
}

/* ── Top Header ───────────────────────────────────────── */
.top-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.gl-logo {
  height: 36px;
  width: auto;
}

.header-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

.header-action {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Bottom Nav (Mobile) ──────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav);
  background: var(--white);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: color 0.2s;
  padding: 8px 0;
}

.nav-item svg {
  width: 22px;
  height: 22px;
  stroke-width: 1.5;
}

.nav-item.active {
  color: var(--steel);
}

.nav-item.active svg {
  stroke: var(--steel);
}

/* ── Page Content ─────────────────────────────────────── */
.page-content {
  flex: 1;
  padding: 20px 16px;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

/* ── Buttons ──────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--steel);
  color: var(--white);
}

.btn-primary:hover { background: var(--steel-dark); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

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

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

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px;
}

.btn-ghost:hover { background: var(--linen); color: var(--text-primary); }

.btn-danger {
  background: transparent;
  color: var(--critical);
  padding: 8px;
}

.btn-danger:hover { background: var(--critical-bg); }

.btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ── Cards ────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.card + .card { margin-top: 12px; }

/* ── Stat Cards ───────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 16px 12px;
  text-align: center;
  border: 1px solid var(--border);
}

.stat-number {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2rem;
  font-weight: 300;
  color: var(--navy);
  line-height: 1;
}

.stat-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── Progress Bar ─────────────────────────────────────── */
.progress-wrap {
  background: var(--linen-dark);
  border-radius: 100px;
  height: 8px;
  overflow: hidden;
  margin: 12px 0;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--steel), var(--sage));
  border-radius: 100px;
  transition: width 0.6s ease;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* ── Search & Filters ─────────────────────────────────── */
.search-bar {
  position: relative;
  margin-bottom: 12px;
}

.search-bar svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

.search-input {
  width: 100%;
  padding: 10px 12px 10px 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  background: var(--white);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s;
}

.search-input:focus { border-color: var(--steel); }
.search-input::placeholder { color: var(--text-muted); }

.filter-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 16px;
  scrollbar-width: none;
}

.filter-row::-webkit-scrollbar { display: none; }

.filter-select {
  flex-shrink: 0;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8rem;
  background: var(--white);
  color: var(--text-primary);
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b6f8a' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

.filter-select:focus { border-color: var(--steel); }

/* ── Badges / Tags ────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: lowercase;
}

.badge-sell    { background: var(--sell-bg);     color: var(--sell-green); }
.badge-storage { background: var(--storage-bg);  color: var(--storage-blue); }
.badge-mobile_kit { background: #fef3c7; color: #92400e; }
.badge-trash   { background: #f3f4f6; color: #6b7280; }
.badge-gift    { background: #fdf2f8; color: #9d174d; }

.priority-critical { color: var(--critical); font-size: 0.75rem; font-weight: 500; }
.priority-necessary { color: var(--text-muted); font-size: 0.75rem; }

/* ── Task Card ────────────────────────────────────────── */
.task-card {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 16px;
  border: 1px solid var(--border);
  margin-bottom: 10px;
  transition: box-shadow 0.2s;
}

.task-card:hover { box-shadow: var(--shadow-md); }

.task-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.task-title {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary);
  flex: 1;
}

.task-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

.task-description {
  font-size: 0.83rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
  line-height: 1.5;
}

.task-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.task-meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.task-meta-item svg {
  width: 12px;
  height: 12px;
}

/* ── Container Card ───────────────────────────────────── */
.container-card {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 16px;
  border: 1px solid var(--border);
  margin-bottom: 10px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  transition: box-shadow 0.2s;
}

.container-card:hover { box-shadow: var(--shadow-md); }

.container-photo {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  background: var(--linen-dark);
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.container-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.container-body { flex: 1; min-width: 0; }

.container-code {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--steel);
  margin-bottom: 2px;
}

.container-title {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.container-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.container-value {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1rem;
  color: var(--navy);
  margin-left: auto;
  flex-shrink: 0;
  align-self: center;
}

/* ── Modal ────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(43,45,66,0.5);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--white);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 24px 20px;
  width: 100%;
  max-width: 600px;
  max-height: 92vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

.modal-overlay.open .modal {
  transform: translateY(0);
}

.modal-handle {
  width: 36px;
  height: 4px;
  background: var(--border);
  border-radius: 100px;
  margin: 0 auto 20px;
}

.modal-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.4rem;
  font-weight: 400;
  margin-bottom: 4px;
}

.modal-subtitle {
  font-size: 0.83rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ── Form Elements ────────────────────────────────────── */
.form-group { margin-bottom: 16px; }

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

label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="url"],
textarea,
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  background: var(--linen);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--steel);
  background: var(--white);
}

textarea { resize: vertical; min-height: 80px; }

input::placeholder, textarea::placeholder { color: var(--text-muted); }

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

.empty-state svg {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  opacity: 0.3;
}

.empty-state p {
  font-size: 0.9rem;
  margin-top: 8px;
}

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

.section-count {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ── Toast ────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: calc(var(--bottom-nav) + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--navy);
  color: var(--white);
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  z-index: 300;
  opacity: 0;
  transition: all 0.3s;
  white-space: nowrap;
  pointer-events: none;
}

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

/* ── Loading ──────────────────────────────────────────── */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 0.9rem;
  gap: 10px;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--steel);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Desktop ──────────────────────────────────────────── */
@media (min-width: 768px) {
  .app-shell { padding-bottom: 0; }
  .bottom-nav { display: none; }
  .page-content { padding: 32px 24px; }

  .modal-overlay { align-items: center; padding: 20px; }
  .modal {
    border-radius: var(--radius-xl);
    max-height: 88vh;
    transform: translateY(16px) scale(0.97);
  }
  .modal-overlay.open .modal { transform: translateY(0) scale(1); }
  .modal-handle { display: none; }

  .top-header { padding: 0 32px; }
}

@media (min-width: 900px) {
  .page-content { padding: 40px 32px; }
}
