/* Platform shell — extends user.css (same canvas as /app) */

.platform-page #mainApp.platform-root {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 0.7rem);
  max-height: calc(100vh - 0.7rem);
  min-height: 0;
  max-width: none;
  padding: 0;
  overflow: hidden;
}

.platform-table-bar {
  display: flex;
  align-items: stretch;
  gap: 0;
  background: rgba(255, 252, 248, 0.96);
  border-bottom: 1px solid #e8e2da;
  padding: 0 0.5rem 0 0.75rem;
  flex-shrink: 0;
  min-height: 2.35rem;
}

.platform-table-tabs {
  display: flex;
  align-items: flex-end;
  gap: 0.1rem;
  overflow-x: auto;
  flex: 1;
  min-width: 0;
  scrollbar-width: thin;
}

.platform-table-tabs .table-tab {
  border: none;
  background: transparent;
  padding: 0.5rem 0.85rem 0.45rem;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  font-size: 0.82rem;
  white-space: nowrap;
  color: #374151;
  font-weight: 500;
  margin-bottom: -1px;
}

.platform-table-tabs .table-tab:hover {
  background: rgba(255, 255, 255, 0.55);
}

.platform-table-tabs .table-tab.active {
  background: #fff;
  color: #1a2332;
  font-weight: 600;
  box-shadow: 0 -1px 0 #d4cfc8, 1px 0 0 rgba(0, 0, 0, 0.04), -1px 0 0 rgba(0, 0, 0, 0.04);
}

.platform-tab-add {
  position: relative;
  align-self: center;
  width: 2.1rem;
  height: 2.1rem;
  margin: 0 0.35rem 0 0.25rem;
  border: 1px solid #d4cfc8;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  color: #1a2332;
  flex-shrink: 0;
  font-weight: 300;
  transition: background 0.15s, box-shadow 0.15s;
}

.platform-tab-add:hover {
  background: #faf8f5;
  box-shadow: 0 2px 8px rgba(26, 35, 50, 0.08);
}

.platform-tab-add:hover::after {
  content: "Add or import table";
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #1f2937;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.35rem 0.55rem;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 50;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.platform-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.platform-view-sidebar {
  width: 210px;
  background: #fafafa;
  border-right: 1px solid rgba(0, 0, 0, 0.08);
  padding: 0.65rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  flex-shrink: 0;
  overflow: hidden;
}

.platform-sidebar-create {
  border: none;
  background: transparent;
  text-align: left;
  padding: 0.35rem 0.45rem;
  cursor: pointer;
  font-size: 0.82rem;
  color: #374151;
  font-weight: 600;
}

.platform-sidebar-create:hover {
  background: #f0f0f5;
  border-radius: 8px;
}

.platform-view-search {
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  padding: 0.35rem 0.5rem;
  font-size: 0.78rem;
  width: 100%;
}

.platform-view-list {
  overflow-y: auto;
  flex: 1;
}

.platform-view-list .view-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.45rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.8rem;
}

.platform-view-list .view-item:hover {
  background: #f0f0f5;
}

.platform-view-list .view-item.active {
  background: #e8e8ff;
  font-weight: 600;
}

.platform-view-list .view-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.platform-view-list .view-dots {
  border: none;
  background: transparent;
  cursor: pointer;
  opacity: 0.5;
  padding: 0 0.25rem;
}

.platform-content {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: transparent;
}

.platform-content .hero,
.platform-content .search-panel {
  flex-shrink: 0;
}

.platform-content #catalogWorkspace {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.platform-content #catalogWorkspace .hero,
.platform-content #catalogWorkspace .search-panel,
.platform-content #catalogWorkspace .mobile-view-bar,
.platform-content #catalogWorkspace .mobile-nav {
  flex-shrink: 0;
}

.platform-content #catalogWorkspace .table-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.platform-content #catalogWorkspace .table-wrap::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

.platform-content #catalogWorkspace .table-wrap::-webkit-scrollbar-thumb {
  background: rgba(107, 114, 128, 0.45);
  border-radius: 6px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.platform-content #catalogWorkspace .table-wrap::-webkit-scrollbar-track {
  background: rgba(243, 244, 246, 0.8);
}

.platform-content #catalogWorkspace .result-table {
  min-width: max-content;
}

/* Search bar — cream / navy palette matching splash background */
.platform-search-panel {
  padding: 0.55rem 0.65rem;
  margin-bottom: 0.45rem;
  background: rgba(255, 252, 248, 0.94);
  border: 1px solid #e8e2da;
  box-shadow: 0 2px 10px rgba(26, 35, 50, 0.05);
}

.platform-content #catalogWorkspace .hero {
  flex-shrink: 0;
  position: relative;
  z-index: 30;
  overflow: visible;
}

.platform-search-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  position: relative;
}

.platform-image-search-wrap {
  position: relative;
  flex-shrink: 0;
}

.platform-image-search-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 2px solid #1a2332;
  border-radius: 50%;
  background: #fff;
  color: #1a2332;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(26, 35, 50, 0.14);
  transition: background 0.15s, color 0.15s, transform 0.12s, box-shadow 0.15s;
  flex-shrink: 0;
}

.platform-image-search-btn:hover {
  background: #1a2332;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(26, 35, 50, 0.2);
}

.platform-image-search-btn .lens-icon {
  display: block;
}

.platform-search-field {
  position: relative;
  flex: 1;
  min-width: 14rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #ddd6ce;
  border-radius: 999px;
  padding: 0.2rem 0.45rem 0.2rem 1rem;
  box-shadow: 0 1px 4px rgba(26, 35, 50, 0.05);
}

.platform-search-field #searchInput {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 0.45rem 0.25rem;
  font-size: 0.92rem;
  color: #1a2332;
  outline: none;
}

.platform-search-go {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: none;
  background: transparent;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.platform-search-go:hover {
  background: rgba(26, 35, 50, 0.07);
}

.platform-lens-menu {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  z-index: 120;
  min-width: 13rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(17, 24, 39, 0.12);
  padding: 0.35rem;
  display: flex;
  flex-direction: column;
}

.platform-lens-menu button {
  text-align: left;
  border: none;
  background: transparent;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.82rem;
  color: #374151;
}

.platform-lens-menu button:hover {
  background: #f3f4f6;
}

.platform-search-row .reset-filter-btn {
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.85);
  border-color: #ddd6ce;
  color: #1a2332;
}

/* Editable platform base name (Airtable-style) */
.platform-base-head {
  position: relative;
}

.platform-base-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0.15rem 0.35rem 0.15rem 0.1rem;
  border-radius: 8px;
  max-width: 100%;
}

.platform-base-btn:hover {
  background: rgba(26, 35, 50, 0.05);
}

.platform-base-icon {
  color: #6b7280;
  font-size: 0.75rem;
}

.platform-base-name {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: #1a2332;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(420px, 55vw);
}

.platform-base-chevron {
  color: #9ca3af;
  font-size: 0.72rem;
  flex-shrink: 0;
}

.platform-base-popover {
  position: fixed;
  z-index: 10050;
  width: min(320px, calc(100vw - 24px));
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(17, 24, 39, 0.18);
  padding: 0.85rem 1rem 1rem;
}

.platform-base-popover-head {
  font-size: 1rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 0.65rem;
}

.platform-base-rename-label {
  display: block;
  font-size: 0.78rem;
  color: #6b7280;
  margin-bottom: 0.65rem;
}

.platform-base-rename-label input {
  display: block;
  width: 100%;
  margin-top: 0.3rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.88rem;
}

.platform-base-save {
  border: none;
  background: #1a2332;
  color: #fff;
  border-radius: 8px;
  padding: 0.4rem 0.85rem;
  font-size: 0.82rem;
  cursor: pointer;
}

.platform-bg-section {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e5e7eb;
}

.platform-bg-head {
  font-size: 0.78rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.45rem;
}

.platform-bg-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.platform-bg-label {
  font-size: 0.78rem;
  color: #6b7280;
}

.platform-bg-btn {
  border: 1px solid #d1d5db;
  background: #fff;
  border-radius: 8px;
  padding: 0.28rem 0.65rem;
  font-size: 0.78rem;
  cursor: pointer;
}

.platform-bg-btn:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}

.platform-base-save:hover {
  background: #111827;
}

/* Generic (non-Buttons) table workspace */
.generic-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #fff;
}

.generic-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  gap: 0.5rem;
  flex-wrap: wrap;
}

.generic-toolbar .active-view-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.generic-toolbar-actions {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.generic-tool-btn {
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: #fff;
  border-radius: 8px;
  padding: 0.28rem 0.55rem;
  font-size: 0.75rem;
  cursor: pointer;
}

.generic-tool-btn.primary {
  background: #111827;
  color: #fff;
  border-color: #111827;
}

.platform-grid-wrap {
  flex: 1;
  min-height: 0;
}

.platform-grid-wrap .tabulator {
  border: none;
  font-size: 0.82rem;
}

.platform-grid-wrap .tabulator-header {
  background: #f9fafb;
}

.filter-bar {
  padding: 0.35rem 0.75rem;
  background: #ecfdf5;
  font-size: 0.75rem;
  border-bottom: 1px solid #bbf7d0;
}

.filter-chip {
  display: inline-block;
  background: #fff;
  border: 1px solid #86efac;
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
  margin-left: 0.25rem;
}

.cell-thumb {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 6px;
}

.cell-thumbs {
  display: flex;
  gap: 2px;
  align-items: center;
}

.pill {
  display: inline-block;
  background: #dbeafe;
  color: #1e40af;
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
  font-size: 0.72rem;
}

/* Platform dialogs & context menu */
.platform-ctx-menu {
  position: fixed;
  z-index: 1000;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
  min-width: 180px;
  padding: 0.35rem 0;
}

.platform-ctx-menu .ctx-item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 0.45rem 0.85rem;
  font-size: 0.82rem;
  cursor: pointer;
}

.platform-ctx-menu .ctx-item:hover {
  background: #f3f4f6;
}

.platform-ctx-menu .ctx-item.danger {
  color: #b91c1c;
}

.platform-dialog {
  border: none;
  border-radius: 12px;
  padding: 1rem 1.25rem;
  max-width: 420px;
  width: calc(100vw - 2rem);
}

.platform-dialog label {
  display: block;
  margin: 0.65rem 0;
  font-size: 0.82rem;
}

.platform-dialog input,
.platform-dialog select {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 8px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.45rem;
  margin-top: 1rem;
}

.platform-dialog .btn {
  border: none;
  border-radius: 8px;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  font-size: 0.82rem;
}

.platform-dialog .btn.primary {
  background: #2563eb;
  color: #fff;
}

.platform-dialog .btn.ghost {
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.12);
}

.platform-dialog .btn.danger {
  background: #fee2e2;
  color: #b91c1c;
}

.platform-dialog .hint {
  font-size: 0.78rem;
  color: #6b7280;
}

.visibility-checks label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.visibility-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.25rem 0;
}

.visibility-user-row label {
  flex: 1;
  min-width: 0;
}

.visibility-del-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  opacity: 0.55;
  padding: 0.15rem 0.35rem;
}

.visibility-del-btn:hover { opacity: 1; }

.visibility-add-form {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}

.visibility-add-form h3 {
  font-size: 0.82rem;
  margin: 0 0 0.45rem;
}

.visibility-add-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto auto;
  gap: 0.35rem;
  align-items: center;
}

@media (max-width: 520px) {
  .visibility-add-row {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .platform-view-sidebar {
    display: none;
  }

  .platform-page.mobile-show-filters .platform-view-sidebar {
    display: flex;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 200;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.12);
  }
}
