/* ============================================================
   AEC TimeTracking — V2 Design System
   A clean, professional sidebar-based interface for AEC firms.
   ============================================================ */

/* ---- Reset / Base ---- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

/* ---- CSS Variables ---- */
:root {
    /* Brand */
    --brand-primary:        #2563eb;
    --brand-primary-hover:  #1d4ed8;
    --brand-primary-light:  #eff6ff;
    --brand-primary-ring:   rgba(37, 99, 235, 0.12);

    /* Sidebar */
    --sidebar-bg:           #0f172a;
    --sidebar-border:       #1e293b;
    --sidebar-text:         rgba(255, 255, 255, 0.62);
    --sidebar-text-hover:   rgba(255, 255, 255, 0.90);
    --sidebar-text-active:  #ffffff;
    --sidebar-item-hover:   #1e293b;
    --sidebar-item-active:  #2563eb;
    --sidebar-width:        240px;

    /* Layout */
    --topbar-height:        56px;
    --bg:                   #f1f5f9;
    --surface:              #ffffff;
    --surface-hover:        #f8fafc;

    /* Text */
    --text:                 #1e293b;
    --text-muted:           #64748b;
    --text-light:           #94a3b8;

    /* Borders */
    --border:               #e2e8f0;
    --border-light:         #f1f5f9;
    --tc-weekend-bg:        #e2e8f0;

    /* Shadows */
    --shadow-sm:  0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow:     0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md:  0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg:  0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);

    /* Status */
    --success:      #22c55e;
    --success-text: #166534;
    --success-bg:   #f0fdf4;
    --success-border: #bbf7d0;
    --warning:      #f59e0b;
    --warning-text: #92400e;
    --warning-bg:   #fffbeb;
    --warning-border: #fde68a;
    --danger:       #ef4444;
    --danger-text:  #991b1b;
    --danger-bg:    #fef2f2;
    --danger-border: #fecaca;
    --info:         #3b82f6;
    --info-text:    #1e40af;
    --info-bg:      #eff6ff;
    --info-border:  #bfdbfe;

    /* Radius */
    --radius-sm: 4px;
    --radius:    8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    /* Transition */
    --transition: 150ms ease;
}


/* ============================================================
   App Layout (Sidebar + Main)
   ============================================================ */

.app-layout {
    display: flex;
    min-height: 100vh;
}


/* ---- Sidebar ---- */

.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 200;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform var(--transition);
    scrollbar-width: thin;
    scrollbar-color: #334155 transparent;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }

/* Logo / header */
.sidebar-header {
    padding: 18px 20px 16px;
    border-bottom: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}

.sidebar-logo {
    display: block;
    font-size: 1.0625rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #ffffff;
    text-decoration: none;
    line-height: 1.3;
}

.sidebar-logo:hover {
    color: #ffffff;
    opacity: 0.9;
    text-decoration: none;
}

.sidebar-logo-accent {
    color: #60a5fa;
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.sidebar-nav-section {
    padding: 0 10px;
    margin-bottom: 6px;
}

.sidebar-nav-label {
    display: block;
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--sidebar-text);
    padding: 10px 10px 4px;
    opacity: 0.6;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 450;
    line-height: 1.25;
    transition: background-color var(--transition), color var(--transition);
    margin-bottom: 2px;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.sidebar-nav-item:hover {
    background-color: var(--sidebar-item-hover);
    color: var(--sidebar-text-hover);
    text-decoration: none;
}

.sidebar-nav-item.active {
    background-color: var(--sidebar-item-active);
    color: var(--sidebar-text-active);
    font-weight: 500;
}

.sidebar-nav-item .nav-icon {
    width: 18px;
    text-align: center;
    flex-shrink: 0;
    font-size: 0.875rem;
    opacity: 0.85;
}

.sidebar-nav-item.active .nav-icon {
    opacity: 1;
}

/* Sidebar footer */
.sidebar-footer {
    padding: 14px 10px;
    border-top: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
}

.sidebar-user-avatar {
    width: 30px;
    height: 30px;
    background-color: var(--brand-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6875rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--sidebar-text-hover);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    display: block;
    font-size: 0.6875rem;
    color: var(--sidebar-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

.sidebar-divider {
    height: 1px;
    background-color: var(--sidebar-border);
    margin: 6px 10px;
}

/* Indented sub-nav items (admin section) */
.sidebar-nav-sub {
    padding-left: 30px;
    font-size: 0.8125rem;
    padding-top: 6px;
    padding-bottom: 6px;
}

/* Admin hub card title */
.admin-hub-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
}

/* Firm Settings hub + sub-navigation */
.firm-settings-subnav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}

.firm-settings-subnav a {
    color: var(--text-muted);
    text-decoration: none;
}

.firm-settings-subnav a:hover {
    color: var(--text);
    text-decoration: underline;
}

.firm-settings-subnav .is-active {
    font-weight: 600;
    color: var(--text);
}

.firm-settings-hub-section {
    margin-bottom: 24px;
}

.firm-settings-hub-section:last-of-type {
    margin-bottom: 0;
}

.firm-settings-hub-heading {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin: 0 0 10px;
}

.firm-settings-hub-grid {
    gap: 12px;
}

.firm-settings-hub-note {
    margin-top: 20px;
    font-size: 0.8125rem;
    color: var(--text-muted);
}


/* ---- Main wrapper ---- */

.main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 100vh;
}


/* ---- Top bar ---- */

.topbar {
    height: var(--topbar-height);
    background-color: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 12px;
    flex-shrink: 0;
}

.topbar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    line-height: 1;
    transition: background-color var(--transition), color var(--transition);
}

.topbar-toggle:hover {
    background-color: var(--bg);
    color: var(--text);
}

.topbar-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    font-size: 0.875rem;
}

.topbar-breadcrumb-item {
    color: var(--text-muted);
}

.topbar-breadcrumb-sep {
    color: var(--text-light);
    font-size: 0.75rem;
}

.topbar-breadcrumb-current {
    color: var(--text);
    font-weight: 600;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-useas {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.topbar-useas select {
    font-size: 0.8125rem;
    padding: 4px 26px 4px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background-color: var(--surface);
    color: var(--text);
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 6px center;
    background-size: 14px;
    cursor: pointer;
    font-family: inherit;
}

.topbar-useas select:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px var(--brand-primary-ring);
}

.topbar-useas button {
    padding: 4px 10px;
    font-size: 0.8125rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background-color: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-family: inherit;
    transition: background-color var(--transition);
}

.topbar-useas button:hover {
    background-color: var(--bg);
}

/* Version badge in topbar */
.topbar-version-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--brand-primary);
    background-color: var(--brand-primary-light);
    padding: 2px 8px;
    border-radius: 9999px;
    border: 1px solid #bfdbfe;
    letter-spacing: 0.02em;
}


/* ---- Main content area ---- */

.main-content {
    flex: 1;
    padding: 28px 28px 40px;
    background-color: var(--bg);
    min-width: 0;
}


/* ============================================================
   Page structure
   ============================================================ */

.page-header {
    margin-bottom: 24px;
}

.page-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.page-title {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.025em;
    line-height: 1.3;
}

.page-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.5;
}


/* ============================================================
   Components
   ============================================================ */

/* ---- Login Page ---- */

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg);
    padding: 24px;
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-brand {
    text-align: center;
    margin-bottom: 24px;
}

.login-logo {
    display: inline-block;
    font-size: 1.375rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
    text-decoration: none;
    line-height: 1.3;
}

.login-logo:hover {
    color: var(--text);
    text-decoration: none;
    opacity: 0.9;
}

.login-logo-accent {
    color: var(--brand-primary);
}

.login-beta {
    color: #ef4444;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    vertical-align: middle;
    margin-left: 4px;
}

.login-card {
    box-shadow: var(--shadow);
}

.login-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.login-card .btn-primary {
    width: 100%;
    margin-top: 4px;
}

.login-footer-link {
    display: block;
    text-align: center;
    margin-top: 16px;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.login-footer-link a {
    color: var(--brand-primary);
}

.login-footer-link a:hover {
    color: var(--brand-primary-hover);
}


/* ---- Cards ---- */

.card {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
}

.card-subtitle {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    background-color: var(--surface-hover);
    border-radius: 0 0 var(--radius) var(--radius);
    display: flex;
    align-items: center;
    gap: 8px;
}


/* ---- Stat/Metric Cards ---- */

.stat-card {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: box-shadow var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow);
}

.stat-card-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    flex-shrink: 0;
}

.stat-card-icon.blue  { background-color: #dbeafe; color: #2563eb; }
.stat-card-icon.green { background-color: #dcfce7; color: #16a34a; }
.stat-card-icon.amber { background-color: #fef3c7; color: #d97706; }
.stat-card-icon.slate { background-color: #f1f5f9; color: #475569; }
.stat-card-icon.red   { background-color: #fee2e2; color: #dc2626; }
.stat-card-icon.purple { background-color: #f3e8ff; color: #9333ea; }

.stat-card-body {
    flex: 1;
    min-width: 0;
}

.stat-card-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.stat-card-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.025em;
    line-height: 1.2;
}

.stat-card-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Click-able stat card */
a.stat-card {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

a.stat-card:hover {
    box-shadow: var(--shadow-md);
    border-color: #cbd5e1;
    text-decoration: none;
    color: inherit;
}


/* ---- Grid helpers ---- */

.grid {
    display: grid;
    gap: 16px;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.grid-auto {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}


/* ---- Buttons ---- */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.25;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    transition: background-color var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition);
    white-space: nowrap;
    font-family: inherit;
    vertical-align: middle;
}

.btn:hover {
    text-decoration: none;
}

.btn-primary {
    background-color: var(--brand-primary);
    color: white;
    border-color: var(--brand-primary);
}

/* Ensure <a> elements styled as primary buttons always render white text */
a.btn-primary:link,
a.btn-primary:visited,
a.btn-primary:hover,
a.btn-primary:active {
    color: white;
    text-decoration: none;
}

.btn-primary:hover {
    background-color: var(--brand-primary-hover);
    border-color: var(--brand-primary-hover);
    color: white;
}

.btn-secondary {
    background-color: var(--surface);
    color: var(--text);
    border-color: var(--border);
}

.btn-secondary:hover {
    background-color: var(--bg);
    color: var(--text);
}

.btn-danger {
    background-color: var(--danger);
    color: white;
    border-color: var(--danger);
}

.btn-danger:hover {
    background-color: #dc2626;
    color: white;
}

.btn-ghost {
    background: none;
    border-color: transparent;
    color: var(--text-muted);
    padding: 7px 10px;
}

.btn-ghost:hover {
    background-color: var(--bg);
    color: var(--text);
}

.btn-link {
    background: none;
    border: none;
    color: var(--brand-primary);
    padding: 0;
    font-size: inherit;
}

.btn-link:hover {
    color: var(--brand-primary-hover);
    text-decoration: underline;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 10px 20px;
    font-size: 1rem;
    border-radius: var(--radius);
}


/* ---- Forms ---- */

.form-group {
    margin-bottom: 16px;
}

.form-row {
    display: grid;
    gap: 16px;
    margin-bottom: 16px;
}

.form-row-2 { grid-template-columns: 1fr 1fr; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }

.form-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 5px;
}

.form-label-required::after {
    content: ' *';
    color: var(--danger);
}

.form-control {
    display: block;
    width: 100%;
    padding: 7px 11px;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text);
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color var(--transition), box-shadow var(--transition);
    font-family: inherit;
    appearance: none;
    -webkit-appearance: none;
}

.form-control:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px var(--brand-primary-ring);
}

.form-control:disabled,
.form-control[readonly] {
    background-color: var(--bg);
    color: var(--text-muted);
    cursor: not-allowed;
}

select.form-control {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 8px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 32px;
    cursor: pointer;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.form-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-error {
    font-size: 0.75rem;
    color: var(--danger);
    margin-top: 4px;
}

.form-control.is-error {
    border-color: var(--danger);
}

.form-control.is-error:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}


/* ---- Tables ---- */

.data-table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    background-color: var(--surface);
}

.data-table thead tr {
    background-color: var(--surface-hover);
    border-bottom: 1px solid var(--border);
}

.data-table thead th {
    padding: 11px 14px;
    text-align: left;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    white-space: nowrap;
}

.data-table thead th:first-child { border-radius: var(--radius) 0 0 0; }
.data-table thead th:last-child  { border-radius: 0 var(--radius) 0 0; }

.data-table tbody tr {
    border-bottom: 1px solid var(--border-light);
    transition: background-color var(--transition);
}

.data-table tbody tr:hover {
    background-color: var(--surface-hover);
}

.data-table tbody tr:last-child {
    border-bottom: none;
}

.data-table tbody td {
    padding: 10px 14px;
    color: var(--text);
    vertical-align: middle;
}

.data-table tfoot td {
    padding: 10px 14px;
    font-weight: 600;
    border-top: 2px solid var(--border);
    background-color: var(--surface-hover);
}

.data-table .col-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Generic HTML tables used in V2 admin pages */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    max-width: 100%;
}

.table-responsive--fit {
    width: fit-content;
    max-width: 100%;
}

.table-responsive--fit .table {
    width: auto;
    min-width: 520px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    background-color: var(--surface);
}

.table thead tr {
    background-color: var(--surface-hover);
    border-bottom: 1px solid var(--border);
}

.table thead th {
    padding: 11px 14px;
    text-align: left;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    white-space: nowrap;
}

.table thead th:first-child { border-radius: var(--radius) 0 0 0; }
.table thead th:last-child  { border-radius: 0 var(--radius) 0 0; }

.table tbody tr {
    border-bottom: 1px solid var(--border-light);
    transition: background-color var(--transition);
}

.table tbody tr:hover {
    background-color: var(--surface-hover);
}

.table tbody tr:last-child {
    border-bottom: none;
}

.table tbody td {
    padding: 10px 14px;
    color: var(--text);
    vertical-align: middle;
}

.table .table-actions,
.table th.table-actions {
    width: 1%;
    white-space: nowrap;
    text-align: right;
}

.table .table-actions-inner {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}

.table .col-status {
    width: 1%;
    white-space: nowrap;
}

.table .col-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}


/* ---- Alerts ---- */

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border: 1px solid transparent;
    line-height: 1.5;
}

.alert i { flex-shrink: 0; margin-top: 1px; }

.alert-success {
    background-color: var(--success-bg);
    color: var(--success-text);
    border-color: var(--success-border);
}

.alert-warning {
    background-color: var(--warning-bg);
    color: var(--warning-text);
    border-color: var(--warning-border);
}

.alert-danger {
    background-color: var(--danger-bg);
    color: var(--danger-text);
    border-color: var(--danger-border);
}

.alert-info {
    background-color: var(--info-bg);
    color: var(--info-text);
    border-color: var(--info-border);
}


/* ---- Badges ---- */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-size: 0.6875rem;
    font-weight: 600;
    border-radius: 9999px;
    white-space: nowrap;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.badge-blue   { background-color: #dbeafe; color: #1e40af; }
.badge-green  { background-color: #dcfce7; color: #166534; }
.badge-yellow { background-color: #fef9c3; color: #854d0e; }
.badge-red    { background-color: #fee2e2; color: #991b1b; }
.badge-gray   { background-color: #f1f5f9; color: #475569; }
.badge-purple { background-color: #f3e8ff; color: #7e22ce; }


/* ---- Inline actions / icon buttons ---- */

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.875rem;
    transition: background-color var(--transition), color var(--transition);
    text-decoration: none;
}

.icon-btn:hover {
    background-color: var(--bg);
    color: var(--text);
    text-decoration: none;
}


/* ---- Divider ---- */

.divider {
    height: 1px;
    background-color: var(--border);
    margin: 16px 0;
}


/* ---- Empty state ---- */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 2.5rem;
    margin-bottom: 16px;
    color: var(--text-light);
}

.empty-state-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.empty-state-text {
    font-size: 0.875rem;
    color: var(--text-muted);
    max-width: 320px;
    line-height: 1.6;
}


/* ---- Maintenance overlay ---- */

.maintenance-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
    color: var(--text-muted);
}

.maintenance-box i {
    font-size: 3rem;
    margin-bottom: 20px;
    color: var(--warning);
}

.maintenance-box h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}


/* ---- Mobile overlay ---- */

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 150;
}

.sidebar-overlay.active {
    display: block;
}


/* ============================================================
   Responsive — Sidebar collapse on mobile
   ============================================================ */

@media (max-width: 900px) {
    .sidebar {
        transform: translateX(calc(-1 * var(--sidebar-width)));
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }

    .main-wrapper {
        margin-left: 0;
    }

    .topbar-toggle {
        display: flex;
    }

    .main-content {
        padding: 18px 16px 32px;
    }

    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .form-row-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
    .grid-2, .grid-3, .grid-4, .grid-auto { grid-template-columns: 1fr; }
    .form-row-2, .form-row-3 { grid-template-columns: 1fr; }
    .topbar { padding: 0 16px; }
    .page-header-row { flex-direction: column; }
}


/* ============================================================
   Utility classes
   ============================================================ */

.flex          { display: flex; }
.flex-col      { flex-direction: column; }
.flex-wrap     { flex-wrap: wrap; }
.items-center  { align-items: center; }
.items-start   { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-end   { justify-content: flex-end; }
.gap-1         { gap: 4px; }
.gap-2         { gap: 8px; }
.gap-3         { gap: 12px; }
.gap-4         { gap: 16px; }
.gap-5         { gap: 20px; }
.flex-1        { flex: 1; }
.min-w-0       { min-width: 0; }

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 20px; }
.mt-6 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }
.mb-6 { margin-bottom: 24px; }

.p-0  { padding: 0 !important; }
.p-4  { padding: 16px; }
.p-5  { padding: 20px; }

.text-sm   { font-size: 0.875rem; }
.text-xs   { font-size: 0.75rem; }
.text-lg   { font-size: 1.125rem; }
.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.font-semibold { font-weight: 600; }
.font-medium   { font-weight: 500; }
.font-bold     { font-weight: 700; }
.w-full  { width: 100%; }
.nowrap  { white-space: nowrap; }
.truncate {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* ============================================================
   TimeCard Entry
   ============================================================ */

/* Toolbar: week nav + add-project form */
.tc-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.tc-week-nav {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tc-week-picker-input {
    padding: 5px 9px;
    font-size: 0.8125rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background-color: var(--surface);
    color: var(--text);
    font-family: inherit;
    cursor: pointer;
}

.tc-week-picker-input:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px var(--brand-primary-ring);
}

.tc-add-project {
    margin-left: auto;
    display: flex;
    align-items: center;
}

/* Week summary strip */
.tc-week-summary {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-wrap: wrap;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 10px;
    margin-bottom: 14px;
    box-shadow: var(--shadow-sm);
}

.tc-day-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    min-width: 56px;
}

.tc-day-chip.tc-weekend {
    background-color: var(--tc-weekend-bg);
}

.tc-day-chip.tc-today {
    background-color: var(--brand-primary-light);
}

.tc-day-chip-name {
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 1px;
}

.tc-day-chip-hours {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.tc-day-chip-date {
    font-size: 0.6rem;
    color: var(--text-light);
    margin-top: 1px;
}

.tc-total-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    background-color: var(--brand-primary-light);
    border-radius: var(--radius-sm);
    margin-left: 6px;
    font-variant-numeric: tabular-nums;
}

.tc-total-chip-label {
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--brand-primary);
}

.tc-total-chip-hours {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--brand-primary);
}

.tc-separator {
    width: 1px;
    height: 26px;
    background-color: var(--border);
    margin: 0 2px;
    flex-shrink: 0;
}

/* Project card */
.tc-project-card {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 8px;
}

.tc-project-header {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    cursor: pointer;
    user-select: none;
    border-radius: var(--radius);
}

.tc-project-header:hover {
    background-color: var(--surface-hover);
}

.tc-project-title {
    flex: 1;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.tc-project-manager {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.tc-pin-btn,
.tc-hide-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: var(--radius-sm);
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.8125rem;
    transition: color var(--transition), background-color var(--transition);
    flex-shrink: 0;
    padding: 0;
    line-height: 1;
}

.tc-pin-btn {
    color: var(--text-light);
}

.tc-pin-btn:hover {
    background-color: var(--brand-primary-light);
    color: var(--brand-primary);
}

.tc-pin-btn.pinned {
    color: var(--brand-primary);
}

.tc-hide-btn {
    color: var(--text-light);
}

.tc-hide-btn:hover {
    background-color: var(--danger-bg);
    color: var(--danger);
}

.tc-project-body {
    border-top: 1px solid var(--border);
    overflow-x: auto;
}

/* Timecard entry table */
.tc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
    white-space: nowrap;
}

.tc-table thead th {
    padding: 5px 6px;
    text-align: center;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    background-color: var(--surface-hover);
}

.tc-table thead th.tc-th-phase,
.tc-table thead th.tc-th-task {
    text-align: left;
    padding-left: 10px;
    min-width: 130px;
}

.tc-table thead th.tc-th-day {
    min-width: 62px;
}

.tc-table thead th.tc-weekend {
    background-color: var(--tc-weekend-bg);
}

.tc-table thead th.tc-today {
    background-color: var(--brand-primary-light);
}

.tc-table tbody tr {
    border-bottom: 1px solid var(--border-light);
}

.tc-table tbody tr:last-child {
    border-bottom: none;
}

.tc-table tbody tr:hover {
    background-color: var(--surface-hover);
}

.tc-table tbody td {
    padding: 3px 4px;
    vertical-align: middle;
}

.tc-td-phase,
.tc-td-task {
    padding-left: 10px !important;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text);
    font-size: 0.8125rem;
}

.tc-td-day {
    text-align: center;
}

.tc-td-day.tc-weekend {
    background-color: var(--tc-weekend-bg);
}

.tc-td-day.tc-today {
    background-color: var(--brand-primary-light);
}

/* Cell: hours input + note button */
.tc-cell {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.tc-hours-input {
    width: 36px;
    text-align: center;
    padding: 3px 3px;
    font-size: 0.8125rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background-color: var(--surface);
    color: var(--text);
    font-family: inherit;
    font-variant-numeric: tabular-nums;
    transition: border-color var(--transition), box-shadow var(--transition), background-color var(--transition);
}

.tc-hours-input:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 2px var(--brand-primary-ring);
    z-index: 1;
    position: relative;
}

.tc-hours-input.tc-weekend-input {
    background-color: var(--tc-weekend-bg);
    border-color: var(--surface);
}

.tc-hours-input.tc-today-input {
    background-color: var(--brand-primary-light);
    border-color: var(--border);
}

.tc-hours-input.saving {
    border-color: var(--warning);
    background-color: var(--warning-bg);
}

.tc-hours-input.saved {
    border-color: var(--success);
    background-color: var(--success-bg);
}

.tc-hours-input.error {
    border-color: var(--danger);
    background-color: var(--danger-bg);
}

/* Note button & inline input */
.tc-note-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.tc-note-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border: none;
    background: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: 0.6875rem;
    transition: color var(--transition);
    padding: 0;
    border-radius: 2px;
    flex-shrink: 0;
    line-height: 1;
}

.tc-note-btn:hover,
.tc-note-btn.has-note {
    color: var(--brand-primary);
}

.tc-note-input {
    display: none;
    position: absolute;
    top: calc(100% + 3px);
    left: -36px;
    z-index: 60;
    width: 180px;
    padding: 4px 8px;
    font-size: 0.8125rem;
    border: 1px solid var(--brand-primary);
    border-radius: var(--radius-sm);
    background: var(--surface);
    box-shadow: var(--shadow-md);
    font-family: inherit;
}

.tc-note-input:focus {
    outline: none;
}

/* ── Note Modal ───────────────────────────────────────────────────────────── */
.tc-note-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.tc-note-modal-box {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 440px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tc-note-modal-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    gap: 8px;
}

.tc-note-modal-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text);
    flex: 1;
}

.tc-note-modal-close-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: none;
    background: none;
    color: var(--text-light);
    cursor: pointer;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    transition: color var(--transition), background var(--transition);
    padding: 0;
}

.tc-note-modal-close-btn:hover {
    color: var(--text);
    background: var(--surface-hover, #f3f4f6);
}

.tc-note-modal-body {
    padding: 16px;
}

.tc-note-modal-textarea {
    width: 100%;
    resize: vertical;
    min-height: 90px;
    padding: 8px 10px;
    font-size: 0.875rem;
    font-family: inherit;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    line-height: 1.5;
    box-sizing: border-box;
}

.tc-note-modal-textarea:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.tc-note-modal-charcount {
    text-align: right;
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 4px;
}

.tc-note-modal-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: var(--surface-alt, var(--surface));
}

/* ============================================================
   Override general.css link colors within v2 */
.app-layout a {
    color: var(--brand-primary);
    text-decoration: none;
}

.app-layout a:hover {
    color: var(--brand-primary-hover);
    text-decoration: underline;
}

/* Sidebar links must not inherit the brand-primary link color */
.sidebar a,
.sidebar a:hover {
    color: var(--sidebar-text);
    text-decoration: none;
}

.sidebar a:hover {
    color: var(--sidebar-text-hover);
}

/* Fade-in animation for page content */
@keyframes v2-fadein {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.main-content {
    animation: v2-fadein 0.18s ease-out;
}


/* ============================================================
   Modal system (used by admin/projects and other pages)
   ============================================================ */

.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background-color: rgba(15, 23, 42, 0.45);
    overflow-y: auto;
    padding: 40px 16px 60px;
}

.modal-backdrop.active {
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(15,23,42,0.18);
    width: 100%;
    max-width: 540px;
    animation: v2-fadein 0.15s ease-out;
}

.modal.modal-wide {
    max-width: 780px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text);
}

.modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9375rem;
    color: var(--text-muted);
    transition: color var(--transition), background-color var(--transition);
    flex-shrink: 0;
}

.modal-close:hover {
    background-color: var(--surface-hover);
    color: var(--text);
}

.modal-body {
    padding: 16px 18px;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 18px;
    border-top: 1px solid var(--border);
    background-color: var(--bg);
    border-bottom-left-radius: var(--radius-lg);
    border-bottom-right-radius: var(--radius-lg);
}


/* ── Inline forms (within modals, below phases/tasks) ── */

.inline-form {
    padding: 10px 12px;
    background-color: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-top: 6px;
}


/* ── Phases modal header toggle ── */

.modal-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.phases-billing-entry-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8125rem;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}


/* ── Phases list (Phases & Tasks modal) ── */

.phases-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.phase-block {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.phase-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    gap: 8px;
}

.phase-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
}

.task-list {
    padding: 6px 10px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.task-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 4px;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
}

.task-row:hover {
    background-color: var(--surface-hover);
}

.task-name {
    font-size: 0.8125rem;
    color: var(--text);
}


/* ── Inline % billed editor (phase header) ── */

.pct-billed-input {
    width: 46px;
    padding: 1px 4px;
    font-size: 0.7rem;
    line-height: 1.4;
    height: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    text-align: right;
    -moz-appearance: textfield;
    transition: border-color var(--transition), background var(--transition);
}

.pct-billed-input::-webkit-outer-spin-button,
.pct-billed-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.pct-billed-input:hover {
    border-color: var(--text-light);
    background: var(--surface);
}

.pct-billed-input:focus {
    border-color: var(--brand-primary);
    background: var(--surface);
    color: var(--text);
    outline: none;
}

.pct-billed-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.pct-billed-wrap {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}


/* ── Phases modal: aligned columns & compact billing view ── */

#modal-phases .phase-header-cols {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

#modal-phases .phase-active-icon {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
}

#modal-phases .phase-name-col {
    width: 220px;
    flex-shrink: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#modal-phases .phase-name-link {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font: inherit;
    color: inherit;
    text-align: left;
    cursor: pointer;
    max-width: 100%;
}

#modal-phases .phase-name-link:hover {
    color: var(--brand-primary);
    text-decoration: underline;
}

.phase-count-link {
    background: none;
    border: none;
    padding: 0;
    font-size: inherit;
    color: var(--text-muted);
    cursor: pointer;
}

.phase-count-link:hover {
    color: var(--brand-primary);
    text-decoration: underline;
}

.consultant-section {
    margin-top: 6px;
    padding: 4px 8px 8px 22px;
    border-top: 1px solid var(--border-light);
}

.consultant-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.consultant-section-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.consultant-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.consultant-empty {
    font-size: 0.75rem;
    padding: 2px 0;
}

.consultant-row {
    padding-left: 0;
}

#modal-phases .phase-fee-col {
    width: 90px;
    flex-shrink: 0;
    text-align: right;
    font-size: 0.75rem;
}

#modal-phases .phase-pct-col {
    width: 100px;
    flex-shrink: 0;
}

#modal-phases.phases-compact .phases-list {
    gap: 0;
}

#modal-phases.phases-compact .phase-block {
    border-radius: 0;
    border-left: none;
    border-right: none;
}

#modal-phases.phases-compact .phase-block:first-child {
    border-top-left-radius: var(--radius);
    border-top-right-radius: var(--radius);
}

#modal-phases.phases-compact .phase-block:last-child {
    border-bottom-left-radius: var(--radius);
    border-bottom-right-radius: var(--radius);
}

#modal-phases.phases-compact .phase-header {
    padding: 2px 8px;
    border-bottom: none;
}

#modal-phases.phases-compact .task-list,
#modal-phases.phases-compact .consultant-section,
#modal-phases.phases-compact [id^="add-task-form-"],
#modal-phases.phases-compact [id^="edit-task-form-"],
#modal-phases.phases-compact [id^="add-consult-form-"],
#modal-phases.phases-compact [id^="edit-consult-form-"] {
    display: none !important;
}

#modal-phases.phases-compact .phase-task-btn {
    display: none;
}


/* ── Drag-to-reorder handles ── */

.drag-handle {
    cursor: grab;
    color: var(--text-light);
    font-size: 0.7rem;
    padding: 2px 3px;
    flex-shrink: 0;
    opacity: 0.4;
    transition: opacity var(--transition), color var(--transition);
    user-select: none;
    -webkit-user-select: none;
}

.phase-header:hover .drag-handle,
.task-row:hover .drag-handle {
    opacity: 1;
    color: var(--text-muted);
}

.drag-handle:active {
    cursor: grabbing;
}

.phase-block.dragging,
.task-row.dragging {
    opacity: 0.35;
}

.phase-block.drag-over {
    outline: 2px dashed var(--brand-primary);
    outline-offset: -2px;
    border-radius: var(--radius);
}

.task-row.drag-over {
    outline: 2px dashed var(--brand-primary);
    outline-offset: -1px;
    border-radius: var(--radius-sm);
}


/* ── form-control-sm variant ── */

.form-control-sm {
    padding: 4px 8px;
    font-size: 0.8125rem;
    height: auto;
    min-height: 30px;
}

select.form-control-sm {
    padding: 4px 8px;
}


/* ── Modal responsive ── */

@media (max-width: 600px) {
    .modal, .modal.modal-wide {
        max-width: 100%;
        margin-bottom: 20px;
    }
    .modal-backdrop {
        padding: 16px 8px 40px;
        align-items: flex-start;
    }
}
