@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
  --bg: #F8F6F1;
  --bg-card: #ffffff;
  --bg-card-hover: #F0EDE6;
  --bg-sheet: #ffffff;
  --bg-input: #F5F3EE;
  --text: #151520;
  --text-dim: #6B6B8E;
  --text-muted: #9E9A90;
  --accent: #2C3E7A;
  --accent-mid: #3D52A0;
  --accent-glow: rgba(44,62,122,0.15);
  --accent-light: #E8ECF8;
  --danger: #943020;
  --danger-glow: rgba(148,48,32,0.12);
  --success: #266146;
  --border: #C8C4B8;
  --border-light: #E5E2DB;
  --border-focus: rgba(44,62,122,0.45);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --font: 'Inter', system-ui, sans-serif;
  --font-display: 'Space Grotesk', sans-serif;
  --shadow-sm: 0 1px 3px rgba(28,32,50,0.07);
  --shadow-md: 0 4px 12px rgba(28,32,50,0.09);
  --shadow-lg: 0 8px 24px rgba(28,32,50,0.12);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  overscroll-behavior-y: contain;
}

/* ── Header ─────────────────────────────── */
.mob-header {
  position: sticky; top: 0; z-index: 50;
  padding: 16px 20px 12px;
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-bottom: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}
.mob-header-top { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.mob-header-logo {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-display); font-weight: 700; font-size: 1.2rem;
  color: var(--accent); text-decoration: none;
}
.mob-header-logo svg { width: 26px; height: 26px; }
.mob-header-title { flex: 1; font-size: 0.82rem; color: var(--text-dim); font-weight: 400; }
.mob-header-count {
  background: var(--accent-light); border: 1px solid rgba(44,62,122,0.15);
  border-radius: 20px; padding: 4px 12px; font-size: 0.75rem;
  color: var(--accent); font-weight: 600;
}

/* Search */
.mob-search { position: relative; display: flex; align-items: center; }
.mob-search input {
  width: 100%; padding: 11px 14px 11px 40px;
  background: var(--bg-input); border: 1px solid var(--border-light);
  border-radius: var(--radius-sm); color: var(--text);
  font-size: 0.92rem; outline: none; transition: 0.2s;
}
.mob-search input::placeholder { color: var(--text-muted); }
.mob-search input:focus { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px rgba(44,62,122,0.08); }
.mob-search svg {
  position: absolute; left: 13px; width: 16px; height: 16px;
  color: var(--text-muted); pointer-events: none;
}

/* ── Object List ────────────────────────── */
.mob-list {
  padding: 12px 16px 120px;
  display: flex; flex-direction: column; gap: 10px;
}

.mob-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--bg-card); border: 1px solid var(--border-light);
  border-radius: var(--radius); padding: 14px;
  transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
  cursor: pointer; position: relative; overflow: hidden;
  -webkit-user-select: none; user-select: none;
  box-shadow: var(--shadow-sm);
}
.mob-card:active { transform: scale(0.98); background: var(--bg-card-hover); }
.mob-card:hover { box-shadow: var(--shadow-md); }

.mob-card-img {
  width: 56px; height: 56px; border-radius: 12px; overflow: hidden;
  background: var(--bg-input); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-light);
}
.mob-card-img img { width: 100%; height: 100%; object-fit: cover; }
.mob-card-dot {
  width: 32px; height: 32px; border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}
.mob-card-body { flex: 1; min-width: 0; }
.mob-card-name {
  font-weight: 600; font-size: 0.95rem; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mob-card-dims { font-size: 0.78rem; color: var(--text-dim); margin-top: 2px; }
.mob-card-actions { display: flex; gap: 6px; flex-shrink: 0; }
.mob-card-btn {
  width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-input); border: 1px solid var(--border-light);
  color: var(--text-dim); cursor: pointer; transition: 0.15s;
}
.mob-card-btn:active { transform: scale(0.9); }
.mob-card-btn.edit:hover, .mob-card-btn.edit:active { background: var(--accent-light); color: var(--accent); border-color: rgba(44,62,122,0.2); }
.mob-card-btn.del:hover, .mob-card-btn.del:active { background: #FFF0EE; color: var(--danger); border-color: rgba(148,48,32,0.2); }

/* ── Empty State ────────────────────────── */
.mob-empty {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 80px 32px; text-align: center;
}
.mob-empty-icon {
  width: 80px; height: 80px; border-radius: 24px;
  background: var(--accent-light);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 20px;
}
.mob-empty-icon svg { width: 36px; height: 36px; color: var(--accent); }
.mob-empty h2 { font-family: var(--font-display); font-size: 1.2rem; font-weight: 600; margin-bottom: 8px; color: var(--text); }
.mob-empty p { color: var(--text-dim); font-size: 0.88rem; line-height: 1.5; max-width: 260px; }

/* ── FAB ────────────────────────────────── */
.mob-fab {
  position: fixed; bottom: calc(24px + var(--safe-bottom)); right: 20px;
  width: 60px; height: 60px; border-radius: 18px;
  background: linear-gradient(135deg, var(--accent), var(--accent-mid));
  color: #fff; border: none; cursor: pointer; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 28px rgba(44,62,122,0.35), 0 2px 8px rgba(0,0,0,0.15);
  transition: transform 0.2s, box-shadow 0.2s;
}
.mob-fab:active { transform: scale(0.92); }
.mob-fab:hover { box-shadow: 0 10px 32px rgba(44,62,122,0.45), 0 2px 8px rgba(0,0,0,0.2); }
.mob-fab svg { width: 28px; height: 28px; }

/* ── Bottom Sheet (Modal) ───────────────── */
.mob-overlay {
  position: fixed; inset: 0; background: rgba(26,26,46,0.35);
  backdrop-filter: blur(4px); z-index: 100;
  opacity: 0; transition: opacity 0.25s;
  display: none;
}
.mob-overlay.active { display: block; opacity: 1; }

.mob-sheet {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--bg-sheet);
  border-radius: 24px 24px 0 0;
  max-height: 92dvh; overflow-y: auto;
  z-index: 101;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  padding-bottom: calc(16px + var(--safe-bottom));
  box-shadow: 0 -8px 40px rgba(0,0,0,0.12);
}
.mob-sheet.active { transform: translateY(0); }

.mob-sheet-handle {
  display: flex; justify-content: center; padding: 12px 0 4px;
}
.mob-sheet-handle::after {
  content: ''; width: 40px; height: 4px; border-radius: 4px;
  background: var(--border);
}
.mob-sheet-header {
  display: flex; align-items: center; padding: 8px 20px 16px;
}
.mob-sheet-title {
  flex: 1; font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; color: var(--text);
}
.mob-sheet-close {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--bg-input); border: 1px solid var(--border-light);
  color: var(--text-dim); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.mob-sheet-close:hover { background: var(--bg-card-hover); }
.mob-sheet-body { padding: 0 20px; display: flex; flex-direction: column; gap: 18px; }

/* Form fields */
.mob-field label {
  display: block; font-size: 0.75rem; font-weight: 600;
  color: var(--text-dim); text-transform: uppercase;
  letter-spacing: 0.06em; margin-bottom: 6px;
}
.mob-field input[type="text"],
.mob-field input[type="number"] {
  width: 100%; padding: 13px 14px;
  background: var(--bg-input); border: 1px solid var(--border-light);
  border-radius: var(--radius-xs); color: var(--text);
  font-size: 1rem; outline: none; transition: 0.2s;
}
.mob-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(44,62,122,0.08); background: #fff; }
.mob-dims-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

/* Color picker */
.mob-color-row { display: flex; align-items: center; gap: 12px; }
.mob-color-swatch {
  width: 44px; height: 44px; border-radius: 12px;
  border: 2px solid var(--border-light); cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.mob-color-hex { font-size: 0.88rem; color: var(--text-dim); font-family: monospace; }
.mob-color-row input[type="color"] { position: absolute; opacity: 0; width: 0; height: 0; }

/* Upload zone */
.mob-upload-zone {
  position: relative; border: 2px dashed var(--border);
  border-radius: var(--radius); padding: 24px 16px;
  text-align: center; cursor: pointer; transition: 0.2s;
  overflow: hidden; background: var(--bg-input);
}
.mob-upload-zone:active { border-color: var(--accent); background: var(--accent-light); }
.mob-upload-zone svg { margin: 0 auto 8px; color: var(--text-muted); }
.mob-upload-zone p { font-size: 0.82rem; color: var(--text-dim); }
.mob-upload-zone .hint { font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; }
.mob-upload-buttons {
  display: flex; gap: 10px; justify-content: center; margin: 8px 0 4px;
}
.mob-upload-opt {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 18px; border-radius: var(--radius-xs);
  background: #fff; border: 1px solid var(--border);
  color: var(--accent); font-size: 0.85rem; font-weight: 600;
  cursor: pointer; transition: 0.15s; font-family: var(--font);
}
.mob-upload-opt:active { transform: scale(0.96); background: var(--accent-light); }
.mob-upload-opt svg { flex-shrink: 0; }
.mob-upload-preview {
  position: absolute; inset: 0; background: var(--bg-input);
  display: flex; align-items: center; justify-content: center;
}
.mob-upload-preview img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
.mob-upload-clear {
  position: absolute; top: 8px; right: 8px;
  width: 28px; height: 28px; border-radius: 8px;
  background: rgba(0,0,0,0.5); border: none;
  color: #fff; cursor: pointer; display: flex;
  align-items: center; justify-content: center;
}

/* Sheet footer */
.mob-sheet-footer {
  padding: 16px 20px 0; display: flex; gap: 10px; margin-top: 8px;
}
.mob-btn {
  flex: 1; padding: 14px; border-radius: var(--radius-sm);
  font-size: 0.95rem; font-weight: 600; border: none;
  cursor: pointer; transition: 0.15s; display: flex;
  align-items: center; justify-content: center; gap: 8px;
}
.mob-btn:active { transform: scale(0.97); }
.mob-btn-cancel { background: var(--bg-input); color: var(--text-dim); border: 1px solid var(--border-light); }
.mob-btn-cancel:hover { background: var(--bg-card-hover); }
.mob-btn-save {
  background: linear-gradient(135deg, var(--accent), var(--accent-mid)); color: #fff;
  box-shadow: 0 4px 16px rgba(44,62,122,0.25);
}
.mob-btn-save:hover { box-shadow: 0 6px 20px rgba(44,62,122,0.35); }
.mob-btn-delete {
  background: linear-gradient(135deg, #dc2626, #b91c1c); color: #fff;
  box-shadow: 0 4px 16px rgba(220,38,38,0.2);
}

/* ── Confirm Dialog ─────────────────────── */
.mob-confirm {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(26,26,46,0.35); backdrop-filter: blur(6px);
  display: none; align-items: center; justify-content: center; padding: 24px;
}
.mob-confirm.active { display: flex; }
.mob-confirm-card {
  background: #fff; border-radius: var(--radius);
  padding: 24px; width: 100%; max-width: 340px;
  box-shadow: var(--shadow-lg);
  animation: sheetUp 0.25s ease;
}
.mob-confirm-card h3 { font-size: 1.05rem; font-weight: 600; margin-bottom: 8px; color: var(--text); }
.mob-confirm-card p { font-size: 0.88rem; color: var(--text-dim); margin-bottom: 20px; line-height: 1.5; }
.mob-confirm-actions { display: flex; gap: 10px; }

/* ── Toast ──────────────────────────────── */
.mob-toast-wrap {
  position: fixed; bottom: calc(96px + var(--safe-bottom));
  left: 50%; transform: translateX(-50%);
  z-index: 300; display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.mob-toast {
  background: #fff; border: 1px solid var(--border-light);
  border-radius: var(--radius-sm); padding: 12px 18px;
  font-size: 0.85rem; font-weight: 500; color: var(--text);
  white-space: nowrap;
  animation: toastIn 0.3s ease;
  box-shadow: var(--shadow-lg);
}
.mob-toast.out { opacity: 0; transition: opacity 0.25s; }

/* ── Animations ─────────────────────────── */
@keyframes sheetUp { from { opacity:0; transform:translateY(40px); } to { opacity:1; transform:translateY(0); } }
@keyframes toastIn { from { opacity:0; transform:translateX(-50%) translateY(12px); } to { opacity:1; transform:translateX(-50%) translateY(0); } }

/* ── Scrollbar ──────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Desktop: center content */
@media (min-width: 600px) {
  .mob-list, .mob-header { max-width: 480px; margin-left: auto; margin-right: auto; }
  .mob-sheet { max-width: 480px; left: 50%; transform: translateX(-50%) translateY(100%); }
  .mob-sheet.active { transform: translateX(-50%) translateY(0); }
}
