/* ==========================================================================
   eFlow2u Configuration Studio — base stylesheet
   Phase 1: enterprise admin shell. Deliberately restrained; no RentalOps
   property-industry branding. Simple system fonts, neutral palette,
   clean spacing, high information density.
   ========================================================================== */

:root {
    --c-bg:          #f4f6fa;
    --c-surface:     #ffffff;
    --c-surface-alt: #f8f9fc;
    --c-border:      #e3e6ef;
    --c-border-strong: #cbd0dc;
    --c-text:        #1f2430;
    --c-text-muted:  #6b7280;
    --c-text-soft:   #9099aa;
    --c-primary:     #1f4cc0;
    --c-primary-dark:#163a94;
    --c-primary-soft:#e8eefc;
    --c-accent:      #1f4cc0;
    --c-success:     #1b8757;
    --c-success-bg:  #e7f5ee;
    --c-danger:      #c0392b;
    --c-danger-bg:   #fbeae8;
    --c-warning:     #b07b00;
    --c-sidebar:     #0f1a2e;
    --c-sidebar-alt: #18253d;
    --c-sidebar-text:#c8d1e2;
    --c-sidebar-text-muted:#7e89a0;
    --radius:        6px;
    --radius-sm:     4px;
    --shadow-sm:     0 1px 2px rgba(16,24,40,0.06);
    --font-stack:    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--font-stack);
    font-size: 14px;
    line-height: 1.5;
    color: var(--c-text);
    background: var(--c-bg);
}

a { color: var(--c-primary); text-decoration: none; }
a:hover { color: var(--c-primary-dark); text-decoration: underline; }

/* --------------------------------------------------------------------------
   Shell layout
   -------------------------------------------------------------------------- */
.studio-shell {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}

.studio-sidebar {
    background: var(--c-sidebar);
    color: var(--c-sidebar-text);
    display: flex;
    flex-direction: column;
}

.studio-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.studio-brand-mark {
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    background: var(--c-primary); color: white;
    font-weight: 700; border-radius: var(--radius-sm);
    font-size: 14px;
}
.studio-brand-mark--lg { width: 48px; height: 48px; font-size: 20px; }
.studio-brand-title { font-size: 14px; font-weight: 600; color: #fff; }
.studio-brand-sub { font-size: 11px; color: var(--c-sidebar-text-muted); letter-spacing: 0.5px; text-transform: uppercase; }

.studio-nav { flex: 1; overflow-y: auto; padding: 12px 0; }
.studio-nav-root { list-style: none; margin: 0; padding: 0; }
.studio-nav-group { padding: 8px 0; }
.studio-nav-group-title {
    padding: 6px 20px;
    font-size: 11px;
    font-weight: 600;
    color: var(--c-sidebar-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}
.studio-nav-children { list-style: none; margin: 0; padding: 0; }
.studio-nav-item a {
    display: block;
    padding: 7px 20px 7px 28px;
    color: var(--c-sidebar-text);
    font-size: 13px;
    border-left: 3px solid transparent;
}
.studio-nav-item a:hover {
    background: var(--c-sidebar-alt);
    color: #fff;
    text-decoration: none;
}
.studio-nav-item.is-active a {
    background: var(--c-sidebar-alt);
    color: #fff;
    border-left-color: var(--c-primary);
    font-weight: 500;
}
.studio-nav-item.is-disabled span {
    display: block;
    padding: 7px 20px 7px 28px;
    font-size: 13px;
    border-left: 3px solid transparent;
    color: var(--c-sidebar-text-muted);
    cursor: not-allowed;
    opacity: 0.55;
}

.studio-sidebar-footer {
    padding: 12px 20px;
    border-top: 1px solid rgba(255,255,255,0.06);
    font-size: 11px;
    color: var(--c-sidebar-text-muted);
}

/* --------------------------------------------------------------------------
   Main area
   -------------------------------------------------------------------------- */
.studio-main { display: flex; flex-direction: column; min-width: 0; }

.studio-topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 28px;
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-border);
}
.studio-breadcrumb { font-size: 13px; color: var(--c-text-muted); }
.studio-breadcrumb-item.is-leaf { color: var(--c-text); font-weight: 500; }
.studio-breadcrumb-sep { margin: 0 6px; color: var(--c-text-soft); }

.studio-user { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.studio-user-name { font-weight: 500; }
.studio-user-role {
    padding: 2px 8px;
    background: var(--c-primary-soft);
    color: var(--c-primary-dark);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
}
.studio-logout-form { margin: 0; }
.studio-logout-btn {
    background: transparent;
    border: 1px solid var(--c-border-strong);
    color: var(--c-text-muted);
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 12px;
}
.studio-logout-btn:hover { background: var(--c-surface-alt); color: var(--c-text); }

.studio-content { flex: 1; padding: 24px 28px; }

.studio-page-header { margin-bottom: 20px; }
.studio-page-title { font-size: 22px; font-weight: 600; margin: 0 0 4px; color: var(--c-text); }
.studio-page-purpose { margin: 0; color: var(--c-text-muted); font-size: 13px; }

.studio-alert-slot:empty { display: none; }
.studio-alert {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 13px;
    border: 1px solid transparent;
}
.studio-alert.is-success { background: var(--c-success-bg); color: var(--c-success); border-color: #b6ddc5; }
.studio-alert.is-error   { background: var(--c-danger-bg);  color: var(--c-danger);  border-color: #efc6c1; }

.studio-page-body { /* page content slot */ }

.studio-footer {
    padding: 12px 28px;
    font-size: 12px;
    color: var(--c-text-soft);
    border-top: 1px solid var(--c-border);
    background: var(--c-surface);
}

/* --------------------------------------------------------------------------
   Placeholder pages
   -------------------------------------------------------------------------- */
.studio-placeholder {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow-sm);
}
.studio-placeholder-note {
    display: inline-block;
    padding: 4px 10px;
    background: var(--c-primary-soft);
    color: var(--c-primary-dark);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}
.studio-placeholder h2 { margin: 0 0 8px; font-size: 18px; }
.studio-placeholder p { margin: 0 0 8px; color: var(--c-text-muted); }
.studio-placeholder ul { margin: 12px 0 0 18px; color: var(--c-text-muted); }

/* --------------------------------------------------------------------------
   Login page
   -------------------------------------------------------------------------- */
.studio-login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, #f4f6fa 0%, #e7ecf6 100%);
    padding: 24px;
}
.studio-login-card {
    width: 100%;
    max-width: 380px;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 10px;
    padding: 32px 28px;
    box-shadow: 0 10px 40px rgba(16,24,40,0.08);
}
.studio-login-brand {
    text-align: center;
    margin-bottom: 24px;
}
.studio-login-brand .studio-brand-mark { margin: 0 auto 12px; }
.studio-login-title { font-size: 18px; margin: 0 0 4px; color: var(--c-text); }
.studio-login-sub { color: var(--c-text-muted); font-size: 12px; margin: 0; }

.studio-form { display: flex; flex-direction: column; gap: 14px; }
.studio-form-field { display: flex; flex-direction: column; gap: 6px; }
.studio-form-field label { font-size: 12px; font-weight: 600; color: var(--c-text); }
.studio-form-field input[type=text],
.studio-form-field input[type=password] {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--c-border-strong);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    background: var(--c-surface);
}
.studio-form-field input:focus {
    outline: none;
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px rgba(31,76,192,0.12);
}
.studio-form-checkbox { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--c-text-muted); }
.studio-btn {
    display: inline-block;
    padding: 10px 16px;
    background: var(--c-primary);
    color: #fff;
    border: 1px solid var(--c-primary);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}
.studio-btn:hover { background: var(--c-primary-dark); }
.studio-btn--block { width: 100%; }

.studio-validation-summary {
    background: var(--c-danger-bg);
    color: var(--c-danger);
    border: 1px solid #efc6c1;
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-size: 13px;
    margin-bottom: 6px;
}
.studio-validation-summary ul { margin: 6px 0 0 18px; padding: 0; }
.studio-field-error { color: var(--c-danger); font-size: 12px; }

/* --------------------------------------------------------------------------
   Error / access denied
   -------------------------------------------------------------------------- */
.studio-error-page {
    max-width: 520px;
    margin: 60px auto;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 32px;
    text-align: center;
    box-shadow: var(--shadow-sm);
}
.studio-error-page h1 { margin: 0 0 10px; font-size: 20px; }
.studio-error-page p  { color: var(--c-text-muted); }
.studio-error-code    { font-size: 48px; font-weight: 700; color: var(--c-primary); margin: 0 0 10px; }

/* --------------------------------------------------------------------------
   Phase 2: Definition pages — toolbar, table, forms, badges
   -------------------------------------------------------------------------- */

/* Toolbar (search + filter + actions row) */
.def-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.def-toolbar .def-search {
    flex: 1 1 220px;
    min-width: 180px;
    padding: 8px 11px;
    border: 1px solid var(--c-border-strong);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    background: var(--c-surface);
}
.def-toolbar .def-search:focus {
    outline: none;
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px rgba(31,76,192,0.10);
}
.def-toolbar select {
    padding: 8px 10px;
    border: 1px solid var(--c-border-strong);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    background: var(--c-surface);
    min-width: 130px;
}
.def-toolbar-right {
    margin-left: auto;
    display: flex;
    gap: 8px;
}

/* Buttons */
.btn-sm {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border: 1px solid var(--c-border-strong);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    background: var(--c-surface);
    color: var(--c-text);
    text-decoration: none;
}
.btn-sm:hover { background: var(--c-surface-alt); text-decoration: none; }
.btn-primary { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }
.btn-primary:hover { background: var(--c-primary-dark); }
.btn-success { background: var(--c-success); color: #fff; border-color: var(--c-success); }
.btn-success:hover { background: #15703f; border-color: #15703f; }
.btn-danger  { color: var(--c-danger); border-color: var(--c-danger); background: var(--c-surface); }
.btn-danger:hover  { background: var(--c-danger-bg); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--c-text-muted); }
.btn-ghost:hover { color: var(--c-text); background: var(--c-surface-alt); }

/* Data table */
.def-card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.def-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.def-table th {
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--c-text-muted);
    background: var(--c-surface-alt);
    border-bottom: 1px solid var(--c-border);
    white-space: nowrap;
}
.def-table td {
    padding: 9px 14px;
    border-bottom: 1px solid var(--c-border);
    vertical-align: middle;
}
.def-table tbody tr:last-child td { border-bottom: none; }
.def-table tbody tr:hover { background: rgba(31,76,192,0.02); }
.def-table .col-id   { width: 60px; text-align: center; }
.def-table .col-seq  { width: 60px; text-align: center; }
.def-table .col-status { width: 80px; text-align: center; }
.def-table .col-actions { width: 140px; text-align: right; white-space: nowrap; }
.def-table .col-date { width: 140px; white-space: nowrap; color: var(--c-text-muted); font-size: 12px; }

/* Status badge */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
}
.badge-active   { background: var(--c-success-bg); color: var(--c-success); }
.badge-inactive { background: #f3f4f6; color: var(--c-text-muted); }

/* Boolean flag badge (for element controls) */
.badge-flag     { padding: 1px 6px; font-size: 10px; }
.badge-flag-on  { background: #dbeafe; color: #1d4ed8; }
.badge-flag-off { background: #f3f4f6; color: #9ca3af; }

/* Empty state */
.def-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--c-text-muted);
}
.def-empty p { margin: 0; }

/* Inline edit/create form panel */
.def-form-panel {
    background: var(--c-surface);
    border: 1px solid var(--c-primary);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 0 0 3px rgba(31,76,192,0.06);
}
.def-form-panel h3 {
    margin: 0 0 14px;
    font-size: 15px;
    font-weight: 600;
    color: var(--c-text);
}
.def-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 16px;
}
.def-form-grid .span-2 { grid-column: span 2; }
.def-form-field { display: flex; flex-direction: column; gap: 4px; }
.def-form-field label {
    font-size: 12px;
    font-weight: 600;
    color: var(--c-text);
}
.def-form-field input[type=text],
.def-form-field input[type=number],
.def-form-field textarea,
.def-form-field select {
    padding: 7px 10px;
    border: 1px solid var(--c-border-strong);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    background: var(--c-surface);
}
.def-form-field input:focus,
.def-form-field textarea:focus,
.def-form-field select:focus {
    outline: none;
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px rgba(31,76,192,0.10);
}
.def-form-field textarea { resize: vertical; min-height: 60px; }
.def-form-field .field-hint { font-size: 11px; color: var(--c-text-muted); }
.def-form-actions {
    display: flex;
    gap: 8px;
    margin-top: 14px;
}

/* Checkbox group (for element control flags) */
.def-check-group {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    padding: 6px 0;
}
.def-check-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--c-text);
}
.def-check-item input[type=checkbox] {
    width: 16px;
    height: 16px;
    accent-color: var(--c-primary);
}

/* Row count summary */
.def-count {
    padding: 8px 14px;
    font-size: 12px;
    color: var(--c-text-muted);
    border-top: 1px solid var(--c-border);
    background: var(--c-surface-alt);
}

/* --------------------------------------------------------------------------
   Phase 3: Workspace — header, tabs, assignment panels
   -------------------------------------------------------------------------- */

/* Workspace header card */
.ws-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 0;
    box-shadow: var(--shadow-sm);
}
.ws-header-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--c-text);
    margin-bottom: 6px;
}
.ws-header-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.ws-chip {
    display: inline-block;
    padding: 2px 10px;
    background: var(--c-surface-alt);
    border: 1px solid var(--c-border);
    border-radius: 999px;
    font-size: 12px;
    color: var(--c-text-muted);
}
.ws-header-actions {
    flex-shrink: 0;
}

/* Workspace tabs */
.ws-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--c-border);
    background: var(--c-surface);
    border-left: 1px solid var(--c-border);
    border-right: 1px solid var(--c-border);
    padding: 0 8px;
}
.ws-tab {
    display: inline-block;
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 500;
    color: var(--c-text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    text-decoration: none;
}
.ws-tab:hover {
    color: var(--c-text);
    text-decoration: none;
}
.ws-tab.is-active {
    color: var(--c-primary);
    border-bottom-color: var(--c-primary);
    font-weight: 600;
}
.ws-tab-disabled {
    color: var(--c-text-soft);
    cursor: default;
    font-style: italic;
}
.ws-tab-disabled:hover { color: var(--c-text-soft); }

/* Tab body */
.ws-tab-body {
    margin-top: 16px;
}

/* Assignment inline form */
.ws-assign-form {
    margin-bottom: 14px;
}
.ws-assign-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.ws-assign-select {
    flex: 1 1 200px;
    min-width: 180px;
    padding: 7px 10px;
    border: 1px solid var(--c-border-strong);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    background: var(--c-surface);
}
.ws-assign-select:focus {
    outline: none;
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px rgba(31,76,192,0.10);
}
.ws-assign-seq {
    width: 70px;
    padding: 7px 10px;
    border: 1px solid var(--c-border-strong);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    background: var(--c-surface);
    text-align: center;
}

/* --------------------------------------------------------------------------
   Phase 4: Contract workspace additions
   -------------------------------------------------------------------------- */

/* Date input in assignment rows */
.ws-assign-date {
    width: 150px;
    padding: 7px 10px;
    border: 1px solid var(--c-border-strong);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    background: var(--c-surface);
}
.ws-assign-date:focus {
    outline: none;
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px rgba(31,76,192,0.10);
}

/* Section label within forms */
.def-form-section-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--c-primary);
    padding-top: 8px;
    border-top: 1px solid var(--c-border);
    margin-top: 4px;
}

/* --------------------------------------------------------------------------
   Phase 5: Assignment relationship workspaces (split panel)
   -------------------------------------------------------------------------- */

.asg-shell {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 16px;
    align-items: start;
}
@media (max-width: 960px) {
    .asg-shell { grid-template-columns: 1fr; }
}

/* Left picker panel */
.asg-left {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 220px);
    min-height: 400px;
}
.asg-left-header {
    padding: 12px 14px;
    border-bottom: 1px solid var(--c-border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.asg-left-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--c-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.asg-left-filters {
    display: flex;
    gap: 6px;
}
.asg-left-search {
    flex: 1;
    padding: 6px 9px;
    border: 1px solid var(--c-border-strong);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    background: var(--c-surface);
}
.asg-left-select {
    padding: 6px 9px;
    border: 1px solid var(--c-border-strong);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    background: var(--c-surface);
}
.asg-left-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
}
.asg-left-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 14px;
    border-left: 3px solid transparent;
    text-decoration: none;
    color: inherit;
    gap: 10px;
    cursor: pointer;
    font-size: 13px;
}
.asg-left-item:hover {
    background: var(--c-hover);
}
.asg-left-item.is-active {
    background: rgba(31,76,192,0.08);
    border-left-color: var(--c-primary);
    font-weight: 600;
}
.asg-left-item-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}
.asg-left-item-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.asg-left-item-sub {
    font-size: 11px;
    color: var(--c-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.asg-left-item-count {
    flex: 0 0 auto;
    min-width: 22px;
    padding: 2px 7px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 10px;
    background: var(--c-muted-bg, #eef1f5);
    color: var(--c-muted);
    text-align: center;
}
.asg-left-item.is-active .asg-left-item-count {
    background: var(--c-primary);
    color: #fff;
}
.asg-left-item.is-inactive .asg-left-item-name {
    color: var(--c-muted);
    font-style: italic;
}
.asg-left-empty {
    padding: 18px 14px;
    font-size: 13px;
    color: var(--c-muted);
    text-align: center;
}

/* Right details panel */
.asg-right {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.asg-right-empty {
    background: var(--c-surface);
    border: 1px dashed var(--c-border-strong);
    border-radius: var(--radius-md);
    padding: 40px 20px;
    text-align: center;
    color: var(--c-muted);
    font-size: 14px;
}
.asg-right-header {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
}
.asg-right-header h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}
.asg-right-header .asg-right-sub {
    margin-top: 4px;
    font-size: 12px;
    color: var(--c-muted);
}

/* Chooser page (Phase 5.4) */
.asg-chooser-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px;
}
.asg-chooser-card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.asg-chooser-card:hover {
    border-color: var(--c-primary);
    box-shadow: 0 2px 8px rgba(31,76,192,0.08);
}
.asg-chooser-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--c-primary);
}
.asg-chooser-card-sub {
    font-size: 12px;
    color: var(--c-muted);
}

/* ==========================================================================
   Phase 7 — Overview pages (Dashboard, Checklist, Health)
   ========================================================================== */

/* Shared card shell */
.ov-card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    margin-bottom: 16px;
}
.ov-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--c-border);
}
.ov-card-header h2 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}
.ov-card-sub {
    display: block;
    font-size: 12px;
    color: var(--c-text-muted);
    margin-top: 2px;
}
.ov-empty {
    padding: 26px 18px;
    font-size: 13px;
    color: var(--c-text-muted);
    text-align: center;
}
.ov-empty-card {
    background: var(--c-surface);
    border: 1px dashed var(--c-border-strong);
    border-radius: var(--radius);
    padding: 36px 24px;
    text-align: center;
    color: var(--c-text-muted);
}
.ov-empty-card h2 { margin: 0 0 8px 0; font-size: 16px; }

/* Dashboard summary tiles */
.ov-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}
.ov-tile {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 14px 16px;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.ov-tile:hover {
    border-color: var(--c-primary);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
}
.ov-tile-label {
    font-size: 12px;
    color: var(--c-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.ov-tile-count {
    font-size: 26px;
    font-weight: 700;
    color: var(--c-text);
}

/* Dashboard split (recent + quick links) */
.ov-split {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
    gap: 16px;
}
@media (max-width: 980px) {
    .ov-split { grid-template-columns: 1fr; }
}

/* Recent changes table */
.ov-recent-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.ov-recent-table th, .ov-recent-table td {
    padding: 8px 14px;
    border-bottom: 1px solid var(--c-border);
    text-align: left;
}
.ov-recent-table thead th {
    font-size: 11px;
    font-weight: 600;
    color: var(--c-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--c-surface-alt);
}
.ov-recent-table tbody tr:last-child td { border-bottom: none; }
.ov-recent-table .col-when { width: 110px; color: var(--c-text-muted); white-space: nowrap; }
.ov-recent-table .col-what { width: 120px; }
.ov-recent-table .col-who  { width: 140px; color: var(--c-text-muted); }
.ov-entity-tag {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    background: var(--c-primary-soft);
    color: var(--c-primary-dark);
    border-radius: 10px;
}

/* Quick links */
.ov-quick-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px 18px;
}
.ov-quick-btn {
    display: block;
    padding: 10px 14px;
    border: 1px solid var(--c-border-strong);
    border-radius: var(--radius-sm);
    background: var(--c-surface);
    text-decoration: none;
    color: var(--c-text);
    font-weight: 500;
    font-size: 13px;
    transition: background 0.15s, border-color 0.15s;
}
.ov-quick-btn:hover {
    background: var(--c-primary-soft);
    border-color: var(--c-primary);
    color: var(--c-primary-dark);
    text-decoration: none;
}

/* Checklist */
.ov-checklist-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.ov-checklist-item {
    display: grid;
    grid-template-columns: 80px 1fr auto;
    gap: 14px;
    align-items: center;
    padding: 12px 18px;
    border-bottom: 1px solid var(--c-border);
}
.ov-checklist-item:last-child { border-bottom: none; }
.ov-checklist-label {
    font-weight: 600;
    font-size: 13px;
    color: var(--c-text);
}
.ov-checklist-guide {
    font-size: 12px;
    color: var(--c-text-muted);
    margin-top: 2px;
}
.ov-checklist-item.is-done .ov-checklist-label { color: var(--c-text-muted); }

/* Health */
.ov-health-cat {
    margin-bottom: 18px;
}
.ov-health-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.ov-health-table th, .ov-health-table td {
    padding: 8px 14px;
    border-bottom: 1px solid var(--c-border);
    text-align: left;
    vertical-align: top;
}
.ov-health-table thead th {
    font-size: 11px;
    font-weight: 600;
    color: var(--c-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--c-surface-alt);
}
.ov-health-table tbody tr:last-child td { border-bottom: none; }
.ov-health-table .col-table { width: 180px; font-family: "Consolas", "SF Mono", ui-monospace, monospace; font-size: 12px; color: var(--c-text-muted); }
.ov-health-table .col-fix   { width: 130px; text-align: right; white-space: nowrap; }
.ov-health-table .col-detail { word-break: break-word; }
.ov-health-truncate {
    padding: 10px 18px;
    font-size: 12px;
    color: var(--c-text-muted);
    background: var(--c-surface-alt);
    border-top: 1px solid var(--c-border);
}

/* Warning badge variant (used by Health counts) */
.badge-warning {
    background: #fdf3d8;
    color: var(--c-warning);
}

/* ============================================================
   Contract Workspace — Init tab rebuild panel (ad-hoc utility)
   ============================================================ */
.ws-rebuild-panel {
    margin-top: 16px;
    padding: 16px 18px;
    border: 1px solid var(--c-border);
    border-radius: 6px;
    background: var(--c-surface-alt);
}

.ws-rebuild-panel.is-nudged {
    border-color: var(--c-warning);
    background: #fff9eb;
}

.ws-rebuild-header {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.ws-rebuild-header h3 {
    margin: 0;
}

.ws-rebuild-preview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px 24px;
    margin: 12px 0 14px;
    padding: 12px 14px;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 4px;
}

.ws-rebuild-preview > div {
    display: flex;
    flex-direction: column;
}

.ws-rebuild-preview dt {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--c-text-muted);
    margin: 0 0 2px 0;
}

.ws-rebuild-preview dd {
    margin: 0;
    font-weight: 600;
}

.ws-rebuild-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-warning {
    background: var(--c-warning);
    color: #fff;
    border-color: var(--c-warning);
}

.btn-warning:hover {
    background: #8a6000;
    border-color: #8a6000;
    color: #fff;
}

/* Centered table cell helper (used by yes/no/badge columns). */
.col-center,
.def-table th.col-center,
.def-table td.col-center {
    text-align: center;
}

/* Inline filter form rendered inside .def-toolbar (label + select). */
.def-toolbar-filter {
    display: flex;
    gap: .5rem;
    align-items: center;
}

/* Informational banner sitting above SystemAdmin pages — quieter than .def-card,
   used for floor-rule / context notes. */
.sys-info-banner {
    padding: 10px 14px;
    margin-bottom: 1rem;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-left: 3px solid var(--c-accent, #2c6fbb);
    border-radius: 4px;
    color: var(--c-text);
    font-size: 13px;
    line-height: 1.45;
}

.sys-info-banner strong {
    color: var(--c-text);
}

/* Compact role badge sitting next to a heading (e.g. "Nick — Full Name [PlatformAdmin]"). */
.sys-user-heading {
    display: flex;
    align-items: center;
    gap: .6rem;
    flex-wrap: wrap;
}

.sys-user-heading h3 {
    margin: 0;
}

/* ==========================================================================
   Mobile hamburger button — hidden on desktop, shown via media query below
   ========================================================================== */
.studio-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 20px;
    color: var(--c-text-muted);
    padding: 4px 6px;
    line-height: 1;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
}
.studio-menu-btn:hover { color: var(--c-text); background: var(--c-surface-alt); }

/* Sidebar backdrop overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 199;
}
.sidebar-overlay.is-visible { display: block; }

/* ==========================================================================
   Responsive — mobile (≤ 768px)
   ========================================================================== */
@media (max-width: 768px) {

    /* Shell: drop the fixed 240px grid column */
    .studio-shell {
        display: block;
    }

    /* Sidebar: fixed, slides in from left */
    .studio-sidebar {
        position: fixed;
        left: -240px;
        top: 0;
        height: 100vh;
        width: 240px;
        z-index: 200;
        transition: left 0.25s ease;
    }
    .studio-sidebar.is-open {
        left: 0;
    }

    /* Hamburger visible */
    .studio-menu-btn {
        display: flex;
    }

    /* Topbar: sticky, tighter padding, accommodate hamburger */
    .studio-topbar {
        position: sticky;
        top: 0;
        z-index: 100;
        padding: 10px 16px;
        gap: 8px;
    }

    /* Breadcrumb: truncate if long */
    .studio-breadcrumb {
        flex: 1;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        min-width: 0;
    }

    /* Hide full name on mobile — role badge + sign out remain */
    .studio-user-name { display: none; }

    /* Content and footer padding */
    .studio-content { padding: 16px; }
    .studio-footer  { padding: 10px 16px; }

    /* Page title */
    .studio-page-title { font-size: 18px; }

    /* Tables: horizontal scroll inside cards */
    .def-card { overflow-x: auto; }

    /* Forms: single column */
    .def-form-grid { grid-template-columns: 1fr; }
    .def-form-grid .span-2 { grid-column: span 1; }

    /* Workspace header: stack */
    .ws-header { flex-direction: column; align-items: flex-start; }
    .ws-header-actions { width: 100%; }

    /* Tabs: swipeable */
    .ws-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; }
    .ws-tab  { white-space: nowrap; }

    /* Assignment shell: single column (override the 960px rule) */
    .asg-shell { grid-template-columns: 1fr; }
    .asg-left  { max-height: 280px; min-height: unset; }

    /* Checklist: drop third column, action sits below */
    .ov-checklist-item {
        grid-template-columns: 70px 1fr;
        grid-template-rows: auto auto;
    }
    .ov-checklist-item .btn-sm { grid-column: 2; }

    /* Error page */
    .studio-error-page { margin: 20px auto; padding: 20px; }
}

