/*
 * Layout for the provider portal's app shell (topbar + sidebar +
 * content), on top of ../auth/tokens.css's shared color/spacing/type
 * tokens — this file adds no new color tokens of its own, so the
 * portal and the auth pages stay visually consistent without
 * duplicating the design system.
 */

body {
  display: block;
  align-items: initial;
  justify-content: initial;
  padding: 0;
}

.shell {
  display: flex;
  min-height: 100vh;
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-4);
  z-index: 10;
}

.topbar .brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 600;
}
.topbar .brand img { height: 24px; }

.topbar .topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.tenant-select {
  padding: 6px 10px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 0.9rem;
}

.btn-plain {
  background: none;
  border: 1px solid var(--color-border);
  color: var(--color-text);
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.88rem;
}
.btn-plain:hover { background: var(--color-surface); }

.sidebar {
  position: fixed;
  top: 56px;
  bottom: 0;
  left: 0;
  width: 220px;
  border-right: 1px solid var(--color-border);
  background: var(--color-bg);
  padding: var(--space-3) 0;
  overflow-y: auto;
}

.sidebar nav a {
  display: block;
  padding: 10px var(--space-4);
  color: var(--color-text);
  text-decoration: none;
  font-size: 0.92rem;
}
.sidebar nav a:hover { background: var(--color-surface); }
.sidebar nav a.active {
  background: var(--color-surface);
  color: var(--color-primary);
  font-weight: 600;
  border-right: 3px solid var(--color-primary);
}

main.content {
  margin-top: 56px;
  margin-left: 220px;
  padding: var(--space-5);
  flex: 1;
  max-width: 960px;
}

body.no-tenant main.content { margin-left: 0; max-width: 480px; margin-left: auto; margin-right: auto; }
body.no-tenant .sidebar { display: none; }

h1.page-title { font-size: 1.4rem; margin: 0 0 var(--space-4); }

.panel {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}

.panel h2 { font-size: 1.05rem; margin: 0 0 var(--space-3); }

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
table.data-table th, table.data-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--color-border);
}
table.data-table th { color: var(--color-text-muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.02em; }
table.data-table tbody tr:hover { background: var(--color-surface); }
.empty-row td { color: var(--color-text-muted); font-style: italic; }

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  text-transform: capitalize;
}
.badge.status-verified, .badge.status-published, .badge.status-active, .badge.status-completed, .badge.status-paid, .badge.status-succeeded, .badge.status-resolved_customer, .badge.status-resolved_provider {
  background: rgba(28,124,63,0.12); color: var(--color-success);
}
.badge.status-pending, .badge.status-pending_review, .badge.status-requested, .badge.status-draft, .badge.status-confirmed, .badge.status-open, .badge.status-quoted {
  background: rgba(47,111,237,0.12); color: var(--color-primary-dark);
}
.badge.status-rejected, .badge.status-cancelled, .badge.status-declined, .badge.status-suspended, .badge.status-no_show, .badge.status-failed, .badge.status-dismissed {
  background: var(--color-error-bg); color: var(--color-error);
}
.badge.status-unverified, .badge.status-archived, .badge.status-paused, .badge.status-in_progress, .badge.status-accepted {
  background: var(--color-surface); color: var(--color-text-muted);
}

.actions-row { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-top: var(--space-3); }

button.small {
  padding: 6px 12px;
  font-size: 0.82rem;
  border-radius: 6px;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
  cursor: pointer;
}
button.small:hover { background: var(--color-surface); }
button.small.primary { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
button.small.primary:hover { background: var(--color-primary-dark); }
button.small.danger { color: var(--color-error); border-color: var(--color-error); }
button.small.danger:hover { background: var(--color-error-bg); }
button.small:disabled { opacity: 0.5; cursor: not-allowed; }

.inline-form { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: flex-end; margin-top: var(--space-3); }
.inline-form .field { margin-bottom: 0; min-width: 160px; }

.field label input[type="checkbox"] { width: auto; }

.tenant-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  margin-bottom: var(--space-2);
  cursor: pointer;
}
.tenant-card:hover { background: var(--color-surface); }
.tenant-card .name { font-weight: 600; }
.tenant-card .meta { color: var(--color-text-muted); font-size: 0.85rem; }

/* Marketplace listing images (web/shared/listing-ui.js) — used by
   both the provider and customer portals' "My Listings" and by the
   customer portal's public listing detail page. */
.listing-images {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.listing-image-thumb {
  width: 120px;
}
.listing-image-thumb img {
  width: 120px;
  height: 90px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  display: block;
  margin-bottom: 4px;
}

/* US-009 (map view) + US-006 (AI search box), added on top of the US-002
   marketplace-listing styles above — same shared file, used by both
   the provider and customer portals. */
.market-view-toggle button {
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  cursor: pointer;
}
.market-view-toggle button.active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}
.ai-search-panel {
  margin-bottom: var(--space-4);
}
.ai-search-result {
  margin-top: var(--space-3);
}

/* US-056 (disputes): evidence attachment list in dispute detail rows. */
.dispute-attachment-list {
  list-style: none;
  padding: 0;
  margin: var(--space-2) 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.dispute-attachment-list li a {
  display: inline-block;
  padding: 4px 10px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 0.78rem;
  text-decoration: none;
  color: var(--color-primary);
}

/* Voice calling (User Stories 1-3's calling halves) -- web/shared/call-ui.js. */
.call-overlay {
  position: fixed;
  bottom: var(--space-4);
  right: var(--space-4);
  z-index: 1000;
  width: 280px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  padding: var(--space-3);
}
.call-overlay .call-title {
  font-weight: 600;
  margin-bottom: var(--space-1);
}
.call-overlay .call-status {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}
.call-overlay .call-actions {
  display: flex;
  gap: var(--space-2);
}
.call-overlay .call-actions button {
  flex: 1;
}
.call-toast {
  position: fixed;
  bottom: var(--space-4);
  right: var(--space-4);
  z-index: 999;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: var(--space-2) var(--space-3);
  font-size: 0.85rem;
  color: var(--color-text);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

/* Help center (web/shared/help-ui.js), used by both the customer and
   provider apps -- this file loads in both (see each app's index.html),
   so it's the shared home for these rules rather than duplicating them. */
.help-search-field { max-width: 420px; margin-bottom: var(--space-4); }
.help-category { margin-bottom: var(--space-4); }
.help-category h2 { margin-bottom: var(--space-2); }
.help-list { list-style: none; margin: 0; padding: 0; }
.help-list li { padding: var(--space-2) 0; border-bottom: 1px solid var(--color-border); }
.help-list li:last-child { border-bottom: none; }
.help-list a { font-weight: 600; }
.help-summary { margin: var(--space-1) 0 0; color: var(--color-text-muted); font-size: 0.9rem; }
.help-breadcrumb { color: var(--color-text-muted); font-size: 0.85rem; margin-bottom: var(--space-1); }
.help-article-body { max-width: 680px; line-height: 1.6; }
.help-article-body p { margin: 0 0 var(--space-3); }
.help-article-body ul, .help-article-body ol { margin: 0 0 var(--space-3); padding-left: 1.4em; }
.help-related-heading { margin-top: var(--space-5); }
.back-link { display: inline-block; margin-bottom: var(--space-3); color: var(--color-text-muted); }
