/* Shared form + control utilities — Velocity Enterprise */

.form-input {
    min-height: var(--control-height);
    padding: 0 var(--space-2);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    background: var(--surface-elevated);
    color: var(--text-primary);
    font-size: var(--font-label);
}

.form-input:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: var(--shadow-focus);
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: var(--touch-target-min);
    min-height: var(--touch-target-min);
    padding: 0;
    border: none;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
}

.btn-icon:hover {
    background: var(--surface-input);
    color: var(--text-primary);
}

/* ==========================================
   TIMELINE VISUALIZATION
   ========================================== */

.timeline-container {
    background-color: var(--surface-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: var(--space-2);
    width: 100%;
    box-shadow: var(--shadow-sm);
}

.timeline-scroll {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    padding-bottom: var(--space-1);
}

.timeline-grid {
    min-width: 100%;
}

.timeline-header-row {
    display: flex;
    border-bottom: 2px solid var(--color-neutral-300);
    position: sticky;
    top: 0;
    background: var(--surface-elevated);
    z-index: 2;
}

.timeline-corner {
    width: var(--deal-label-width, 200px);
    min-width: var(--deal-label-width, 200px);
    flex-shrink: 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: var(--space-1);
    border-right: 2px solid var(--border-default);
    cursor: help;
}

.axis-label-y {
    font-size: var(--font-caption);
    font-weight: var(--font-weight-semibold);
    color: var(--text-secondary);
    writing-mode: vertical-rl;
    transform: rotate(180deg);
}

.timeline-axis-area {
    flex: 1;
    min-width: 0;
}

.timeline-axis-top {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 4px var(--space-1);
    border-bottom: 1px solid var(--border-subtle);
    cursor: help;
}

.axis-label-x {
    font-size: var(--font-caption);
    font-weight: var(--font-weight-semibold);
    color: var(--text-secondary);
}

.timeline-granularity-badge {
    font-size: var(--font-caption);
    background: var(--brand-primary-subtle);
    color: var(--brand-primary);
    padding: 2px var(--space-1);
    border-radius: var(--radius-pill);
    font-weight: var(--font-weight-medium);
}

.timeline-periods {
    display: flex;
}

.timeline-period {
    flex-shrink: 0;
    text-align: center;
    padding: var(--space-1) 4px;
    font-size: var(--font-caption);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    border-right: 1px solid var(--border-default);
    box-sizing: border-box;
}

.timeline-period:last-child {
    border-right: none;
}

.timeline-body {
    display: flex;
    flex-direction: column;
}

.timeline-row {
    display: flex;
    align-items: stretch;
    border-bottom: 1px solid var(--border-subtle);
    min-height: 52px;
}

.timeline-row:hover {
    background-color: var(--color-neutral-50);
}

.timeline-deal-label {
    width: var(--deal-label-width, 200px);
    min-width: var(--deal-label-width, 200px);
    flex-shrink: 0;
    padding: var(--space-1) var(--space-2);
    font-size: var(--font-label);
    font-weight: var(--font-weight-medium);
    color: var(--text-primary);
    border-right: 2px solid var(--border-default);
    display: flex;
    align-items: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.timeline-track {
    position: relative;
    flex-shrink: 0;
    height: 52px;
}

.timeline-grid-bg {
    position: absolute;
    inset: 0;
    display: flex;
    pointer-events: none;
}

.timeline-grid-col {
    flex-shrink: 0;
    height: 100%;
    border-right: 1px dashed var(--border-default);
    box-sizing: border-box;
}

.timeline-grid-col:last-child {
    border-right: none;
}

.timeline-bar {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    height: 32px;
    min-width: 72px;
    padding: 0 10px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: box-shadow var(--transition-fast), filter var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-on-brand);
    font-size: var(--font-caption);
    font-weight: var(--font-weight-bold);
    z-index: 1;
    box-shadow: var(--shadow-sm);
}

.timeline-bar:hover {
    filter: brightness(1.08);
    box-shadow: var(--shadow-md);
    z-index: 10;
}

.timeline-bar.planned {
    background: linear-gradient(90deg, var(--status-planned) 0%, var(--brand-primary) 100%);
}

.timeline-bar.invoiced {
    background: linear-gradient(90deg, var(--status-invoiced) 0%, var(--status-warning) 100%);
}

.timeline-bar.paid {
    background: linear-gradient(90deg, var(--status-paid) 0%, #16a34a 100%);
}

.timeline-bar-label {
    white-space: nowrap;
    overflow: visible;
}

.timeline-bar:hover .timeline-tooltip {
    display: block;
}

.timeline-tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--color-neutral-900);
    color: var(--text-on-brand);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-md);
    font-size: var(--font-caption);
    white-space: nowrap;
    z-index: 100;
    box-shadow: var(--shadow-lg);
    pointer-events: none;
}

.timeline-tooltip-title {
    font-weight: var(--font-weight-semibold);
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(255,255,255,0.2);
}

.timeline-tooltip-item {
    display: flex;
    gap: var(--space-1);
    margin-bottom: 3px;
}

.timeline-tooltip-item:last-child {
    margin-bottom: 0;
}

.timeline-tooltip-label {
    font-weight: var(--font-weight-medium);
    min-width: 64px;
    color: #bdbdbd;
}

.timeline-empty {
    text-align: center;
    color: var(--text-secondary);
    padding: var(--space-6);
    font-size: var(--font-label);
}

.timeline-granularity-tag {
    font-size: var(--font-caption);
    background: var(--brand-primary-subtle);
    color: var(--brand-primary);
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-weight: var(--font-weight-medium);
}

.timeline-legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    align-items: center;
    margin-top: var(--space-2);
    padding-top: var(--space-2);
    border-top: 1px solid var(--border-default);
    font-size: var(--font-label);
    color: var(--text-secondary);
}

.legend-box {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: var(--radius-sm);
    margin-right: var(--space-1);
    vertical-align: middle;
}

.legend-box.planned {
    background: linear-gradient(90deg, var(--status-planned) 0%, var(--brand-primary) 100%);
}

.legend-box.invoiced {
    background: linear-gradient(90deg, var(--status-invoiced) 0%, var(--status-warning) 100%);
}

.legend-box.paid {
    background: linear-gradient(90deg, var(--status-paid) 0%, #16a34a 100%);
}

.legend-hint {
    margin-left: auto;
    font-size: var(--font-caption);
    color: var(--text-muted);
    font-style: italic;
}

.timeline-range {
    display: inline-block;
    min-width: 160px;
    text-align: center;
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    font-size: var(--font-label);
}

.timeline-controls {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    flex-wrap: wrap;
}

/* ==========================================
   KANBAN LOADING & WELCOME STATES
   ========================================== */

.kanban-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-8) var(--space-2);
    min-height: 400px;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-default);
    border-top-color: var(--brand-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: var(--space-3);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    font-size: var(--font-label);
    color: var(--text-secondary);
    font-weight: var(--font-weight-medium);
}

.kanban-welcome-banner {
    background: linear-gradient(135deg, var(--brand-primary-subtle) 0%, var(--surface-elevated) 100%);
    border: 2px dashed var(--brand-primary);
    border-radius: var(--radius-lg);
    padding: var(--space-6) var(--space-4);
    margin-bottom: var(--space-4);
    text-align: center;
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.welcome-content {
    max-width: 600px;
    margin: 0 auto;
}

.welcome-icon {
    font-size: 48px;
    margin-bottom: var(--space-2);
}

.welcome-content h3 {
    font-size: var(--font-heading);
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
    margin: 0 0 var(--space-2) 0;
}

.welcome-content p {
    font-size: var(--font-label);
    color: var(--text-secondary);
    margin: 0 0 var(--space-4) 0;
    line-height: 1.5;
}

.welcome-tips {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin-top: var(--space-3);
}

.tip {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--surface-elevated);
    border-radius: var(--radius-md);
    font-size: var(--font-caption);
    color: var(--text-secondary);
    text-align: left;
}

.tip-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.kanban-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-8) var(--space-2);
    min-height: 400px;
    text-align: center;
}

.error-icon {
    font-size: 48px;
    margin-bottom: var(--space-3);
}

.error-text {
    font-size: var(--font-label);
    color: var(--text-secondary);
    margin-bottom: var(--space-3);
    max-width: 400px;
}

.kanban-empty {
    text-align: center;
    padding: var(--space-4) var(--space-2);
    color: var(--text-muted);
    font-size: var(--font-caption);
    font-style: italic;
}
