﻿:root {
  --brand-primary: #0b4f8d;
  --brand-primary-strong: #083766;
  --brand-accent: #ff7b36;
  --brand-accent-soft: #ffb07a;
  --bg: #eef3f9;
  --bg-panel: #f8fbff;
  --surface: #ffffff;
  --surface-muted: #f4f7fc;
  --text: #172536;
  --text-soft: #4d627c;
  --text-muted: #70849e;
  --line: #d8e3f1;
  --line-strong: #b9cae0;
  --success: #148a55;
  --warning: #b26e12;
  --danger: #c93f3f;
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --shadow-xs: 0 6px 16px rgba(11, 54, 99, 0.08);
  --shadow-sm: 0 12px 28px rgba(11, 54, 99, 0.12);
  --shadow-md: 0 20px 44px rgba(7, 37, 69, 0.18);
  --focus: 0 0 0 3px rgba(255, 123, 54, 0.25);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Source Sans Pro", "Segoe UI", Tahoma, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 10% -20%, rgba(11, 79, 141, 0.14) 0, transparent 42%),
    radial-gradient(circle at 92% -10%, rgba(255, 123, 54, 0.08) 0, transparent 28%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.65rem;
  background: linear-gradient(96deg, #062a50 0%, #0a4b83 70%, #0c5f9a 100%);
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 24px rgba(6, 33, 63, 0.28);
}

.brand a {
  font-size: 1.3rem;
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem;
}
.btn, .btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.58rem 1.02rem;
  border-radius: var(--radius-xs);
  text-decoration: none;
  margin: 0.15rem 0.1rem;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.18s ease, box-shadow 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.btn {
  background: var(--surface-muted);
  border-color: var(--line-strong);
  color: var(--brand-primary-strong);
}
.btn-primary {
  background: linear-gradient(135deg, #0d5ea4 0%, #0a467a 100%);
  border-color: #0a467a;
  color: #fff;
  box-shadow: 0 10px 20px rgba(10, 70, 122, 0.25);
}
.btn:hover {
  background: #edf3fb;
  border-color: #9cb5d2;
  transform: translateY(-1px);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #0b528f 0%, #083c69 100%);
  transform: translateY(-1px);
}
.btn:active, .btn-primary:active {
  transform: translateY(0);
}
.btn:disabled, .btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}
.btn:focus-visible,
.btn-primary:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}
.flash { list-style: none; padding: 0; }
.flash li { margin: 0.5rem 0; padding: 0.6rem 0.8rem; border-radius: 6px; }
.flash li.success { background: #e3fcef; }
.flash li.danger { background: #ffe3e3; }
.flash li.info { background: #e0f2ff; }
.hero { background: var(--surface); padding: 2rem; border-radius: var(--radius-md); box-shadow: var(--shadow-sm); border: 1px solid var(--line); }
.grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(220px,1fr)); gap: 1rem; }
.card { background: var(--surface); padding: 1rem; border-radius: var(--radius-sm); box-shadow: var(--shadow-xs); border: 1px solid var(--line); }
.table { width: 100%; border-collapse: collapse; background: var(--surface); }
.table th, .table td { padding: 0.68rem 0.82rem; border-bottom: 1px solid var(--line); }
.table th { font-size: 0.76rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.table-compact td { padding: 0.3rem 0.5rem; }
.form-grid { display: grid; gap: 0.7rem; background: var(--surface); padding: 1.2rem; border-radius: var(--radius-sm); box-shadow: var(--shadow-xs); border: 1px solid var(--line); }
.form-grid fieldset { border: 1px solid var(--line); border-radius: var(--radius-xs); padding: 0.6rem; }
.form-grid legend { padding: 0 0.4rem; }
.form-grid label { display: flex; flex-direction: column; font-weight: 700; font-size: 0.86rem; color: var(--text-soft); }
.form-compact { display: flex; flex-direction: column; gap: 0.6rem; background: var(--surface); padding: 1.2rem; border-radius: var(--radius-sm); width: 320px; border: 1px solid var(--line); box-shadow: var(--shadow-xs); }
input, select, textarea {
  padding: 0.58rem 0.68rem;
  border-radius: var(--radius-xs);
  border: 1px solid var(--line-strong);
  background: #fbfdff;
  color: var(--text);
  font-family: inherit;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}
input:hover, select:hover, textarea:hover {
  border-color: #95afcf;
}
.checkbox { flex-direction: row; align-items: center; gap: 0.5rem; }
.designer { display: grid; grid-template-columns: 2fr 1fr; gap: 1.5rem; margin: 2rem 0; background: white; padding: 1.5rem; border-radius: 12px; box-shadow: 0 6px 24px rgba(3,31,61,0.15); }
.designer .charts { display: flex; gap: 1rem; }
.designer figure { background: #0a4e8b0d; padding: 0.5rem; border-radius: 10px; text-align: center; }
.designer .controls label { display: flex; flex-direction: column; font-size: 0.85rem; margin-bottom: 0.7rem; }
.designer input[type=range] { width: 100%; }
.footer {
  text-align: center;
  padding: 1.2rem 1.5rem;
  background: linear-gradient(95deg, #062a50 0%, #0a4b83 100%);
  color: rgba(255, 255, 255, 0.88);
  margin-top: 2.4rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.color-samples { list-style: none; padding: 0; display: flex; gap: 1rem; }
.color-samples span { display: inline-block; width: 32px; height: 32px; border-radius: 50%; margin-right: 0.5rem; }
.separator td { background: #f4f7fb; height: 6px; }
@media (max-width: 900px) { .designer { grid-template-columns: 1fr; } .designer .charts { flex-direction: column; align-items: center; } }

.brand {
  display: flex;
  align-items: center;
}

.brand-logo img {
  height: 38px;
  display: block;
  filter: drop-shadow(0 4px 12px rgba(3, 26, 52, 0.32));
}

.brand span {
  margin-left: 0.8rem;
  font-size: 0.9rem;
  color: rgba(229, 239, 255, 0.86);
  letter-spacing: 0.02em;
}

.form-grid-wide { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.form-field { display: flex; flex-direction: column; gap: 0.35rem; }
.form-field-span { grid-column: span 2; }
.form-field.checkbox { flex-direction: row; align-items: center; gap: 0.5rem; grid-column: span 2; }
.form-field.checkbox input { margin: 0; }
.required { color: #d12c2c; margin-left: 0.25rem; }
.error { color: #d12c2c; font-size: 0.85rem; }
.help { font-size: 0.8rem; color: #4b5563; }
.password-field { display: flex; align-items: center; gap: 0.5rem; }
.password-field input { flex: 1; }
.password-toggle { border: 1px solid #c7d2e0; background: #f4f7fb; color: #0A4E8B; padding: 0.35rem 0.6rem; border-radius: 6px; cursor: pointer; font-size: 0.8rem; }
.password-toggle:hover { background: #dbe2ef; }
.password-toggle[aria-pressed="true"] { background: #0A4E8B; color: #fff; }
.form-compact .form-field { margin-bottom: 0.75rem; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.dialog-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 31, 61, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}
.dialog {
  background: #fff;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(3, 31, 61, 0.25);
  max-width: 420px;
  text-align: center;
}
.dialog p {
  margin-bottom: 1.5rem;
  font-size: 1.05rem;
  color: #1f2933;
}
.password-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.password-toggle .icon-eye::before {
  content: '\1F441';
}
.password-toggle.is-active .icon-eye::before {
  content: '\1F648';
}
.pattern-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.2rem;
  margin-top: 1rem;
}
.pattern-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  align-items: start;
}
.pattern-preview-grid figure {
  background: #fff;
  border: 1px solid #dbe2ef;
  border-radius: 12px;
  box-shadow: 0 8px 18px rgba(3, 31, 61, 0.08);
  padding: 0.75rem;
  display: grid;
  gap: 0.35rem;
}
.pattern-preview-grid img {
  width: 100%;
  border-radius: 10px;
  border: 1px solid #e5ecf5;
}
.pattern-preview-grid figcaption {
  font-weight: 600;
  color: #0A4E8B;
}
.pattern-preview-grid ul {
  margin: 0;
  padding-left: 1rem;
  color: #4a5568;
  font-size: 0.9rem;
}
.pattern-preview-grid li {
  margin-bottom: 0.2rem;
}
.pattern-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(3, 31, 61, 0.12);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.pattern-card header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.pattern-card canvas {
  width: 100%;
  height: 200px;
}
.pattern-upload label {
  font-weight: 600;
}

.inline-info { font-size: 0.9rem; color: #0A4E8B; margin: 0.4rem 0; }
.inline-info strong { font-weight: 600; }


.form-section { border: 1px solid #dbe2ef; border-radius: 12px; padding: 1rem; background: #fff; box-shadow: 0 6px 14px rgba(3,31,61,0.08); margin: 0.8rem 0; }
.form-section legend { font-weight: 600; padding: 0 0.5rem; color: #0A4E8B; }



.pattern-visuals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 1.5rem 0;
}

.pattern-figure {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(3, 31, 61, 0.12);
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.pattern-figure header h2,
.pattern-figure header h3 {
  margin: 0;
  font-size: 1.1rem;
  color: #0A4E8B;
}

.pattern-figure img {
  width: 100%;
  border-radius: 10px;
  border: 1px solid #dbe2ef;
  background: #f7f9fc;
}
.pattern-entry__titles {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.pattern-entry__badge {
  display: inline-block;
  background: #ffe3e3;
  color: #9b1b1b;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
}
.pattern-entry--removed {
  opacity: 0.65;
  border: 1px dashed #f87171;
}
.btn-danger {
  background: #f06565;
  color: #fff;
}

.metric-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: #1f2933;
}

.metric-list li {
  background: #f4f7fb;
  border-radius: 6px;
  padding: 0.45rem 0.6rem;
}
.app-shell {
  --sidebar-width: 240px;
  --shell-height: calc(100vh - 160px);
  display: grid;
  grid-template-columns: var(--sidebar-width) 8px 1fr;
  gap: 0;
  min-height: 420px;
  height: var(--shell-height);
  overflow: hidden;
}
.app-public .app-shell {
  display: block;
  min-height: 0;
  height: auto;
}
.sidebar {
  width: 100%;
  min-width: 200px;
  background:
    radial-gradient(circle at 18% -8%, rgba(255, 255, 255, 0.12), transparent 30%),
    linear-gradient(180deg, #062448 0%, #0a3f73 62%, #0b5a98 100%);
  color: #ccdaf2;
  padding: 1.25rem 0.9rem 1.1rem;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255, 255, 255, 0.14);
  height: 100%;
  overflow: auto;
}
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.sidebar-group {
  display: flex;
  flex-direction: column;
  gap: 0.34rem;
}
.sidebar-group-title {
  margin: 0.2rem 0 0.38rem;
  padding: 0 0.65rem;
  font-size: 0.73rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(204, 218, 242, 0.62);
  font-weight: 700;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.62rem;
  padding: 0.62rem 0.7rem;
  border-radius: 10px;
  color: #d5e5ff;
  text-decoration: none;
  font-weight: 600;
  line-height: 1.25;
  border: 1px solid transparent;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.14s ease;
}
.sidebar-icon {
  width: 1.3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(217, 230, 255, 0.92);
}
.sidebar-label {
  flex: 1;
}
.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(255, 255, 255, 0.16);
  transform: translateX(1px);
}
.sidebar-link.active {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0.08) 100%);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
  box-shadow: inset 2px 0 0 rgba(255, 176, 122, 0.95), 0 8px 20px rgba(3, 21, 40, 0.22);
}
.sidebar-link.active .sidebar-icon {
  color: #fff;
}
.sidebar-footer {
  margin-top: auto;
  font-size: 0.75rem;
  opacity: 0.82;
  letter-spacing: 0.08em;
  color: rgba(221, 232, 250, 0.72);
  padding: 0.8rem 0.7rem 0.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}
.workspace {
  padding: 2rem 2.4rem 2.2rem;
  max-width: none;
  width: 100%;
  margin: 0;
  min-width: 0;
  height: 100%;
  overflow: auto;
}

.app-shell-splitter {
  width: 8px;
  cursor: col-resize;
  background: rgba(3, 31, 61, 0.08);
}

.app-shell-splitter:hover {
  background: rgba(3, 31, 61, 0.2);
}

.app-shell-hsplitter {
  height: 8px;
  cursor: row-resize;
  background: rgba(3, 31, 61, 0.08);
}

.app-shell-hsplitter:hover {
  background: rgba(3, 31, 61, 0.2);
}
.app-public .workspace {
  padding: 2rem;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.topbar-actions a {
  color: #fff;
  text-decoration: none;
  font-weight: 600;
}
.topbar-actions a:hover {
  color: #fff;
  opacity: 0.95;
}
.topbar-actions .btn-primary {
  padding: 0.45rem 1rem;
}
.topbar-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(255, 255, 255, 0.16);
  padding: 0.4rem 0.86rem;
  border-radius: 999px;
  font-size: 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  letter-spacing: 0.02em;
}
.logout-link {
  border: 1px solid rgba(255, 255, 255, 0.38);
  padding: 0.38rem 0.82rem;
  border-radius: 8px;
  transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.12s ease;
}
.logout-link:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.56);
  transform: translateY(-1px);
}
.topbar-logout {
  background: rgba(220, 68, 68, 0.16);
  border-color: rgba(255, 170, 170, 0.46);
}
.dashboard-hero {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  align-items: stretch;
  background: #fff;
  border-radius: 18px;
  padding: 2rem;
  box-shadow: 0 24px 60px rgba(3, 31, 61, 0.18);
  margin-bottom: 2.5rem;
}
.hero-intro {
  flex: 1 1 260px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.hero-intro h1 {
  margin: 0;
  font-size: 2rem;
  color: var(--brand-primary);
}
.hero-intro p {
  margin: 0;
  color: #475569;
  line-height: 1.6;
}
.metric-grid {
  flex: 1 1 260px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
}
.metric-card {
  background: linear-gradient(135deg, #0a4e8b 0%, #133b67 100%);
  color: #fff;
  padding: 1.2rem 1.4rem;
  border-radius: 16px;
  box-shadow: 0 18px 40px rgba(10, 78, 139, 0.25);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.metric-card span {
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.85;
}
.metric-card strong {
  font-size: 1.8rem;
}
.dashboard-section {
  background: #fff;
  border-radius: 16px;
  padding: 1.8rem;
  box-shadow: 0 14px 32px rgba(3, 31, 61, 0.15);
  margin-bottom: 2.5rem;
}
.dashboard-section h2 {
  margin-top: 0;
  color: var(--brand-primary);
}
.dashboard-activity .section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.activity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}
.activity-card {
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 1rem;
  background: #f8fbff;
  display: grid;
  gap: 0.5rem;
}
.activity-card h3 {
  margin: 0;
  font-size: 1rem;
  color: #0f172a;
}
.activity-card .tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #475569;
}
.activity-card p {
  margin: 0;
  color: #475569;
  font-size: 0.85rem;
}
.activity-card time {
  font-size: 0.75rem;
  color: #64748b;
}
.activity-card .muted {
  font-size: 0.75rem;
  color: #94a3b8;
}
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}
.summary-card {
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 1rem;
  display: grid;
  gap: 0.75rem;
}
.summary-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.summary-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.75rem;
}
.summary-card li {
  display: grid;
  gap: 0.35rem;
}
.summary-card li small {
  color: #64748b;
  font-size: 0.75rem;
}
.summary-card p {
  margin: 0;
  color: #64748b;
  font-size: 0.85rem;
}
.dashboard-export-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}
.dashboard-export-meta {
  margin: 0 0 1rem;
  color: #475569;
  font-size: 0.9rem;
}
.dashboard-export-card {
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 1rem;
  display: grid;
  gap: 0.55rem;
  background: #f8fbff;
}
.dashboard-export-card.is-pending {
  background: #fff7ed;
  border-color: #fdba74;
}
.dashboard-export-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.dashboard-export-card h3 {
  margin: 0;
  color: #0f172a;
  font-size: 1rem;
}
.dashboard-export-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  background: #dcfce7;
  color: #166534;
}
.dashboard-export-pill.is-pending {
  background: #ffedd5;
  color: #9a3412;
}
.dashboard-export-card p {
  margin: 0;
  color: #475569;
  font-size: 0.85rem;
}
.dashboard-export-card small {
  color: #64748b;
  font-size: 0.78rem;
}
.dashboard-export-card time {
  color: #64748b;
  font-size: 0.75rem;
}
.btn-primary.btn-disabled {
  opacity: 0.6;
  pointer-events: none;
}
.project-table {
  width: 100%;
  border-collapse: collapse;
}
.project-table th {
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: #64748b;
}
.project-table td,
.project-table th {
  padding: 0.75rem 0.6rem;
  border-bottom: 1px solid #e2e8f0;
}
.project-table tbody tr:hover {
  background: #f8fbff;
}
.badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  background: rgba(10, 78, 139, 0.12);
  color: var(--brand-primary);
}
.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}
.quick-actions .btn-primary {
  margin: 0;
}
.admin-access-section p {
  margin: 0;
  color: #475569;
}
.admin-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.2rem;
}
.admin-metric-card {
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 1rem;
  background: #f8fbff;
  display: grid;
  gap: 0.4rem;
}
.admin-metric-card span {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  font-weight: 700;
}
.admin-metric-card strong {
  color: #0f172a;
  font-size: 1.7rem;
  line-height: 1.1;
}
.admin-online-block {
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 1rem;
  background: #ffffff;
}
.admin-online-block h3 {
  margin: 0 0 0.85rem;
  color: #0f172a;
  font-size: 1rem;
}
.admin-online-list {
  margin: 0;
}
.admin-online-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.admin-online-list li div {
  display: grid;
  gap: 0.2rem;
}
.admin-online-list li small {
  color: #64748b;
}
.admin-online-list li span {
  color: #334155;
  font-size: 0.9rem;
}
.pb-import-banner {
  display: grid;
  gap: 0.25rem;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  padding: 0.9rem 1rem;
  margin-bottom: 1rem;
  background: #f8fafc;
  color: #0f172a;
}
.pb-import-banner.is-running {
  border-color: #f59e0b;
  background: #fffbeb;
}
.pb-import-banner.is-error {
  border-color: #ef4444;
  background: #fef2f2;
}
.pb-summary-grid .card ul.pb-summary-list {
  margin: 0;
  display: grid;
  gap: 0.35rem;
}
.pb-summary-list li code {
  display: inline-block;
  max-width: 260px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}
.pb-status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.16rem 0.58rem;
  font-weight: 700;
  font-size: 0.78rem;
  border: 1px solid transparent;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.pb-status-pill.is-success {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}
.pb-status-pill.is-running {
  background: #fef3c7;
  color: #92400e;
  border-color: #fcd34d;
}
.pb-status-pill.is-error {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fca5a5;
}
.pb-status-pill.is-busy {
  background: #e0f2fe;
  color: #0c4a6e;
  border-color: #7dd3fc;
}
.pb-history-section .table td code {
  font-size: 0.78rem;
}
.app-auth .footer {
  margin-top: 2rem;
}
@media (max-width: 1080px) {
  .workspace {
    padding: 2rem;
  }
}
@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    height: auto;
    min-height: 0;
  }
  .app-shell-splitter,
  .app-shell-hsplitter {
    display: none;
  }
  .sidebar {
    width: 100%;
    flex-direction: column;
    align-items: center;
    padding: 0.8rem;
    overflow-x: auto;
  }
  .sidebar-nav {
    width: 100%;
    flex-direction: row;
    gap: 0.4rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 0.2rem;
  }
  .sidebar-group {
    display: flex;
    flex-direction: row;
    gap: 0.4rem;
    align-items: center;
  }
  .sidebar-group-title {
    display: none;
  }
  .sidebar-link {
    min-width: max-content;
    padding: 0.55rem 0.78rem;
  }
  .sidebar-footer {
    display: none;
  }
  .dashboard-hero {
    flex-direction: column;
  }
  .metric-grid {
    width: 100%;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.2rem;
}
.export-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.2rem;
}
.export-card {
  background: #f8fbff;
  border-radius: 14px;
  padding: 1.2rem;
  box-shadow: 0 12px 24px rgba(3, 31, 61, 0.12);
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.export-card header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.export-card h3 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--brand-primary);
}
.export-card time {
  font-size: 0.85rem;
  color: #64748b;
}
.header-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn-with-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.btn-badge-dev {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: rgba(234, 179, 8, 0.2);
  border: 1px solid rgba(234, 179, 8, 0.55);
  color: #7a5200;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.2;
}

.export-panel {
  margin: 2.5rem 0;
}

.export-panel h2 {
  margin-bottom: 1.2rem;
  color: var(--brand-primary);
}

.export-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.4rem;
  perspective: 1200px;
}

.export-history-list {
  display: grid;
  gap: 1.5rem;
}

.export-batch {
  display: grid;
  gap: 0.9rem;
}

.export-batch-header h3 {
  margin: 0;
  color: var(--brand-primary);
}

.export-card {
  position: relative;
  padding: 1.6rem;
  border-radius: 18px;
  color: #fff;
  transform-style: preserve-3d;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 25px 45px rgba(10, 78, 139, 0.25);
  background: linear-gradient(135deg, #0a4e8b 0%, #143b67 100%);
}

.export-card::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  pointer-events: none;
}

.export-card:hover {
  transform: rotateY(-6deg) rotateX(4deg);
  box-shadow: 0 35px 55px rgba(10, 78, 139, 0.35);
}

.export-card header {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.export-icon {
  font-size: 1.8rem;
}

.export-card p {
  margin: 0 0 1.2rem 0;
  color: rgba(255, 255, 255, 0.85);
}

.export-action {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  transition: background 0.2s ease;
}

.export-action:hover {
  background: rgba(255, 255, 255, 0.3);
}

.export-card--pdf {
  background: linear-gradient(135deg, #ff6a3d 0%, #d94b1c 100%);
}

.export-card--pat {
  background: linear-gradient(135deg, #00a7c4 0%, #006f93 100%);
}

.export-card--prn {
  background: linear-gradient(135deg, #8a5cf6 0%, #5a38c4 100%);
}

.export-card--bundle {
  background: linear-gradient(135deg, #31c46b 0%, #1f8c49 100%);
}

@media (max-width: 720px) {
  .export-card {
    transform: none !important;
  }
}

.assistant-toggle {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.75rem 1.2rem;
  border: none;
  border-radius: 999px;
  background: #0a4e8b;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(3, 31, 61, 0.28);
  z-index: 2200;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.assistant-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 36px rgba(3, 31, 61, 0.32);
}

.assistant-toggle .assistant-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffb347 0%, #ff6a3d 100%);
  color: #031f3d;
  font-size: 1.25rem;
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.2);
}

.assistant-panel {
  position: fixed;
  bottom: 5.5rem;
  right: 1.5rem;
  width: min(360px, calc(100% - 3rem));
  max-height: 480px;
  display: none;
  flex-direction: column;
  background: #fefefe;
  border-radius: 18px;
  box-shadow: 0 18px 46px rgba(3, 31, 61, 0.28);
  overflow: hidden;
  z-index: 2200;
  border: 1px solid rgba(10, 78, 139, 0.12);
}

.assistant-panel.is-open {
  display: flex;
}

.assistant-panel.is-loading {
  opacity: 0.8;
}

.assistant-header {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 1rem 1.2rem;
  background: linear-gradient(135deg, rgba(10, 78, 139, 0.96), rgba(3, 31, 61, 0.96));
  color: #fff;
}

.assistant-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.assistant-title span {
  display: block;
  font-size: 0.75rem;
  opacity: 0.85;
}

.assistant-close {
  margin-left: auto;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.assistant-messages {
  flex: 1;
  padding: 1rem 1.2rem;
  overflow-y: auto;
  background: linear-gradient(180deg, #f5f9ff 0%, #ffffff 45%);
}

.assistant-message {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.9rem;
  max-width: 100%;
}

.assistant-message.from-user {
  align-items: flex-end;
}

.assistant-message.from-assistant {
  align-items: flex-start;
}

.assistant-bubble {
  padding: 0.75rem 0.9rem;
  border-radius: 14px;
  box-shadow: 0 10px 22px rgba(3, 31, 61, 0.12);
  background: #0a4e8b;
  color: #fff;
  max-width: 100%;
  white-space: pre-wrap;
  word-break: break-word;
}

.assistant-message.from-assistant .assistant-bubble {
  background: #ffffff;
  color: #1f2933;
  border: 1px solid rgba(10, 78, 139, 0.12);
  box-shadow: 0 12px 24px rgba(3, 31, 61, 0.12);
}

.assistant-meta {
  font-size: 0.7rem;
  color: rgba(31, 41, 51, 0.6);
}

.assistant-message.from-user .assistant-meta {
  color: rgba(255, 255, 255, 0.75);
}

.assistant-status {
  min-height: 1.3rem;
  padding: 0 1.2rem 0.4rem;
  font-size: 0.8rem;
  color: #0a4e8b;
}

.assistant-status.error {
  color: #d12c2c;
}

.assistant-form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0.85rem 1.2rem 1.1rem;
  background: #fff;
  border-top: 1px solid rgba(10, 78, 139, 0.12);
}

.assistant-form textarea {
  min-height: 64px;
  resize: vertical;
  border-radius: 12px;
  border: 1px solid rgba(10, 78, 139, 0.25);
  padding: 0.75rem;
  font-family: inherit;
}

.assistant-actions {
  display: flex;
  justify-content: flex-end;
}

.assistant-form button {
  border: none;
  cursor: pointer;
}

@media (max-width: 600px) {
  .assistant-panel {
    width: calc(100% - 1.5rem);
    right: 0.75rem;
    left: 0.75rem;
    bottom: 6rem;
  }
  .assistant-toggle {
    right: 0.75rem;
    bottom: 1rem;
  }
}
/* Admin data manager enhancements */
.data-manager .section-intro {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.data-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.2rem;
}
.data-card {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  background: #f9fbff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 1.2rem 1.4rem;
  text-decoration: none;
  color: inherit;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.data-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 36px rgba(3, 31, 61, 0.16);
}
.data-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
}
.data-card h2 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--brand-primary);
}
.data-card-pill {
  display: inline-block;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(10, 78, 139, 0.12);
  color: var(--brand-primary);
}
.data-card dl {
  display: flex;
  gap: 1.6rem;
  margin: 0 0 0.6rem;
}
.data-card dt {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
  margin-bottom: 0.25rem;
}
.data-card dd {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}
.data-card-action {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--brand-primary);
}
.data-list-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.2rem;
}
.data-list-toolbar .toolbar-left,
.data-list-toolbar .toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.filter-field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: #64748b;
}
.filter-field input[type="search"] {
  padding: 0.45rem 0.6rem;
  border-radius: 999px;
  border: 1px solid #cbd5f5;
  min-width: 220px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.filter-field input[type="search"]:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}
.data-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.9rem;
  margin-bottom: 1.5rem;
}
.data-summary-grid article {
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 0.85rem 1rem;
  background: linear-gradient(145deg, #f8fbff, #fff);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.data-summary-grid article span {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
}
.data-summary-grid article strong {
  font-size: 1.05rem;
  color: #1f2937;
}
.data-list-count {
  font-size: 0.85rem;
  color: #64748b;
}
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  border: 1px solid #cbd5f5;
  background: #f8fbff;
  color: #1f2937;
  font-size: 0.8rem;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  margin-right: 0.4rem;
}
.btn-secondary:hover {
  background: #e2ecff;
  border-color: #94a3b8;
}
.btn-secondary.copied {
  background: #16a34a;
  border-color: #15803d;
  color: #fff;
}
.ds-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 15, 25, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1200;
  padding: 1.5rem;
}
.ds-modal {
  background: #0f1c2e;
  border-radius: 18px;
  width: 720px;
  max-width: 96vw;
  max-height: 96vh;
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(2, 6, 23, 0.5);
  border: 1px solid rgba(59, 130, 246, 0.2);
}
.ds-modal.ds-modal-large {
  width: 960px;
}
.ds-modal-header,
.ds-modal-footer {
  padding: 1rem 1.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.ds-modal-header h3 {
  margin: 0;
  font-size: 1.15rem;
  color: #f1f5ff;
}
.ds-modal-body {
  padding: 1rem 1.4rem;
  overflow: auto;
  display: flex;
  gap: 1rem;
  flex: 1;
}
.ds-modal-footer {
  border-top: 1px solid rgba(148, 163, 184, 0.2);
}
.ds-modal-footer .btn-primary,
.ds-modal-footer .secondary {
  min-width: 120px;
}
.asset-body {
  flex-wrap: wrap;
}
.ds-asset-grid {
  flex: 1 1 55%;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.75rem;
  padding: 0.25rem;
}
.ds-asset-card {
  background: rgba(15, 28, 46, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  color: #e2e8f0;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.ds-asset-card img {
  width: 100%;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
}
.ds-asset-card.selected {
  border-color: #3b82f6;
  transform: translateY(-2px);
}
.ds-asset-preview {
  flex: 1 1 40%;
  min-width: 240px;
  background: rgba(15, 28, 46, 0.7);
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
}
.ds-asset-preview img {
  max-width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(59, 130, 246, 0.3);
}
.ds-asset-preview dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 0.75rem;
  margin: 0;
}
.ds-asset-preview dt {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
}
.ds-asset-placeholder {
  color: #94a3b8;
}
.ds-dataset-options {
  flex: 0 0 220px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.ds-dataset-option {
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 28, 46, 0.8);
  color: #e2e8f0;
  text-align: left;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.ds-dataset-option.selected {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.15);
}
.ds-dataset-preview {
  flex: 1;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(7, 13, 24, 0.6);
  padding: 1rem;
  overflow: auto;
}
.ds-dataset-preview pre {
  margin: 0;
  font-size: 0.8rem;
  white-space: pre-wrap;
  word-break: break-word;
}
.ds-diagram-list {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
}
.ds-diagram-card {
  padding: 0.6rem;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 28, 46, 0.75);
  color: #e2e8f0;
  text-align: left;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.ds-diagram-card.selected {
  border-color: #3b82f6;
  transform: translateY(-2px);
}
.ds-diagram-preview {
  flex: 1;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(7, 13, 24, 0.6);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
  justify-content: center;
}
.ds-diagram-preview img {
  max-width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(59, 130, 246, 0.25);
}
.ds-modal-footer .btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.table-wrapper {
  overflow-x: auto;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
}
.data-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}
.data-table thead {
  background: #f8fbff;
}
.data-table th,
.data-table td {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: top;
}
.data-table tbody tr:hover {
  background: #f8fbff;
}
.column-hint {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.7rem;
  color: #94a3b8;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.actions-column {
  white-space: nowrap;
  text-align: right;
}
.data-cell.is-muted {
  color: #94a3b8;
}
.data-cell.is-code code {
  display: inline-block;
  font-family: "Consolas", "SFMono-Regular", monospace;
  font-size: 0.85rem;
  background: #f1f5f9;
  border-radius: 6px;
  padding: 0.2rem 0.35rem;
}
.data-cell.is-json details {
  cursor: pointer;
}
.data-cell.is-json summary {
  font-weight: 600;
  color: var(--brand-primary);
  margin-bottom: 0.45rem;
}
.data-cell.is-json summary::-webkit-details-marker {
  display: none;
}
.data-cell.is-json pre {
  margin: 0;
  padding: 0.75rem;
  background: rgba(10, 78, 139, 0.07);
  border-radius: 10px;
  max-height: 220px;
  overflow: auto;
  font-size: 0.78rem;
  line-height: 1.35;
}
.data-cell.is-json code {
  display: block;
  font-family: "Consolas", "SFMono-Regular", monospace;
}
.data-cell.is-multiline span {
  white-space: pre-line;
  display: block;
}
.badge-positive {
  background: rgba(16, 185, 129, 0.2);
  color: #047857;
}
.badge-neutral {
  background: rgba(148, 163, 184, 0.25);
  color: #475569;
}
.field-hint {
  display: block;
  font-size: 0.75rem;
  color: #64748b;
  margin: 0.25rem 0 0.6rem;
}
.form-field.is-readonly input {
  background: #f1f5f9;
  color: #64748b;
}
.record-id code {
  font-family: "Consolas", "SFMono-Regular", monospace;
  background: #f1f5f9;
  padding: 0.2rem 0.4rem;
  border-radius: 6px;
}
.form-actions {
  margin-top: 1.2rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
}
@media (max-width: 768px) {
  .data-table {
    min-width: 100%;
  }
}

.rf-formula-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.rf-formula-pill {
  display: block;
  padding: 0.6rem 0.85rem;
  border-radius: 0.75rem;
  background: linear-gradient(135deg, rgba(226, 232, 240, 0.55), rgba(148, 163, 184, 0.25));
  border: 1px solid rgba(148, 163, 184, 0.35);
  font-family: "JetBrains Mono", "Fira Code", "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.85rem;
  color: #0f172a;
  letter-spacing: 0.02em;
}

.rf-formula-pill strong {
  font-weight: 600;
}
/* ========= Portfolio Grid & Cards (escopo local) ========= */
.portfolio .grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); /* colunas consistentes */
  gap: 16px;
  align-items: start; /* não esticar cards */
}

/* Card vira um flex container vertical com rodapé fixo */
.portfolio .card {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #fff;
  border: 1px solid rgba(2, 6, 23, 0.06);
  border-radius: 12px;
  padding: 0;                        /* conteúdo controlado pelas seções abaixo */
  box-shadow: 0 4px 10px rgba(0,0,0,0.05);
  overflow: hidden;
}

/* Cabeçalho de mídia com tamanho fixo via aspect-ratio (funciona mesmo sem wrapper) */
.portfolio .card .thumb {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;               /* padronize 4:3 (mude se preferir 16:9) */
  object-fit: cover;                  /* corta sem deformar */
  background: #f2f4f7;                /* placeholder de fundo enquanto carrega */
  border-bottom: 1px solid #eef2f7;
}

/* Placeholder automático para cards SEM imagem (requer :has – suportado nos navegadores atuais) */
.portfolio .card:not(:has(.thumb))::before {
  content: "Sem imagem";
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #f2f4f7;
  color: #98a2b3;
  font-size: 0.9rem;
  border-bottom: 1px solid #eef2f7;
}

/* Área de conteúdo do card */
.portfolio .card h3,
.portfolio .card p,
.portfolio .card small,
.portfolio .card span {
  padding: 0 14px;
}

.portfolio .card h3 {
  margin: 12px 0 6px;
  font-size: 1rem;
  line-height: 1.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;             /* evita títulos compridos quebrarem o layout */
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.portfolio .card p {
  margin: 0 0 8px;
  color: #475467;
  font-size: 0.92rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;             /* limita descrição a 3 linhas */
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.portfolio .card small,
.portfolio .card span {
  display: block;
  color: #667085;
  font-size: 0.85rem;
  margin-bottom: 2px;
}

/* Ações sempre no rodapé do card */
.portfolio .card .card-actions {
  margin-top: auto;                   /* empurra para baixo */
  padding: 10px 14px 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  border-top: 1px solid #eef2f7;
}

.portfolio .card .btn {
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  padding: 6px 10px;
  background: #fff;
  text-decoration: none;
  font-size: .9rem;
}
.portfolio .card .btn:hover { background: #f9fafb; }

/* Títulos de seção mais próximos do grid */
.portfolio > h3 {
  margin: 1.25rem 0 0.75rem;
}

/* Agent Selection */
.assistant-panel[data-view="chat"] .assistant-agent-selection {
  display: none;
}
.assistant-panel[data-view="agent-selection"] .assistant-messages,
.assistant-panel[data-view="agent-selection"] .assistant-form {
  display: none;
}

.assistant-agent-selection-title {
  font-size: 1rem;
  font-weight: 600;
  padding: 0.75rem 1rem;
  margin: 0;
  border-bottom: 1px solid #eee;
}

.assistant-agent-selection-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.5rem;
}

.assistant-agent-item {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid #ddd;
  border-radius: 0.5rem;
  background: #f9f9f9;
  cursor: pointer;
  text-align: left;
  transition: background-color 0.2s, border-color 0.2s;
}

.assistant-agent-item:hover {
  background-color: #f0f0f0;
  border-color: #ccc;
}

.assistant-agent-item-role {
  font-weight: 600;
  color: #333;
}

.assistant-agent-item-desc {
  font-size: 0.875rem;
  color: #666;
  margin-top: 0.25rem;
}

.assistant-back-button {
  position: absolute;
  top: 0.5rem;
  right: 2.5rem;
  background: none;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  cursor: pointer;
  color: #555;
}
.assistant-back-button:hover {
    background: #eee;
}
