/* ===============================
   DESIGN TOKENS (Milestone 6)
   Single source of truth for color, radius, shadow, and transition.
   Values are calibrated to the codebase's actual existing dominant
   usage, not invented -- see Decision Log D-024 for the survey this
   was based on. Deliberately limited to categories the app actually
   uses; not every one-off decorative color was tokenized.
=============================== */
:root {
    /* Brand / primary actions */
    --color-primary: #2b7cff;
    --color-primary-hover: #1a5edb;

    /* Semantic status colors */
    --color-success: #28a745;
    --color-success-bg: #d4edda;
    --color-success-text: #155724;
    --color-danger: #c0392b;
    --color-danger-bg: #f8d7da;
    --color-danger-text: #721c24;
    --color-warning: #ffc107;
    --color-warning-bg: #fffaf0;

    /* Text */
    --color-text: #2c3e50;
    --color-text-muted: #6b7a8c;
    --color-heading-dark: #1f2a36;

    /* Surfaces */
    --color-background: #f4f6f8;
    --color-surface: #ffffff;
    --color-border: #e1e6ec;

    /* Shape / motion -- matching the most common existing values,
       not a forced unification of every variant in the file. */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.15);
    --transition-fast: 0.2s ease;

    /* Spacing scale -- calibrated to the file's actual dominant
       repeated values (113 exact single-value declarations
       matched these 5 numbers before tokenization; values that
       didn't cleanly recur, e.g. 3/5/6/15/40/60px, were left
       hardcoded rather than forced into a bucket). */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 10px;
    --space-lg: 20px;
    --space-xl: 30px;
}

/* ===============================
   GLOBAL RESET
=============================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Segoe UI", Roboto, Arial, sans-serif;
}

body {
    background: var(--color-background);
    color: var(--color-text);
    line-height: 1.4;
}

.hidden {
    display: none !important;
}

/* ===============================
   HEADER
=============================== */
.top-header {
    background: var(--color-heading-dark);
    color: var(--color-surface);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
}

.logo {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.top-nav {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.nav-group {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.user-name {
    font-weight: 600;
}

.user-role {
    font-size: 12px;
    opacity: 0.8;
}



/* ===============================
   BUTTONS
=============================== */
button {
    border: none;
    background: #e0e6ed;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: 0.2s;
}

button:hover {
    background: #d2d8df;
}

button.primary {
    background: var(--color-primary);
    color: var(--color-surface);
}

button.primary:hover {
    background: #1c6ed5;
}

button.danger {
    background: #e74c3c;
    color: var(--color-surface);
}

button.danger:hover {
    background: var(--color-danger);
}

button.small {
    padding: 4px 8px;
    font-size: 12px;
}

/* ===============================
   DASHBOARD
=============================== */

.suspended .project-tile {
    opacity: 0.5;
    pointer-events: none;
}
.dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    padding: 15px 20px;
    background: var(--color-surface);
    border-bottom: 1px solid #e2e8f0;
}

.metric {
    background: #f8fafc;
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.metric span {
    font-weight: 600;
    color: var(--color-primary);
}

.metric.plan-reminder {
    background: var(--color-warning-bg);
    border: 1px solid var(--color-warning);
}

.search-bar {
    grid-column: span 2;
}

.search-bar input {
    width: 100%;
    padding: 8px 10px;
    border-radius: 4px;
    border: 1px solid #cfd8e3;
}

/* ===============================
   PROJECT INDEX
=============================== */
.project-index {
    padding: var(--space-lg);
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 15px;
}

.project-tile {
    background: var(--color-surface);
    border-radius: 6px;
    padding: 15px;
    border: 1px solid var(--color-border);
    transition: 0.2s;
}

.project-tile:hover {
    border-color: var(--color-primary);
}

.project-tile h3 {
    font-size: 16px;
    margin-bottom: 5px;
}

.project-tile p {
    font-size: 13px;
    color: var(--color-text-muted);
    margin-bottom: var(--space-md);
}

.project-tile .meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}

.batch-header {
    margin-bottom: 12px;
}

.batch-tile .owner {
    font-size: 13px;
    color: #666;
    margin: 4px 0;
}

.batch-tile .meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
}

.batch-tile .status {
    font-weight: 600;
    color: #1a7f37; /* final */
}
.record-header {
    margin-bottom: 12px;
}

.batch-line {
    font-size: 13px;
    color: #555;
    margin-top: var(--space-xs);
}

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

.record-table th,
.record-table td {
    border: 1px solid #ddd;
    padding: 6px;
    font-size: 13px;
}

.record-table td[contenteditable="true"] {
    background: var(--color-surface)df5;
}

.draft-block {
    border: 1px solid #ddd;
    padding: var(--space-sm);
    margin-bottom: var(--space-sm);
    background: var(--color-surface);
}

.record-table.enhanced {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.record-table.enhanced th {
    background: #f3f5fb;
    font-weight: 600;
    text-align: left;
}

.record-table.enhanced th,
.record-table.enhanced td {
    border: 1px solid #e2e6ef;
    padding: 6px 8px;
}

.record-table.enhanced td.sr {
    width: 50px;
    text-align: center;
    color: #666;
}

.record-table.enhanced td.action {
    width: 60px;
    text-align: center;
}

.edit-btn {
    cursor: pointer;
    font-size: 14px;
}

.edit-btn:hover {
    transform: scale(1.1);
}
.record-header {
    margin-bottom: 12px;
}

.batch-line {
    font-size: 14px;
    color: #555;
    margin-top: var(--space-sm);
    font-weight: 600;
}

/* ===============================
   SECONDARY NAV
=============================== */
.secondary-nav {
    background: #000;
    padding: 0px 0px;
   
    display: flex;
    gap: var(--space-sm);

}

/* ===============================
   SESSION INDEX
=============================== */
.session-index {
    padding: 15px 20px;
}

.session-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--space-md);
    font-size: 13px;
}

.session-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: var(--space-md);
}

.session-tile {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    padding: var(--space-md);
    border-radius: 4px;
    text-align: center;
    cursor: pointer;
}

.session-tile:hover {
    border-color: var(--color-primary);
}

/* ===============================
   WORKSPACE
=============================== */
.workspace {
    padding: var(--space-lg);
}

.workspace-header h2 {
    font-size: 20px;
    margin-bottom: var(--space-xs);
}

.workspace-header p {
    font-size: 13px;
    color: var(--color-text-muted);
    margin-bottom: 15px;
}

.form-area {
    display: grid;
    gap: var(--space-md);
    margin-bottom: 15px;
}

.form-area label {
    font-size: 13px;
    color: #556273;
}

.form-area input {
    padding: 8px 10px;
    border: 1px solid #cfd8e3;
    border-radius: 4px;
}

.voice-controls {
    display: flex;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

/* ===============================
   LIVE PREVIEW
=============================== */
.live-preview {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 15px;
}

.live-preview h3 {
    margin-bottom: var(--space-md);
    font-size: 15px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

thead {
    background: #f1f4f7;
}

th, td {
    padding: 8px 10px;
    border: 1px solid var(--color-border);
}

/* ===============================
   DATA TABLE
=============================== */
.data-table {
    padding: var(--space-lg);
}

.pagination {
    margin-top: var(--space-md);
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}

/* ===============================
   SUSPENDED
=============================== */
.suspended {
    padding: 40px;
    text-align: center;
    font-size: 16px;
    color: var(--color-danger);
}

/* ===============================
   AUTH VIEW
=============================== */
.auth-view {
    display: flex;
    justify-content: center;
    align-items: flex-start; /* instead of center */
    padding-top: 60px;
}

.auth-card {
    background: var(--color-surface);
    padding: var(--space-xl);
    border-radius: 8px;
    width: 320px;
    border: 1px solid var(--color-border);
}

.auth-card h2 {
    margin-bottom: var(--space-lg);
    text-align: center;
}

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    font-size: 13px;
    color: #556273;
}

.form-group input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #cfd8e3;
    border-radius: 4px;
}

.full {
    width: 100%;
}

.auth-msg {
    margin-top: var(--space-md);
    font-size: 13px;
    text-align: center;
    color: var(--color-danger);
}
.owner {
    font-size: 0.85rem;
    color: #555;
    margin-bottom: var(--space-xs);
}
/* ===============================
   SUSPENDED BANNER
=============================== */
.suspended-banner {
    background: var(--color-danger);
    color: var(--color-surface);
    padding: 10px 16px;
    text-align: center;
    font-size: 14px;
    
}
.muted {
    color: var(--color-text-muted);
    font-size: 13px;
}
#consolidatedContainer {
    margin-top: var(--space-xl);
    padding: 15px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 6px;
}
#consolidatedContainer h3 {
    margin-bottom: var(--space-md);
    font-size: 16px;
}

#consolidatedContainer table {
    margin-top: var(--space-md);
}
.consolidated-header{
    margin-bottom:12px;
    padding-bottom:6px;
    border-bottom:1px solid #ddd;
}

.consolidated-meta{
    font-size:13px;
    color:#444;
    font-weight:600;
}

.consolidated-header h2 {
    font-size: 14px;
    color: #555;
    margin-bottom: 6px;
}

.consolidated-meta {
    font-size: 13px;
    color: #444;
    font-weight: 600;
}

#dataTable .consolidated-header {
    position: sticky;
    top: 0;
    background: var(--color-surface);
    z-index: 10;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    padding-bottom: 5px;
    margin-bottom: var(--space-md);
}

/* ================= TEMPLATE SECTION ================= */

.template-container{
    padding:12px;
    
}

/* ===============================
   TEMPLATE CARD GRID
=============================== */

.template-cards{
    display:grid;
    grid-template-columns:repeat(auto-fill,minmax(170px,1fr));
    gap: var(--space-md);
    margin-bottom:12px;
}

/* ===============================
   TEMPLATE CARD
=============================== */

.template-card{

    border:1px solid #e2e6ea;
    background:#fafafa;
    padding: var(--space-sm);
    border-radius:6px;

    cursor:pointer;

    font-size:12px;
    line-height:1.3;

    transition:all 0.15s ease;
}

.template-card:hover{
    background:#f0f6ff;
    border-color:#1971c2;
    transform:translateY(-2px);
}

/* ===============================
   CARD TEXT
=============================== */

.template-title{
    font-weight:600;
    font-size:13px;
    margin-bottom:2px;
}

.template-descr{
    font-size:11px;
    color:#555;
    margin-bottom: var(--space-xs);
}

.template-meta{
    font-size:10px;
    color: var(--color-text-muted);
    font-weight:600;
    margin-bottom: 2px;
}

.template-cols{
    font-size:11px;
    color:#777;
}

/* SEARCH */

.template-search{
    width:50%;
    padding:6px;
    margin-bottom: var(--space-sm);
min-width: 350px;
}

/* PICKER */

.template-picker{
    width:100%;
    padding:6px;
}



/* ===============================
   VOICE VAULT MODULE
   (Isolated styles for voice input system)
=============================== */
.content-view{
padding: var(--space-lg);
}

.user-view{
max-width:1200px;
margin:auto;
}



input,textarea,select{
width:100%;
padding: var(--space-sm);
margin-bottom: var(--space-md);
border:1px solid #ccc;
border-radius:4px;
}
.voice-buttons {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}
.voice-buttons button{
padding:8px 14px;

}


.action-row{
margin-top: var(--space-md);
}

.workspace-layout{
display:flex;
gap: var(--space-lg);
margin-top: var(--space-lg);
}

.schema-input{}
.voice-buttons select {
    width: auto;          
}
#voiceInstruction{
margin-top:6px;
font-size:13px;
color:#666;
font-style:italic;
}

.voice-feedback{
display:flex;
flex-direction:column;
gap: var(--space-xs);
margin-top:12px;
}

#activeFieldLabel{
font-weight:600;
color:#333;
}

#voiceStatus{
font-weight:600;
color:#2c6fdb;
}
#dataEntryWorkspace{
flex:1;
}

#livePayloadPanel{
width:40%;
background:white;
padding: var(--space-md);
border-radius:6px;
}
.payload-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
#payloadTable tr:hover {
    background-color: #f5f5f5;
}
.payload-table-container{
max-height:400px;
overflow:auto;
}
#payloadTable {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed; /* 🔥 prevents column jumping */
font-size:13px;
}

#payloadTable th,
#payloadTable td{
border:1px solid #ddd;
padding:6px;
text-align:left;
 word-wrap: break-word;
 overflow-wrap: break-word;
}
#payloadTable thead th {
    position: sticky;
    top: 0;
    background: #f8f8f8;
    z-index: 1;
}

.activeField{
border:2px solid var(--color-primary);
background:#eef5ff;
}
.new-row {
    background-color: #e6ffe6;
    animation: fadeRow 2s ease-out;
}

@keyframes fadeRow {
    from { background-color: #c6f7c6; }
    to { background-color: transparent; }
}

.voice-control-panel{
margin-bottom:15px;
}

.voice-buttons button{
margin-bottom:5px;
}

.voice-feedback{
margin-top: var(--space-md);
font-weight:bold;
color:#444;
}

.voice-table th,
.voice-table td{}
/* Default input */
#dynamicDataForm input {
    border: 1px solid #ccc;
    padding: 6px;
    margin-bottom: var(--space-sm);
}

/* 🔥 Active field highlight */
#dynamicDataForm input.active-field {
    border: 2px solid var(--color-primary);
    background-color: #eaf3ff;
}

/* ===============================
   OFF-CANVAS NAVIGATION DRAWER (Milestone 3)
   Desktop (>768px) is untouched by this block — .hamburger stays
   display:none and .top-nav keeps its normal flex layout above
   the breakpoint below.
=============================== */
.hamburger {
    display: none;
    background: transparent;
    border: none;
    color: var(--color-surface);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 10px;
}

#navDrawerBackdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 998;
}

#navDrawerBackdrop.open {
    display: block;
}

@media (max-width: 768px) {

    .hamburger {
        display: inline-block;
    }

    .top-nav {
        position: fixed;
        top: 0;
        left: -280px;
        width: 260px;
        height: 100%;
        background: var(--color-heading-dark);
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-xs);
        padding: 60px 16px 16px;
        overflow-y: auto;
        transition: left 0.25s ease;
        z-index: 999;
    }

    .top-nav.open {
        left: 0;
    }

    .top-nav .nav-group {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        gap: var(--space-xs);
    }

    .top-nav .nav-group button {
        width: 100%;
        text-align: left;
    }

    body.drawer-open {
        overflow: hidden;
    }

    button.danger,
    button.small {
        min-height: 44px;
    }
}

@media (max-width: 600px) {

    #payloadTable thead,
    .record-table thead {
        display: none;
    }

    #payloadTable tbody tr,
    .record-table tbody tr {
        display: block;
        margin-bottom: var(--space-md);
        border: 1px solid var(--color-border);
        border-radius: 6px;
        padding: var(--space-sm);
    }

    #payloadTable td,
    .record-table td {
        display: flex;
        justify-content: space-between;
        gap: var(--space-md);
        padding: 6px 4px;
        border: none;
        border-bottom: 1px solid #f0f2f5;
        text-align: right;
    }

    #payloadTable td:last-child,
    .record-table td:last-child {
        border-bottom: none;
    }

    #payloadTable td::before,
    .record-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--color-text-muted);
        text-align: left;
    }
}

/* MOBILE LAYOUT */

@media(max-width:768px){

.workspace-layout{
flex-direction:column;
}

#livePayloadPanel{
width:100%;
}

.payload-table-container{
max-height:120px;
}

}



/* Show schema builder buttons by default */
#schemaStartBtn, #schemaPreviewBtn, #schemaResetBtn {
    display: inline-block;  /* Ensure these buttons are visible in the schema builder step */
}

/* Hide schema builder buttons when in the preview stage */
#schemaPreviewSection:not(.hidden) #schemaStartBtn,
#schemaPreviewSection:not(.hidden) #schemaPreviewBtn,
#schemaPreviewSection:not(.hidden) #schemaResetBtn {
    display: none;  /* Hide buttons from the schema builder when preview is active */
}

/* Make sure preview buttons are visible */
#schemaConfirmBtn, #schemaEditBtn, #schemaPreviewBackBtn {
    display: inline-block;  /* Ensure preview-specific buttons are visible */
}

/* Schema preview section styling */
#schemaPreviewSection {
    padding: var(--space-lg);
    background-color: #f9f9f9;
    border-radius: 8px;
    max-width: 800px;
    margin: 0 auto;
    display: none;  /* Ensure preview section is hidden by default */
}

/* Make schema preview section visible when not hidden */
#schemaPreviewSection:not(.hidden) {
    display: block;  /* Show preview when section is active */
}

/* Ensure labels are visible in the preview */
#schemaPreviewContainer label {
    display: block;  /* Ensure labels are visible and stacked above the input fields */
    font-weight: bold;  /* Optional: make labels stand out */
    margin-bottom: 5px;  /* Add some space between the label and input field */
}

/* Styling for the text fields inside the preview */
#schemaPreviewContainer .dataField {
    padding: var(--space-sm);
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 100%;
}

#schemaPreviewContainer .dataField:focus {
    border-color: #007BFF; /* Highlight color when the field is focused */
}
.project-start-options{

display:flex;
gap: var(--space-lg);
margin-top: var(--space-lg);

}

.project-card{

flex:1;
background:var(--color-surface);
border:1px solid #ddd;
border-radius:8px;
padding: var(--space-lg);
text-align:center;

box-shadow:0 2px 6px rgba(0,0,0,0.08);

}

.project-card h3{

margin-top:0;

}

.project-card button{

margin-top: var(--space-md);
padding:10px 18px;

background:var(--color-primary);
color:white;
border:none;
border-radius:5px;

cursor:pointer;

}

.project-card button:hover{

background:#0056b3;

}


/* MOBILE */

@media(max-width:768px){

.project-start-options{

flex-direction:column;

}

}
.col-log { 
    font-size: 0.85rem; 
    color: #444; 
    margin-top: 5px; 
    border-bottom: 1px solid #eee; 
    padding-bottom: 3px; 
    font-family: 'Segoe UI', system-ui, sans-serif;
}

.col-log b {
    color: #228be6; /* Matches the Pro3 Blue theme */
    margin-right: var(--space-sm);
}
.public-view {
    max-width: 820px;
    margin: 50px auto;
    padding: var(--space-lg);
    line-height: 1.7;
    color: var(--color-text);
}

/* Headings */
.public-view h1 {
    text-align: center;
    font-size: 2.2rem;
    margin-bottom: var(--space-md);
}

.tagline {
    text-align: center;
    font-size: 18px;
    color: #666;
}

/* Section titles */
.public-view h2 {
    margin-top: 35px;
    margin-bottom: var(--space-md);
    color: #1f2d3d;
    font-size: 1.4rem;
    border-left: 4px solid var(--color-primary);
    padding-left: 10px;
}

/* Text readability */
.public-view p,
.public-view li {
    max-width: 700px;
}

/* Lists */
.public-view ul,
.public-view ol {
    padding-left: 20px;
    margin-top: var(--space-md);
}

/* CTA section */
.public-cta {
    text-align: center;
    margin-top: var(--space-xl);
}

/* Buttons */
.public-cta button {
    padding: 10px 18px;
    font-size: 15px;
    cursor: pointer;
    border: none;
    border-radius: 8px;
    background: var(--color-primary);
    color: white;
    margin: 5px;
    transition: all 0.2s ease;
}

.public-cta button:hover {
    background: var(--color-primary-hover);
    transform: translateY(-1px);
}

/* Images */
.about-img {
    width: 100%;
    max-width: 780px;
    display: block;
    margin: 25px auto;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.08);
}

/* Divider */
.public-view hr {
    border: none;
    height: 1px;
    background: #e5e7eb;
    margin: 40px 0;
}

.about-hero {
  text-align: center;
  margin-bottom: var(--space-lg);
}
#aboutView p,
#aboutView li {
  max-width: 700px;
}
.plans-container {
    display: flex;
    gap: var(--space-lg);
    overflow-x: auto;
    padding: 20px 10px;
    scroll-snap-type: x mandatory;
}

.plan-card {
    min-width: 280px;
    max-width: 300px;
    flex: 0 0 auto;
    background: var(--color-surface);
    border-radius: 12px;
    padding: var(--space-lg);
    box-shadow: 0 6px 20px rgba(0,0,0,0.08);
    scroll-snap-align: start;
    transition: transform 0.2s ease;
}

.plan-card:hover {
    transform: translateY(-5px);
}

.plan-card h2 {
    margin-bottom: 5px;
}

.plan-sub {
    font-size: 14px;
    color: #666;
    margin-bottom: var(--space-md);
}

.plan-card h3 {
    margin: 10px 0;
    color: var(--color-primary);
}

.plan-card ul {
    padding-left: 18px;
    margin: 15px 0;
}

.plan-card li {
    margin-bottom: 6px;
}

/* Featured Plan Highlight */
.plan-card.featured {
    border: 2px solid var(--color-primary);
    transform: scale(1.05);
}

/* Buttons */
.public-cta-btn {
    width: 100%;
    padding: var(--space-md);
    border: none;
    border-radius: 8px;
    background: var(--color-primary);
    color: white;
    cursor: pointer;
    transition: background 0.2s ease;
}

.public-cta-btn:hover {
    background: var(--color-primary-hover);
}
#plansView {
    max-width: 1100px;
}
.badge {
    background: var(--color-primary);
    color: white;
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 6px;
    display: inline-block;
    margin-bottom: var(--space-md);
}

/* ===============================
   STATUS BADGE (Milestone 6)
   Generic status-indicator component for application state (locked,
   active, draft, final, archived, suspended, etc.) -- distinct from
   .badge above, which remains the Pricing page's "Popular" plan
   indicator and is untouched by this milestone.
=============================== */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    line-height: 1.6;
}

.status-badge--active {
    background: var(--color-success-bg);
    color: var(--color-success-text);
}

.status-badge--locked,
.status-badge--final {
    background: var(--color-border);
    color: var(--color-text);
}

.status-badge--draft {
    background: var(--color-warning-bg);
    color: #856404;
}

.status-badge--archived,
.status-badge--suspended {
    background: var(--color-danger-bg);
    color: var(--color-danger-text);
}

/* ===============================
   LOADING STATE (Milestone 6)
   Applied to a button during an in-flight async operation, in
   addition to the existing `disabled` attribute pattern already used
   at several call sites -- this adds the visual indicator that
   pattern was missing, without changing the disabling logic itself.
=============================== */
button.is-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

button.is-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 14px;
    height: 14px;
    margin: -7px 0 0 -7px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: statusSpin 0.6s linear infinite;
}

button.is-loading.secondary::after,
button.is-loading:not(.primary):not(.danger)::after {
    border: 2px solid rgba(43,124,255,0.25);
    border-top-color: var(--color-primary);
}

@keyframes statusSpin {
    to { transform: rotate(360deg); }
}

.pricing-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 20px 0;
}

.toggle-label {
    font-size: 14px;
    color: #666;
}

.toggle-label.active {
    color: var(--color-primary);
    font-weight: 600;
}

/* Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}

.switch input {
    display: none;
}

.slider {
    position: absolute;
    cursor: pointer;
    background-color: #ccc;
    border-radius: 20px;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    transition: 0.3s;
}

.slider:before {
    content: "";
    position: absolute;
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: 0.3s;
}

input:checked + .slider {
    background-color: var(--color-primary);
}

input:checked + .slider:before {
    transform: translateX(20px);
}
.save-note {
    color: var(--color-success);
    font-size: 12px;
    display: block;
    margin-top: 2px;
}


/* ===============================
   manageUsersView
=============================== */

.user-list.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--space-md);
}

/* User card base styles */
.user-card {
    border: 1px solid #ddd;
    padding: var(--space-md);
    border-radius: 8px;
    background: var(--color-surface);
    cursor: pointer;
    margin: 5px 0;
}

/* Assigned to the current project (green) */
.user-card.assigned {
    border-left: 4px solid var(--color-success); /* Green */
    background: #f6fff8;
}

/* Assigned to another project (yellow) */
.user-card.other-project {
    border-left: 4px solid var(--color-warning); /* Yellow */
    background: var(--color-warning-bg);
}

/* Free users (light gray) */
.user-card.free-user {
    border-left: 4px solid #17a2b8; /* Teal */
    background: #e9f7f7;
}

/* Optional: Apply hover effect for better UX */
.user-card:hover {
    background-color: #f5f5f5;
}

input[type="checkbox"]:disabled {
    opacity: 0.5;
}
.user-card small {
    display: block;
    color: #666;
}

.user-summary {
    display: flex;
    gap: var(--space-lg);
    align-items: center;
    padding: 10px 12px;
    margin: 10px 0;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #ddd;
    flex-wrap: wrap; /* responsive */
}

.user-summary p {
    margin: 0;
    font-size: 14px;
    color: #444;
    display: flex;
    gap: 5px;
    align-items: center;
}

.user-summary span {
    font-weight: 600;
    color: #000;
}
.success-message {
    margin-top: var(--space-md);
    padding: var(--space-md);
    font-size: 14px;
    border-radius: 5px;
    border: 1px solid #ddd;
    background-color: #e7f4e7;
    text-align: center;
}

.success-message.error {
    background-color: var(--color-danger-bg);
    color: var(--color-danger-text);
}

.success-message.success {
    background-color: var(--color-success-bg);
    color: var(--color-success-text);
}

/* ===============================
   FOOTER
=============================== */
.footer {
    background: var(--color-heading-dark);
    color: #cfd8e3;
    text-align: center;
    padding: var(--space-md);
    font-size: 12px;
    margin-top: var(--space-xl);
}

/* ===============================
   RESPONSIVE
=============================== */
@media (max-width: 900px) {

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

    .search-bar {
        grid-column: span 2;
    }

}

@media (max-width: 600px) {

    /* .top-header / .top-nav mobile stacking rules removed here —
       superseded by the off-canvas drawer (Milestone 3), which now
       governs mobile nav layout via the @media(max-width:768px)
       block above. Desktop (>768px) styling for these selectors
       is unaffected. */

    .dashboard {
        grid-template-columns: 1fr;
    }

    .project-index {
        grid-template-columns: 1fr;
    }

    .session-tiles {
        grid-template-columns: 1fr;
    }

    .voice-controls {
        flex-direction: column;
    }

}

/* ===============================
   UNIFIED NOTIFICATION (Milestone 3.5)
   Reuses .success-message / .success / .error — only positioning
   is new, since the existing class is normally inline-flow.
=============================== */
#globalNotification {
    position: fixed;
    top: 16px;
    right: 16px;
    max-width: 320px;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* ===============================
   UNIFIED CONFIRMATION MODAL (Milestone 3.5)
   Replaces window.confirm(). New component — no existing modal
   pattern was present in the codebase to reuse.
=============================== */
#confirmModalBackdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1001;
    align-items: center;
    justify-content: center;
}

#confirmModalBackdrop.open {
    display: flex;
}

#confirmModal {
    background: var(--color-surface);
    border-radius: 6px;
    padding: var(--space-lg);
    max-width: 320px;
    width: 90%;
    text-align: center;
}

#confirmModal p {
    margin: 0;
    font-size: 14px;
    color: var(--color-text);
}

.confirm-modal-actions {
    display: flex;
    justify-content: center;
    gap: var(--space-md);
    margin-top: 16px;
}

/* ===============================
   TEMPLATE VERSION PICKER (Milestone: version-history browsing)
   Same structural pattern as the confirm modal above -- reused
   rather than duplicated with new values.
=============================== */
#versionPickerBackdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1001;
    align-items: center;
    justify-content: center;
}

#versionPickerBackdrop.open {
    display: flex;
}

#versionPickerModal {
    background: var(--color-surface);
    border-radius: 6px;
    padding: var(--space-lg);
    max-width: 360px;
    width: 90%;
    text-align: left;
}

#versionPickerModal p {
    margin: 0 0 var(--space-sm) 0;
    font-size: 14px;
    color: var(--color-text);
}

.version-picker-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-xs);
    cursor: pointer;
    font-size: 13px;
}

.version-picker-row:hover {
    border-color: var(--color-primary);
    background: var(--color-background);
}

.version-picker-row .version-picker-meta {
    color: var(--color-text-muted);
    font-size: 11px;
}