/* =========================================================
   Atlassian Design System tokens (Light + Dark)
   ========================================================= */
:root,
[data-theme="light"] {
    /* Surfaces — 3-step elevation for cards on columns on canvas */
    --ds-surface-default: #FFFFFF;            /* page/topbar */
    --ds-surface-sunken: #F7F8F9;             /* app canvas behind columns */
    --ds-surface-column: #F1F2F4;             /* columns — slightly darker than canvas */
    --ds-surface: #FFFFFF;                    /* cards */
    --ds-surface-raised: #FFFFFF;
    --ds-surface-overlay: #FFFFFF;
    --ds-surface-hovered: #F1F2F4;
    --ds-surface-pressed: #DCDFE4;

    --ds-background-neutral: #DCDFE4;
    --ds-background-neutral-hovered: #B3B9C4;
    --ds-background-neutral-subtle: transparent;
    --ds-background-neutral-subtle-hovered: rgba(9, 30, 66, 0.06);

    /* Text */
    --ds-text: #172B4D;
    --ds-text-subtle: #44546F;
    --ds-text-subtlest: #626F86;
    --ds-text-disabled: #8590A2;
    --ds-text-inverse: #FFFFFF;

    /* Brand — Atlassian blue */
    --ds-background-brand-bold: #0C66E4;
    --ds-background-brand-bold-hovered: #0055CC;
    --ds-background-brand-bold-pressed: #09326C;
    --ds-text-brand: #0C66E4;
    --ds-border-brand: #0C66E4;

    /* Semantic backgrounds (subtle) + text (saturated) */
    --ds-text-success: #216E4E;
    --ds-background-success: #DCFFF1;
    --ds-text-warning: #A54800;
    --ds-background-warning: #FFF7D6;
    --ds-text-danger: #AE2A19;
    --ds-background-danger: #FFEDEB;
    --ds-text-information: #0055CC;
    --ds-background-information: #E9F2FF;

    /* Borders — 1px thin for a corporate/tight feel */
    --ds-border: #DCDFE4;
    --ds-border-strong: #C1C7D0;
    --ds-border-bold: #A0A8B4;
    --ds-border-input: #DCDFE4;               /* 1px resting border for fields */
    --ds-border-input-hover: #C1C7D0;
    --ds-border-focused: #0C66E4;             /* focus ring color (brand blue) */
    --ds-focus-ring: rgba(12, 102, 228, 0.2); /* outer glow on focus */
    --ds-border-danger:  #AE2A19;
    --ds-border-disabled: rgba(9, 30, 66, 0.06);

    /* Form field backgrounds — consistent white, no ADS inversion */
    --ds-field-bg-idle:   #FFFFFF;
    --ds-field-bg-hover:  #FAFBFC;
    --ds-field-bg-focus:  #FFFFFF;
    --ds-field-bg-disabled: #F4F5F7;
    --ds-text-accent-red: #AE2A19;

    /* Shadows — disabled by design choice (flat surfaces) */
    --ds-shadow-raised: none;
    --ds-shadow-overflow: none;
    --ds-shadow-overlay: none;

    /* Issue type icons — SOLID colored squares, white glyph (Jira @atlaskit/icon-object) */
    --issue-task-solid:    #1868DB;
    --issue-story-solid:   #22A06B;
    --issue-bug-solid:     #C9372C;
    --issue-epic-solid:    #8270DB;
    --issue-chore-solid:   #626F86;
    --issue-feature-solid: #22A06B;

    /* Priority icons — colored arrows (no fill) */
    --prio-critical: #CA3521;
    --prio-high:     #E34935;
    --prio-medium:   #E56910;
    --prio-low:      #2898BD;
}

[data-theme="dark"] {
    /* Surfaces — Jira dark theme 3-step elevation */
    --ds-surface-default: #1D2125;
    --ds-surface-sunken: #161A1D;
    --ds-surface-column: #282E33;             /* columns sit visibly above canvas */
    --ds-surface: #22272B;                    /* cards */
    --ds-surface-raised: #22272B;
    --ds-surface-overlay: #2C333A;
    --ds-surface-hovered: #2C333A;
    --ds-surface-pressed: #454F59;

    --ds-background-neutral: #454F59;
    --ds-background-neutral-hovered: #596773;
    --ds-background-neutral-subtle: transparent;
    --ds-background-neutral-subtle-hovered: rgba(166, 197, 226, 0.08);

    --ds-text: #B6C2CF;
    --ds-text-subtle: #9FADBC;
    --ds-text-subtlest: #8C9BAB;
    --ds-text-disabled: #5D6B7A;
    --ds-text-inverse: #1D2125;

    --ds-background-brand-bold: #579DFF;
    --ds-background-brand-bold-hovered: #85B8FF;
    --ds-background-brand-bold-pressed: #CCE0FF;
    --ds-text-brand: #579DFF;
    --ds-border-brand: #579DFF;

    --ds-text-success: #7EE2B8;
    --ds-background-success: #164B35;
    --ds-text-warning: #F5CD47;
    --ds-background-warning: #533F04;
    --ds-text-danger: #FD9891;
    --ds-background-danger: #5D1F1A;
    --ds-text-information: #85B8FF;
    --ds-background-information: #09326C;

    --ds-border: #343B42;
    --ds-border-strong: #454F59;
    --ds-border-bold: #596773;
    --ds-border-input: #454F59;
    --ds-border-input-hover: #596773;
    --ds-border-focused: #579DFF;
    --ds-focus-ring: rgba(87, 157, 255, 0.25);
    --ds-border-danger:  #FD9891;
    --ds-border-disabled: rgba(166, 197, 226, 0.06);

    --ds-field-bg-idle:   #22272B;
    --ds-field-bg-hover:  #2C333A;
    --ds-field-bg-focus:  #22272B;
    --ds-field-bg-disabled: #1D2125;
    --ds-text-accent-red: #FD9891;

    --ds-shadow-raised: none;
    --ds-shadow-overflow: none;
    --ds-shadow-overlay: none;

    --issue-task-solid:    #388BFF;
    --issue-story-solid:   #4BCE97;
    --issue-bug-solid:     #F87168;
    --issue-epic-solid:    #B8ACF6;
    --issue-chore-solid:   #9FADBC;
    --issue-feature-solid: #4BCE97;

    --prio-critical: #F87168;
    --prio-high:     #F87168;
    --prio-medium:   #FEA362;
    --prio-low:      #6CC3E0;
}

/* =========================================================
   Base
   ========================================================= */
* { box-sizing: border-box; }
html, body {
    margin: 0; padding: 0;
    font: 400 14px/20px "Inter", "Atlassian Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    font-feature-settings: "cv11", "ss01", "ss03";   /* Inter → looks closer to Atlassian Sans */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: var(--ds-surface-sunken);
    color: var(--ds-text);
    letter-spacing: -0.003em;
}

code, pre, .mono, input.mono {
    font-family: "JetBrains Mono", "Atlassian Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-feature-settings: normal;
}

[data-theme="dark"] body { background: var(--ds-surface-default); }
a { color: var(--ds-text-brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; border: 0; font: inherit; background: none; color: inherit; }
hr { border: 0; border-top: 1px solid var(--ds-border); margin: 16px 0; }

/* Icon base — <i data-lucide="..."> gets replaced by an <svg class="icon"> */
.icon, [data-lucide] {
    width: 16px; height: 16px; stroke-width: 1.5;
    vertical-align: -2px; flex-shrink: 0; color: currentColor;
}
.icon--sm { width: 12px; height: 12px; }
.icon--md { width: 20px; height: 20px; }
.icon--lg { width: 24px; height: 24px; }

/* =========================================================
   Topbar
   ========================================================= */
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    height: 56px; padding: 0 20px;
    background: var(--ds-surface-default);
    border-bottom: 1px solid var(--ds-border);
    position: sticky; top: 0; z-index: 10;
}
.brand a {
    display: inline-flex; align-items: center; gap: 8px;
    font-weight: 600; font-size: 15px; color: var(--ds-text);
    letter-spacing: -0.005em;
}
.brand .brand-mark {
    width: 24px; height: 24px; border-radius: 4px;
    background: var(--ds-background-brand-bold); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
}
.brand .brand-logo {
    width: 28px; height: 28px; object-fit: contain; margin-top: -3px;
}

.nav-links { display: flex; gap: 2px; }
.nav-links a {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 10px; border-radius: 3px;
    color: var(--ds-text-subtle); font-weight: 500; font-size: 13px;
    transition: background-color 100ms ease, color 100ms ease;
}
.nav-links a:hover { color: var(--ds-text); background: var(--ds-surface-hovered); text-decoration: none; }
.nav-links a.active { color: var(--ds-text-brand); background: var(--ds-background-information); }

.user-box { display: flex; gap: 8px; align-items: center; }
#userName {
    color: var(--ds-text-subtle); font-size: 13px; font-weight: 500;
}

/* Icon button — clickable wrapper for icons */
.icon-button {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 3px;
    color: var(--ds-text-subtle);
    transition: background-color 100ms ease, color 100ms ease;
}
.icon-button:hover { background: var(--ds-surface-hovered); color: var(--ds-text); }
.icon-button:active { background: var(--ds-surface-pressed); }

/* Theme switcher segmented control */
.theme-toggle {
    display: inline-flex; align-items: center;
    background: var(--ds-surface-sunken);
    border: 1px solid var(--ds-border); border-radius: 3px;
    padding: 2px;
}
.theme-toggle button {
    width: 26px; height: 26px; border-radius: 3px;
    color: var(--ds-text-subtle);
    display: inline-flex; align-items: center; justify-content: center;
    transition: background-color 100ms ease, color 100ms ease;
}
.theme-toggle button:hover { color: var(--ds-text); }
.theme-toggle button.active {
    background: var(--ds-surface); color: var(--ds-text);
    box-shadow: var(--ds-shadow-raised);
}

/* =========================================================
   Layout
   ========================================================= */
.main { padding: 20px 16px; max-width: 1600px; margin: 0 auto; }

/* =========================================================
   Buttons
   ========================================================= */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 32px; padding: 0 12px; border-radius: 3px;
    font-size: 13px; font-weight: 500; line-height: 1;
    white-space: nowrap; letter-spacing: 0;
    border: 1px solid transparent;
    transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease, box-shadow 120ms ease;
}
.btn-primary {
    background: var(--ds-background-brand-bold); color: #fff;
    border-color: var(--ds-background-brand-bold);
}
.btn-primary:hover {
    background: var(--ds-background-brand-bold-hovered);
    border-color: var(--ds-background-brand-bold-hovered);
}
.btn-primary:active { background: var(--ds-background-brand-bold-pressed); }

.btn-secondary {
    background: var(--ds-surface); color: var(--ds-text);
    border-color: var(--ds-border-strong);
}
.btn-secondary:hover { background: var(--ds-surface-hovered); border-color: var(--ds-border-bold); }
.btn-secondary:active { background: var(--ds-surface-pressed); }

.btn-ghost {
    background: transparent; color: var(--ds-text);
}
.btn-ghost:hover { background: var(--ds-background-neutral-subtle-hovered); }
.btn-ghost:active { background: var(--ds-surface-pressed); }

.btn-danger {
    background: transparent; color: var(--ds-text-danger);
}
.btn-danger:hover { background: var(--ds-background-danger); }

.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ds-focus-ring); }
.btn:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }

/* =========================================================
   Auth page
   ========================================================= */
.auth-body {
    display: flex; align-items: center; justify-content: center; min-height: 100vh;
    background: var(--ds-surface-sunken);
}
.auth-card {
    width: 400px; background: var(--ds-surface);
    padding: 32px; border-radius: 4px;
    box-shadow: var(--ds-shadow-overflow);
    border: 1px solid var(--ds-border);
}
.auth-card h1 {
    margin: 0 0 4px; font-size: 20px; font-weight: 500; color: var(--ds-text);
    letter-spacing: -0.005em;
}
.muted { color: var(--ds-text-subtle); }
.small { font-size: 12px; line-height: 16px; }
.error { color: var(--ds-text-danger); min-height: 1em; margin-top: 8px; font-size: 12px; }

/* =========================================================
   Forms — Atlaskit textfield / select / textarea
   ========================================================= */
.form { display: flex; flex-direction: column; gap: 16px; }
.form > label { display: flex; flex-direction: column; gap: 4px; }

/* Label text: 12px / 600, subtle color, NOT uppercase. 4px to the control. */
.form label, .form-label {
    font-size: 12px; line-height: 16px; font-weight: 600;
    color: var(--ds-text-subtle);
}
/* Red asterisk helper — wrap label text in .label-text.is-required to show it */
.label-text.is-required::after {
    content: ' *'; color: var(--ds-text-accent-red); font-weight: 700;
}

/* Helper and error text below the input (margin-top 4px) */
.form .helper, .form .error-text {
    font-size: 12px; line-height: 16px; font-weight: 400;
    color: var(--ds-text-subtle); margin-top: 4px;
}
.form .error-text { color: var(--ds-text-accent-red); }

/* Core control styling — corporate 1px borders, subtle focus ring */
.form input, .form select, .form textarea,
select, input[type="text"], input[type="search"], input[type="email"],
input[type="password"], input[type="number"], input[type="date"], input[type="url"], textarea {
    height: 32px; min-height: 32px; padding: 0 10px;
    background: var(--ds-field-bg-idle);
    color: var(--ds-text);
    border: 1px solid var(--ds-border-input);
    border-radius: 3px;
    font: 400 13px/20px inherit;
    transition: border-color 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
    width: 100%;
}
.form textarea, textarea {
    height: auto; min-height: 80px;
    padding: 8px 10px; line-height: 20px; resize: vertical;
}

input::placeholder, textarea::placeholder { color: var(--ds-text-subtlest); }

/* Hover: darker border, no background change */
.form input:hover, .form select:hover, .form textarea:hover,
select:hover, input[type="text"]:hover, input[type="search"]:hover,
input[type="email"]:hover, input[type="password"]:hover, input[type="number"]:hover,
input[type="date"]:hover, input[type="url"]:hover, textarea:hover {
    border-color: var(--ds-border-input-hover);
}

/* Focus: border turns brand blue + 3px soft glow ring */
.form input:focus, .form select:focus, .form textarea:focus,
select:focus, input[type="text"]:focus, input[type="search"]:focus,
input[type="email"]:focus, input[type="password"]:focus, input[type="number"]:focus,
input[type="date"]:focus, input[type="url"]:focus, textarea:focus {
    outline: none;
    border-color: var(--ds-border-focused);
    box-shadow: 0 0 0 3px var(--ds-focus-ring);
    background: var(--ds-field-bg-focus);
}

/* Invalid state: red border + red ring on focus */
.form input.is-invalid, .form select.is-invalid, .form textarea.is-invalid,
input.is-invalid, select.is-invalid, textarea.is-invalid,
input:user-invalid, select:user-invalid, textarea:user-invalid {
    border-color: var(--ds-border-danger);
}
input.is-invalid:focus, input:user-invalid:focus,
textarea.is-invalid:focus, textarea:user-invalid:focus,
select.is-invalid:focus, select:user-invalid:focus {
    box-shadow: 0 0 0 3px rgba(174, 42, 25, 0.15);
}

.form input:disabled, select:disabled, textarea:disabled {
    background: var(--ds-field-bg-disabled);
    border-color: var(--ds-border);
    color: var(--ds-text-disabled);
    cursor: not-allowed;
}

/* Native select caret: keep a visible chevron using inline SVG. */
select {
    appearance: none; -webkit-appearance: none;
    padding-right: 30px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23626F86' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
    cursor: pointer;
}
[data-theme="dark"] select {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238C9BAB' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>");
}

/* Color input — match 32px control height */
input[type="color"] {
    height: 32px; width: 42px; padding: 2px; cursor: pointer;
    border: 1px solid var(--ds-border-input); border-radius: 3px;
    background: var(--ds-field-bg-idle);
    transition: border-color 120ms ease;
}
input[type="color"]:hover { border-color: var(--ds-border-input-hover); }
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: none; border-radius: 2px; }

/* File input — match button aesthetics */
input[type="file"] {
    font-size: 13px; color: var(--ds-text-subtle);
    padding: 4px 0; border: 0; background: transparent; min-height: auto; height: auto;
}
input[type="file"]:focus, input[type="file"]:hover { box-shadow: none; border: 0; background: transparent; }
input[type="file"]::file-selector-button {
    height: 28px; padding: 0 12px; margin-right: 8px;
    background: var(--ds-surface); color: var(--ds-text);
    border: 1px solid var(--ds-border-strong); border-radius: 3px;
    font: 500 13px/1 inherit; cursor: pointer;
    transition: background-color 120ms ease, border-color 120ms ease;
}
input[type="file"]::file-selector-button:hover { background: var(--ds-surface-hovered); border-color: var(--ds-border-bold); }

/* Range — slim track, blue accent */
input[type="range"] {
    accent-color: var(--ds-background-brand-bold);
    height: 20px; padding: 0; border: 0; background: transparent;
}

/* Checkbox — tight 1px corporate look */
input[type="checkbox"] {
    appearance: none; -webkit-appearance: none;
    width: 16px; height: 16px; min-height: 16px; margin: 0;
    border: 1px solid var(--ds-border-input-hover); border-radius: 2px;
    background: var(--ds-field-bg-idle);
    cursor: pointer; flex-shrink: 0; padding: 0;
    position: relative;
    transition: background-color 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}
input[type="checkbox"]:hover { border-color: var(--ds-border-bold); }
input[type="checkbox"]:checked {
    background: var(--ds-background-brand-bold);
    border-color: var(--ds-background-brand-bold);
}
input[type="checkbox"]:checked::after {
    content: '';
    position: absolute; left: 4px; top: 0;
    width: 4px; height: 8px;
    border: solid #fff; border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
input[type="checkbox"]:focus-visible {
    box-shadow: 0 0 0 3px var(--ds-focus-ring);
}

/* A label that wraps a checkbox + its text (horizontal, 8px gap) */
.form label.inline,
.form .checkbox-row {
    flex-direction: row; align-items: center; gap: 8px;
    font-size: 14px; font-weight: 400; color: var(--ds-text);
}

/* Input with leading icon (eg. search field) */
.input-with-icon {
    position: relative; display: inline-flex; align-items: center; width: 100%;
}
.input-with-icon .leading-icon {
    position: absolute; left: 8px; top: 50%; transform: translateY(-50%);
    color: var(--ds-text-subtlest); pointer-events: none;
    display: inline-flex; align-items: center;
}
.input-with-icon input { padding-left: 32px; }

/* Search input — built-in leading icon via background image */
input[type="search"] {
    padding-left: 32px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23626F86' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><path d='m20 20-3.5-3.5'/></svg>");
    background-repeat: no-repeat;
    background-position: left 8px center;
    background-color: var(--ds-field-bg-idle);
}
[data-theme="dark"] input[type="search"] {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238C9BAB' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><path d='m20 20-3.5-3.5'/></svg>");
}

.hidden { display: none !important; }

/* =========================================================
   Board — toolbar + kanban
   ========================================================= */
.board-toolbar {
    display: flex; align-items: center;
    gap: 8px; margin-bottom: 16px; flex-wrap: wrap;
    padding: 10px 12px;
    background: var(--ds-surface);
    border: 1px solid var(--ds-border);
    border-radius: 3px;
    box-shadow: var(--ds-shadow-raised);
}
.board-toolbar__group {
    display: inline-flex; align-items: center; gap: 6px;
}
.board-toolbar__project { flex-shrink: 0; }
.board-toolbar__project .jselect { min-width: 200px; max-width: 280px; }
.board-toolbar__label {
    font-size: 11px; font-weight: 700; color: var(--ds-text-subtle);
    text-transform: uppercase; letter-spacing: 0;
    white-space: nowrap; padding-right: 2px;
}
.board-toolbar__search {
    flex: 0 1 300px; min-width: 180px;
}
.board-toolbar__search input[type="search"] { width: 100%; }
.board-toolbar__prio { min-width: 160px; }
.board-toolbar__right { margin-left: auto; }
.board-toolbar select, .board-toolbar input[type="search"] {
    height: 32px; min-height: 32px; font-size: 13px;
}
.board-toolbar #projectSelect { min-width: 200px; max-width: 320px; }

.board-toolbar__divider {
    width: 1px; height: 24px; background: var(--ds-border-strong);
    margin: 0 4px;
}

/* Icon-only button — square 32x32 */
.btn.btn-icon-only {
    width: 32px; padding: 0; justify-content: center;
}
.btn.btn-icon-only [data-lucide] { width: 16px; height: 16px; }

@media (max-width: 820px) {
    .board-toolbar { flex-wrap: wrap; gap: 6px; }
    .board-toolbar__divider { display: none; }

    /* El grupo de proyecto ocupa toda la fila y envuelve internamente */
    .board-toolbar__project {
        flex: 1 1 100%;
        flex-wrap: wrap;
        min-width: 0;
        order: 1;
    }
    /* El jselect llena el espacio disponible en la primera sub-fila */
    .board-toolbar__project .jselect {
        flex: 1 1 auto;
        min-width: 140px;
        max-width: none;
    }
    /* Los botones empujan a la siguiente sub-fila porque el jselect ya llenó la anterior */
    #editProjectBtn { flex-basis: auto; }
    #newProjectBtn  { flex: 1; }

    /* Buscador full width */
    .board-toolbar__search {
        flex: 1 1 100%;
        min-width: 0;
        order: 3;
    }

    .board-toolbar__right { order: 4; }
    #newTicketBtn          { order: 4; }
}

/* Kanban scroll wrapper — fade hint + wheel conversion */
.kanban-wrap {
    position: relative;
}
.kanban-wrap::after {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 48px; height: 100%;
    background: linear-gradient(to right, transparent, var(--ds-surface-sunken));
    pointer-events: none;
    border-radius: 0 3px 3px 0;
    opacity: 1;
    transition: opacity 200ms;
}
.kanban-wrap.is-scrolled-end::after { opacity: 0; }

.kanban {
    display: grid;
    grid-template-columns: repeat(5, 280px);
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 12px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;

    /* Thin, themed scrollbar */
    scrollbar-width: thin;
    scrollbar-color: var(--ds-border-strong) transparent;
}
.kanban::-webkit-scrollbar { height: 5px; }
.kanban::-webkit-scrollbar-track { background: transparent; }
.kanban::-webkit-scrollbar-thumb {
    background: var(--ds-border-strong);
    border-radius: 99px;
}
.kanban::-webkit-scrollbar-thumb:hover { background: var(--ds-border-bold); }

/* Column: a step darker than the canvas so cards pop */
.column {
    display: flex; flex-direction: column;
    background: var(--ds-surface-column);
    border-radius: 3px;
    min-height: 300px;
}
.column-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 12px;
    color: var(--ds-text-subtle);
    position: sticky; top: 0; z-index: 1;
    background: var(--ds-surface-column);
    border-radius: 3px 3px 0 0;
}
.column-title {
    margin: 0;
    font-family: inherit;
    font-size: 11px !important;
    font-weight: 700 !important;
    line-height: 14px;
    text-transform: uppercase;
    letter-spacing: 0;
    color: var(--ds-text-subtle);
}
.count {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 20px; height: 18px; padding: 0 6px;
    background: var(--ds-background-neutral);
    color: var(--ds-text-subtle);
    border-radius: 9999px;
    font-size: 11px; font-weight: 600;
}
.column-body {
    padding: 4px 8px 8px; flex: 1;
    display: flex; flex-direction: column; gap: 8px;
}

/* Card — subtle hover: slight bg tint + shadow lift + border tint */
.card {
    display: flex; flex-direction: column; gap: 8px;
    padding: 10px 12px;
    background: var(--ds-surface);
    border: 1px solid var(--ds-border);
    border-radius: 3px;
    box-shadow: var(--ds-shadow-raised);
    cursor: pointer;
    transition: background-color 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}
.card:hover {
    background: var(--ds-surface-hovered);
    box-shadow: var(--ds-shadow-overflow);
    border-color: var(--ds-border-strong);
}
.card:focus-visible { outline: 2px solid var(--ds-border-focused); outline-offset: 2px; }
.card.sortable-ghost { opacity: .4; }
.card.sortable-chosen { box-shadow: var(--ds-shadow-overlay); }

.card .key {
    color: var(--ds-text-subtlest); font-weight: 600; font-size: 12px;
    line-height: 16px; letter-spacing: 0;
}
.card .title {
    margin: 0; font-size: 14px; line-height: 20px; font-weight: 500;
    color: var(--ds-text);
}
.card .desc {
    margin: 0; font-size: 12px; line-height: 16px; color: var(--ds-text-subtle);
    max-height: 2em; overflow: hidden; text-overflow: ellipsis;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}

/* Progress — slim bar */
.progress-row { display: flex; align-items: center; gap: 8px; }
.progress-bar {
    flex: 1; height: 4px; background: var(--ds-background-neutral);
    border-radius: 9999px; overflow: hidden;
}
.progress-fill { height: 100%; background: var(--ds-background-brand-bold); transition: width .3s ease; }
.progress-label {
    font: 400 11px/16px inherit; color: var(--ds-text-subtlest); min-width: 3em; text-align: right;
}

/* Done column — summary card instead of full list */
.column.is-done-column .column-body { padding: 8px; gap: 8px; }
.done-summary {
    display: flex; flex-direction: column; gap: 12px;
    padding: 16px 14px;
    background: var(--ds-surface);
    border: 1px solid var(--ds-border);
    border-radius: 3px;
    box-shadow: var(--ds-shadow-raised);
}
.done-summary__top {
    display: flex; align-items: center; gap: 12px;
}
.done-summary__icon {
    width: 36px; height: 36px; border-radius: 9999px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--ds-background-success); color: var(--ds-text-success);
}
.done-summary__icon [data-lucide] { width: 20px; height: 20px; stroke-width: 1.75; }
.done-summary__count { font: 600 22px/24px inherit; color: var(--ds-text); letter-spacing: -0.01em; }
.done-summary__label { font-size: 12px; color: var(--ds-text-subtle); margin-top: 2px; }

.done-summary__recent {
    display: flex; flex-direction: column; gap: 2px;
    border-top: 1px solid var(--ds-border-strong); padding-top: 12px;
}
.done-summary__recent-label {
    font-size: 11px !important; font-weight: 700 !important;
    text-transform: uppercase; letter-spacing: 0;
    color: var(--ds-text-subtlest); margin-bottom: 4px;
    line-height: 14px;
}
.done-summary__row {
    display: flex; gap: 8px; align-items: center;
    padding: 4px 6px; border-radius: 3px; cursor: pointer;
    font-size: 12px; transition: background-color 100ms ease;
}
.done-summary__row:hover { background: var(--ds-surface-hovered); }
.done-summary__row .key {
    color: var(--ds-text-subtlest); font-weight: 600; flex-shrink: 0;
    font-family: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
    font-size: 11px;
}
.done-summary__row .title {
    color: var(--ds-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.done-summary__view {
    justify-content: center; width: 100%; border: 1px solid var(--ds-border-strong);
}
.key-mono {
    font-family: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
    font-size: 12px; font-weight: 600; color: var(--ds-text-subtle);
}

/* Card footer: issue-type icon + key on left, priority + avatar on right */
.card footer {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px; font-size: 12px;
}
.card .card-left { display: flex; align-items: center; gap: 6px; min-width: 0; }
.card .card-right { display: flex; align-items: center; gap: 6px; }
/* Issue type: SOLID colored square, WHITE glyph — Jira pattern */
.card .issue-type {
    display: inline-flex; align-items: center; justify-content: center;
    width: 16px; height: 16px; border-radius: 3px;
    background: var(--issue-task-solid); color: #fff;
}
.card .issue-type [data-lucide], .card .issue-type svg { width: 12px; height: 12px; stroke-width: 2; }
.card .issue-type.type-task    { background: var(--issue-task-solid); }
.card .issue-type.type-story   { background: var(--issue-story-solid); }
.card .issue-type.type-bug     { background: var(--issue-bug-solid); }
.card .issue-type.type-epic    { background: var(--issue-epic-solid); }
.card .issue-type.type-chore   { background: var(--issue-chore-solid); }
.card .issue-type.type-feature { background: var(--issue-feature-solid); }

.card .priority-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 16px; height: 16px;
}
.card .priority-icon.prio-low      { color: var(--prio-low); }
.card .priority-icon.prio-medium   { color: var(--prio-medium); }
.card .priority-icon.prio-high     { color: var(--prio-high); }
.card .priority-icon.prio-critical { color: var(--prio-critical); }

/* Labels/tags on top of card — Jira "lozenge" */
.card .labels { display: flex; flex-wrap: wrap; gap: 4px; }
.card .tag {
    display: inline-flex !important; align-items: center; gap: 3px;
    padding: 1px 5px !important; border-radius: 3px;
    font-size: 10px !important;
    line-height: 14px !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.04em;
    background: var(--ds-background-neutral); color: var(--ds-text-subtle);
}
.card .tag [data-lucide] { width: 10px !important; height: 10px !important; stroke-width: 2.25; }
.card .tag.tag-branch {
    background: var(--ds-background-information); color: var(--ds-text-information);
    font-family: "JetBrains Mono", "Atlassian Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    text-transform: none; letter-spacing: 0; font-weight: 700;
    max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card .tag.tag-difficulty.trivial { background: var(--ds-background-success); color: var(--ds-text-success); }
.card .tag.tag-difficulty.easy    { background: var(--ds-background-information); color: var(--ds-text-information); }
.card .tag.tag-difficulty.medium  { background: var(--ds-background-neutral); color: var(--ds-text-subtle); }
.card .tag.tag-difficulty.hard    { background: var(--ds-background-warning); color: var(--ds-text-warning); }
.card .tag.tag-difficulty.expert  { background: var(--ds-background-danger); color: var(--ds-text-danger); }
.card .tag.tag-module {
    background: color-mix(in srgb, var(--module-color, #6366f1) 12%, transparent);
    border: 1px solid; font-weight: 600;
    display: inline-flex; align-items: center; gap: 4px;
}
.module-dot {
    display: inline-block; width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
}
.assignee-filter .module-chip .module-dot {
    width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
    background: var(--module-color, #6366f1);
    opacity: 0.85;
    margin-right: 5px;
}
/* Modules section inside project modal */
.modules-section { margin-top: 4px; }
.modules-section__header {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px;
}
.modules-list { min-height: 20px; }
.module-item:last-child { border-bottom: none !important; }

.card .points {
    font-size: 11px; font-weight: 600; color: var(--ds-text-subtlest);
}

/* =========================================================
   Modal
   ========================================================= */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(9, 30, 66, 0.54);
    display: flex; align-items: center; justify-content: center; z-index: 50;
    padding: 16px;
}
.modal {
    width: min(640px, 100%); max-height: 90vh; overflow: auto;
    background: var(--ds-surface-overlay);
    border-radius: 4px;
    border: 1px solid var(--ds-border);
    box-shadow: var(--ds-shadow-overlay);
    padding: 24px;
}
.modal h2 {
    margin: 0 0 16px; font: 500 20px/24px inherit; color: var(--ds-text);
    letter-spacing: -0.005em;
}
.modal h3 { margin: 16px 0 8px; font: 600 14px/16px inherit; color: var(--ds-text); }
.modal .row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal .actions {
    display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px;
    padding-top: 16px; border-top: 1px solid var(--ds-border);
}

/* =========================================================
   Ticket detail — Jira-style two-column view w/ inline edit
   ========================================================= */
.modal.modal--ticket {
    width: min(960px, 100%); padding: 0; overflow: hidden;
    display: flex; flex-direction: column; max-height: 92vh;
}
.ticket-detail { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.ticket-detail__header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 20px; border-bottom: 1px solid var(--ds-border);
    gap: 12px;
}
.ticket-detail__breadcrumb {
    display: flex; align-items: center; gap: 8px;
    font-size: 12px; color: var(--ds-text-subtle); font-weight: 600;
}
.ticket-detail__breadcrumb .issue-type {
    display: inline-flex; align-items: center; justify-content: center;
    width: 16px; height: 16px; border-radius: 3px; color: #fff;
}
.ticket-detail__breadcrumb .issue-type [data-lucide] { width: 12px; height: 12px; stroke-width: 2; }
.ticket-detail__body {
    display: grid; grid-template-columns: minmax(0, 1fr) 360px;
    gap: 24px; padding: 20px 24px 24px;
    overflow: auto; flex: 1; min-height: 0;
}
.ticket-detail__main  { min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.ticket-detail__sidebar {
    display: flex; flex-direction: column;
    background: var(--ds-surface-sunken);
    border: 1px solid var(--ds-border);
    border-radius: 3px;
    padding: 12px;
    align-self: start;
}

/* Title */
.ticket-detail__title {
    margin: 0; font-size: 22px; line-height: 28px; font-weight: 500;
    color: var(--ds-text); letter-spacing: -0.01em;
}

/* Section */
.ticket-detail__section { display: flex; flex-direction: column; gap: 8px; }
.ticket-detail__section-label {
    font-size: 11px !important; font-weight: 700 !important;
    color: var(--ds-text-subtle);
    text-transform: uppercase; letter-spacing: 0;
    line-height: 14px;
}
.ticket-detail__description {
    font-size: 14px; line-height: 20px; color: var(--ds-text);
    white-space: pre-wrap; word-break: break-word;
    min-height: 32px; padding: 6px 8px;
    border-radius: 3px;
}
.ticket-detail__description:empty::before {
    content: "Agregá una descripción…"; color: var(--ds-text-subtlest);
}

/* Sidebar rows */
.detail-row {
    display: grid; grid-template-columns: 130px minmax(0, 1fr);
    gap: 10px; align-items: center;
    padding: 6px 4px;
    min-height: 36px;
}
.detail-label {
    font-size: 12px; font-weight: 600; color: var(--ds-text-subtle);
    letter-spacing: 0;
}
.detail-value {
    font-size: 13px; color: var(--ds-text); min-width: 0;
    padding: 4px 6px; border-radius: 3px; min-height: 24px;
    display: flex; align-items: center; gap: 6px;
}
.detail-value .value-empty { color: var(--ds-text-subtlest); font-style: italic; }
.detail-value .assignee-pill {
    display: inline-flex; align-items: center; gap: 6px; min-width: 0;
}
.detail-value .assignee-pill .name {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Inline edit — quiet, Linear/Notion-style; blur/Enter commits, Esc cancels */
.is-editable {
    cursor: pointer;
    position: relative;
    transition: background-color 120ms ease, box-shadow 120ms ease;
}
.is-editable:hover:not(.editing) {
    background: var(--ds-surface-hovered);
    box-shadow: inset 0 0 0 1px var(--ds-border);
}
.is-editable.editing {
    background: transparent;
    box-shadow: none;
    cursor: auto;
    padding: 0 !important;
}

.inline-edit-wrap {
    display: flex; width: 100%;
}
.inline-edit-wrap input,
.inline-edit-wrap select,
.inline-edit-wrap textarea {
    width: 100%;
    margin: 0;
    font-size: 13px;
}
.inline-edit-wrap textarea {
    min-height: 96px; line-height: 20px;
    font-size: 14px;
}

/* Title field uses larger text */
.ticket-detail__title.is-editable.editing .inline-edit-wrap input {
    font-size: 22px; line-height: 28px; font-weight: 500; height: 36px;
    padding: 4px 10px;
}

/* Stage badge in sidebar */
.stage-badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px; border-radius: 3px;
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--ds-background-neutral); color: var(--ds-text-subtle);
}
.stage-badge.stage-backlog       { background: var(--ds-background-neutral);     color: var(--ds-text-subtle); }
.stage-badge.stage-todo          { background: var(--ds-background-information); color: var(--ds-text-information); }
.stage-badge.stage-in_progress   { background: var(--ds-background-information); color: var(--ds-text-information); }
.stage-badge.stage-merge_request { background: var(--ds-background-warning);     color: var(--ds-text-warning); }
.stage-badge.stage-production    { background: var(--ds-background-success);     color: var(--ds-text-success); }

/* Progress mini-bar in sidebar */
.detail-progress { display: flex; align-items: center; gap: 8px; width: 100%; }
.detail-progress__bar {
    flex: 1; height: 4px; background: var(--ds-background-neutral);
    border-radius: 9999px; overflow: hidden;
}
.detail-progress__fill { height: 100%; background: var(--ds-background-brand-bold); }
.detail-progress__label { font-size: 12px; color: var(--ds-text-subtlest); min-width: 3em; text-align: right; }

/* Comments / activity */
.comment-list { display: flex; flex-direction: column; gap: 10px; }
.comment {
    display: flex; gap: 10px;
    padding: 10px 12px;
    background: var(--ds-surface-sunken);
    border: 1px solid var(--ds-border);
    border-radius: 3px;
}
.comment__meta {
    display: flex; align-items: baseline; gap: 8px;
    font-size: 12px; margin-bottom: 4px;
}
.comment__meta .name { color: var(--ds-text); font-weight: 600; }
.comment__meta .time { color: var(--ds-text-subtlest); }
.comment__body { font-size: 14px; line-height: 20px; color: var(--ds-text); white-space: pre-wrap; word-break: break-word; }

@media (max-width: 760px) {
    .modal.modal--ticket { max-height: 100dvh; border-radius: 0; width: 100%; }

    .ticket-detail__header { padding: 10px 14px; }
    .ticket-detail__breadcrumb { font-size: 11px; }

    .ticket-detail__body {
        grid-template-columns: 1fr;
        gap: 16px;
        padding: 14px 14px 20px;
    }

    .ticket-detail__title { font-size: 17px; line-height: 22px; }

    /* Sidebar: flat, sin fondo separado, separador superior */
    .ticket-detail__sidebar {
        background: none;
        border: none;
        border-top: 1px solid var(--ds-border);
        border-radius: 0;
        padding: 12px 0 0;
    }

    /* Campos sidebar: label encima del valor en pantallas muy pequeñas */
    .detail-row {
        grid-template-columns: 1fr;
        gap: 2px;
        padding: 8px 0;
        min-height: unset;
        border-bottom: 1px solid var(--ds-border);
    }
    .detail-row:last-child { border-bottom: none; }
    .detail-label { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; }
    .detail-value  { padding: 2px 0; font-size: 14px; }

    /* Secciones más compactas */
    .ticket-detail__section { gap: 6px; }
    .ticket-detail__main    { gap: 14px; }

    /* Subtarea input más alto para touch */
    .subtask-add input { min-height: 38px; font-size: 14px; }

    /* Comentario textarea más compacto */
    #commentForm textarea { min-height: 60px; font-size: 14px; }

    /* Botón comentar full width */
    #commentForm div { justify-content: stretch; }
    #commentForm .btn { width: 100%; justify-content: center; }
}

/* =========================================================
   Flatpickr — Jira/corporate theme
   ========================================================= */
.flatpickr-calendar {
    background: var(--ds-surface-overlay);
    border: 1px solid var(--ds-border-strong);
    border-radius: 4px;
    box-shadow: var(--ds-shadow-overlay);
    font: 400 13px/20px "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--ds-text);
    width: 320px;
    padding: 8px;
}
.flatpickr-calendar.arrowTop::before,
.flatpickr-calendar.arrowTop::after,
.flatpickr-calendar.arrowBottom::before,
.flatpickr-calendar.arrowBottom::after { display: none; }

.flatpickr-months {
    display: flex; align-items: center; justify-content: space-between;
    padding: 4px 2px 10px; margin: 0;
}
.flatpickr-months .flatpickr-month {
    color: var(--ds-text); background: transparent;
    height: auto; line-height: 1; overflow: visible;
}
.flatpickr-current-month {
    font-size: 14px; font-weight: 600; color: var(--ds-text);
    padding: 0;
    position: static;
    display: inline-flex; align-items: center; gap: 6px;
    width: auto; left: auto;
}
.flatpickr-current-month .flatpickr-monthDropdown-months {
    background: transparent; color: var(--ds-text); font-weight: 600;
    font-size: 14px; border: 0; padding: 2px 4px; height: 24px; min-height: 0;
    border-radius: 3px; appearance: none;
}
.flatpickr-current-month .flatpickr-monthDropdown-months:hover { background: var(--ds-surface-hovered); }
.flatpickr-current-month .cur-month {
    font-weight: 600; font-size: 14px; color: var(--ds-text);
    padding: 2px 2px; cursor: default;
}
.flatpickr-current-month input.cur-year {
    color: var(--ds-text); font-weight: 600; font-size: 14px;
    background: transparent; border: 0; padding: 0; margin: 0 0 0 4px;
    height: 24px;
}
.flatpickr-current-month .numInputWrapper:hover { background: var(--ds-surface-hovered); border-radius: 3px; }
.flatpickr-current-month .numInputWrapper span.arrowUp,
.flatpickr-current-month .numInputWrapper span.arrowDown { border: 0; }
.flatpickr-current-month .numInputWrapper span.arrowUp::after { border-bottom-color: var(--ds-text-subtle); }
.flatpickr-current-month .numInputWrapper span.arrowDown::after { border-top-color: var(--ds-text-subtle); }

.flatpickr-prev-month, .flatpickr-next-month {
    position: static; padding: 4px; height: 28px; width: 28px;
    color: var(--ds-text-subtle); border-radius: 3px;
    display: inline-flex; align-items: center; justify-content: center;
    fill: var(--ds-text-subtle);
}
.flatpickr-prev-month:hover, .flatpickr-next-month:hover {
    background: var(--ds-surface-hovered); color: var(--ds-text);
    fill: var(--ds-text);
}
.flatpickr-prev-month svg, .flatpickr-next-month svg { width: 14px; height: 14px; }

.flatpickr-weekdays {
    background: transparent; height: auto; padding: 4px 0;
}
.flatpickr-weekday {
    background: transparent !important; color: var(--ds-text-subtle) !important;
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.04em;
}

.flatpickr-days { width: 100%; border: 0; }
.dayContainer {
    width: 100%; min-width: 0; max-width: none;
    padding: 2px 0; gap: 0;
}

.flatpickr-day {
    background: transparent; border: 1px solid transparent; color: var(--ds-text);
    border-radius: 3px; font-size: 13px; font-weight: 400;
    max-width: none; height: 34px; line-height: 34px; flex-basis: 14.285%;
    margin: 1px 0;
}
.flatpickr-day:hover { background: var(--ds-surface-hovered); border-color: transparent; }
.flatpickr-day.today {
    border-color: var(--ds-border-focused); font-weight: 600; color: var(--ds-text-brand);
}
.flatpickr-day.today:hover { background: var(--ds-surface-hovered); }
.flatpickr-day.selected, .flatpickr-day.selected:hover,
.flatpickr-day.startRange, .flatpickr-day.endRange {
    background: var(--ds-background-brand-bold) !important;
    border-color: var(--ds-background-brand-bold);
    color: #fff;
}
.flatpickr-day.prevMonthDay, .flatpickr-day.nextMonthDay,
.flatpickr-day.flatpickr-disabled {
    color: var(--ds-text-disabled);
}

/* =========================================================
   Toasts
   ========================================================= */
#toastRoot {
    position: fixed; bottom: 16px; right: 16px;
    display: flex; flex-direction: column; gap: 8px; z-index: 100;
}
.toast {
    background: var(--ds-surface-overlay); color: var(--ds-text);
    padding: 10px 14px; border-radius: 3px;
    border: 1px solid var(--ds-border);
    border-left: 3px solid var(--ds-background-brand-bold);
    box-shadow: var(--ds-shadow-overlay);
    font-size: 13px; min-width: 220px;
}
.toast.error   { border-left-color: var(--ds-text-danger); }
.toast.success { border-left-color: var(--ds-text-success); }

/* =========================================================
   Metrics & data tables
   ========================================================= */
/* =========================================================
   Users — card layout (mobile)
   ========================================================= */
.user-cards { display: none; flex-direction: column; gap: 8px; }

.user-card {
    display: flex; align-items: center; gap: 12px;
    background: var(--ds-surface);
    border: 1px solid var(--ds-border);
    border-radius: 6px;
    padding: 12px;
}
.user-card__avatar {
    width: 44px; height: 44px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px; font-weight: 800; color: #fff;
    flex-shrink: 0; overflow: hidden;
}
.user-card__avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-card__info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.user-card__name { font-weight: 700; font-size: 14px; color: var(--ds-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-card__meta { font-size: 12px; color: var(--ds-text-subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-card__badges { display: flex; gap: 4px; margin-top: 4px; flex-wrap: wrap; }
.user-card__actions { display: flex; gap: 4px; flex-shrink: 0; }

.users-table-wrap {
    display: block;
    background: var(--ds-surface);
    border: 1px solid var(--ds-border);
    border-radius: 3px;
    padding: .75rem;
}

@media (max-width: 640px) {
    .users-table-wrap { display: none; }
    .user-cards       { display: flex; }
}

/* Metrics selects */
.metrics-sel-project .jselect { min-width: 220px; }
.metrics-sel-user .jselect    { min-width: 180px; }

/* KPI row */
.kpi-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 12px;
}
.kpi-card {
    background: var(--ds-surface);
    border: 1px solid var(--ds-border);
    border-radius: 3px;
    padding: 18px 20px;
    display: flex; flex-direction: column; gap: 2px;
}
.kpi-label {
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    color: var(--ds-text-subtle); letter-spacing: .04em;
}
.kpi-value {
    font-size: 32px; font-weight: 700; line-height: 1.1;
    color: var(--ds-text);
}
.kpi-value--success { color: var(--ds-text-success); }
.kpi-value--info    { color: #2684FF; }
.kpi-sub { font-size: 11px; color: var(--ds-text-subtlest); }

/* Podio tokens */
:root {
    --podio-gold-bg:    #fef9c3; --podio-gold-fg:    #713f12; --podio-gold-bar:    #eab308;
    --podio-silver-bg:  #f1f5f9; --podio-silver-fg:  #334155; --podio-silver-bar:  #94a3b8;
    --podio-bronze-bg:  #fff7ed; --podio-bronze-fg:  #7c2d12; --podio-bronze-bar:  #f97316;
}
[data-theme="dark"] {
    --podio-gold-bg:    #422006; --podio-gold-fg:    #fde68a; --podio-gold-bar:    #ca8a04;
    --podio-silver-bg:  #1e293b; --podio-silver-fg:  #cbd5e1; --podio-silver-bar:  #64748b;
    --podio-bronze-bg:  #431407; --podio-bronze-fg:  #fed7aa; --podio-bronze-bar:  #ea580c;
}

.podio-card { margin-bottom: 12px; }

.podio-stage {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 8px;
    padding: 24px 16px 0;
}

.podio-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    max-width: 200px;
}

.podio-player {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    background: var(--player-bg); color: var(--player-fg);
    border-radius: 8px 8px 0 0;
    padding: 12px 10px 10px;
    width: 100%;
}

.podio-medal { font-size: 22px; line-height: 1; }

.podio-avatar {
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; color: #fff;
    flex-shrink: 0;
}

.podio-avatar-img {
    width: 140px; height: 140px;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,.25));
}

.podio-name {
    font-weight: 700; text-align: center; line-height: 1.2;
    word-break: break-word;
}

.podio-stats {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    opacity: .85;
}
.podio-stat { text-align: center; }

.podio-bar {
    width: 100%;
    border-radius: 0;
    display: flex; align-items: center; justify-content: center;
}
.podio-pos {
    font-size: 28px; font-weight: 800; color: rgba(255,255,255,.55);
    line-height: 1;
}

/* Rest of ranking */
.podio-rest {
    border-top: 1px solid var(--ds-border);
    margin-top: 16px;
    padding-top: 12px;
    display: flex; flex-direction: column; gap: 4px;
}
.podio-rest-row {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 8px;
    border-radius: 4px;
}
.podio-rest-row:hover { background: var(--ds-surface-hovered); }
.podio-rest-pos {
    font-size: 12px; font-weight: 700; color: var(--ds-text-subtle);
    min-width: 18px; text-align: right;
}
.podio-rest-avatar {
    width: 30px; height: 30px; border-radius: 50%;
    background: var(--ds-background-neutral);
    color: var(--ds-text-subtle);
    font-size: 11px; font-weight: 800;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.podio-rest-name  { flex: 1; font-size: 13px; font-weight: 600; color: var(--ds-text); }
.podio-rest-stat  { font-size: 12px; color: var(--ds-text-subtle); }

/* Metrics grids */
.metrics-grid { display: grid; gap: 12px; margin-bottom: 12px; }
.metrics-grid--3 { grid-template-columns: repeat(3, 1fr); }
.metrics-grid--1 { grid-template-columns: 1fr; }

.metric-card {
    background: var(--ds-surface);
    border: 1px solid var(--ds-border);
    border-radius: 3px;
    padding: 16px;
    display: flex; flex-direction: column; gap: 8px;
}
.metric-card__title {
    margin: 0;
    font-size: 12px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .04em; color: var(--ds-text-subtle);
}
.metric-card__sub {
    font-weight: 400; text-transform: none; letter-spacing: 0;
    color: var(--ds-text-subtlest);
}
.chart-wrap { position: relative; width: 100%; }
.chart-wrap canvas { max-height: 260px; }
.chart-wrap--tall canvas { max-height: 180px; }

@media (max-width: 900px) {
    .kpi-row          { grid-template-columns: repeat(2, 1fr); }
    .metrics-grid--3  { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    .kpi-row          { grid-template-columns: 1fr; }
    .metrics-grid--3  { grid-template-columns: 1fr; }
}

/* Attention page */
.attn-summary-row {
    display: grid;
    grid-template-columns: repeat(3, auto) 1fr;
    gap: 12px;
    align-items: stretch;
    margin-bottom: 12px;
}
.attn-stat {
    background: var(--ds-surface);
    border: 1px solid var(--ds-border);
    border-radius: 3px;
    padding: 16px 24px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    min-width: 110px;
}
.attn-stat__label { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--ds-text-subtle); }
.attn-stat__value { font-size: 28px; font-weight: 700; line-height: 1; color: var(--ds-text); }
.attn-stat--warning .attn-stat__value  { color: var(--ds-text-warning); }
.attn-stat--critical .attn-stat__value { color: var(--ds-text-danger); }
.attn-thresholds { min-height: unset !important; gap: 6px !important; }
.attn-sel-project .jselect { min-width: 260px; }
.attn-sel-assignee .jselect { min-width: 220px; }
.attn-thresholds__title { margin: 0; font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--ds-text-subtle); }

@media (max-width: 820px) {
    /* Atención y métricas — toolbar wraps */
    .attn-sel-project .jselect,
    .attn-sel-assignee .jselect,
    .metrics-sel-project .jselect,
    .metrics-sel-user .jselect { min-width: 0; width: 100%; }

    /* Atención — stats row: 3 stats arriba, thresholds abajo */
    .attn-summary-row {
        grid-template-columns: repeat(3, 1fr);
    }
    .attn-thresholds { grid-column: span 3; }

    /* Métricas — toolbar selects */
    .metrics-sel-project .jselect,
    .metrics-sel-user .jselect { min-width: 0; flex: 1; }

    /* KPI: 2 columnas en tablet */
    .kpi-row { grid-template-columns: repeat(2, 1fr); }

    /* Podio: columnas más estrechas */
    .podio-slot { max-width: 140px; }
    .podio-avatar-img { width: 100px; height: 100px; }
}

@media (max-width: 600px) {
    /* Stats de atención: 1 columna */
    .attn-summary-row { grid-template-columns: 1fr 1fr; }
    .attn-thresholds  { grid-column: span 2; }

    /* KPI: 1 columna */
    .kpi-row { grid-template-columns: repeat(2, 1fr); }

    /* Podio: comprimido */
    .podio-stage { gap: 4px; padding: 12px 4px 0; }
    .podio-slot  { max-width: 110px; }
    .podio-avatar-img { width: 80px; height: 80px; }
    .podio-name  { font-size: 11px !important; }
    .podio-stats { display: none; }
    .podio-rest-stat { display: none; }
}


.totals { display: flex; gap: 12px; flex-wrap: wrap; }
.totals .cell {
    background: var(--ds-surface-sunken);
    padding: 12px;
    border-radius: 3px; border: 1px solid var(--ds-border);
    display: flex; flex-direction: column; gap: 2px; min-width: 110px;
}
.totals .cell .label {
    color: var(--ds-text-subtle);
    font-size: 11px !important; font-weight: 700 !important;
    text-transform: uppercase; letter-spacing: 0;
    line-height: 14px;
}
.totals .cell .value { color: var(--ds-text); font-size: 20px; font-weight: 600; }

.table-scroll-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--ds-border-strong) transparent;
}
.table-scroll-wrap::-webkit-scrollbar { height: 5px; }
.table-scroll-wrap::-webkit-scrollbar-thumb { background: var(--ds-border-strong); border-radius: 99px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 600px; }
.data-table th, .data-table td {
    padding: 8px 10px; border-bottom: 1px solid var(--ds-border); text-align: left;
}
.data-table th {
    color: var(--ds-text-subtle);
    font-weight: 700 !important; font-size: 11px !important;
    text-transform: uppercase; letter-spacing: 0;
    line-height: 14px;
}
.data-table tbody tr:hover td { background: var(--ds-surface-hovered); }

/* =========================================================
   Badges (lozenges)
   ========================================================= */
.badge {
    display: inline-flex; align-items: center; padding: 2px 6px;
    border-radius: 3px; font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.04em;
    background: var(--ds-background-neutral); color: var(--ds-text-subtle);
}
.badge.role-superadmin { background: var(--issue-epic-bg); color: var(--issue-epic-fg); }
.badge.role-admin      { background: var(--ds-background-danger); color: var(--ds-text-danger); }
.badge.role-user       { background: var(--ds-background-success); color: var(--ds-text-success); }

.badge.severity-warning  { background: var(--ds-background-warning); color: var(--ds-text-warning); }
.badge.severity-critical { background: var(--ds-background-danger); color: var(--ds-text-danger); }

.badge.priority-low      { background: var(--ds-background-success); color: var(--ds-text-success); }
.badge.priority-medium   { background: var(--ds-background-information); color: var(--ds-text-information); }
.badge.priority-high     { background: var(--ds-background-warning); color: var(--ds-text-warning); }
.badge.priority-critical { background: var(--ds-background-danger); color: var(--ds-text-danger); }

.nav-badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 18px; height: 18px; padding: 0 6px;
    background: var(--ds-text-warning); color: #fff;
    border-radius: 9999px; font-size: 11px; font-weight: 600;
}
.nav-badge.critical { background: var(--ds-text-danger); }

/* =========================================================
   Avatars
   ========================================================= */
.avatar {
    display: inline-flex; align-items: center; justify-content: center;
    width: 24px; height: 24px; border-radius: 9999px;
    color: #fff; font-size: 10px; font-weight: 600;
    background: var(--ds-background-brand-bold);
    overflow: hidden; flex-shrink: 0;
    border: 1px solid transparent; box-sizing: border-box;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.xs { width: 22px; height: 22px; font-size: 9px; }
.avatar.sm { width: 20px; height: 20px; font-size: 9px; }
.avatar.md { width: 44px; height: 44px; font-size: 15px; }
.avatar.lg { width: 72px; height: 72px; font-size: 22px; }

.card .assignee-avatar {
    display: inline-flex; align-items: center; gap: 0;
}

/* Avatar chip filter row */
.assignee-filter {
    display: flex; align-items: center; gap: 6px;
    flex-wrap: wrap; padding: 8px 0 12px;
}
.assignee-filter .chip {
    display: inline-flex; align-items: center; gap: 0;
    padding: 2px; border-radius: 9999px;
    border: 2px solid transparent;
    background: transparent;
    transition: border-color 160ms var(--motion-enter),
                background-color 160ms var(--motion-enter),
                gap 200ms var(--motion-enter);
}
.assignee-filter .chip:hover { background: var(--ds-surface-hovered); }
.assignee-filter .chip.active {
    border-color: var(--ds-border-focused);
    gap: 4px;
}
/* Name slides out from behind the avatar when the chip activates. */
.assignee-filter .chip .name-hint {
    display: inline-block;
    font-size: 12px; font-weight: 600; color: var(--ds-text);
    max-width: 0;
    padding-left: 0; padding-right: 0;
    opacity: 0;
    overflow: hidden;
    white-space: nowrap;
    transform: translateX(-4px);
    transition: max-width 240ms var(--motion-enter),
                opacity   180ms var(--motion-enter),
                padding   240ms var(--motion-enter),
                transform 240ms var(--motion-enter);
}
.assignee-filter .chip.active .name-hint {
    max-width: 160px;
    padding: 0 8px 0 2px;
    opacity: 1;
    transform: translateX(0);
}
.assignee-filter .chip-all {
    padding: 4px 10px; border-radius: 3px;
    color: var(--ds-text-subtle); background: var(--ds-surface);
    border: 1px solid var(--ds-border); font-size: 12px; font-weight: 600;
}
.assignee-filter .chip-all:hover { background: var(--ds-surface-hovered); }
.assignee-filter .chip-all.active {
    background: var(--ds-background-information);
    color: var(--ds-text-information);
    border: 1px solid transparent;
    gap: 0;
}
.jselect.module-filter-jselect {
    width: auto; min-width: 200px;
}

/* Assignee picker — grid of clickable avatars, replaces the select */
.assignee-picker {
    border: 1px solid var(--ds-border);
    border-radius: 3px;
    background: var(--ds-surface);
    padding: 8px;
}
.assignee-picker__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
    gap: 4px;
    max-height: 200px; overflow-y: auto;
}
.assignee-option {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 8px; border-radius: 3px;
    background: transparent; border: 1px solid transparent;
    cursor: pointer; text-align: left;
    transition: background-color 120ms ease, border-color 120ms ease;
}
.assignee-option:hover { background: var(--ds-surface-hovered); }
.assignee-option.is-selected {
    background: var(--ds-background-information);
    border-color: var(--ds-border-focused);
}
.assignee-option.is-selected .assignee-option__name { color: var(--ds-text-information); font-weight: 600; }
.assignee-option__name {
    font-size: 12px; color: var(--ds-text);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    flex: 1; min-width: 0;
}
.assignee-option .avatar { width: 28px; height: 28px; font-size: 11px; }

/* Profile avatar picker */
/* Profile modal header */
.profile-modal-header {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 16px; padding-bottom: 16px;
    border-bottom: 1px solid var(--ds-border);
}
.profile-modal-icon {
    width: 40px; height: 40px; border-radius: 8px; flex-shrink: 0;
    background: var(--ds-background-information);
    color: var(--ds-text-information);
    display: flex; align-items: center; justify-content: center;
}

/* Avatar picker */
.avatar-picker {
    display: flex; align-items: center; gap: 16px; margin-bottom: 16px;
    padding-bottom: 16px; border-bottom: 1px solid var(--ds-border);
}
.avatar-picker .preview {
    width: 72px; height: 72px; border-radius: 9999px; overflow: hidden;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--ds-background-brand-bold); color: #fff;
    font-size: 22px; font-weight: 600; flex-shrink: 0;
}
.avatar-picker .preview img { width: 100%; height: 100%; object-fit: cover; }
.avatar-picker .controls { display: flex; flex-direction: column; gap: 6px; min-width: 0; }

@media (max-width: 480px) {
    .avatar-picker { flex-direction: column; align-items: flex-start; }
    .avatar-picker .preview { width: 80px; height: 80px; font-size: 26px; align-self: center; }
    .avatar-picker .controls { flex-direction: row; flex-wrap: wrap; width: 100%; }
    .modal .row { grid-template-columns: 1fr; }
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 1100px) {
    .kanban { grid-template-columns: repeat(5, 260px); }
}
/* Hamburger button — hidden on desktop */
.nav-hamburger {
    display: none;
    align-items: center; justify-content: center;
    width: 34px; height: 34px;
    border-radius: 4px; border: none;
    background: transparent;
    color: var(--ds-text-subtle);
    cursor: pointer;
    transition: background-color 100ms ease, color 100ms ease;
    flex-shrink: 0;
}
.nav-hamburger:hover { background: var(--ds-surface-hovered); color: var(--ds-text); }
.nav-hamburger i, .nav-hamburger svg { pointer-events: none; }

/* =========================================================
   Mobile slide-in sidebar
   ========================================================= */
.nav-sidebar {
    position: fixed; top: 0; right: 0; bottom: 0;
    width: 280px; max-width: 90vw;
    background: var(--ds-surface-overlay, var(--ds-surface-default));
    border-left: 1px solid var(--ds-border);
    z-index: 300;
    transform: translateX(100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex; flex-direction: column;
    overflow-y: auto;
}
.nav-sidebar.is-open { transform: translateX(0); }
.nav-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 299;
    opacity: 0; pointer-events: none;
    transition: opacity 0.25s ease;
}
.nav-overlay.is-open { opacity: 1; pointer-events: auto; }
.nav-sidebar__header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--ds-border);
    flex-shrink: 0;
}
.nav-sidebar__user-info {
    display: flex; align-items: center; gap: 10px;
    min-width: 0; flex: 1;
}
.nav-sidebar__name {
    font-weight: 600; font-size: 14px; color: var(--ds-text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nav-sidebar__role {
    font-size: 11px; color: var(--ds-text-subtle);
    text-transform: uppercase; letter-spacing: .04em; margin-top: 1px;
}
.nav-sidebar__links {
    display: flex; flex-direction: column;
    padding: 10px 8px;
    flex: 1;
    gap: 2px;
}
.nav-sidebar__links a {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 6px;
    color: var(--ds-text-subtle);
    text-decoration: none;
    font-size: 14px; font-weight: 500;
    transition: background 0.1s, color 0.1s;
}
.nav-sidebar__links a:hover { background: var(--ds-surface-hovered); color: var(--ds-text); }
.nav-sidebar__links a.active { background: var(--ds-background-information); color: var(--ds-text-brand); }
.nav-sidebar__footer {
    padding: 14px 16px;
    border-top: 1px solid var(--ds-border);
    display: flex; flex-direction: column; gap: 10px;
    flex-shrink: 0;
}
.nav-sidebar__theme-row {
    display: flex; align-items: center; justify-content: space-between;
}
.nav-sidebar__theme-label {
    font-size: 13px; font-weight: 500; color: var(--ds-text-subtle);
}

@media (max-width: 640px) {
    /* Single-row topbar, vertically centered */
    .topbar {
        height: 56px; padding: 0 12px;
        flex-wrap: nowrap; align-items: center;
    }
    .brand { flex: 1; display: flex; align-items: center; }
    .brand .brand-logo { width: 20px; height: 20px; margin-top: -3px; margin-left: 6px; }
    .brand a { font-size: 13px; gap: 6px; }
    .user-box { height: 56px; align-items: center; gap: 8px; }

    .nav-hamburger { display: flex; }

    /* Hide desktop-only topbar elements */
    .nav-links,
    #userName,
    #logoutBtn,
    .user-box .theme-toggle { display: none !important; }
}

/* =========================================================
   Turnos / Shifts
   ========================================================= */
.shift-week-nav { gap: 4px !important; }

.shifts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    padding: 4px 0;
}

.shift-card {
    background: var(--ds-surface);
    border: 1px solid var(--ds-border);
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.15s;
}
.shift-card:hover { box-shadow: var(--ds-shadow-raised); }
.shift-card--empty {
    border-style: dashed;
    opacity: .8;
}
.shift-card--add {
    border: 2px dashed var(--ds-border);
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 120px;
    cursor: pointer;
    color: var(--ds-text-subtle);
    font-size: 13px;
    font-weight: 500;
    transition: border-color .15s, color .15s, background .15s;
    box-shadow: none;
}
.shift-card--add:hover {
    border-color: var(--ds-accent);
    color: var(--ds-accent);
    background: var(--ds-bg-hover, rgba(79,70,229,.04));
}
.shift-card__header {
    display: flex; align-items: center; gap: 8px;
    padding: 12px 12px 6px;
}
.shift-card__color-dot {
    width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.shift-card__task-name {
    font-weight: 600; font-size: 14px; color: var(--ds-text);
    flex: 1; min-width: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.shift-card__actions { display: flex; gap: 2px; flex-shrink: 0; }
.shift-card__desc {
    padding: 0 12px 6px;
    font-size: 12px; color: var(--ds-text-subtle);
}
.shift-card__body { padding: 6px 12px 10px; }
.shift-card__assignee { display: flex; align-items: center; gap: 10px; }
.shift-card__person { font-size: 13px; font-weight: 500; color: var(--ds-text); }
.shift-card__notes { font-size: 12px; color: var(--ds-text-subtle); margin-top: 2px; }
.shift-card__empty { font-size: 13px; color: var(--ds-text-subtlest, var(--ds-text-subtle)); font-style: italic; }
.shift-card__footer {
    display: flex;
    gap: 6px;
    padding: 8px 10px;
    border-top: 1px solid var(--ds-border);
}
.shift-card__footer .btn {
    flex: 1;
    justify-content: center;
    font-size: 12px;
    gap: 5px;
}

/* Rotation list */
.shift-rotate-details { margin-top: 4px; }
.shift-rotate-summary {
    font-size: 12px; font-weight: 600; color: var(--ds-text-subtle); text-transform: uppercase;
    letter-spacing: .04em; cursor: pointer; padding: 6px 0; list-style: none;
    display: flex; align-items: center; gap: 6px;
}
.shift-rotate-summary::-webkit-details-marker { display: none; }
.shift-rotate-list {
    display: flex; flex-direction: column; gap: 3px;
    margin-top: 6px; max-height: 240px; overflow-y: auto;
    border: 1px solid var(--ds-border); border-radius: 6px; padding: 4px;
}
.shift-rotate-row {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 8px; border-radius: 4px;
    transition: background 0.1s;
}
.shift-rotate-row:hover { background: var(--ds-surface-hovered); }
.shift-rotate-row--top { background: var(--ds-background-information); }
.shift-rotate-name { flex: 1; font-size: 13px; color: var(--ds-text); min-width: 0; }

/* Badges */
.shift-badge {
    font-size: 11px; padding: 2px 6px; border-radius: 3px; white-space: nowrap;
    background: var(--ds-surface-sunken); color: var(--ds-text-subtle);
}
.shift-badge--never  { background: var(--ds-background-success, #dffcf0); color: var(--ds-text-success, #1f845a); }
.shift-badge--recent { background: var(--ds-background-warning, #fff0b3); color: var(--ds-text-warning, #974f0c); }
.shift-badge--suggest { background: var(--ds-background-information); color: var(--ds-text-information); }

/* Star rating */
.shift-rating-row {
    display: flex; align-items: center; gap: 3px;
    padding: 6px 12px 8px;
}
.shift-star {
    background: none; border: none; padding: 0; cursor: pointer;
    font-size: 18px; line-height: 1; color: var(--ds-border);
    transition: color .1s, transform .1s;
}
.shift-star--on { color: #f59e0b; }
.shift-star:not([disabled]):hover { color: #f59e0b; transform: scale(1.15); }
.shift-star[disabled] { cursor: default; }
.shift-rating-label {
    margin-left: 6px; font-size: 12px; color: var(--ds-text-subtle); font-weight: 500;
}
.shift-rating-none { color: var(--ds-text-subtlest, var(--ds-text-subtle)); font-style: italic; font-weight: 400; }

/* Podium */
.shift-podium {
    display: flex; align-items: flex-end; justify-content: center;
    gap: 8px; padding: 24px 16px 0;
}
.shift-podium__slot {
    display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 1; max-width: 110px;
}
.shift-podium__slot--empty { opacity: 0; pointer-events: none; }
.shift-podium__avatar-wrap { position: relative; }
.shift-podium__crown {
    position: absolute; top: -18px; left: 50%; transform: translateX(-50%);
    font-size: 16px; line-height: 1;
}
.shift-podium__name {
    font-size: 13px; font-weight: 600; color: var(--ds-text);
    text-align: center; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.shift-podium__block {
    width: 100%; border-radius: 6px 6px 0 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    padding: 8px 4px;
}
.shift-podium__medal { font-size: 20px; line-height: 1; }
.shift-podium__pts { font-size: 12px; font-weight: 700; color: var(--ds-text); }
.shift-podium__list {
    border-top: 1px solid var(--ds-border); margin-top: 16px; padding-top: 12px;
    display: flex; flex-direction: column; gap: 4px;
}
.shift-podium__list-row {
    display: flex; align-items: center; gap: 8px; padding: 6px 8px;
    border-radius: 6px; font-size: 13px;
}
.shift-podium__list-row--first { background: rgba(234,179,8,.08); }
.shift-podium__list-rank { width: 28px; text-align: center; font-size: 14px; flex-shrink: 0; }
.shift-podium__list-name { flex: 1; font-weight: 500; color: var(--ds-text); }
.shift-podium__list-shifts { font-size: 12px; color: var(--ds-text-subtle); }
.shift-podium__list-pts { font-weight: 700; color: var(--ds-text); min-width: 42px; text-align: right; }

/* Subtask list inside shift card */
.shift-subtask-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.shift-subtask-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 4px;
    border-radius: 5px;
    transition: background 0.1s;
}
.shift-subtask-row:not(:last-child) {
    border-bottom: 1px solid var(--ds-border);
}
.shift-subtask-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--ds-text-subtle);
    min-width: 0;
    flex-shrink: 0;
    max-width: 40%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.shift-subtask-right {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex: 1;
    justify-content: flex-end;
}
.shift-subtask-person {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
}
.shift-subtask-person__name {
    font-size: 12px;
    font-weight: 500;
    color: var(--ds-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100px;
}
.shift-subtask-empty {
    font-size: 12px;
    color: var(--ds-text-subtlest, var(--ds-text-subtle));
    font-style: italic;
}
.shift-subtask-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}
.shift-subtask-assign-btn {
    font-size: 11px !important;
    padding: 3px 8px !important;
    height: auto !important;
    white-space: nowrap;
}
.shift-unassign-btn {
    color: var(--ds-text-danger) !important;
    width: 22px !important;
    height: 22px !important;
}
.shift-add-subtask-btn {
    font-size: 12px !important;
    gap: 4px !important;
    color: var(--ds-text-subtle) !important;
    margin-left: auto;
}
.shift-add-subtask-btn:hover { color: var(--ds-accent) !important; }

/* Subtask management rows inside edit modal */
.shift-subtask-manage-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 5px;
    border: 1px solid var(--ds-border);
    background: var(--ds-surface);
}
.shift-subtask-manage-name {
    flex: 1;
    font-size: 13px;
    color: var(--ds-text);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Manage-tasks modal row */
.shift-manage-row {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 6px;
    border: 1px solid var(--ds-border);
    background: var(--ds-surface);
    transition: background 0.1s;
}
.shift-manage-row:hover { background: var(--ds-surface-hovered); }

@media (max-width: 640px) {
    .shifts-grid { grid-template-columns: 1fr; }
    .shift-week-nav span { min-width: 0 !important; font-size: 12px; }
}

/* =========================================================
   Motion — only on state changes (modal, toast).
   Static page content does NOT animate on render.
   ========================================================= */

/* Standard Material/Atlassian easings. */
:root {
    --motion-enter: cubic-bezier(0.4, 0, 0.2, 1);   /* decelerate */
    --motion-exit:  cubic-bezier(0.4, 0, 1, 1);     /* accelerate */
    --motion-fast:  140ms;
    --motion-base:  180ms;
}

/* --- Modal --------------------------------------------------------------- */
@keyframes modalBackdropIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalBackdropOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes modalDialogIn    {
    from { opacity: 0; transform: translateY(-4px) scale(.98); }
    to   { opacity: 1; transform: translateY(0)    scale(1); }
}
@keyframes modalDialogOut   {
    from { opacity: 1; transform: translateY(0)    scale(1); }
    to   { opacity: 0; transform: translateY(-4px) scale(.98); }
}

.modal-backdrop { animation: modalBackdropIn var(--motion-fast) var(--motion-enter) both; }
.modal          { animation: modalDialogIn   var(--motion-base) var(--motion-enter) both; }

.modal-backdrop.is-closing { animation: modalBackdropOut var(--motion-fast) var(--motion-exit) both; }
.modal-backdrop.is-closing .modal { animation: modalDialogOut var(--motion-fast) var(--motion-exit) both; }

/* --- Toasts -------------------------------------------------------------- */
@keyframes toastIn  { from { opacity: 0; transform: translateX(8px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; transform: translateX(0);   } to { opacity: 0; transform: translateX(8px); } }
.toast            { animation: toastIn  var(--motion-base) var(--motion-enter) both; }
.toast.is-closing { animation: toastOut var(--motion-fast) var(--motion-exit)  both; }

/* Reduced motion: respect user preference. */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* =========================================================
   Jira-style select (custom dropdown)
   ========================================================= */
.jselect {
    position: relative;
    display: inline-block;
    width: 100%;
    font: inherit;
}
/* Native <select> stays in DOM (so FormData works) but is invisible. */
.jselect > select.jselect__native {
    position: absolute !important;
    top: 0; left: 0;
    width: 1px !important; height: 1px !important;
    opacity: 0 !important;
    pointer-events: none !important;
    border: 0 !important; padding: 0 !important;
    margin: 0 !important;
    clip: rect(0 0 0 0);
    overflow: hidden;
}

.jselect__trigger {
    width: 100%;
    min-height: 32px;
    display: inline-flex; align-items: center; gap: 8px;
    padding: 4px 8px 4px 10px;
    background: var(--ds-field-bg-idle);
    border: 1px solid var(--ds-border-input);
    border-radius: 3px;
    color: var(--ds-text);
    font: 400 14px/20px inherit;
    text-align: left;
    cursor: pointer;
    transition: background-color 120ms var(--motion-enter), border-color 120ms var(--motion-enter);
}
.jselect__trigger:hover {
    background: var(--ds-field-bg-hover);
    border-color: var(--ds-border-input-hover);
}
.jselect__trigger:focus-visible,
.jselect__trigger[aria-expanded="true"] {
    outline: none;
    border-color: var(--ds-border-focused);
    box-shadow: 0 0 0 2px var(--ds-focus-ring);
}
.jselect__trigger[disabled] {
    background: var(--ds-field-bg-disabled);
    color: var(--ds-text-disabled);
    cursor: not-allowed;
}
.jselect__value {
    flex: 1;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.jselect__value.is-placeholder {
    color: var(--ds-text-subtlest);
}
.jselect__caret {
    flex: 0 0 auto;
    width: 16px; height: 16px;
    color: var(--ds-text-subtle);
    transition: transform 160ms var(--motion-enter);
    pointer-events: none;
}
.jselect__trigger[aria-expanded="true"] .jselect__caret { transform: rotate(180deg); }

@keyframes jselectIn  { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
@keyframes jselectOut { from { opacity: 1; transform: translateY(0); }    to { opacity: 0; transform: translateY(-4px); } }

.jselect__menu {
    position: absolute;
    left: 0;
    top: calc(100% + 4px);
    min-width: 100%;
    max-width: min(360px, 100vw);
    background: var(--ds-surface-overlay);
    border: 1px solid var(--ds-border);
    border-radius: 4px;
    z-index: 200;
    overflow: hidden;
    animation: jselectIn 140ms var(--motion-enter) both;
}
.jselect__menu.is-above {
    top: auto; bottom: calc(100% + 4px);
    animation-name: jselectIn;
}
.jselect__menu.is-closing { animation: jselectOut 120ms var(--motion-exit) both; }

.jselect__search {
    width: 100%;
    height: 32px;
    padding: 0 10px;
    border: 0;
    border-bottom: 1px solid var(--ds-border);
    border-radius: 0;
    background: transparent;
    color: var(--ds-text);
    font: inherit;
}
.jselect__search:focus { outline: none; box-shadow: none; border-bottom-color: var(--ds-border-focused); }

.jselect__list {
    max-height: 240px;
    overflow-y: auto;
    padding: 4px;
}
.jselect__option {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 8px;
    border-radius: 3px;
    color: var(--ds-text);
    font: 400 14px/20px inherit;
    cursor: pointer;
    user-select: none;
}
.jselect__option:hover,
.jselect__option.is-highlighted {
    background: var(--ds-surface-hovered);
}
.jselect__option.is-selected {
    background: var(--ds-background-information);
    color: var(--ds-text-information);
    font-weight: 600;
}
.jselect__option.is-selected.is-highlighted {
    /* Slight tint when selected + highlighted simultaneously. */
    filter: brightness(.97);
}
.jselect__check {
    width: 14px; height: 14px;
    flex: 0 0 auto;
    color: var(--ds-text-information);
    visibility: hidden;
}
.jselect__option.is-selected .jselect__check { visibility: visible; }
.jselect__empty {
    padding: 12px; text-align: center;
    color: var(--ds-text-subtlest);
    font-size: 13px;
}

/* =========================================================
   Subtasks (ticket detail)
   ========================================================= */
.subtasks-counter {
    display: inline-block;
    margin-left: 4px;
    padding: 1px 6px;
    border-radius: 999px;
    background: var(--ds-background-neutral);
    color: var(--ds-text-subtle);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    min-width: 24px;
    text-align: center;
}
.subtasks-counter:empty { display: none; }

.subtasks {
    display: flex; flex-direction: column;
    border-top: 1px solid var(--ds-border);
}
.subtasks:empty { border-top: 0; }

.subtask {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 4px;
    border-bottom: 1px solid var(--ds-border);
    transition: background-color 120ms var(--motion-enter);
}
.subtask:last-child { border-bottom: 0; }
.subtask:hover { background: var(--ds-surface-hovered); }

.subtask__check {
    flex: 0 0 auto;
    width: 22px; height: 22px;
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--ds-text-subtle);
    background: transparent;
    border-radius: 3px;
    cursor: pointer;
    transition: color 120ms var(--motion-enter), background-color 120ms var(--motion-enter);
}
.subtask__check:hover:not([disabled]) {
    background: var(--ds-background-neutral-subtle-hovered);
    color: var(--ds-text);
}
.subtask__check[disabled] { cursor: not-allowed; opacity: .5; }
.subtask.is-done .subtask__check { color: var(--ds-text-success); }
.subtask__check [data-lucide] { width: 18px; height: 18px; stroke-width: 2; }

.subtask__title {
    flex: 1;
    color: var(--ds-text);
    font-size: 14px; line-height: 20px;
    cursor: text;
    word-break: break-word;
}
.subtask.is-done .subtask__title {
    color: var(--ds-text-subtlest);
    text-decoration: line-through;
}
.subtask__title-input {
    flex: 1;
    height: 28px;
    padding: 0 8px;
    border: 1px solid var(--ds-border-input);
    border-radius: 3px;
    background: var(--ds-field-bg-idle);
    color: var(--ds-text);
    font: inherit;
}
.subtask__title-input:focus {
    outline: none;
    border-color: var(--ds-border-focused);
    box-shadow: 0 0 0 2px var(--ds-focus-ring);
}

.subtask__delete {
    flex: 0 0 auto;
    width: 22px; height: 22px;
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--ds-text-subtlest);
    background: transparent;
    border-radius: 3px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 120ms var(--motion-enter), color 120ms var(--motion-enter), background-color 120ms var(--motion-enter);
}
.subtask:hover .subtask__delete { opacity: 1; }
.subtask__delete:hover { color: var(--ds-text-danger); background: var(--ds-background-danger); }

.subtask-add {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 4px;
    border-top: 1px solid var(--ds-border);
    margin-top: 0;
}
.subtasks:empty + .subtask-add { border-top: 0; }
.subtask-add__icon { color: var(--ds-text-subtlest); flex: 0 0 auto; }
.subtask-add input {
    flex: 1;
    height: 32px;
    padding: 0 8px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--ds-text);
    font: inherit;
    border-radius: 3px;
    transition: background-color 120ms var(--motion-enter), border-color 120ms var(--motion-enter);
}
.subtask-add input::placeholder { color: var(--ds-text-subtlest); }
.subtask-add input:hover { background: var(--ds-surface-hovered); }
.subtask-add input:focus {
    outline: none;
    background: var(--ds-field-bg-focus);
    border-color: var(--ds-border-focused);
    box-shadow: 0 0 0 2px var(--ds-focus-ring);
}

/* Lock state on the progress field when subtasks exist. */
.is-readonly { cursor: help !important; opacity: .96; }
.is-readonly:hover { background: transparent !important; }
.detail-progress__hint {
    margin-left: 8px;
    font-size: 11px; font-weight: 600;
    color: var(--ds-text-subtle);
    letter-spacing: 0.02em;
}

/* =========================================================
   Notifications bell & dropdown
   ========================================================= */
.notif-bell-wrap { position: relative; }

.notif-badge {
    position: absolute; top: 2px; right: 2px;
    min-width: 16px; height: 16px; padding: 0 4px;
    background: var(--ds-text-danger); color: #fff;
    border-radius: 9999px; font-size: 10px; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
    pointer-events: none;
}

.notif-dropdown {
    display: none;
    position: absolute; top: calc(100% + 8px); right: 0;
    width: 340px; max-height: 440px;
    background: var(--ds-surface-default);
    border: 1px solid var(--ds-border-default);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    z-index: 1000;
    overflow: hidden;
    flex-direction: column;
}
.notif-dropdown.open { display: flex; }

.notif-dropdown__header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px 10px;
    border-bottom: 1px solid var(--ds-border-default);
    flex-shrink: 0;
}
.notif-dropdown__title { font-size: 14px; font-weight: 600; color: var(--ds-text); }

.notif-list { overflow-y: auto; flex: 1; }

.notif-empty {
    text-align: center; padding: 32px 16px;
    font-size: 13px; color: var(--ds-text-subtle);
}

.notif-item {
    display: flex; gap: 10px; align-items: flex-start;
    padding: 11px 16px;
    border-bottom: 1px solid var(--ds-border-default);
    cursor: pointer; transition: background .12s;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--ds-background-neutral-subtle-hovered); }
.notif-item.unread { background: var(--ds-background-information-subtle); }
.notif-item.unread:hover { background: var(--ds-background-information-subtle-hovered, #e8f0fc); }

.notif-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--ds-brand); flex-shrink: 0; margin-top: 5px;
}
.notif-item.read .notif-dot { visibility: hidden; }

.notif-content { flex: 1; min-width: 0; }
.notif-title { font-size: 13px; font-weight: 600; color: var(--ds-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-item.read .notif-title { font-weight: 400; }
.notif-body  { font-size: 12px; color: var(--ds-text-subtle); margin-top: 1px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.notif-time  { font-size: 11px; color: var(--ds-text-subtlest); flex-shrink: 0; margin-top: 2px; }
