* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f5f7;
}

.hidden {
  display: none !important;
}

.login-overlay {
  position: fixed;
  inset: 0;
  background: #111827;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.login-card {
  width: 360px;
  background: #fff;
  border-radius: 10px;
  padding: 18px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.login-title {
  font-weight: 700;
  font-size: 18px;
}

.login-subtitle {
  color: #6b7280;
  font-size: 13px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.login-hint {
  color: #6b7280;
  font-size: 12px;
}

.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.app-header {
  height: 56px;
  padding: 0 16px;
  background: #111827;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.app-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-button {
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: transparent;
  color: #fff;
}

.header-button:hover {
  background: rgba(255, 255, 255, 0.1);
}

.app-title {
  font-weight: 600;
}

.app-body {
  flex: 1;
  display: flex;
  min-height: 0;
}

.app-sidebar {
  width: 180px;
  background: #111827;
  color: #9ca3af;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
}

.menu-group-title {
  font-size: 12px;
  text-transform: uppercase;
  margin: 8px 8px 4px;
  color: #6b7280;
}

.menu-item {
  border: none;
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
}

.menu-item.active,
.menu-item:hover {
  background: #1f2937;
  color: #f9fafb;
}

.app-main {
  flex: 1;
  padding: 12px 16px;
  overflow: auto;
}

.toolbar-input {
  padding: 6px 8px;
  border-radius: 4px;
  border: 1px solid #d1d5db;
  font-size: 13px;
  min-width: 120px;
}

.page {
  display: none;
  height: 100%;
}

.page.active {
  display: block;
}

.page-header {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}

.map-container {
  width: 100%;
  height: calc(100vh - 120px);
  background: #e5e7eb;
  position: relative;
}

.map-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.map-canvas {
  position: absolute;
  inset: 0;
}

.input-readonly {
  background: #f3f4f6;
  color: #374151;
}

.address-field {
  position: relative;
}

.suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 2px);
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  box-shadow: 0 10px 24px rgba(17, 24, 39, 0.12);
  max-height: 220px;
  overflow: auto;
  z-index: 10;
}

.suggestion-item {
  padding: 8px 10px;
  border-bottom: 1px solid #f3f4f6;
  cursor: pointer;
}

.suggestion-item:last-child {
  border-bottom: none;
}

.suggestion-item:hover {
  background: #f9fafb;
}

.suggestion-title {
  font-size: 13px;
  color: #111827;
}

.suggestion-desc {
  font-size: 12px;
  color: #6b7280;
  margin-top: 2px;
}

.map-static-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.map-preview-caption {
  position: absolute;
  left: 12px;
  bottom: 12px;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(17, 24, 39, 0.78);
  color: #f9fafb;
  font-size: 13px;
}

.map-fallback {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  color: #111827;
  background: rgba(229, 231, 235, 0.9);
  text-align: center;
  font-size: 13px;
}

.stores-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.stores-cards {
  display: none;
  gap: 8px;
  flex-direction: column;
  margin-bottom: 10px;
}

.store-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.store-card-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.store-card-title strong {
  font-size: 15px;
}

.store-card-meta {
  color: #6b7280;
  font-size: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.store-card-actions {
  display: flex;
  gap: 8px;
}

.stores-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

.stores-table th,
.stores-table td {
  border: 1px solid #e5e7eb;
  padding: 6px 8px;
  font-size: 13px;
}

.stores-table th {
  background: #f3f4f6;
}

button {
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 4px;
  border: 1px solid #d1d5db;
  background: #fff;
  cursor: pointer;
}

button:hover {
  background: #f3f4f6;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal.hidden {
  display: none;
}

.modal-content {
  width: 720px;
  max-height: 90vh;
  background: #fff;
  border-radius: 8px;
  padding: 16px 20px 20px;
  display: flex;
  flex-direction: column;
}

.modal-content.modal-map {
  width: min(980px, calc(100vw - 24px));
  height: min(720px, calc(100vh - 24px));
  max-height: none;
  padding: 12px 12px 10px;
}

.map-picker {
  flex: 1;
  min-height: 320px;
  border-radius: 8px;
  overflow: hidden;
  background: #e5e7eb;
}

.map-picker-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}

.map-picker-address {
  flex: 1;
  font-size: 13px;
  color: #111827;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px 10px;
}

.map-picker-actions {
  display: flex;
  gap: 8px;
}

.advanced-field.hidden {
  display: none;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 56px;
  background: #111827;
  display: none;
  align-items: center;
  justify-content: space-around;
  padding: 0 10px;
}

.bottom-nav-item {
  border: none;
  background: transparent;
  color: #9ca3af;
  font-size: 13px;
  padding: 10px 12px;
  border-radius: 8px;
}

.bottom-nav-item.active {
  color: #f9fafb;
  background: #1f2937;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.icon-button {
  border: none;
  background: transparent;
  font-size: 20px;
  line-height: 1;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 16px;
  overflow-y: auto;
}

.form-grid label {
  display: flex;
  flex-direction: column;
  font-size: 13px;
  gap: 4px;
}

input,
select {
  padding: 6px 8px;
  border-radius: 4px;
  border: 1px solid #d1d5db;
  font-size: 13px;
}

.full-width {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

@media (max-width: 768px) {
  .app-sidebar {
    display: none;
  }

  .app-main {
    padding-bottom: 72px;
  }

  .bottom-nav {
    display: flex;
  }

  .stores-table {
    display: none;
  }

  .stores-cards {
    display: flex;
  }

  .modal-content {
    width: 100%;
    height: 100vh;
    max-height: none;
    border-radius: 0;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .map-container {
    height: calc(100vh - 100px);
  }

  .modal-content.modal-map {
    width: 100%;
    height: 100vh;
    max-height: none;
    border-radius: 0;
  }
}
