/* ============================================
   TikTak Design System
   Version 1.0
   ============================================ */

/* ── Design Tokens ─────────────────────── */

:root {
    /* Colour — Core */
    --st-bg: #F5F5F3;
    --st-surface: #FFFFFF;
    --st-surface-hover: #FAFAFA;
    --st-border: #E5E5E3;
    --st-divider: #F0F0EE;
    --st-text: #1A1A1A;
    --st-text-secondary: #6B6B6B;
    --st-text-disabled: #C4C4C4;
    --st-text-inverse: #FFFFFF;

    /* Colour — Accent */
    --st-accent: #2B5797;
    --st-accent-hover: #1E3F6F;
    --st-accent-light: #EDF2F9;
    --st-accent-subtle: rgba(43, 87, 151, 0.08);

    /* Colour — Status */
    --st-success: #2E7D4F;
    --st-success-light: #F0F7F3;
    --st-warning: #C47F17;
    --st-warning-light: #FEF9F0;
    --st-error: #C0392B;
    --st-error-light: #FDF2F1;

    /* Typography */
    --st-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --st-text-xs: 0.8125rem;
    --st-text-sm: 0.875rem;
    --st-text-base: 1rem;
    --st-text-md: 1.125rem;
    --st-text-lg: 1.25rem;
    --st-text-xl: 1.5rem;
    --st-text-2xl: 2rem;
    --st-text-3xl: 2.5rem;
    --st-weight-regular: 400;
    --st-weight-medium: 500;
    --st-weight-semibold: 600;
    --st-leading-tight: 1.3;
    --st-leading-normal: 1.6;
    --st-tracking-tight: -0.02em;

    /* Spacing — 8px grid */
    --st-space-1: 0.25rem;
    --st-space-2: 0.5rem;
    --st-space-3: 1rem;
    --st-space-4: 1.5rem;
    --st-space-5: 2rem;
    --st-space-6: 3rem;
    --st-space-8: 4rem;

    /* Radii */
    --st-radius: 0.5rem;
    --st-radius-sm: 0.5rem;
    --st-radius-md: 0.625rem;
    --st-radius-lg: 0.75rem;
    --st-radius-xl: 1rem;
    --st-radius-full: 9999px;

    /* Shadows */
    --st-shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --st-shadow-md: 0 4px 6px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.04);
    --st-shadow-lg: 0 10px 15px rgba(0,0,0,0.08), 0 4px 6px rgba(0,0,0,0.04);

    /* Transitions */
    --st-transition-fast: 150ms ease-out;
    --st-transition-normal: 200ms ease-out;

    /* Layout */
    --st-max-form: 800px;
    --st-max-content: 1200px;
    --st-touch-target: 48px;
    --st-touch-target-lg: 56px;
}

/* ── Reduced Motion ────────────────────── */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ── Base ───────────────────────────────── */

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: var(--st-font);
    font-size: var(--st-text-md);
    font-weight: var(--st-weight-regular);
    line-height: var(--st-leading-normal);
    color: var(--st-text);
    background-color: var(--st-bg);
    margin: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    line-height: var(--st-leading-tight);
    font-weight: var(--st-weight-semibold);
    color: var(--st-text);
    margin-top: 0;
    margin-bottom: var(--st-space-3);
}

h1 {
    font-size: var(--st-text-2xl);
    letter-spacing: var(--st-tracking-tight);
}

h2 {
    font-size: var(--st-text-xl);
    letter-spacing: var(--st-tracking-tight);
}

h3 {
    font-size: var(--st-text-lg);
    font-weight: var(--st-weight-medium);
}

h4 {
    font-size: var(--st-text-md);
    font-weight: var(--st-weight-medium);
}

p {
    margin-top: 0;
    margin-bottom: var(--st-space-3);
    color: var(--st-text-secondary);
}

a {
    color: var(--st-accent);
    text-decoration: none;
    transition: color var(--st-transition-fast);
}

a:hover {
    color: var(--st-accent-hover);
}

hr {
    border: none;
    border-top: 1px solid var(--st-divider);
    margin: var(--st-space-5) 0;
}

/* ── Focus ──────────────────────────────── */

:focus-visible {
    outline: 2px solid var(--st-accent);
    outline-offset: 2px;
}

/* ── Buttons ────────────────────────────── */

.btn {
    font-family: var(--st-font);
    font-size: var(--st-text-md);
    font-weight: var(--st-weight-medium);
    min-height: 52px;
    padding: 0.75rem 1.5rem;
    border-radius: var(--st-radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all var(--st-transition-fast);
    text-decoration: none;
    line-height: 1.4;
}

.btn:active:not(:disabled) {
    transform: scale(0.98);
}

.btn-primary,
.btn-primary:focus-visible {
    background-color: var(--st-accent);
    border-color: var(--st-accent);
    color: var(--st-text-inverse);
    box-shadow: var(--st-shadow-sm);
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--st-accent-hover);
    border-color: var(--st-accent-hover);
    color: var(--st-text-inverse);
    box-shadow: var(--st-shadow-md);
}

.btn-secondary,
.btn-outline-secondary,
.btn-secondary:focus-visible {
    background-color: var(--st-surface);
    border-color: var(--st-border);
    color: var(--st-text);
}

.btn-secondary:hover:not(:disabled),
.btn-outline-secondary:hover:not(:disabled) {
    background-color: var(--st-surface-hover);
    border-color: var(--st-text-disabled);
    color: var(--st-text);
}

.btn-danger,
.btn-danger:focus-visible {
    background-color: var(--st-surface);
    border-color: var(--st-border);
    color: var(--st-error);
}

.btn-danger:hover:not(:disabled) {
    background-color: var(--st-error-light);
    border-color: var(--st-error);
    color: var(--st-error);
}

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--st-text-secondary);
}

.btn-ghost:hover:not(:disabled) {
    background-color: var(--st-surface-hover);
    color: var(--st-text);
}

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

.btn-sm {
    min-height: 40px;
    font-size: var(--st-text-base);
    padding: 0.5rem 1rem;
}

.btn-lg {
    min-height: var(--st-touch-target-lg);
    font-size: var(--st-text-lg);
    padding: 1rem 2rem;
}

/* ── Form Controls ──────────────────────── */

.form-control,
.form-select {
    font-family: var(--st-font);
    font-size: var(--st-text-md);
    min-height: var(--st-touch-target);
    padding: 0.625rem 1rem;
    border: 1px solid var(--st-border);
    border-radius: var(--st-radius-sm);
    background-color: var(--st-surface);
    color: var(--st-text);
    transition: border-color var(--st-transition-fast), box-shadow var(--st-transition-fast);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--st-accent);
    box-shadow: 0 0 0 3px var(--st-accent-subtle);
    outline: none;
}

.form-control::placeholder {
    color: var(--st-text-disabled);
}

/* ── Cards ──────────────────────────────── */

.card {
    background: var(--st-surface);
    border: none;
    border-radius: var(--st-radius-lg);
    box-shadow: var(--st-shadow-sm);
    padding: var(--st-space-4);
}

.card-interactive {
    transition: box-shadow var(--st-transition-fast), background-color var(--st-transition-fast);
    cursor: pointer;
}

.card-interactive:hover {
    box-shadow: var(--st-shadow-md);
    background: var(--st-surface-hover);
}

/* ── Badges ─────────────────────────────── */

.badge {
    font-family: var(--st-font);
    font-weight: var(--st-weight-medium);
    font-size: var(--st-text-sm);
    padding: 0.25rem 0.75rem;
    border-radius: var(--st-radius-full);
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}


/* ── Action Buttons (Stop / Continue) ──── */

.btn-action-circle {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0;
    flex-shrink: 0;
    color: white;
    transition: opacity var(--st-transition-fast);
}

/* 44px invisible tap area for touch devices */
.btn-action-circle::after {
    content: "";
    position: absolute;
    inset: -8px;
    border-radius: 50%;
}

.btn-action-stop {
    background-color: var(--st-error);
}

.btn-action-continue {
    background-color: var(--st-accent);
}

.btn-action-circle:hover {
    opacity: 0.85;
}

.btn-action-circle:disabled {
    opacity: 0.5;
    cursor: default;
}

/* ── Timer Bar ─────────────────────────── */

.timer-bar {
    background-color: var(--st-accent);
    color: var(--st-text-inverse);
    padding: 0 var(--st-space-4);
}

.timer-bar-content {
    display: flex;
    align-items: center;
    gap: var(--st-space-3);
    min-height: 48px;
    max-width: var(--st-max-content);
}

.timer-bar-label {
    flex: 1;
    font-size: var(--st-text-base);
    font-weight: var(--st-weight-medium);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.timer-bar-customer {
    opacity: 0.75;
    font-weight: var(--st-weight-regular);
}

.timer-bar-time {
    font-size: var(--st-text-lg);
    font-weight: var(--st-weight-semibold);
}

.timer-bar .btn-sm {
    min-height: 32px;
    padding: 0.25rem 0.75rem;
    font-size: var(--st-text-sm);
}

/* Stacked timer bars (2 timers) */
.timer-bar-stacked {
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.timer-bar-stacked:first-child {
    border-top: none;
}

.timer-bar-stacked .timer-bar-content {
    min-height: 40px;
}

/* Collapsed timer bar (3+ timers) */
.timer-bar-collapsed {
    cursor: pointer;
}

.timer-bar-collapsed:hover {
    background-color: color-mix(in srgb, var(--st-accent) 90%, black);
}

.timer-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--st-text-inverse);
    color: var(--st-accent);
    font-weight: var(--st-weight-bold);
    font-size: var(--st-text-sm);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    margin-right: var(--st-space-1);
}

/* Timer dropdown (3+ timers expanded) */
.timer-dropdown {
    background-color: var(--st-surface);
    border-bottom: 1px solid var(--st-border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.timer-dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--st-space-3);
    padding: var(--st-space-2) var(--st-space-4);
    border-bottom: 1px solid var(--st-border);
    max-width: var(--st-max-content);
}

.timer-dropdown-item:last-child {
    border-bottom: none;
}

.timer-dropdown-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: var(--st-space-3);
    min-width: 0;
}

.timer-dropdown-label {
    flex: 1;
    font-size: var(--st-text-sm);
    font-weight: var(--st-weight-medium);
    color: var(--st-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.timer-dropdown-time {
    font-size: var(--st-text-sm);
    font-weight: var(--st-weight-semibold);
    color: var(--st-accent);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

@media (max-width: 768px) {
    .timer-bar {
        position: sticky;
        top: 0;
        z-index: 100;
    }

    .timer-bar-label {
        font-size: var(--st-text-sm);
    }

    .timer-bar-time {
        font-size: var(--st-text-base);
    }

    .timer-dropdown {
        position: sticky;
        top: 40px;
        z-index: 99;
    }
}

/* ── Modal / Dialog ────────────────────── */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--st-space-3);
    animation: st-fade-in 150ms ease-out;
}

.modal-content {
    background: var(--st-surface);
    border: none; /* override Bootstrap's default border */
    border-radius: var(--st-radius-xl);
    box-shadow: var(--st-shadow-lg);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    animation: st-scale-in 150ms ease-out;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--st-space-4) var(--st-space-4) 0;
    border-bottom: none; /* override Bootstrap's border-bottom */
}

.modal-header .modal-title {
    margin: 0;
    font-size: var(--st-text-xl);
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--st-text-secondary);
    font-size: 1.25rem;
    padding: var(--st-space-1);
    border-radius: var(--st-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    min-height: 36px;
    transition: all var(--st-transition-fast);
}

.modal-close:hover {
    background-color: var(--st-surface-hover);
    color: var(--st-text);
}

.modal-body {
    padding: var(--st-space-4);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--st-space-2);
    padding: 0 var(--st-space-4) var(--st-space-4);
}

@keyframes st-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@media (max-width: 768px) {
    .modal-backdrop {
        align-items: flex-end;
        padding: 0;
    }

    .modal-content {
        max-width: 100%;
        max-height: 95vh;
        border-radius: var(--st-radius-xl) var(--st-radius-xl) 0 0;
        animation: st-slide-up 200ms ease-out;
    }
}

@keyframes st-slide-up {
    from { opacity: 0; transform: translateY(100%); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Toast ─────────────────────────────── */

.toast-container {
    position: fixed;
    top: var(--st-space-4);
    right: var(--st-space-4);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: var(--st-space-2);
    pointer-events: none;
}

.toast {
    background: var(--st-text);
    color: var(--st-text-inverse);
    padding: var(--st-space-3) var(--st-space-4);
    border-radius: var(--st-radius-md);
    box-shadow: var(--st-shadow-lg);
    font-size: var(--st-text-base);
    font-weight: var(--st-weight-medium);
    display: flex;
    align-items: center;
    gap: var(--st-space-2);
    pointer-events: auto;
    animation: st-toast-in 200ms ease-out;
    max-width: 400px;
}

.toast-success {
    background: var(--st-success);
}

.toast-error {
    background: var(--st-error);
}

.toast-dismiss {
    background: none;
    border: none;
    color: inherit;
    opacity: 0.7;
    cursor: pointer;
    padding: var(--st-space-1);
    margin-left: auto;
    font-size: 1rem;
}

.toast-dismiss:hover {
    opacity: 1;
}

@keyframes st-toast-in {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}

@media (max-width: 768px) {
    .toast-container {
        top: auto;
        bottom: calc(80px + env(safe-area-inset-bottom));
        right: var(--st-space-3);
        left: var(--st-space-3);
    }

    .toast {
        max-width: 100%;
    }
}

/* ── Result Slider ─────────────────────── */

.result-slider-wrap {
    padding: 0 var(--st-space-2) var(--st-space-3);
}

.result-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: var(--st-border);
    border-radius: var(--st-radius-full);
    outline: none;
    cursor: pointer;
}

.result-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 28px;
    height: 28px;
    background: var(--st-accent);
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    cursor: grab;
}

.result-slider::-moz-range-thumb {
    width: 28px;
    height: 28px;
    background: var(--st-accent);
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    cursor: grab;
}

.result-slider:active::-webkit-slider-thumb {
    cursor: grabbing;
    transform: scale(1.15);
}

.result-slider:active::-moz-range-thumb {
    cursor: grabbing;
    transform: scale(1.15);
}

.result-slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: var(--st-text-sm);
    color: var(--st-text-disabled);
    margin-top: var(--st-space-1);
}

/* ── Time Range Slider (noUiSlider) ──── */

.time-range-slider {
    position: relative;
    padding: var(--st-space-3) var(--st-space-4);
    margin-bottom: var(--st-space-3);
}

.trs-labels {
    display: flex;
    justify-content: space-between;
    font-size: var(--st-text-xs);
    color: var(--st-text-disabled);
    margin-bottom: var(--st-space-2);
}

/* ── Track ── */
.trs-nouislider.noUi-target {
    background: var(--st-divider);
    border: none;
    border-radius: var(--st-radius-full);
    box-shadow: none;
    height: 4px;
}

/* ── Connect bar (fill between handles) ── */
.trs-nouislider .noUi-connect {
    background: var(--st-accent);
    border-radius: 4px;
    transition: background 0.15s ease;
}

/* ── Handles (thumbs) ── */
.trs-nouislider .noUi-handle {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--st-surface);
    border: 2.5px solid var(--st-accent);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    cursor: grab;
    top: -10px;
    right: -11px;
    transition: box-shadow 0.15s ease, transform 0.15s ease, background 0.15s ease;
}

/* Remove noUiSlider default handle decoration lines */
.trs-nouislider .noUi-handle::before,
.trs-nouislider .noUi-handle::after {
    display: none;
}

/* ── Hover state ── */
.trs-nouislider .noUi-handle:hover {
    box-shadow: 0 0 0 4px rgba(43, 87, 151, 0.08), 0 1px 3px rgba(0, 0, 0, 0.15);
}

/* ── Active / dragging state ── */
.trs-nouislider .noUi-active {
    cursor: grabbing;
    transform: scale(1.2);
    box-shadow: 0 0 0 6px rgba(43, 87, 151, 0.12), 0 2px 4px rgba(0, 0, 0, 0.15);
    background: var(--st-accent);
    border-color: var(--st-accent);
}

/* ── Tooltips ── */
.trs-nouislider .noUi-tooltip {
    background: var(--st-accent);
    color: #fff;
    border: none;
    border-radius: var(--st-radius-sm);
    font-size: var(--st-text-xs);
    font-variant-numeric: tabular-nums;
    padding: 2px 8px;
    line-height: 1.4;
    display: none;
}

.trs-nouislider .noUi-active .noUi-tooltip,
.trs-nouislider .noUi-handle:hover .noUi-tooltip {
    display: block;
}

/* ── Touch-friendly: extend hit area ── */
.trs-nouislider .noUi-touch-area {
    width: 44px;
    height: 44px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* ── Drag cursor on connect bar ── */
.trs-nouislider .noUi-draggable {
    cursor: grab;
}

.trs-nouislider .noUi-state-drag .noUi-draggable {
    cursor: grabbing;
}

/* ── Disabled state ── */
.trs-nouislider.noUi-target[disabled] {
    opacity: 0.5;
}

.trs-nouislider[disabled] .noUi-handle {
    cursor: not-allowed;
}

.trs-nouislider[disabled] .noUi-connect {
    background: var(--st-text-disabled);
}

/* ── Template collapsible ─────────────── */

.template-collapsible {
    margin-top: var(--st-space-2);
    border: 1px solid var(--st-border);
    border-radius: var(--st-radius);
    overflow: hidden;
}

.template-toggle {
    display: flex;
    align-items: center;
    gap: var(--st-space-2);
    width: 100%;
    padding: var(--st-space-2) var(--st-space-3);
    background: var(--st-bg);
    border: none;
    cursor: pointer;
    font-size: var(--st-text-sm);
    color: var(--st-text-secondary);
    font-weight: var(--st-weight-medium);
    transition: background 0.15s;
}

.template-toggle:hover {
    background: var(--st-bg-hover, rgba(0,0,0,0.03));
}

.template-list {
    max-height: 300px;
    overflow-y: auto;
    border-top: 1px solid var(--st-border);
}

.template-group-header {
    padding: var(--st-space-2) var(--st-space-3);
    font-size: var(--st-text-xs);
    font-weight: var(--st-weight-semibold);
    color: var(--st-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: var(--st-bg);
    border-top: 1px solid var(--st-border);
    position: sticky;
    top: 0;
    z-index: 1;
}

.template-list .list-row:first-child .template-group-header {
    border-top: none;
}

.template-group-header:first-child {
    border-top: none;
}

/* ── Utilities ──────────────────────────── */

.text-tabular {
    font-variant-numeric: tabular-nums;
}

.text-secondary {
    color: var(--st-text-secondary) !important;
}

.text-accent {
    color: var(--st-accent) !important;
}

.text-success {
    color: var(--st-success) !important;
}

.text-warning {
    color: var(--st-warning) !important;
}

.text-error {
    color: var(--st-error) !important;
}

.bg-surface {
    background-color: var(--st-surface) !important;
}

.max-w-form {
    max-width: var(--st-max-form);
}

.max-w-content {
    max-width: var(--st-max-content);
}

/* ── Attachment Section ──────────────── */

.file-drop-zone {
    border: 2px dashed var(--st-border);
    border-radius: var(--st-radius-md);
    padding: var(--st-space-4);
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.file-drop-zone:hover,
.file-drop-zone.drag-over {
    border-color: var(--st-accent);
    background: rgba(43, 87, 151, 0.04);
}

.attachment-item {
    display: flex;
    align-items: center;
    gap: var(--st-space-2);
    padding: var(--st-space-2) 0;
}

.attachment-item + .attachment-item {
    border-top: 1px solid var(--st-divider);
}

/* ── Address Row ───────────────────────── */

.address-row {
    display: flex;
    gap: var(--st-space-2);
}

.address-postal { width: 30%; }
.address-city { flex: 1; }
.address-country { width: 30%; }

/* ── Invoice Line Items ────────────────── */

.line-items-header {
    display: flex;
    gap: var(--st-space-2);
    align-items: center;
    padding: var(--st-space-2) 0;
    border-bottom: 2px solid var(--st-border);
    font-size: var(--st-text-sm);
    font-weight: var(--st-weight-semibold);
    color: var(--st-text-secondary);
}

.line-item-row {
    display: flex;
    gap: var(--st-space-2);
    align-items: flex-start;
    padding: var(--st-space-2) 0;
    border-bottom: 1px solid var(--st-divider);
}

.line-col-desc { flex: 3; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.line-col-qty { flex: 0.7; text-align: right; }
.line-col-unit { flex: 0.5; text-align: center; }
.line-col-rate { flex: 0.8; text-align: right; }
.line-col-vat { flex: 0.5; text-align: right; }
.line-col-total { flex: 1; text-align: right; }
.line-col-delete { width: 32px; }

/* ── Week View ─────────────────────────── */

.week-grid {
    display: grid;
    grid-template-columns: 1fr repeat(5, 60px) 60px;
    gap: var(--st-space-1);
    align-items: center;
}

/* ── Mobile Week Day Cards ───────────── */

.week-day-card {
    border-bottom: 1px solid var(--st-divider);
}

.week-day-card:last-child {
    border-bottom: none;
}

.week-day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--st-space-3) var(--st-space-4);
    cursor: pointer;
    transition: background var(--st-transition-fast);
    -webkit-tap-highlight-color: transparent;
}

.week-day-header:active {
    background: var(--st-surface-hover);
}

.week-day-name {
    font-weight: var(--st-weight-medium);
    font-size: var(--st-text-sm);
    color: var(--st-text);
}

.week-day-date {
    font-size: var(--st-text-xs);
    color: var(--st-text-secondary);
    margin-left: var(--st-space-1);
}

.week-day-total {
    font-weight: var(--st-weight-semibold);
    font-size: var(--st-text-sm);
    color: var(--st-accent);
    font-variant-numeric: tabular-nums;
}

.week-day-total.empty {
    color: var(--st-text-disabled);
    font-weight: var(--st-weight-regular);
}

.week-day-details {
    padding: 0 var(--st-space-4) var(--st-space-3);
}

.week-day-entry {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: var(--st-space-1) 0;
    font-size: var(--st-text-sm);
}

.week-day-entry-label {
    color: var(--st-text-secondary);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    margin-right: var(--st-space-2);
}

.week-day-entry-hours {
    font-variant-numeric: tabular-nums;
    font-weight: var(--st-weight-medium);
    color: var(--st-text);
    flex-shrink: 0;
}

.week-total-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--st-space-3) var(--st-space-4);
    background: var(--st-bg);
    font-weight: var(--st-weight-semibold);
    font-size: var(--st-text-sm);
    border-top: 2px solid var(--st-border);
}

.week-total-bar span:last-child {
    color: var(--st-accent);
    font-variant-numeric: tabular-nums;
}

/* ── Mobile Overrides ──────────────────── */

@media (max-width: 768px) {


    /* Address: postal+city on row 1, country full-width row 2 */
    .address-row {
        flex-wrap: wrap;
    }

    .address-postal {
        width: 35%;
    }

    .address-city {
        flex: 1 1 60%;
    }

    .address-country {
        width: 100%;
    }

    /* Line items: stacked card layout */
    .line-items-header {
        display: none;
    }

    .line-item-row {
        flex-wrap: wrap;
        padding: var(--st-space-3) 0;
        position: relative;
        padding-right: 36px;
    }

    .line-col-desc {
        flex: 1 1 100%;
    }

    .line-col-qty,
    .line-col-unit,
    .line-col-rate {
        flex: 1 1 calc(33.3% - var(--st-space-2));
        text-align: left;
    }

    .line-col-vat {
        flex: 1 1 calc(50% - var(--st-space-2));
        text-align: left;
    }

    .line-col-total {
        flex: 1 1 calc(50% - var(--st-space-2));
        text-align: right;
        font-weight: var(--st-weight-semibold);
    }

    .line-col-delete {
        position: absolute;
        right: 0;
        top: var(--st-space-3);
    }

    /* Week view desktop grid: hidden on mobile (replaced by day cards) */
    .week-grid-wrapper {
        display: none;
    }

}
