/* ── app-grids-shell.css — data grid card, impersonation banner, hamburger, auth login forms, mobile ── */
/* Auto-split from app.css 2026-05-27 (Phase J.6). Cascade order preserved by
   the <link> sequence in index.html. Edit the file whose concern matches your
   change; do NOT recreate app.css. See _docs/canonical/coding-conventions.md §0. */

/* ── Data grid card (unified: toolbar + table + footer) ─────────────────── */

.grid-card {
  background: var(--panel-bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
}

/* Legacy .table-wrap kept for any non-grid tables */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--panel-bg);
  box-shadow: var(--shadow-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 10px 16px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-soft);
  max-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Action cells (buttons, tags) must never be clipped */
td:last-child {
  max-width: none;
  overflow: visible;
  width: 1%;
  white-space: nowrap;
}

/* Cells that intentionally wrap (e.g. name + subtitle) */
td.cell-wrap, .cell-sub {
  white-space: normal;
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

th {
  background: var(--panel-alt);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
  max-width: none;
  overflow: visible;
  border-bottom: 2px solid var(--border-soft);
}

tbody tr:hover td {
  background: var(--panel-alt);
}

tbody tr:last-child td {
  border-bottom: none;
}

.list-surface {
  display: grid;
  gap: 10px;
}

.list-item {
  padding: 14px 16px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--panel-alt);
}

.helper-command {
  display: block;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--panel-alt);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.5;
  overflow-wrap: break-word;
  word-break: break-all;
  white-space: pre-wrap;
}

.section-secondary {
  background: var(--panel-alt);
  border-color: var(--border-soft);
  box-shadow: none;
}

.section-secondary .details-grid > div {
  background: var(--panel-bg);
}

.hidden {
  display: none !important;
}

.status-ok {
  color: var(--success);
}

.status-error {
  color: var(--danger);
}

details.section {
  padding: 0;
}

details.section summary {
  list-style: none;
  cursor: pointer;
  padding: 18px 20px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

details.section summary::-webkit-details-marker {
  display: none;
}

details.section[open] summary {
  border-bottom: 1px solid var(--border-soft);
}

details.section .details-body {
  padding: 20px;
}

@media (max-width: 1280px) {
  .summary-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .workflow-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-grid,
  .details-grid,
  .filter-row,
  .permission-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ── Impersonation banner ──────────────────────────────────────────────── */
.impersonate-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 10px var(--space-7);
  background: linear-gradient(90deg, rgba(255, 176, 104, 0.15), rgba(108, 215, 255, 0.1));
  border-bottom: 1px solid rgba(255, 176, 104, 0.3);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent-warm);
}

.impersonate-banner button {
  padding: 4px 12px;
  border: 1px solid rgba(255, 176, 104, 0.4);
  border-radius: 999px;
  background: transparent;
  color: var(--accent-warm);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.impersonate-banner button:hover {
  background: rgba(255, 176, 104, 0.12);
}

/* ── Hamburger / mobile sidebar ────────────────────────────────────────── */
.hamburger-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel-bg);
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
  flex-shrink: 0;
}

.sidebar-close-btn {
  display: none;
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--sidebar-muted);
  font-size: 1rem;
  cursor: pointer;
  border-radius: 6px;
}

.sidebar-close-btn:hover {
  color: var(--sidebar-text);
  background: rgba(255,255,255,0.08);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
}

body.sidebar-open .sidebar-overlay {
  display: block;
}

/* ── Auth login forms ──────────────────────────────────────────────────── */
.login-form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  text-align: left;
  margin-bottom: 12px;
}

.login-form-field label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--sidebar-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.login-form-field input {
  width: 100%;
  padding: 11px 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  color: var(--sidebar-text, #f4f8fb);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 140ms;
}

.login-form-field input:focus {
  border-color: rgba(108, 215, 255, 0.45);
}

.login-password-btn {
  width: 100%;
  padding: 13px 20px;
  font-size: 1rem;
  font-weight: 700;
  background: rgba(108, 215, 255, 0.12);
  color: #6cd7ff;
  border: 1px solid rgba(108, 215, 255, 0.25);
  border-radius: 12px;
  cursor: pointer;
  transition: background 140ms, border-color 140ms;
  margin-top: 4px;
}

.login-password-btn:hover {
  background: rgba(108, 215, 255, 0.2);
  border-color: rgba(108, 215, 255, 0.45);
}

.login-auth-toggle {
  background: none;
  border: none;
  color: rgba(108, 215, 255, 0.7);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0;
  margin-top: 8px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.login-auth-toggle:hover {
  color: #6cd7ff;
}

.login-mode-tabs {
  display: flex;
  gap: 4px;
  background: rgba(255,255,255,0.05);
  border-radius: 10px;
  padding: 3px;
  margin-bottom: 20px;
  width: 100%;
}

.login-mode-tab {
  flex: 1;
  padding: 8px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--sidebar-muted, #7f92a3);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 140ms, color 140ms;
}

.login-mode-tab.is-active {
  background: rgba(108, 215, 255, 0.14);
  color: #6cd7ff;
}

.login-pending-notice {
  padding: 14px 16px;
  background: rgba(255, 176, 104, 0.1);
  border: 1px solid rgba(255, 176, 104, 0.25);
  border-radius: 10px;
  color: #ffb068;
  font-size: 0.875rem;
  text-align: left;
  margin-top: 12px;
}

