:root {
  --lavender: #CCA8D8;
  --mauve: #8474A1;
  --seafoam: #6EC6CA;
  --teal: #08979D;
  --deep-teal: #05585C;
  --ink: #062e33;
  --muted: #4d6f76;
  --sand: #f3fafb;
  --white: #ffffff;
  --danger: #c0392b;
  --warn: #b7791f;
  --ok: #1a7a4c;
  --pending: #08979D;
  --font-display: "Outfit", sans-serif;
  --font-body: "Figtree", sans-serif;
  --shadow: 0 16px 40px rgba(5, 88, 92, 0.12);
  --radius: 18px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--sand);
  min-height: 100vh;
  line-height: 1.5;
}
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
a { color: var(--teal); text-decoration: none; font-weight: 600; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }

.sky {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(204, 168, 216, 0.32), transparent 55%),
    radial-gradient(ellipse 70% 45% at 95% 0%, rgba(110, 198, 202, 0.38), transparent 50%),
    linear-gradient(180deg, #eef9fb 0%, var(--sand) 45%, #e4f4f5 100%);
}

.wrap { width: min(1080px, calc(100% - 2rem)); margin-inline: auto; }

/* Auth */
.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
}
.auth-card {
  width: min(420px, 100%);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(8, 151, 157, 0.12);
  border-radius: 24px;
  padding: 2rem 1.6rem;
  box-shadow: var(--shadow);
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.4rem;
}
.auth-brand img {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  box-shadow: 0 6px 16px rgba(5, 88, 92, 0.2);
}
.auth-brand h1 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.auth-brand p { color: var(--muted); font-size: 0.88rem; margin-top: 0.15rem; }
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
  padding: 0.3rem;
  background: rgba(8, 151, 157, 0.08);
  border-radius: 12px;
}
.auth-tabs button {
  border: 0;
  background: transparent;
  padding: 0.55rem;
  border-radius: 9px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.auth-tabs button.active {
  background: var(--white);
  color: var(--deep-teal);
  box-shadow: 0 2px 8px rgba(5, 88, 92, 0.1);
}

.field { margin-bottom: 0.95rem; }
.field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--deep-teal);
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  border: 1.5px solid rgba(8, 151, 157, 0.2);
  background: rgba(255, 255, 255, 0.9);
  outline: none;
  transition: border-color 0.2s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--teal);
}
.field textarea { resize: vertical; min-height: 88px; }
.field .hint { font-size: 0.78rem; color: var(--muted); margin-top: 0.3rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border: 0;
  cursor: pointer;
  border-radius: 12px;
  padding: 0.75rem 1.15rem;
  font-weight: 700;
  transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none !important; }
.btn-primary {
  background: linear-gradient(135deg, var(--seafoam), var(--teal));
  color: var(--white);
  box-shadow: 0 8px 22px rgba(8, 151, 157, 0.28);
  width: 100%;
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(8, 151, 157, 0.35);
}
.btn-ghost {
  background: rgba(255, 255, 255, 0.6);
  border: 1.5px solid rgba(8, 151, 157, 0.22);
  color: var(--deep-teal);
}
.btn-ghost:hover:not(:disabled) { border-color: var(--teal); }
.btn-sm { padding: 0.45rem 0.8rem; font-size: 0.88rem; border-radius: 10px; width: auto; }

.error-banner {
  background: rgba(192, 57, 43, 0.1);
  color: var(--danger);
  border: 1px solid rgba(192, 57, 43, 0.2);
  border-radius: 12px;
  padding: 0.7rem 0.9rem;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}
.success-banner {
  background: rgba(26, 122, 76, 0.1);
  color: var(--ok);
  border: 1px solid rgba(26, 122, 76, 0.2);
  border-radius: 12px;
  padding: 0.7rem 0.9rem;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}
.info-banner {
  background: rgba(8, 151, 157, 0.1);
  color: var(--deep-teal);
  border: 1px solid rgba(8, 151, 157, 0.18);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  font-size: 0.92rem;
  margin-bottom: 1rem;
}

/* App shell */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(14px);
  background: rgba(243, 250, 251, 0.8);
  border-bottom: 1px solid rgba(8, 151, 157, 0.1);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand img { width: 34px; height: 34px; border-radius: 9px; }
.brand span { font-size: 0.98rem; }
.topbar-actions { display: flex; align-items: center; gap: 0.6rem; }
.user-chip {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-tabs {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  padding: 0.15rem 0 0.85rem;
  -webkit-overflow-scrolling: touch;
}
.nav-tabs button {
  border: 0;
  background: transparent;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
.nav-tabs button.active {
  background: linear-gradient(135deg, rgba(110, 198, 202, 0.35), rgba(8, 151, 157, 0.22));
  color: var(--deep-teal);
}

main.content { flex: 1; padding: 1.5rem 0 3rem; }

.page-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2rem);
  letter-spacing: -0.035em;
  margin-bottom: 0.35rem;
}
.page-lead { color: var(--muted); margin-bottom: 1.5rem; max-width: 40rem; }

.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.9rem;
  margin-bottom: 1.5rem;
}
.metric {
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(8, 151, 157, 0.1);
  border-radius: var(--radius);
  padding: 1.1rem 1rem;
  box-shadow: 0 8px 24px rgba(5, 88, 92, 0.06);
}
.metric.hero {
  grid-column: span 2;
  background: linear-gradient(135deg, var(--deep-teal), var(--teal));
  color: var(--white);
  border: 0;
}
.metric .label {
  font-size: 0.8rem;
  font-weight: 600;
  opacity: 0.75;
  margin-bottom: 0.35rem;
}
.metric.hero .label { opacity: 0.85; color: #fff; }
.metric .value {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.metric.hero .value { font-size: 2.1rem; }

.panel {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(8, 151, 157, 0.1);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 8px 24px rgba(5, 88, 92, 0.05);
}
.panel h2 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  margin-bottom: 0.85rem;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}
.quick-actions button {
  text-align: left;
  padding: 1rem;
  border-radius: 14px;
  border: 1.5px solid rgba(8, 151, 157, 0.15);
  background: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s;
}
.quick-actions button:hover {
  border-color: var(--teal);
  transform: translateY(-1px);
}
.quick-actions strong {
  display: block;
  font-family: var(--font-display);
  margin-bottom: 0.2rem;
}
.quick-actions span { color: var(--muted); font-size: 0.85rem; }

/* Lists */
.list { display: flex; flex-direction: column; gap: 0.65rem; }
.list-item {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 0.85rem;
  align-items: center;
  padding: 0.75rem;
  border-radius: 14px;
  background: rgba(243, 250, 251, 0.8);
  border: 1px solid rgba(8, 151, 157, 0.08);
}
.list-item.no-thumb { grid-template-columns: 1fr auto; }
.thumb {
  width: 64px;
  height: 96px;
  border-radius: 10px;
  object-fit: cover;
  background: rgba(8, 151, 157, 0.12);
}
.list-item h3 {
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.list-item .meta { color: var(--muted); font-size: 0.82rem; margin-top: 0.2rem; }
.badge {
  display: inline-block;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge.pending { background: rgba(8, 151, 157, 0.15); color: var(--pending); }
.badge.approved { background: rgba(26, 122, 76, 0.15); color: var(--ok); }
.badge.rejected { background: rgba(192, 57, 43, 0.12); color: var(--danger); }
.empty {
  text-align: center;
  color: var(--muted);
  padding: 2rem 1rem;
}

/* Upload */
.upload-grid {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 1.25rem;
}
.dropzone {
  border: 2px dashed rgba(8, 151, 157, 0.3);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  background: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--teal);
  background: rgba(110, 198, 202, 0.12);
}
.dropzone input[type="file"] { display: none; }
.preview-frame {
  width: min(220px, 100%);
  aspect-ratio: 9 / 16;
  margin: 1rem auto 0;
  border-radius: 18px;
  overflow: hidden;
  background: #0a1f24;
  box-shadow: var(--shadow);
  touch-action: none;
  cursor: grab;
}
.preview-frame.is-dragging { cursor: grabbing; }
.preview-frame canvas, .preview-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}
.crop-panel {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 14px;
  background: rgba(243, 250, 251, 0.95);
  border: 1px solid rgba(8, 151, 157, 0.14);
}
.crop-panel h3 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
  letter-spacing: -0.02em;
}
.crop-panel .hint {
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 0.9rem;
}
.crop-row {
  display: grid;
  grid-template-columns: 88px 1fr auto;
  gap: 0.65rem;
  align-items: center;
  margin-bottom: 0.75rem;
}
.crop-row:last-child { margin-bottom: 0; }
.crop-row .crop-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--deep-teal);
}
.crop-row .crop-val {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  min-width: 3.5rem;
  text-align: right;
}
.crop-stepper {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.crop-stepper button {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1.5px solid rgba(8, 151, 157, 0.28);
  background: #fff;
  color: var(--deep-teal);
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.crop-stepper button:hover {
  border-color: var(--teal);
  background: rgba(110, 198, 202, 0.15);
}
.crop-stepper input[type="range"] {
  flex: 1;
  min-width: 0;
  height: 32px;
  margin: 0;
  cursor: pointer;
  accent-color: var(--teal);
}
.cats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.chip {
  border: 1.5px solid rgba(204, 168, 216, 0.55);
  background: rgba(255, 255, 255, 0.7);
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--deep-teal);
}
.chip.selected {
  background: linear-gradient(135deg, var(--seafoam), var(--teal));
  border-color: transparent;
  color: var(--white);
}
.chip:disabled { opacity: 0.4; cursor: not-allowed; }

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 46, 51, 0.35);
  display: grid;
  place-items: center;
  z-index: 100;
}
.loading-card {
  background: var(--white);
  border-radius: 16px;
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 600;
  box-shadow: var(--shadow);
}
.spinner {
  width: 22px;
  height: 22px;
  border: 2.5px solid rgba(8, 151, 157, 0.2);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.footer-note {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 1rem 0 2rem;
}

@media (max-width: 860px) {
  .metrics { grid-template-columns: 1fr 1fr; }
  .metric.hero { grid-column: span 2; }
  .upload-grid { grid-template-columns: 1fr; }
  .quick-actions { grid-template-columns: 1fr; }
  .user-chip { display: none; }
}

@media (max-width: 480px) {
  .metrics { grid-template-columns: 1fr; }
  .metric.hero { grid-column: span 1; }
  .list-item { grid-template-columns: 52px 1fr; }
  .list-item .side { grid-column: 2; }
}
