/**
 * WorkShift Component System — Enterprise SaaS (Atlassian Design Language)
 * Flat surfaces, 1px borders, subtle tonal steps, small radii, compact lozenges
 */

/* =========================================================================
   Buttons
   ========================================================================= */

.clay-btn,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    font-family: var(--font-sans);
    font-size: var(--text-body);
    font-weight: var(--weight-medium);
    line-height: 1;
    height: 40px;
    padding: 0 var(--space-4);
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    user-select: none;
    transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
    white-space: nowrap;
    position: relative;
    box-shadow: none;
}

.clay-btn:hover,
.btn:hover {
    text-decoration: none;
}

.clay-btn:disabled,
.clay-btn.disabled,
.btn:disabled,
.btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Primary Button (Solid Blue) */
.clay-btn-primary,
.btn-primary {
    background: var(--color-brand);
    color: var(--color-brand-text);
    border-color: var(--color-brand);
    font-weight: var(--weight-semibold);
}

.clay-btn-primary:hover,
.btn-primary:hover {
    background: var(--color-brand-hover);
    border-color: var(--color-brand-hover);
    color: var(--color-brand-text);
}

/* Secondary Button (Subtle Neutral / Bordered) */
.clay-btn-secondary,
.btn-secondary {
    background: var(--color-bg-surface);
    color: var(--color-text);
    border-color: var(--color-border);
}

.clay-btn-secondary:hover,
.btn-secondary:hover {
    background: var(--color-bg-hover);
    color: var(--color-text);
}

/* Danger Button */
.clay-btn-danger,
.btn-danger {
    background: var(--color-danger);
    color: #FFFFFF;
    border-color: var(--color-danger);
}

.clay-btn-danger:hover,
.btn-danger:hover {
    opacity: 0.9;
    color: #FFFFFF;
}

/* Success Button */
.clay-btn-success,
.btn-success {
    background: var(--color-success);
    color: #FFFFFF;
    border-color: var(--color-success);
}

.clay-btn-success:hover,
.btn-success:hover {
    opacity: 0.9;
    color: #FFFFFF;
}

/* Ghost / Subtle Button */
.clay-btn-ghost,
.btn-ghost,
.btn-subtle {
    background: transparent;
    color: var(--color-text-subtle);
    border-color: transparent;
}

.clay-btn-ghost:hover,
.btn-ghost:hover,
.btn-subtle:hover {
    background: var(--color-bg-hover);
    color: var(--color-text);
}

/* Link Button */
.clay-btn-link,
.btn-link {
    background: transparent;
    color: var(--color-link);
    border-color: transparent;
    padding: 0;
    height: auto;
}

.clay-btn-link:hover,
.btn-link:hover {
    color: var(--color-link-hover);
    text-decoration: underline;
}

/* Sizes */
.clay-btn-sm,
.btn-sm {
    height: 32px;
    padding: 0 var(--space-3);
    font-size: var(--text-caption);
    border-radius: var(--radius-sm);
}

.clay-btn-lg,
.btn-lg {
    height: 48px;
    padding: 0 var(--space-6);
    font-size: var(--text-body-lg);
}

.clay-btn-icon,
.btn-icon-only {
    width: 40px;
    height: 40px;
    padding: 0;
}

.clay-btn-icon-sm,
.btn-icon-sm {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: var(--radius-sm);
}

@media (max-width: 639px) {
    .clay-btn-primary,
    .btn-primary {
        height: 48px;
    }
    .clay-btn-sm,
    .btn-sm {
        height: 36px;
    }
}

/* =========================================================================
   Lozenges & Compact Tags
   ========================================================================= */

.clay-chip,
.lozenge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: var(--weight-semibold);
    line-height: 1.2;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.chip-dot {
    width: 6px;
    height: 6px;
    border-radius: var(--radius-full);
    background: currentColor;
}

/* Status variants */
.chip-success,
.lozenge-success {
    background: var(--color-success-bg);
    color: var(--color-success-text);
    border-color: var(--color-success-border);
}

.chip-warning,
.lozenge-warning {
    background: var(--color-warning-bg);
    color: var(--color-warning-text);
    border-color: var(--color-warning-border);
}

.chip-danger,
.lozenge-danger {
    background: var(--color-danger-bg);
    color: var(--color-danger-text);
    border-color: var(--color-danger-border);
}

.chip-primary,
.lozenge-info {
    background: var(--color-info-bg);
    color: var(--color-info-text);
    border-color: var(--color-info-border);
}

.chip-muted,
.lozenge-default {
    background: var(--color-bg-surface-sunken);
    color: var(--color-text-subtle);
    border-color: var(--color-border);
}

.chip-pro,
.lozenge-discovery {
    background: var(--color-discovery-bg);
    color: var(--color-discovery-text);
    border-color: rgba(159, 143, 239, 0.3);
}

/* Blocker Lozenges: Distinct color, icon, label, days counter */
.clay-chip-blocker {
    padding: 3px 8px;
    font-size: 11px;
    font-weight: var(--weight-semibold);
    letter-spacing: 0.02em;
    text-transform: none;
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    border-radius: var(--radius-sm);
}

.chip-icon-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chip-days-bubble {
    font-size: 10px;
    font-weight: var(--weight-semibold);
    padding: 1px 4px;
    border-radius: 2px;
    background: rgba(0, 0, 0, 0.15);
    margin-left: var(--space-1);
}

[data-theme="dark"] .chip-days-bubble {
    background: rgba(255, 255, 255, 0.15);
}

.clay-blocker-feedback {
    background: var(--blocker-feedback-bg);
    color: var(--blocker-feedback-text);
    border-color: var(--blocker-feedback-border);
}

.clay-blocker-content {
    background: var(--blocker-content-bg);
    color: var(--blocker-content-text);
    border-color: var(--blocker-content-border);
}

.clay-blocker-payment {
    background: var(--blocker-payment-bg);
    color: var(--blocker-payment-text);
    border-color: var(--blocker-payment-border);
}

.clay-blocker-scheduling {
    background: var(--blocker-scheduling-bg);
    color: var(--blocker-scheduling-text);
    border-color: var(--blocker-scheduling-border);
}

.clay-blocker-default {
    background: var(--color-bg-surface-sunken);
    color: var(--color-text-subtle);
    border-color: var(--color-border);
}

/* =========================================================================
   Cards & Panels
   ========================================================================= */

.clay-card,
.panel {
    background: var(--color-bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    padding: var(--space-5);
    position: relative;
    box-shadow: none;
}

.clay-card-interactive,
.panel-interactive {
    cursor: pointer;
    transition: border-color var(--transition-fast), background var(--transition-fast);
}

.clay-card-interactive:hover,
.panel-interactive:hover {
    border-color: var(--color-border-focused);
    background: var(--color-bg-hover);
}

.clay-card-shallow {
    background: var(--color-bg-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    padding: var(--space-4);
    box-shadow: none;
}

/* Stat Tiles */
.clay-stat-tile,
.stat-card {
    display: flex;
    flex-direction: column;
    padding: var(--space-5);
    background: var(--color-bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    position: relative;
    box-shadow: none;
    transition: border-color var(--transition-fast);
}

.clay-stat-tile:hover,
.stat-card:hover {
    border-color: var(--color-border-focused);
}

.stat-icon-bubble {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-3);
    flex-shrink: 0;
    background: var(--color-bg-surface-sunken);
    color: var(--color-text-subtle);
    border: 1px solid var(--color-border);
}

.stat-val {
    font-size: var(--text-h2);
    font-weight: var(--weight-semibold);
    line-height: 1.1;
    color: var(--color-text);
    margin-bottom: var(--space-1);
    font-variant-numeric: tabular-nums;
}

.stat-label {
    font-size: 11px;
    font-weight: var(--weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-subtle);
}

/* =========================================================================
   Form Controls
   ========================================================================= */

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin-bottom: var(--space-5);
}

.form-label {
    font-size: var(--text-caption);
    font-weight: var(--weight-semibold);
    color: var(--color-text-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.form-help {
    font-size: var(--text-caption);
    color: var(--color-text-subtlest);
    line-height: 1.4;
}

.clay-input,
.clay-select,
.clay-textarea,
.form-input,
.form-select,
.form-textarea {
    width: 100%;
    min-height: 40px;
    height: 40px;
    padding: 0 var(--space-3);
    border-radius: var(--radius-md);
    background: var(--color-bg-input);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    font-size: var(--text-body);
    line-height: 1.4;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    box-sizing: border-box;
    box-shadow: none;
}

.clay-textarea,
.form-textarea {
    height: auto;
    min-height: 96px;
    padding: var(--space-2) var(--space-3);
    resize: vertical;
}

.clay-input:focus,
.clay-select:focus,
.clay-textarea:focus,
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--color-border-focused);
    box-shadow: 0 0 0 1px var(--color-border-focused);
    background: var(--color-bg-input);
}

.clay-select,
.form-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238993A5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
}

.clay-dropzone {
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-bg-surface-sunken);
    padding: var(--space-8) var(--space-4);
    text-align: center;
    cursor: pointer;
    transition: border-color var(--transition-fast), background var(--transition-fast);
}

.clay-dropzone:hover,
.clay-dropzone.dragover {
    border-color: var(--color-brand);
    background: var(--color-brand-subtle);
}

/* =========================================================================
   Underlined Tabs Navigation (Jira-style)
   ========================================================================= */

.tab-nav {
    display: flex;
    align-items: center;
    gap: var(--space-6);
    border-bottom: 1px solid var(--color-border);
    margin-bottom: var(--space-6);
    overflow-x: auto;
}

.tab-item {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    height: 44px;
    font-size: var(--text-body);
    font-weight: var(--weight-medium);
    color: var(--color-text-subtle);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    padding: 0 var(--space-1);
    transition: color var(--transition-fast), border-color var(--transition-fast);
}

.tab-item:hover {
    color: var(--color-text);
    text-decoration: none;
}

.tab-item.active {
    color: var(--color-brand);
    font-weight: var(--weight-semibold);
    border-bottom-color: var(--color-brand);
}

/* =========================================================================
   Breadcrumbs
   ========================================================================= */

.breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-caption);
    color: var(--color-text-subtle);
    margin-bottom: var(--space-2);
}

.breadcrumb a {
    color: var(--color-text-subtle);
    text-decoration: none;
}

.breadcrumb a:hover {
    color: var(--color-text);
    text-decoration: underline;
}

.breadcrumb-separator {
    color: var(--color-text-subtlest);
}

/* =========================================================================
   Toolbars
   ========================================================================= */

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.toolbar-left,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
}

/* =========================================================================
   Tables (Atlassian structured table)
   ========================================================================= */

.clay-table-wrap,
.table-container {
    width: 100%;
    background: var(--color-bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    overflow: hidden;
    margin-bottom: var(--space-6);
}

.clay-table,
.table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.clay-table th,
.table th {
    height: 48px;
    padding: 0 var(--space-4);
    font-size: 11px;
    font-weight: var(--weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-subtlest);
    background: var(--color-bg-surface-sunken);
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}

.clay-table td,
.table td {
    min-height: 56px;
    height: 56px;
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-body);
    color: var(--color-text);
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}

.clay-table tbody tr,
.table tbody tr {
    transition: background var(--transition-fast);
}

.clay-table tbody tr:hover,
.table tbody tr:hover {
    background: var(--color-bg-hover);
}

.clay-table tbody tr:last-child td,
.table tbody tr:last-child td {
    border-bottom: none;
}

/* Mobile responsive table card fallback */
@media (max-width: 639px) {
    .clay-table-responsive thead {
        display: none;
    }
    .clay-table-responsive tbody {
        display: flex;
        flex-direction: column;
        gap: var(--space-3);
        padding: var(--space-3);
    }
    .clay-table-responsive tr {
        display: flex;
        flex-direction: column;
        background: var(--color-bg-surface);
        border-radius: var(--radius-md);
        border: 1px solid var(--color-border);
        padding: var(--space-4);
        gap: var(--space-2);
        height: auto;
    }
    .clay-table-responsive td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: var(--space-2) 0;
        border-bottom: 1px solid var(--color-border);
        height: auto;
        min-height: auto;
    }
    .clay-table-responsive td:last-child {
        border-bottom: none;
        padding-top: var(--space-3);
        justify-content: flex-end;
    }
    .clay-table-responsive td::before {
        content: attr(data-label);
        font-size: 11px;
        font-weight: var(--weight-semibold);
        text-transform: uppercase;
        color: var(--color-text-subtlest);
        letter-spacing: 0.04em;
    }
}

/* =========================================================================
   Dropdown Menus (Floating layer with shadow)
   ========================================================================= */

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: var(--space-1);
    background: var(--color-bg-surface-overlay);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: var(--space-1) 0;
    min-width: 180px;
    z-index: var(--z-dropdown);
    display: none;
}

.dropdown-menu.open {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-body);
    color: var(--color-text);
    text-decoration: none;
    cursor: pointer;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    transition: background var(--transition-fast);
}

.dropdown-item:hover {
    background: var(--color-bg-hover);
    color: var(--color-text);
    text-decoration: none;
}

.dropdown-divider {
    height: 1px;
    background: var(--color-border);
    margin: var(--space-1) 0;
}

/* =========================================================================
   Modals & Dialogs
   ========================================================================= */

.clay-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.clay-modal-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.clay-modal {
    width: 100%;
    max-width: 560px;
    background: var(--color-bg-surface);
    border-radius: var(--radius-xl);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-overlay);
    overflow: hidden;
    transform: translateY(12px);
    transition: transform 0.2s ease;
    display: flex;
    flex-direction: column;
}

.clay-modal-backdrop.open .clay-modal {
    transform: translateY(0);
}

.modal-header {
    padding: var(--space-6);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-body {
    padding: var(--space-6);
    overflow-y: auto;
    max-height: 75vh;
}

.modal-footer {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--color-border);
    background: var(--color-bg-surface-sunken);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-3);
}

@media (max-width: 639px) {
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: var(--space-4);
    }
}

/* =========================================================================
   Toasts & Alerts
   ========================================================================= */

.clay-toast {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    font-size: var(--text-body);
    font-weight: var(--weight-medium);
}

.clay-toast-success {
    border-left: 3px solid var(--color-success);
    background: var(--color-success-bg);
}

.clay-toast-error {
    border-left: 3px solid var(--color-danger);
    background: var(--color-danger-bg);
}

.clay-toast-upgrade {
    border-left: 3px solid var(--color-warning);
    background: var(--color-warning-bg);
}

/* =========================================================================
   Empty States
   ========================================================================= */

.clay-empty-state {
    text-align: center;
    padding: var(--space-12) var(--space-6);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-bg-surface-sunken);
}

.empty-icon-bubble {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-subtle);
    margin: 0 auto var(--space-3);
}

/* =========================================================================
   Timer Widget (Topbar Active Tracker)
   ========================================================================= */

.clay-timer-widget {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    background: var(--color-bg-surface-sunken);
    border-radius: var(--radius-full);
    border: 1px solid var(--color-border);
    padding: 2px var(--space-3) 2px var(--space-2);
    font-size: var(--text-caption);
    font-weight: var(--weight-semibold);
}

.clay-timer-widget.hidden {
    display: none !important;
}

.timer-pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    background: var(--color-danger);
    animation: pulseGlow 1.5s infinite;
    flex-shrink: 0;
}

@keyframes pulseGlow {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

.timer-digits {
    font-family: monospace;
    font-size: var(--text-caption);
    font-weight: var(--weight-semibold);
    color: var(--color-text);
}

.timer-title {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--color-text-subtle);
}

/* =========================================================================
   Enterprise Modal System (WS.modal)
   Atlassian Design Language: 12px radius, 1px border, 32px padding,
   Bottom sheet on mobile, accessible focus & animations.
   ========================================================================= */

body.ws-modal-locked {
    overflow: hidden !important;
}

.ws-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    opacity: 1;
    animation: wsModalFadeIn 0.18s ease-out forwards;
}

.ws-modal-backdrop.ws-modal-closing {
    animation: wsModalFadeOut 0.15s ease-in forwards;
}

.ws-modal-card {
    width: 100%;
    max-width: 440px;
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35), 0 2px 6px rgba(0, 0, 0, 0.2);
    padding: 32px;
    position: relative;
    transform: scale(1);
    animation: wsModalScaleIn 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    max-height: calc(100vh - 48px);
    max-height: calc(100dvh - 48px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.ws-modal-wide {
    max-width: 560px;
}

.ws-modal-closing .ws-modal-card {
    animation: wsModalScaleOut 0.15s ease-in forwards;
}

.ws-modal-drag-handle {
    display: none;
}

.ws-modal-header-row {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 20px;
}

.ws-modal-icon-bubble {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid transparent;
}

.ws-icon-success {
    background: rgba(34, 197, 94, 0.12);
    border-color: rgba(34, 197, 94, 0.25);
}

.ws-icon-error,
.ws-icon-danger {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.25);
}

.ws-icon-warning {
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.25);
}

.ws-icon-info,
.ws-icon-confirm,
.ws-icon-loading {
    background: rgba(87, 157, 255, 0.12);
    border-color: rgba(87, 157, 255, 0.25);
}

.ws-modal-titles {
    flex: 1;
    min-width: 0;
}

.ws-modal-title {
    font-family: var(--font-sans);
    font-size: 1.125rem;
    font-weight: var(--weight-bold);
    color: var(--color-text);
    margin: 0 0 8px 0;
    line-height: 1.25;
}

.ws-modal-message {
    font-size: var(--text-body);
    color: var(--color-text-subtle);
    line-height: 1.55;
    margin: 0;
}

.ws-modal-label {
    display: block;
    font-size: var(--text-caption);
    font-weight: var(--weight-semibold);
    color: var(--color-text-subtle);
    margin-bottom: 6px;
}

.ws-modal-input-error {
    color: var(--color-danger);
    font-size: var(--text-caption);
    font-weight: var(--weight-medium);
    margin-top: 4px;
}

.ws-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

/* Countdown bar for auto-closing success modals */
.ws-modal-countdown-track {
    width: 100%;
    height: 3px;
    background: var(--color-border);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-top: 16px;
}

.ws-modal-countdown-bar {
    height: 100%;
    background: #22C55E;
    width: 100%;
    animation: wsCountdown linear forwards;
}

@keyframes wsCountdown {
    from { width: 100%; }
    to { width: 0%; }
}

@keyframes wsModalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes wsModalFadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes wsModalScaleIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes wsModalScaleOut {
    from { transform: scale(1); opacity: 0; }
    to { transform: scale(0.95); opacity: 0; }
}

.ws-spin {
    animation: wsSpin 1s linear infinite;
}

@keyframes wsSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Mobile Bottom Sheet (<= 639px) */
@media (max-width: 639px) {
    .ws-modal-backdrop {
        align-items: flex-end;
        padding: 0;
    }

    .ws-modal-card {
        max-width: 100%;
        border-radius: 16px 16px 0 0;
        border-bottom: none;
        padding: 24px var(--space-4) calc(24px + env(safe-area-inset-bottom, 0));
        animation: wsModalSlideUp 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }

    .ws-modal-drag-handle {
        display: block;
        width: 36px;
        height: 4px;
        border-radius: 2px;
        background: var(--color-border);
        margin: 0 auto 16px;
    }

    .ws-modal-closing .ws-modal-card {
        animation: wsModalSlideDown 0.18s ease-in forwards;
    }

    .ws-modal-footer {
        flex-direction: column-reverse;
        gap: 12px;
        margin-top: 24px;
    }

    .ws-modal-footer .btn {
        width: 100%;
        height: 48px;
        font-size: 1rem;
    }
}

@keyframes wsModalSlideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

@keyframes wsModalSlideDown {
    from { transform: translateY(0); }
    to { transform: translateY(100%); }
}

/* =========================================================================
   Utility Classes & Component Layouts
   ========================================================================= */

.rounded-full { border-radius: var(--radius-full); }
.italic { font-style: italic; }
.py-1 { padding-top: var(--space-1); padding-bottom: var(--space-1); }
.m-0 { margin: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.mt-0 { margin-top: 0 !important; }
.p-0 { padding: 0 !important; }
.leading-relaxed { line-height: 1.625; }
.table-wrap { overflow-x: auto; width: 100%; -webkit-overflow-scrolling: touch; }
.empty-state { text-align: center; padding: var(--space-8) var(--space-4); }
.empty-state-icon { margin: 0 auto var(--space-3); color: var(--color-text-subtle); display: flex; align-items: center; justify-content: center; }
.auth-card-body { padding: var(--space-2) 0; }
.dirty-check { position: relative; }
.task-cards-list { display: flex; flex-direction: column; gap: var(--space-2); min-height: 40px; }
.task-card-drag-handle { cursor: grab; }
.client-form-main-col { flex: 1; min-width: 0; }
.client-form-aside-col { width: 320px; flex-shrink: 0; }
.client-grid-2col { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-4); }
.client-grid-3col { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-4); }
.stage-chip { display: inline-flex; align-items: center; gap: var(--space-1); padding: 2px 8px; border-radius: var(--radius-sm); font-size: 12px; }
.stage-chip-title { font-weight: var(--weight-medium); }
.clients-page, .pipeline-page, .client-detail-page { width: 100%; }
.client-tab-content { margin-top: var(--space-4); }
.client-summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--space-4); }
.hover\:text-primary:hover { color: var(--color-text) !important; }
.hover\:text-brand:hover { color: var(--color-brand) !important; }
.hover\:underline:hover { text-decoration: underline !important; }
.card { background: var(--color-bg-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); }
.cursor-pointer { cursor: pointer; }
.max-w-sm { max-width: 384px; }
.pl-7 { padding-left: 1.75rem; }
.px-2 { padding-left: var(--space-2); padding-right: var(--space-2); }
.pb-2 { padding-bottom: var(--space-2); }
.mb-5 { margin-bottom: 1.25rem; }
.dashboard-page, .invoices-page { width: 100%; }
.invoice-form-main-col { flex: 1; min-width: 0; }
.invoice-form-aside-col { width: 320px; flex-shrink: 0; }
.invoice-grid-2col { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-4); }
.item-qty, .item-price, .item-row-total { text-align: right; }
.freelancer-block { margin-bottom: var(--space-4); }


