/* ============================================================
   Operandi One — Demo Pages Shared Stylesheet
   All 5 building block pages share this single file.
   Uses Manrope (loaded via Google Fonts in each HTML page).
   Tailwind-compatible utility classes are inlined here so
   the pages have zero external build-step dependencies.
   ============================================================ */

/* --- Reset & Base ----------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  border-width: 0;
  border-style: solid;
  border-color: #e5e7eb;
}
html {
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  font-family: 'Manrope', sans-serif;
  height: 100%;
  background-color: #f9fafb;
}
body {
  margin: 0;
  line-height: inherit;
  height: 100%;
}
a { color: inherit; text-decoration: inherit; }
b, strong { font-weight: bolder; }
img, svg { display: block; }
table { border-collapse: collapse; }

/* --- CSS Variables ---------------------------------------- */
:root {
  --indigo-50:  #eef2ff;
  --indigo-100: #e0e7ff;
  --indigo-600: #4f46e5;
  --indigo-700: #4338ca;
  --gray-50:    #f9fafb;
  --gray-100:   #f3f4f6;
  --gray-200:   #e5e7eb;
  --gray-300:   #d1d5db;
  --gray-400:   #9ca3af;
  --gray-500:   #6b7280;
  --gray-700:   #374151;
  --gray-900:   #111827;
  --sidebar-w:  18rem; /* 288px = w-72 */
  --green-100:  #dcfce7;
  --green-700:  #15803d;
  --blue-100:   #dbeafe;
  --blue-800:   #1e40af;
  --yellow-100: #fef9c3;
  --yellow-800: #854d0e;
  --red-100:    #fee2e2;
  --red-700:    #b91c1c;
}

/* --- Demo Banner ------------------------------------------ */
.demo-banner {
  background: var(--indigo-600);
  color: #fff;
  text-align: center;
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  letter-spacing: 0.01em;
  position: sticky;
  top: 0;
  z-index: 100;
}
.demo-banner a,
.demo-banner-link {
  color: #c7d2fe;
  text-decoration: underline;
  margin-left: 0.5rem;
}
.demo-banner-link {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-size: inherit;
  font-weight: inherit;
  font-family: inherit;
  letter-spacing: inherit;
}

/* --- Layout ----------------------------------------------- */
.layout {
  display: flex;
  min-height: 100vh;
}

/* --- Sidebar ---------------------------------------------- */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  position: fixed;
  left: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--gray-200);
  background: #fff;
  overflow-y: auto;
  height: 100%;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  height: 4.5rem;
  padding: 0 1.5rem;
  margin-top: 1rem;
  flex-shrink: 0;
}
.sidebar-logo img {
  height: 4rem;
  width: auto;
}
.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0 1.5rem;
  padding-bottom: 1rem;
}
.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}
.nav-item a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-radius: 0.375rem;
  padding: 0.5rem;
  font-size: 0.875rem;
  line-height: 1.5rem;
  font-weight: 600;
  color: var(--gray-700);
  transition: background 0.15s, color 0.15s;
}
.nav-item a:hover {
  background: var(--gray-50);
  color: var(--indigo-600);
}
.nav-item a:hover svg { color: var(--indigo-600); }
.nav-item a.active {
  background: var(--gray-50);
  color: var(--indigo-600);
}
.nav-item a.active svg { color: var(--indigo-600); }
.nav-item svg {
  width: 1.5rem;
  height: 1.5rem;
  flex-shrink: 0;
  color: var(--gray-400);
}

/* Sidebar bottom user area */
.sidebar-user {
  margin: 0 -1.5rem 20px;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-900);
  border-top: 1px solid var(--gray-200);
}
.sidebar-user svg {
  width: 2rem;
  height: 2rem;
  color: var(--gray-400);
  flex-shrink: 0;
}

/* --- Main content ----------------------------------------- */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  background: #fff;
  min-height: 100vh;
}
.page-body {
  padding: 2.5rem 2rem;
}

/* --- Page header ------------------------------------------ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.page-title {
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--gray-900);
  letter-spacing: -0.02em;
  margin: 0;
}
.page-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* --- Buttons ---------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  border-radius: 0.375rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  border: none;
}
.btn-primary {
  background: var(--indigo-600);
  color: #fff;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}
.btn-primary:hover { background: var(--indigo-700); }
.btn-secondary {
  background: #fff;
  color: var(--gray-900);
  box-shadow: 0 0 0 1px var(--gray-300) inset;
}
.btn-secondary:hover { background: var(--gray-50); }
.btn svg {
  width: 1.25rem;
  height: 1.25rem;
}
.btn-sm {
  min-width: 6rem;
  border-radius: 0.25rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
}

/* --- Placeholder context box ------------------------------ */
.context-box {
  background: var(--indigo-50);
  border: 1px solid var(--indigo-100);
  border-radius: 0.5rem;
  padding: 1rem 1.25rem;
  margin-bottom: 2rem;
  display: flex;
  gap: 0.75rem;
  align-items: center;
}
.context-box-icon {
  width: 1.25rem;
  height: 1.25rem;
  color: var(--indigo-600);
  flex-shrink: 0;
  margin-top: 0.125rem;
}
.context-box-text { font-size: 0.875rem; color: var(--gray-700); line-height: 1.6; }
.context-box-text strong { color: var(--indigo-600); }

/* --- Tables ----------------------------------------------- */
.table-wrap {
  overflow-x: auto;
  margin: 0 -0.5rem;
}
table.data-table {
  width: 100%;
  min-width: 600px;
  border-collapse: collapse;
  font-size: 0.875rem;
}
table.data-table thead th {
  padding: 0.875rem 0.75rem;
  text-align: left;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-900);
  border-bottom: 1px solid var(--gray-300);
}
table.data-table thead th:first-child { padding-left: 1.5rem; }
table.data-table thead th:last-child { padding-right: 1.5rem; }
table.data-table tbody tr { border-bottom: 1px solid var(--gray-200); }
table.data-table tbody tr:last-child { border-bottom: none; }
table.data-table tbody tr.odd { background: var(--gray-50); }
table.data-table td {
  padding: 1rem 0.75rem;
  color: var(--gray-500);
  white-space: nowrap;
}
table.data-table td:first-child {
  padding-left: 1.5rem;
  color: var(--gray-900);
  font-weight: 500;
}
table.data-table td:last-child {
  padding-right: 1.5rem;
  text-align: right;
}
table.data-table td.truncate-cell {
  max-width: 18rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- Badges ----------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  border-radius: 9999px;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
}
.badge-dot {
  width: 0.375rem;
  height: 0.375rem;
  border-radius: 50%;
  flex-shrink: 0;
}
.badge-neutral {
  color: var(--gray-900);
  box-shadow: 0 0 0 1px var(--gray-200) inset;
}
.badge-neutral .badge-dot { background: #1e40af; }
.badge-blue {
  background: var(--blue-100);
  color: var(--blue-800);
  box-shadow: 0 0 0 1px rgb(37 99 235 / 0.2) inset;
}
.badge-green {
  background: var(--green-100);
  color: var(--green-700);
  box-shadow: 0 0 0 1px rgb(21 128 61 / 0.2) inset;
}
.badge-yellow {
  background: var(--yellow-100);
  color: var(--yellow-800);
  box-shadow: 0 0 0 1px rgb(133 77 14 / 0.2) inset;
}
.badge-red {
  background: var(--red-100);
  color: var(--red-700);
  box-shadow: 0 0 0 1px rgb(185 28 28 / 0.2) inset;
}

/* --- News feed (timeline) --------------------------------- */
.news-feed { list-style: none; margin: 0; padding: 0; }
.news-item { position: relative; padding-bottom: 2rem; }
.news-item:last-child { padding-bottom: 0; }
.news-item::before {
  content: '';
  position: absolute;
  left: 1rem;
  top: 2rem;
  bottom: 0;
  width: 2px;
  background: var(--gray-200);
}
.news-item:last-child::before { display: none; }
.news-item-inner {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}
.news-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 8px #fff;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.news-icon-wrap svg {
  width: 1.5rem;
  height: 1.5rem;
  color: var(--gray-500);
}
/* Type badge in news meta line */
.news-type-badge {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.125rem 0.4rem;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.news-type-user    { background: var(--indigo-50);  color: var(--indigo-600); }
.news-type-system  { background: var(--gray-100);   color: var(--gray-500);   }
.news-type-process { background: var(--green-100);  color: var(--green-700);  }
.news-body { flex: 1; min-width: 0; }
.news-title { font-size: 0.875rem; font-weight: 500; color: var(--gray-900); }
.news-content { margin-top: 0.5rem; font-size: 0.875rem; color: var(--gray-700); line-height: 1.6; }
.news-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: var(--gray-500);
}

/* --- Section description ---------------------------------- */
.section-description {
  font-size: 0.9375rem;
  color: var(--gray-500);
  margin: 0 0 1.5rem 0;
  line-height: 1.6;
  max-width: 52rem;
}

/* --- Records / Reports / Actions grid (icon cards) -------- */
.record-name-cell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.record-name-cell svg {
  width: 1.25rem;
  height: 1.25rem;
  color: var(--indigo-600);
  flex-shrink: 0;
}

/* --- Responsive: hide sidebar on small screens ------------ */
@media (max-width: 1023px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; }
}
