/* gs-systems.css — minimal UI classes for extended systems */
/* plain CSS only — no @apply, no build step required */

/* ============================================
   Buttons
   ============================================ */
.gs-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.25rem;
    border-radius: 0.25rem;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #374151;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
    text-decoration: none;
}
/* focus/active included so legacy global button styles can't invert the label (e.g. Hide/Show Filter) */
.gs-btn:hover, .gs-btn:focus, .gs-btn:active { background: #f9fafb; color: #374151; outline: none; }

.gs-btn-primary { background: #2563eb; color: #fff; border-color: #2563eb; }
/* solid variants re-assert white text on hover/focus/active so the generic .gs-btn:hover dark color can't win */
.gs-btn-primary:hover, .gs-btn-primary:focus, .gs-btn-primary:active { background: #1d4ed8; border-color: #1d4ed8; color: #fff; }

.gs-btn-secondary { background: #f3f4f6; color: #374151; border-color: #d1d5db; }
.gs-btn-secondary:hover, .gs-btn-secondary:focus, .gs-btn-secondary:active { background: #e5e7eb; color: #374151; }

.gs-btn-success { background: #16a34a; color: #fff; border-color: #16a34a; }
.gs-btn-success:hover, .gs-btn-success:focus, .gs-btn-success:active { background: #15803d; border-color: #15803d; color: #fff; }

.gs-btn-danger { background: #dc2626; color: #fff; border-color: #dc2626; }
.gs-btn-danger:hover, .gs-btn-danger:focus, .gs-btn-danger:active { background: #b91c1c; border-color: #b91c1c; color: #fff; }

.gs-btn-outline { background: transparent; color: #4b5563; border-color: #d1d5db; }
.gs-btn-outline:hover { background: #f9fafb; color: #1f2937; }

.gs-btn-sm { padding: 4px 8px; font-size: 0.75rem; }

.gs-btn-ghost { background: transparent; border-color: transparent; color: #6b7280; }
.gs-btn-ghost:hover { background: #f3f4f6; color: #374151; }

/* Opinionated submit button (pair with width utility classes like w-200px/w-full). */
.gs-submit {
    padding: 0.75rem 1rem;
    border: 0;
    border-radius: 0.75rem;
    background: #2563eb;
    color: #fff;
    cursor: pointer;
}

/* Solid button anchors must keep white text inside .gs-page/.gs-page-fluid
   (whose `a { color }` rule would otherwise win and wash out the label). */
.gs-page a.gs-btn-primary, .gs-page-fluid a.gs-btn-primary,
.gs-page a.gs-btn-success, .gs-page-fluid a.gs-btn-success,
.gs-page a.gs-btn-danger,  .gs-page-fluid a.gs-btn-danger { color: #fff; }

/* ============================================
   Cards
   ============================================ */
.gs-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
}
.gs-card-body { padding: 1rem; }
.gs-card-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}
.gs-card-hover { transition: box-shadow 0.15s; }
.gs-card-hover:hover { box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1); }

/* ============================================
   Tables
   ============================================ */
.gs-table {
    width: 100%;
    font-size: 0.875rem;
    text-align: left;
    border-collapse: collapse;
}
.gs-table th {
    padding: 0.5rem 0.75rem;
    background: #f9fafb;
    color: #4b5563;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    border-bottom: 1px solid #e5e7eb;
}
.gs-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #f3f4f6;
    color: #374151;
}
.gs-table tr:hover td { background: #f9fafb; }

/* compact, evenly-spaced vertical header cell: label → input/sublabel → All action */
.gs-th-stack { display: flex; flex-direction: column; align-items: center; gap: 0.25rem; }
.gs-th-stack small { color: #6b7280; text-transform: none; font-weight: 400; }
.gs-table th:has(.gs-th-stack) { vertical-align: top; }

/* ============================================
   Inputs
   ============================================ */
.gs-input, .gs-select {
    padding: 6px 8px;
    font-size: 0.875rem;
    border: 1px solid #d1d5db;
    border-radius: 0.25rem;
    background: #fff;
    color: #374151;
}
.gs-input:focus, .gs-select:focus {
    outline: none;
    border-color: #60a5fa;
    box-shadow: 0 0 0 1px #60a5fa;
}
.gs-checkbox { width: 1rem; height: 1rem; }

/* ============================================
   Badges
   ============================================ */
.gs-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 0.25rem;
}
.gs-badge-success { background: #dcfce7; color: #15803d; }
.gs-badge-error   { background: #fee2e2; color: #b91c1c; }
.gs-badge-warning { background: #fef9c3; color: #a16207; }
.gs-badge-info    { background: #dbeafe; color: #1d4ed8; }
.gs-badge-ghost   { background: #f3f4f6; color: #6b7280; }

/* Audit marker: missing required reference/data value (soft warning).
   Use on a cell/row to highlight, or compose with .gs-badge for an inline label. */
.gs-missing { background: #fef9c3; border: 1px solid #fde68a; color: #a16207; }

/* ============================================
   Layout
   ============================================ */
.gs-container { padding: 1.5rem; }

/* ============================================
   Links
   ============================================ */
.gs-link { color: #2563eb; font-size: 0.875rem; text-decoration: none; }
.gs-link:hover { text-decoration: underline; }

/* ============================================
   Alerts
   ============================================ */
.gs-alert { padding: 0.75rem 1rem; border-radius: 0.25rem; font-size: 0.875rem; }
.gs-alert-warning { background: #fefce8; color: #854d0e; border: 1px solid #fde68a; }
.gs-alert-error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.gs-alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }

/* ============================================
   Modal
   ============================================ */
.gs-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
}
.gs-modal {
    background: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);
    padding: 1.5rem;
    max-height: 90vh;
    overflow-y: auto;
    width: 100%;
    max-width: 42rem;
}
.gs-modal-title { font-size: 1.125rem; font-weight: 700; margin-bottom: 1rem; }
.gs-modal-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1rem; }

/* ============================================
   Page primitives
   ============================================ */
/* Centered, max-width page container (default for view/edit/manage/settings pages). */
.gs-page { width: 100%; max-width: 1280px; margin: 0 auto; padding: 1.25rem 1.5rem 2rem; color: #1f2937; font-size: 14px; }
/* Full-width page container (wide tables/matrix/reports/dashboards only). */
.gs-page-fluid { width: 100%; padding: 1.25rem 1.5rem 2rem; color: #1f2937; font-size: 14px; }
.gs-page a, .gs-page-fluid a { color: #1d4ed8; text-decoration: none; }
.gs-page a:hover, .gs-page-fluid a:hover { text-decoration: underline; }
.gs-page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-bottom: 0.875rem; border-bottom: 1px solid #e5e7eb; margin-bottom: 1rem; }
.gs-page-title { font-size: 1.25rem; font-weight: 600; color: #111827; margin: 0; }
.gs-page-subtitle { margin: 2px 0 0; font-size: 0.8125rem; color: #6b7280; }

/* ============================================
   Toolbar (compact text-link row)
   ============================================ */
.gs-toolbar { display: flex; flex-wrap: wrap; gap: 0.125rem 0.25rem; align-items: center; }
.gs-toolbar a { display: inline-block; padding: 4px 8px; border-radius: 0.25rem; font-size: 0.8125rem; color: #4b5563; text-decoration: none; }
.gs-toolbar a:hover { background: #f3f4f6; color: #111827; text-decoration: none; }
.gs-toolbar-sep { color: #d1d5db; padding: 0 2px; user-select: none; }
.gs-toolbar-label { color: #9ca3af; text-transform: uppercase; letter-spacing: 0.05em; font-size: 0.6875rem; padding-right: 4px; }
.gs-toolbar-sub { margin: -0.25rem 0 1rem; font-size: 0.8125rem; gap: 0.125rem 0.5rem; }

/* ============================================
   Grouped links (segmented control — joined links, no gaps)
   ============================================ */
.gs-groupedlinks { display: inline-flex; vertical-align: middle; border: 1px solid #cbd5e1; border-radius: 0.375rem; overflow: hidden; }
.gs-groupedlink { display: inline-block; padding: 4px 12px; font-size: 0.8125rem; line-height: 1.4; color: #334155; text-decoration: none; background: #fff; border-left: 1px solid #cbd5e1; }
.gs-groupedlink:first-child { border-left: 0; }
.gs-groupedlink:hover { background: #eff6ff; color: #1d4ed8; text-decoration: none; }
.gs-groupedlink.is-active { background: #2563eb; color: #fff; }

/* ============================================
   Pill navigation (level switchers, segmented filters)
   ============================================ */
.gs-nav { display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 0.5rem 0 0.875rem; margin: 0 0 1rem; border-bottom: 1px solid #f3f4f6; }
.gs-nav a { padding: 6px 14px; border-radius: 999px; font-size: 0.8125rem; font-weight: 500; line-height: 1; color: #4b5563; text-decoration: none; background: #fff; border: 1px solid #e5e7eb; transition: all 0.15s ease; }
.gs-nav a:hover { background: #f9fafb; color: #111827; border-color: #d1d5db; text-decoration: none; transform: translateY(-1px); }
.gs-nav a.active { background: #2563eb; color: #fff; border-color: #2563eb; box-shadow: 0 1px 2px rgba(37, 99, 235, 0.3); }
.gs-nav a.active:hover { background: #1d4ed8; color: #fff; }

/* ============================================
   Section group (soft inner panel with small uppercase title)
   ============================================ */
.gs-section { margin-top: 1.5rem; padding: 1rem; background: #fafbfc; border: 1px solid #e5e7eb; border-radius: 0.5rem; }
.gs-section-title { font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; color: #6b7280; margin: 0 0 0.75rem; }

/* ============================================
   Card status variants and panel heading
   ============================================ */
.gs-card-warn   { border-color: #fde68a; background: #fffbeb; }
.gs-card-danger { border-color: #fecaca; background: #fff5f5; }
.gs-card-heading { font-size: 0.875rem; font-weight: 600; color: #111827; margin: 0 0 0.5rem; }
.gs-card-warn   .gs-card-heading { color: #92400e; }
.gs-card-danger .gs-card-heading { color: #991b1b; }

/* ============================================
   Form row (label above input, input fills row)
   ============================================ */
.gs-form-row { margin-bottom: 0.5rem; }
.gs-form-label { display: block; font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.04em; color: #6b7280; margin-bottom: 3px; font-weight: 500; }
.gs-form-row .gs-input, .gs-form-row .gs-select { width: 100%; box-sizing: border-box; }

/* ============================================
   Help text (paragraph under headings / fields)
   ============================================ */
.gs-help-text { margin: 0 0 0.625rem; font-size: 0.75rem; color: #6b7280; }
.gs-card-warn   .gs-help-text { color: #92400e; }
.gs-card-danger .gs-help-text { color: #b91c1c; }

/* ============================================
   Alert info variant
   ============================================ */
.gs-alert-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* ============================================
   Compact scrollable bordered list
   ============================================ */
.gs-list { max-height: 360px; overflow-y: auto; font-size: 0.8125rem; border-top: 1px solid #f3f4f6; }
.gs-list a, .gs-list .gs-list-row { display: block; padding: 4px 6px; color: #374151; border-bottom: 1px solid #f3f4f6; font-variant-numeric: tabular-nums; text-decoration: none; }
.gs-list a:hover { background: #f9fafb; color: #1d4ed8; text-decoration: none; }

/* ============================================
   Detail list (read-only label/value rows)
   ============================================ */
.gs-detail-row { display: flex; padding: 0.5rem 0; border-bottom: 1px solid #f3f4f6; }
.gs-detail-row:last-child { border-bottom: none; }
.gs-detail-label { flex: 0 0 160px; color: #6b7280; font-size: 0.8125rem; }
.gs-detail-value { flex: 1; color: #1f2937; font-size: 0.875rem; }

/* ============================================
   Form actions (button row under a form)
   ============================================ */
.gs-form-actions { display: flex; gap: 0.5rem; margin-top: 1rem; }

/* ============================================
   Helpers
   ============================================ */
.gs-muted { color: #9ca3af; }

/* ============================================
   Menu hub (object navigation: search bar + grouped link cards)
   Reusable across SSCC {object}/index hubs. Behavior in gs-systems.js.
   ============================================ */
.gs-hub-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; margin-bottom: 1.25rem; }
.gs-hub-bar-icon { color: #9ca3af; font-size: 14px; flex-shrink: 0; }
.gs-hub-search { flex: 1; border: 0; outline: 0; font-size: 13px; color: #1f2937; background: transparent; }
.gs-hub-search::placeholder { color: #9ca3af; }
.gs-hub-group { margin-bottom: 1.5rem; }
.gs-hub-group-title { font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; color: #6b7280; margin: 0 0 0.625rem; padding-bottom: 0.375rem; border-bottom: 1px solid #f3f4f6; }
.gs-hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.5rem; }
.gs-hub-card { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid #e5e7eb; border-radius: 8px; background: #fff; text-decoration: none; color: #1f2937; transition: border-color 0.15s, box-shadow 0.15s; }
.gs-hub-card:hover { border-color: #bfdbfe; box-shadow: 0 2px 8px rgba(37, 99, 235, 0.08); text-decoration: none; }
.gs-hub-icon { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 7px; background: #f3f4f6; font-size: 15px; flex-shrink: 0; }
.gs-hub-card:hover .gs-hub-icon { background: #eff6ff; }
.gs-hub-label { font-size: 13px; font-weight: 500; line-height: 1.3; color: #374151; }

/* ============================================
   Searchable (canon in-page filter — #searchInput + .searchable)
   Behavior in gs-systems.js: findSearchable() / clearSearch().
   ============================================ */
.searchable.highlight-match { border-color: #86efac; box-shadow: 0 0 0 2px rgba(134, 239, 172, 0.45); }

/* ============================================
   Report dashboard (reusable: filter card + KPI grid + chart/table cards)
   Pattern reference: labrooms/report
   ============================================ */
.gs-filter-card { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.75rem; background: #fff; border: 1px solid #e5e7eb; border-radius: 0.5rem; padding: 0.875rem 1rem; margin-bottom: 1rem; }
.gs-filter-field { display: flex; flex-direction: column; gap: 3px; }
.gs-filter-field label { font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.04em; color: #6b7280; font-weight: 600; }
.gs-filter-quick { display: flex; align-items: center; gap: 0.25rem; font-size: 0.8125rem; padding-bottom: 7px; }
.gs-filter-quick a { cursor: pointer; }
.gs-filter-actions { display: flex; gap: 0.5rem; margin-left: auto; padding-bottom: 1px; }

.gs-kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.75rem; margin: 0 0 1rem; }
.gs-kpi-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 0.5rem; padding: 0.875rem 1rem; }
.gs-kpi-label { font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.05em; color: #6b7280; font-weight: 600; }
.gs-kpi-value { margin-top: 0.25rem; font-size: 1.5rem; font-weight: 700; color: #111827; font-variant-numeric: tabular-nums; line-height: 1.1; }
.gs-kpi-sub { margin-top: 2px; font-size: 0.75rem; color: #9ca3af; }
.gs-kpi-card.is-accent { border-color: #bfdbfe; background: #eff6ff; }
.gs-kpi-card.is-accent .gs-kpi-value { color: #1d4ed8; }

.gs-chart-card, .gs-table-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 0.5rem; padding: 1rem; margin-bottom: 1rem; }
.gs-chart-wrap { position: relative; height: 340px; width: 100%; }

/* ============================================
   Report shell (page-head action row, numeric cells, empty state)
   Reusable report pattern. Pairs with .gs-page-head + .gs-filter-card + .gs-table.
   ============================================ */
.gs-report-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.gs-num { text-align: right; font-variant-numeric: tabular-nums; }
.gs-report-empty { padding: 2rem 1rem; text-align: center; color: #9ca3af; font-size: 0.875rem; }

/* ============================================
   Records data-table typography (apply on the page root)
   Humanist system sans + tabular numerals so numeric columns align; denser table text.
   ============================================ */
.gs-records, .gs-records table { font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; font-variant-numeric: tabular-nums; }
.gs-records table { font-size: 0.875rem; }
