:root {
  --background: #f4f4f1;
  --surface: #ffffff;
  --foreground: #171817;
  --muted: #666a65;
  --border: #d8d8d1;
  --primary: #185c52;
  --primary-soft: #dcebe7;
  --warm: #ffe0d1;
  --warm-text: #7a3323;
  --danger: #a9392d;
  --danger-soft: #fae3df;
  --shadow: 0 10px 28px rgba(22, 25, 22, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--foreground);
  background: var(--background);
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html {
  min-width: 320px;
  background: var(--background);
}

body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
.button,
.icon-button {
  cursor: pointer;
}

svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.app-shell {
  width: min(100%, 700px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--background);
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 10px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 7px;
  background: var(--primary);
  color: white;
}

.header-actions,
.row-actions,
.inline-actions,
.secondary-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--foreground);
}

.icon-button:hover,
.icon-button:focus-visible {
  background: var(--primary-soft);
}

.icon-button.outlined {
  border: 1px solid var(--border);
  background: var(--surface);
}

.icon-button.compact {
  width: 34px;
  height: 34px;
}

.view-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin: 0 16px 10px;
  padding: 4px;
  border-radius: 8px;
  background: #e9e9e4;
}

.view-tabs a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 7px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.88rem;
}

.view-tabs a.is-active {
  background: var(--surface);
  color: var(--primary);
  font-weight: 600;
}

.page-content {
  padding: 8px 18px 40px;
}

.page-heading,
.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 10px 0 18px;
}

.section-heading {
  display: block;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 1.55rem;
  line-height: 1.25;
}

h2 {
  font-size: 1.06rem;
}

.page-heading p,
.section-heading p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.9rem;
}

.soft-badge {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--warm);
  color: var(--warm-text);
  font-size: 0.78rem;
}

.messages {
  display: grid;
  gap: 6px;
  padding: 0 18px 4px;
}

.message {
  padding: 10px 12px;
  border-left: 3px solid var(--primary);
  background: var(--primary-soft);
  font-size: 0.9rem;
}

.message-error {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.auth-panel {
  width: min(100%, 420px);
  margin: 52px auto 0;
}

.stack-form {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 600;
}

.field small {
  color: var(--muted);
  font-weight: 400;
}

.field ul,
.errorlist {
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--danger);
  font-size: 0.82rem;
  font-weight: 500;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="search"],
input[type="file"],
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #c6c8c2;
  border-radius: 7px;
  outline: none;
  background: var(--surface);
  color: var(--foreground);
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(24, 92, 82, 0.22);
  outline-offset: 1px;
}

input[type="checkbox"] {
  accent-color: var(--primary);
}

.field-inline {
  display: inline-flex;
  margin-right: 10px;
}

.field-inline label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

#id_usage_tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

#id_usage_tags label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 400;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--foreground);
  font-weight: 600;
}

.button-primary {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
}

.button-danger {
  border-color: var(--danger);
  background: var(--danger);
  color: white;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.button-block {
  width: 100%;
}

.compact-button {
  min-height: 38px;
  padding: 7px 10px;
  font-size: 0.84rem;
}

.search-field {
  position: relative;
  display: block;
}

.search-field svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
}

.search-field input {
  padding-left: 40px;
}

.filter-form {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
}

.filter-grid select {
  min-width: 0;
  min-height: 38px;
  padding: 7px 8px;
  font-size: 0.82rem;
}

.bulk-panel {
  display: grid;
  gap: 12px;
}

.bulk-toolbar {
  display: flex;
  align-items: center;
  gap: 7px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.bulk-toolbar select {
  width: auto;
  min-width: 112px;
  min-height: 38px;
  padding: 7px 8px;
  font-size: 0.82rem;
}

.select-all {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.82rem;
}

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

.shoe-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.shoe-card > a {
  display: block;
}

.shoe-card img,
.shoe-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #e6e7e2;
  color: var(--muted);
}

.shoe-placeholder svg {
  width: 34px;
  height: 34px;
}

.shoe-card-copy {
  display: block;
  padding: 10px;
}

.shoe-card-copy strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shoe-card-copy small {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 5px;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shoe-card-copy small svg {
  width: 14px;
  height: 14px;
}

.card-check {
  position: absolute;
  top: 7px;
  right: 7px;
  z-index: 2;
}

.card-check input {
  position: absolute;
  opacity: 0;
}

.card-check span {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border: 2px solid white;
  border-radius: 50%;
  background: rgba(23, 24, 23, 0.42);
  color: transparent;
}

.card-check input:checked + span {
  background: var(--primary);
  color: white;
}

.location-list {
  display: grid;
}

.location-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 68px;
  border-bottom: 1px solid var(--border);
}

.location-main {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  padding: 9px 0;
}

.location-main > span:last-child {
  min-width: 0;
}

.location-main strong,
.location-main small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.location-main small {
  margin-top: 3px;
  color: var(--muted);
}

.location-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 7px;
  background: var(--primary-soft);
  color: var(--primary);
}

.location-summary,
.location-callout,
.warning-box {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 18px;
  padding: 13px;
  border-left: 3px solid var(--primary);
  background: var(--primary-soft);
}

.location-summary div,
.location-callout span {
  display: grid;
  flex: 1;
  gap: 2px;
}

.location-summary span,
.location-callout small {
  color: var(--muted);
}

.warning-box {
  align-items: flex-start;
  border-color: var(--danger);
  background: var(--danger-soft);
}

.detail-photos {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.detail-photos.two-photos {
  grid-template-columns: 1fr 1fr;
}

.detail-photos img,
.detail-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  background: #e6e7e2;
  color: var(--muted);
}

.detail-placeholder svg {
  width: 48px;
  height: 48px;
}

.detail-list {
  margin: 0;
}

.detail-list > div {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.detail-list dt {
  color: var(--muted);
}

.detail-list dd {
  margin: 0;
}

.existing-photos {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-bottom: 18px;
}

.existing-photos > div {
  position: relative;
}

.existing-photos img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
}

.photo-delete {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 30px;
  height: 30px;
  background: rgba(255, 255, 255, 0.9);
}

.settings-links {
  display: grid;
  margin-top: 26px;
  border-top: 1px solid var(--border);
}

.settings-links a,
.settings-links button {
  display: grid;
  grid-template-columns: 24px 1fr 24px;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 54px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--foreground);
  text-align: left;
}

.danger-link {
  color: var(--danger) !important;
}

.secondary-actions {
  justify-content: flex-end;
  margin-top: 24px;
}

.text-link {
  font-weight: 600;
}

.empty-state {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 52px 16px;
  color: var(--muted);
  text-align: center;
}

.empty-state > svg {
  width: 34px;
  height: 34px;
}

.span-all {
  grid-column: 1 / -1;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: 20px;
  color: var(--muted);
  font-size: 0.88rem;
}

.pagination a {
  color: var(--primary);
  font-weight: 600;
}

@media (max-width: 560px) {
  .filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-grid select:last-child {
    grid-column: 1 / -1;
  }

  .bulk-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch;
    overflow: visible;
  }

  .bulk-toolbar .select-all {
    grid-column: 1 / -1;
  }

  .bulk-toolbar select {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 360px) {
  .page-content {
    padding-inline: 14px;
  }

  .app-header {
    padding-inline: 14px;
  }

  .view-tabs {
    margin-inline: 12px;
  }

  .shoe-grid {
    gap: 8px;
  }

  .shoe-card-copy {
    padding: 8px;
  }
}
