:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-subtle: #efede8;
  --border: #e4e1d8;
  --border-strong: #cfcac0;
  --ink: #171717;
  --ink-muted: #6c6a64;
  --ink-faint: #9c9990;
  --accent: #18181b;
  --accent-hover: #2e2e33;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --success: #15803d;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 20px 44px rgba(0, 0, 0, 0.14);
}

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

body {
  margin: 0;
  font-family: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(246, 245, 241, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 14px;
  padding-bottom: 14px;
}

.brand-kicker {
  font-size: 10px;
  letter-spacing: 0.16em;
  font-weight: 700;
  color: var(--ink-muted);
}

.brand-title {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-dot {
  color: var(--ink-faint);
  font-weight: 400;
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
}

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

.btn-ghost {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border);
}

.btn-ghost:hover {
  background: var(--surface-subtle);
  border-color: var(--border-strong);
}

.btn-danger-ghost {
  background: transparent;
  color: var(--danger);
  border-color: transparent;
}

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

.btn-sm {
  padding: 5px 9px;
  font-size: 12px;
  border-radius: 6px;
}

.count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--surface-subtle);
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
}

/* Main */
.main-content {
  padding-top: 22px;
  padding-bottom: 64px;
}

/* Stats */
.stats-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: var(--shadow-sm);
}

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

.stat-value {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* Toolbar */
.toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 22px;
}

.toolbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.status-tabs {
  display: inline-flex;
  background: var(--surface-subtle);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.tab-btn {
  border: none;
  background: transparent;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-muted);
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
}

.tab-btn.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.search-sort-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  justify-content: flex-end;
  min-width: 260px;
}

.search-box {
  position: relative;
  flex: 1;
  max-width: 340px;
}

.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--ink-faint);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  padding: 9px 12px 9px 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  font-family: inherit;
  color: var(--ink);
}

.search-box input:focus,
.sort-select:focus {
  outline: none;
  border-color: var(--accent);
}

.sort-select {
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  color: var(--ink);
  cursor: pointer;
}

.mall-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mall-pill {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-muted);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.mall-pill.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

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

.cloth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.cloth-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.cloth-card.is-hidden {
  opacity: 0.72;
}

.card-media {
  position: relative;
  aspect-ratio: 4 / 5;
  background: var(--surface-subtle);
  overflow: hidden;
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-media-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--ink-faint);
  font-size: 12px;
  padding: 16px;
  text-align: center;
  gap: 6px;
}

.card-badges {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  backdrop-filter: blur(6px);
}

.chip-mall {
  background: rgba(24, 24, 27, 0.78);
  color: #ffffff;
}

.chip-status {
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  border: 1px solid var(--border);
}

.card-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.card-brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-brand {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-category {
  font-size: 11px;
  color: var(--ink-faint);
  flex-shrink: 0;
}

.card-name {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 39px;
}

.card-meta-highlight {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 4px;
}

.size-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--accent);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 6px;
  max-width: 58%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.size-badge.empty {
  background: var(--surface-subtle);
  color: var(--ink-muted);
  font-weight: 600;
}

.card-price {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.card-submeta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: var(--ink-faint);
}

.card-memo {
  font-size: 12px;
  color: var(--ink-muted);
  background: var(--bg);
  border-radius: 6px;
  padding: 6px 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-actions {
  margin-top: auto;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  background: #fcfbf9;
}

.card-actions-left {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 64px 20px;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
}

.empty-icon {
  font-size: 40px;
  margin-bottom: 10px;
}

.empty-state h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.empty-state p {
  margin: 0 0 20px;
  font-size: 14px;
  color: var(--ink-muted);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(15, 15, 15, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-wide {
  max-width: 720px;
}

.modal-narrow {
  max-width: 420px;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
}

.modal-subtitle {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--ink-muted);
}

.modal-close {
  border: none;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  color: var(--ink-muted);
  cursor: pointer;
  padding: 0 4px;
}

.modal-body {
  padding: 20px 22px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 8px;
}

.image-upload-row {
  display: flex;
  gap: 14px;
  align-items: center;
}

.image-preview-box {
  width: 96px;
  height: 120px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-strong);
  background: var(--bg);
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--ink-faint);
  text-align: center;
  padding: 6px;
}

.image-preview-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-inputs {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-muted);
}

.form-label input[type='text'],
.form-label input[type='url'],
.form-label input[type='number'],
.form-label input[type='password'],
.form-label textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  font-size: 13px;
  font-family: inherit;
  color: var(--ink);
  background: var(--surface);
}

.form-label input:focus,
.form-label textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.file-input {
  font-size: 12px;
}

/* Blocklist */
.blocklist-body {
  gap: 10px;
}

.blocklist-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.blocklist-info {
  min-width: 0;
  flex: 1;
}

.blocklist-title {
  font-size: 13px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.blocklist-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--accent);
  color: #ffffff;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-md);
}

.toast.error {
  background: var(--danger);
}

@media (max-width: 640px) {
  .stats-strip {
    grid-template-columns: 1fr;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .wardrobe-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .image-upload-row {
    flex-direction: column;
    align-items: stretch;
  }
  .image-preview-box {
    width: 100%;
    height: 160px;
  }
}
