/* Map Inventory admin */

:root {
  --accent: #FF3D7A;
  --accent-dark: #E12463;
  --ink: #14151A;
  --ink-soft: #5B5F6B;
  --bg: #FFFFFF;
  --bg-soft: #F9F9FB;
  --border: #ECEDF1;
  --danger: #D8383E;
  --font-display: "Plus Jakarta Sans", "Inter", -apple-system, sans-serif;
  --font-body: "Inter", -apple-system, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg-soft);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--accent); }

.page {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-left img { width: 40px; height: 40px; }

.header-title h1 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  margin: 0;
}

.header-title p {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--ink-soft);
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.tab {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink-soft);
}

.tab.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.workflow-hint {
  margin: -8px 0 16px;
  padding: 10px 14px;
  font-size: 12px;
  color: var(--ink-soft);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
}

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

.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--border);
}

.btn-ghost:hover { color: var(--ink); border-color: var(--ink-soft); }

.btn-danger {
  background: #FDEAEA;
  color: var(--danger);
  border: 1px solid #F5C2C4;
}

.btn-sm { padding: 6px 10px; font-size: 12px; }

.field { margin-bottom: 16px; }

.field label {
  display: block;
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 6px;
}

.field-hint {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 4px;
}

input[type="text"],
input[type="url"],
input[type="date"],
input[type="password"],
select,
textarea {
  width: 100%;
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(255, 61, 122, 0.25);
  border-color: var(--accent);
}

select {
  padding-right: 36px;
  appearance: none;
  -webkit-appearance: none;
  -moz-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='%235B5F6B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
}

.items-filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.items-search {
  flex: 1;
  min-width: 200px;
  max-width: 320px;
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
}

.items-search:focus {
  outline: 2px solid rgba(255, 61, 122, 0.25);
  border-color: var(--accent);
}

#itemsProjectFilter {
  min-width: 160px;
  width: auto;
}

.items-filter-summary {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--ink-soft);
}

.items-table tr[hidden] {
  display: none;
}

.project-input-wrap { display: block; }

.project-combobox {
  position: relative;
  display: flex;
  align-items: stretch;
}

.project-combobox input {
  flex: 1;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.project-combobox-btn {
  border: 1px solid var(--border);
  border-left: none;
  border-radius: 0 8px 8px 0;
  background: var(--bg-soft);
  color: var(--ink-soft);
  padding: 0 14px;
  font-size: 14px;
  cursor: pointer;
}

.project-combobox-btn:hover {
  color: var(--ink);
  background: var(--border);
}

.project-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(20, 21, 26, 0.1);
  max-height: 220px;
  overflow-y: auto;
  z-index: 20;
}

.project-dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  padding: 10px 12px;
  font: inherit;
  cursor: pointer;
  color: var(--ink);
}

.project-dropdown-item:hover,
.project-dropdown-item:focus,
.project-dropdown-item.active {
  background: var(--bg-soft);
  outline: none;
}

.project-dropdown-item.active {
  color: var(--accent);
  font-weight: 600;
}

.project-dropdown-empty {
  padding: 10px 12px;
  font-size: 12px;
  color: var(--ink-soft);
}

.items-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.items-table th:nth-child(1),
.items-table td:nth-child(1) { width: 38%; }

.items-table th:nth-child(2),
.items-table td:nth-child(2) { width: 22%; }

.items-table th:nth-child(3),
.items-table td:nth-child(3) { width: 18%; }

.items-table th:nth-child(4),
.items-table td.actions-cell { width: 22%; }

.items-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.items-table th:last-child,
.items-table td.actions-cell {
  text-align: right;
}

.items-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  overflow: hidden;
}

.items-table td.project-cell {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.items-table td.actions-cell {
  white-space: nowrap;
  vertical-align: middle;
}

.row-actions {
  display: inline-flex;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
}

.row-actions .btn {
  padding: 8px 14px;
  font-size: 13px;
}

.project-editor-row {
  display: grid;
  grid-template-columns: 52px 1fr auto 36px;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.project-move-btns {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.project-move-btns .icon-btn {
  width: 24px;
  height: 24px;
  font-size: 12px;
  line-height: 1;
}

.project-order-hint {
  padding: 10px 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 12px !important;
}

.project-count {
  font-size: 12px;
  color: var(--ink-soft);
  white-space: nowrap;
}

.settings-section {
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.items-table tr:last-child td { border-bottom: none; }

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  padding: 4px 10px;
}

.status-chip svg { width: 14px; height: 14px; }

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
}

.login-card h1 {
  font-family: var(--font-display);
  font-size: 24px;
  margin: 0 0 8px;
}

.login-card p {
  color: var(--ink-soft);
  margin: 0 0 24px;
}

.form-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 20px;
}

.error-banner {
  background: #FDEAEA;
  color: var(--danger);
  border: 1px solid #F5C2C4;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 16px;
  font-size: 13px;
}

.success-banner {
  background: #E8F8EE;
  color: #1E9950;
  border: 1px solid #B8E6CB;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 16px;
  font-size: 13px;
}

.status-editor-row {
  display: grid;
  grid-template-columns: 1fr 120px 80px 80px 48px 36px;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.status-color-swatch {
  width: 100%;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
}

.status-color-swatch:hover {
  border-color: var(--accent);
}

.link-type-row {
  display: grid;
  grid-template-columns: 28px 1fr 120px auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.link-type-icon {
  width: 20px;
  height: 20px;
  display: block;
}

.link-type-badge {
  font-size: 11px;
  color: var(--ink-soft);
  white-space: nowrap;
}

.field-group-title {
  margin: 20px 0 6px;
  font-size: 14px;
  font-weight: 600;
}

.custom-links-section {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}

.custom-link-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr 36px;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.custom-link-row input[type="text"],
.custom-link-row input[type="url"] {
  min-width: 0;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-btn svg { width: 18px; height: 18px; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 21, 26, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
}

.modal {
  background: var(--bg);
  border-radius: 14px;
  padding: 24px;
  max-width: 520px;
  width: 100%;
  max-height: 80vh;
  overflow: auto;
}

.modal h2 {
  font-family: var(--font-display);
  margin: 0 0 16px;
  font-size: 18px;
}

.icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  gap: 8px;
}

.icon-grid button {
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-grid button:hover,
.icon-grid button.selected {
  border-color: var(--accent);
  background: #FFF0F5;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle span {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s;
}

.toggle span::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.15s;
}

.toggle input:checked + span { background: var(--accent); }
.toggle input:checked + span::before { transform: translateX(20px); }

.empty-state {
  text-align: center;
  color: var(--ink-soft);
  padding: 40px 16px;
}

.footer-link {
  margin-top: 24px;
  font-size: 12px;
  color: var(--ink-soft);
  text-align: center;
}

@media (max-width: 720px) {
  .status-editor-row {
    grid-template-columns: 1fr 1fr;
  }
  .items-table thead { display: none; }
  .items-table tr { display: block; margin-bottom: 12px; border-bottom: 1px solid var(--border); }
  .items-table td { display: block; border: none; padding: 4px 12px; }
}
