:root {
    color-scheme: dark;
    --bg: #08090b;
    --panel: #111318;
    --panel-2: #171a20;
    --line: #262a33;
    --text: #f3f4f6;
    --muted: #9298a5;
    --red: #e34b4b;
    --yellow: #d4b233;
    --orange: #dc7b2d;
    --green: #3ea76a;
    --blue: #628cff;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html {
    min-height: 100%;
    background: var(--bg);
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}
body {
    min-height: 100vh;
    margin: 0;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    color: var(--text);
    background:
        radial-gradient(circle at 15% -10%, rgba(73, 86, 120, .18), transparent 28rem),
        radial-gradient(circle at 100% 20%, rgba(35, 88, 66, .08), transparent 24rem),
        var(--bg);
}
body.app-body {
    display: flex;
    align-items: stretch;
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
}
button, input, textarea, select { font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }

/* Dark subtle scrollbars */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.12) transparent;
}
*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.1);
    border-radius: 99px;
}
*::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.18); }

.side-rail {
    flex: 0 0 48px;
    width: 48px;
    border-right: 1px solid rgba(38, 42, 51, .55);
    background: rgba(8, 9, 11, .92);
    padding: 0 0 12px;
    z-index: 30;
    transition: width .2s ease, flex-basis .2s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
body.rail-expanded .side-rail {
    flex-basis: 148px;
    width: 148px;
}
.rail-top {
    flex: 0 0 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    border-bottom: 1px solid rgba(38, 42, 51, .45);
}
body.rail-expanded .rail-top {
    justify-content: flex-start;
    padding-left: 8px;
}
.rail-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 6px 0;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}
.rail-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 36px;
    padding: 7px 8px;
    border-radius: 8px;
    color: var(--muted);
    background: transparent;
    transform: none;
}
.rail-btn:hover { color: #fff; background: rgba(39, 44, 54, .7); transform: none; }
.rail-btn.active { color: #fff; background: #272c36; }
.rail-ico {
    flex: 0 0 22px;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.rail-ico svg { display: block; }
.rail-label {
    display: none;
    font-size: .74rem;
    font-weight: 650;
    white-space: nowrap;
    letter-spacing: .01em;
}
body.rail-expanded .rail-label { display: inline; }

.app-main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.topbar {
    min-height: 56px;
    height: 56px;
    padding: 0 14px 0 10px;
    border-bottom: 1px solid var(--line);
    background: rgba(8, 9, 11, .9);
    backdrop-filter: blur(14px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: nowrap;
    position: sticky;
    top: 0;
    z-index: 20;
    flex: 0 0 auto;
}

.brand-block {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    min-width: 0;
    padding-left: 4px;
}
.menu-toggle {
    width: 34px;
    height: 34px;
    padding: 8px 7px;
    display: inline-flex;
    flex-direction: column;
    justify-content: space-between;
    border-radius: 8px;
    background: transparent;
    border: 1px solid transparent;
    transform: none;
    flex: 0 0 auto;
}
.menu-toggle:hover {
    background: rgba(39, 44, 54, .65);
    border-color: var(--line);
    transform: none;
}
.menu-toggle span {
    display: block;
    height: 2px;
    border-radius: 2px;
    background: #c5cad4;
}
body.rail-expanded .menu-toggle { background: rgba(39, 44, 54, .8); }

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 1.15rem; letter-spacing: -.04em; }
.eyebrow { margin: 0 0 1px; color: var(--muted); font-size: .55rem; font-weight: 800; letter-spacing: .14em; }
.muted { color: var(--muted); }
.brand-title { flex: 0 0 auto; min-width: 0; }
.top-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.top-actions form { margin: 0; }

button {
    border: 0;
    border-radius: 10px;
    padding: 10px 15px;
    color: var(--text);
    background: var(--panel-2);
    transition: transform .15s ease, background .15s ease, border-color .15s ease;
}
button:hover { transform: translateY(-1px); }
.primary { background: var(--blue); color: #fff; font-weight: 750; box-shadow: 0 8px 24px rgba(72, 111, 222, .2); }
.primary:hover { background: #769aff; }
.ghost { border: 1px solid var(--line); background: transparent; }
.ghost:hover { background: var(--panel-2); }
.danger { border: 1px solid rgba(227, 75, 75, .38); background: rgba(227, 75, 75, .12); color: #ff8585; }
.full { width: 100%; margin-top: 20px; padding: 12px; }
.hidden { display: none !important; }

.workspace {
    padding: 12px 14px 20px;
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    max-width: 100%;
    display: flex;
    flex-direction: column;
}
.summary-top {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    flex: 1 1 auto;
    max-width: 520px;
    margin: 0 auto;
    min-width: 0;
}
.summary-top article {
    padding: 5px 8px;
    border: 1px solid rgba(38, 42, 51, .85);
    border-radius: 9px;
    background: rgba(17, 19, 24, .85);
    text-align: center;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    min-width: 0;
}
.summary-top article:hover {
    border-color: #3a4150;
    background: rgba(28, 32, 40, .95);
}
.summary-top span {
    display: block;
    font-size: .95rem;
    font-weight: 800;
    letter-spacing: -.04em;
    line-height: 1.1;
}
.summary-top small {
    color: var(--muted);
    font-size: .58rem;
    font-weight: 650;
    letter-spacing: .02em;
}
.sum-inicio { border-top: 2px solid var(--red) !important; }
.sum-proceso { border-top: 2px solid var(--yellow) !important; }
.sum-pruebas { border-top: 2px solid var(--orange) !important; }
.sum-cerrado { border-top: 2px solid var(--green) !important; }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.toolbar input, .toolbar select, .modal input, .modal textarea, .modal select, .login-card input {
    border: 1px solid var(--line);
    border-radius: 9px;
    outline: none;
    color: var(--text);
    background: #0e1014;
    transition: border-color .15s, box-shadow .15s;
}
.toolbar input:focus, .toolbar select:focus, .modal input:focus, .modal textarea:focus, .modal select:focus, .login-card input:focus {
    border-color: #577adc;
    box-shadow: 0 0 0 3px rgba(87, 122, 220, .13);
}
.search { position: relative; width: min(300px, 100%); }
.search span { position: absolute; left: 13px; top: 8px; color: var(--muted); font-size: 1.25rem; }
.search input { width: 100%; padding: 8px 12px 8px 38px; }
.toolbar select { padding: 8px 34px 8px 12px; }
.check-filter { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .85rem; }
.compact { padding: 6px 10px; font-size: .74rem; }
.date-range {
    display: flex;
    gap: 12px;
    padding: 10px;
    margin: 0 0 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(17, 19, 24, .8);
}
.date-range label { color: var(--muted); font-size: .76rem; }
.date-range input {
    margin-left: 6px;
    padding: 7px;
    border: 1px solid var(--line);
    border-radius: 7px;
    color: var(--text);
    background: #0e1014;
}

.board {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    width: 100%;
    max-width: 100%;
    align-items: stretch;
    min-height: 0;
    flex: 1 1 auto;
}
#tasks-view.module-view {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1 1 auto;
}
#tasks-view.module-view.hidden { display: none !important; }
.status-tabs { display: none; }
.column {
    --status: var(--muted);
    min-height: 0;
    min-width: 0;
    height: 100%;
    border: 1px solid var(--line);
    border-top: 2px solid var(--status);
    border-radius: 12px;
    background: rgba(16, 18, 23, .76);
    overflow: hidden;
    transition: opacity .2s, transform .2s;
    display: flex;
    flex-direction: column;
}
.column.status-inicio { --status: var(--red); background: linear-gradient(180deg, rgba(104, 25, 25, .18), rgba(16, 18, 23, .78) 120px); }
.column.status-proceso { --status: var(--yellow); background: linear-gradient(180deg, rgba(103, 87, 23, .16), rgba(16, 18, 23, .78) 120px); }
.column.status-pruebas { --status: var(--orange); background: linear-gradient(180deg, rgba(107, 56, 18, .17), rgba(16, 18, 23, .78) 120px); }
.column.status-cerrado { --status: var(--green); background: linear-gradient(180deg, rgba(24, 91, 53, .18), rgba(16, 18, 23, .78) 120px); }
.column.filtered-out { display: none; }
.column > header {
    padding: 10px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex: 0 0 auto;
}
.column > header div { display: flex; align-items: center; gap: 8px; }
.column h2 { margin: 0; font-size: .92rem; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--status); box-shadow: 0 0 10px var(--status); }
.count { min-width: 24px; padding: 2px 6px; border-radius: 999px; text-align: center; font-size: .7rem; background: rgba(255,255,255,.07); }
.cards {
    flex: 1 1 auto;
    min-height: 0;
    padding: 0 6px 6px;
    overflow-x: hidden;
    overflow-y: auto;
    transition: background .15s;
}
.cards.drag-over { background: rgba(98, 140, 255, .08); outline: 1px dashed rgba(98, 140, 255, .45); outline-offset: -7px; }
.add-column {
    width: calc(100% - 16px);
    margin: 0 8px 8px;
    padding: 6px 8px;
    color: var(--muted);
    background: transparent;
    border: 1px dashed #303540;
    flex: 0 0 auto;
    font-size: .72rem;
}
.add-column:hover { color: var(--text); border-color: #4b5261; }

.task-card {
    position: relative;
    margin-bottom: 5px;
    padding: 6px 7px 5px;
    border: 1px solid #292d36;
    border-left: 3px solid #5e6676;
    border-radius: 8px;
    background: linear-gradient(145deg, #1a1d24, #15171d);
    box-shadow: 0 3px 10px rgba(0,0,0,.12);
    transition: transform .15s, border-color .15s, opacity .15s;
}
.task-card:hover { transform: translateY(-1px); border-top-color: #383e4a; border-right-color: #383e4a; border-bottom-color: #383e4a; }
.task-card.dragging { opacity: .35; transform: rotate(1.5deg); }
.task-card.priority-urgente { border-left-color: #f05d5d; }
.task-card.priority-alta { border-left-color: #e58c42; }
.task-card.priority-media { border-left-color: #628cff; }
.task-card.priority-baja { border-left-color: #6e7788; }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 5px; margin-bottom: 2px; }
.card-top-left { display: flex; align-items: center; gap: 5px; min-width: 0; flex: 1; }
.priority-badge { color: #aab0bd; font-size: .54rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; flex: 0 0 auto; }
.priority-urgente .priority-badge { color: #ff7777; }
.priority-alta .priority-badge { color: #efa35f; }
.client-badge {
    display: inline-block;
    max-width: 55%;
    margin-top: 0;
    padding: 0 5px;
    overflow: hidden;
    border: 1px solid;
    border-radius: 999px;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .54rem;
    font-weight: 700;
}
.drag-handle { color: #545b69; cursor: grab; font-size: .9rem; flex: 0 0 auto; }
.title-row {
    display: flex;
    align-items: flex-start;
    gap: 4px;
    margin: 0 0 3px;
}
.title-input {
    flex: 1;
    min-width: 0;
    margin: 0;
    padding: 1px 4px;
    border: 1px solid transparent;
    border-radius: 5px;
    color: var(--text);
    background: transparent;
    font-size: .78rem;
    font-weight: 700;
    line-height: 1.2;
    resize: none;
    overflow: hidden;
    field-sizing: content;
}
.title-input:hover { border-color: #303641; background: rgba(0,0,0,.18); }
.title-input:focus {
    border-color: #577adc;
    background: #0e1014;
    box-shadow: 0 0 0 2px rgba(87, 122, 220, .12);
    outline: none;
}
.title-input.dirty { border-color: rgba(212, 178, 51, .55); }
.save-title {
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 1px solid #303641;
    border-radius: 5px;
    color: #9eb0d8;
    background: #151922;
    font-size: .85rem;
    line-height: 1;
}
.save-title:hover { color: #fff; background: #243056; transform: none; }
.save-title.saving { opacity: .55; }
.save-title.saved { color: #83dda9; border-color: rgba(62,167,106,.45); }
.description { display: none; }
.step-list { display: none; }
.progress-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 3px;
}
.progress-row > span {
    display: none;
}
.progress-track { flex: 1; height: 2px; overflow: hidden; border-radius: 99px; background: #292d35; }
.progress-fill { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #557eea, #64a3ff); transition: width .3s ease; }
.progress-pct { flex: 0 0 auto; color: #8b93a3; font-size: .55rem; font-weight: 700; min-width: 22px; text-align: right; }
.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid #272b33;
    padding-top: 5px;
    gap: 6px;
}
.card-dates {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    flex: 1 1 auto;
}
.created-date {
    color: #7e8592;
    font-size: .58rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.due-date { color: #9aa3b5; font-size: .58rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.due-date.soon { color: #e3bc53; }
.due-date.overdue { color: #f26c6c; font-weight: 700; }
.optional-hint { color: var(--muted); font-weight: 500; font-size: .78em; }
#task-created-at {
    color: var(--muted);
    background: #0a0c10;
    cursor: default;
    opacity: .9;
}
.edit-button { padding: 2px 6px; color: #8f98a9; background: transparent; font-size: .65rem; }
.edit-button:hover { color: #fff; transform: none; }
.quick-move {
    display: none;
    width: 100%;
    margin-top: 6px;
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: 7px;
    color: var(--muted);
    background: #111318;
    font-size: .68rem;
}

.notice {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 100;
    max-width: min(380px, calc(100vw - 32px));
    padding: 12px 16px;
    border: 1px solid rgba(62, 167, 106, .45);
    border-radius: 10px;
    background: #10271a;
    color: #83dda9;
    opacity: 0;
    transform: translateY(15px);
    pointer-events: none;
    transition: .2s ease;
}
.notice.visible { opacity: 1; transform: translateY(0); }
.notice.error { border-color: rgba(227,75,75,.5); background: #2b1214; color: #ff8c8c; }

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(0,0,0,.72);
    backdrop-filter: blur(7px);
    animation: fade-in .15s ease;
}
.modal {
    width: min(650px, 100%);
    max-height: calc(100vh - 36px);
    overflow: auto;
    border: 1px solid #303641;
    border-radius: 16px;
    background: #13161b;
    box-shadow: 0 30px 80px rgba(0,0,0,.55);
    animation: rise-in .2s ease;
}
.modal > header { display: flex; justify-content: space-between; padding: 14px 20px 6px; }
.modal h2 { margin: 0; font-size: 1.15rem; }
.icon-button { padding: 2px 9px; color: var(--muted); background: transparent; font-size: 1.6rem; }
.modal form { padding: 4px 20px 16px; }
.modal label, .login-card label { display: block; margin: 8px 0 4px; color: #c0c5cf; font-size: .74rem; font-weight: 700; }
.modal label small { color: var(--muted); font-weight: 400; }
.modal input:not([type=range]), .modal textarea, .modal select, .login-card input { width: 100%; padding: 8px 10px; }
.modal textarea { resize: vertical; line-height: 1.4; min-height: 52px; max-height: 90px; }
.whoami { align-self: center; color: #9aa3b2; font-size: 13px; margin-right: 8px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1.3fr; }
.form-grid > label { margin-top: 8px; }
.range-field { display: flex; align-items: center; gap: 10px; height: 34px; }
.range-field input { width: 100%; accent-color: var(--blue); }
.range-field output { min-width: 40px; color: #b9c8ef; font-size: .76rem; }
.modal footer { display: flex; align-items: center; gap: 9px; margin-top: 14px; }
.spacer { flex: 1; }
.modal-open { overflow: hidden; }

.module-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    max-width: 1100px;
    margin-bottom: 20px;
}
.module-header h2 { margin: 0 0 5px; font-size: 1.5rem; }
.module-header .muted { margin: 0; font-size: .85rem; }
.client-search { display: block; margin-bottom: 16px; }
.clients-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 13px;
    max-width: 1100px;
}
.client-card {
    position: relative;
    padding: 17px;
    border: 1px solid var(--line);
    border-top: 3px solid var(--blue);
    border-radius: 13px;
    background: linear-gradient(145deg, #191c22, #111318);
}
.client-card.inactive { opacity: .58; }
.client-card header { display: flex; align-items: center; gap: 11px; margin-bottom: 14px; }
.client-card h3 { margin: 0 0 3px; font-size: .96rem; }
.client-card small, .client-card p { color: var(--muted); font-size: .74rem; }
.client-card p { margin: 5px 0; overflow-wrap: anywhere; }
.client-card button { margin-top: 13px; }
.client-avatar {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border-radius: 11px;
    color: #fff;
    font-size: .75rem;
    font-weight: 900;
}
.inactive-badge { position: absolute; right: 13px; top: 13px; color: #aaa; font-size: .62rem; text-transform: uppercase; }
.empty-state { padding: 30px; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); text-align: center; }
.inline-check { display: flex !important; align-items: center; gap: 8px; }
.inline-check input { width: auto !important; }

.download-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
    max-width: 1000px;
    align-items: start;
}
.download-card {
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: linear-gradient(145deg, #191c22, #111318);
}
.download-card.highlight { border-color: rgba(98, 140, 255, .4); }
.download-card h3 { margin: 0 0 10px; font-size: 1.02rem; }
.download-icon {
    display: grid;
    place-items: center;
    width: 84px;
    height: 84px;
    margin-bottom: 14px;
    border-radius: 20px;
    background: #0e1014;
    border: 1px solid var(--line);
}
.download-card a.full { display: block; margin-top: 16px; text-align: center; text-decoration: none; }
.download-card .full { margin-top: 16px; }
.apk-link-label { display: block; margin: 16px 0 6px; color: var(--muted); font-size: .72rem; font-weight: 700; }
.apk-link-row { display: flex; gap: 8px; align-items: center; }
.apk-link-row input {
    flex: 1;
    min-width: 0;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: #c7ccd6;
    background: #0e1014;
    font-size: .72rem;
}
.steps-list { margin: 6px 0 0; padding-left: 18px; color: #c3c7d0; font-size: .84rem; line-height: 1.7; }
.steps-list b { color: #fff; }

.login-page { display: grid; place-items: center; padding: 20px; }
.login-card {
    width: min(390px, 100%);
    padding: 38px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: linear-gradient(145deg, rgba(25,28,35,.98), rgba(14,16,20,.98));
    box-shadow: 0 30px 80px rgba(0,0,0,.4);
}
.login-card h1 { margin: 4px 0 8px; }
.login-card .muted { margin-bottom: 24px; font-size: .9rem; }
.brand-logo {
    display: block;
    width: 72px;
    height: 72px;
    margin-bottom: 18px;
    border-radius: 18px;
}
.brand-mark {
    display: grid;
    place-items: center;
    width: 45px;
    height: 45px;
    margin-bottom: 20px;
    border-radius: 13px;
    color: #fff;
    background: linear-gradient(145deg, #1a2233, #0c1018);
    box-shadow: 0 10px 30px rgba(0,0,0,.35);
    font-size: 1.5rem;
    font-weight: 900;
}
.alert { padding: 10px 12px; margin: 15px 0; border-radius: 8px; font-size: .8rem; }
.alert.error { border: 1px solid rgba(227,75,75,.35); color: #ff8c8c; background: rgba(227,75,75,.1); }

@keyframes fade-in { from { opacity: 0; } }
@keyframes rise-in { from { opacity: 0; transform: translateY(12px) scale(.985); } }

.status-tabs {
    display: none;
    gap: 6px;
    margin: 0 0 14px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(17, 19, 24, .92);
}
.status-tab {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 10px 6px;
    border-radius: 8px;
    color: var(--muted);
    background: transparent;
    font-size: .72rem;
    font-weight: 700;
}
.status-tab .status-dot { width: 7px; height: 7px; flex: 0 0 auto; }
.status-tab[data-status-tab="inicio"] .status-dot { background: var(--red); box-shadow: 0 0 8px var(--red); }
.status-tab[data-status-tab="proceso"] .status-dot { background: var(--yellow); box-shadow: 0 0 8px var(--yellow); }
.status-tab[data-status-tab="pruebas"] .status-dot { background: var(--orange); box-shadow: 0 0 8px var(--orange); }
.status-tab[data-status-tab="cerrado"] .status-dot { background: var(--green); box-shadow: 0 0 8px var(--green); }
.status-tab .tab-count {
    min-width: 18px;
    padding: 1px 5px;
    border-radius: 999px;
    background: rgba(255,255,255,.08);
    font-size: .65rem;
    font-weight: 800;
}
.status-tab.active {
    color: #fff;
    background: #272c36;
    transform: none;
}
.status-tab:hover { transform: none; }

@media (max-width: 1100px) {
    .board {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .column { height: auto; min-height: 260px; }
    .cards { min-height: 180px; }
    .summary-top { max-width: 380px; }
}

@media (max-width: 760px) {
    html, body {
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100vw !important;
        position: relative;
    }
    body.app-body {
        height: 100vh;
        max-height: 100vh;
        padding-bottom: 0;
        flex-direction: column;
    }
    .side-rail {
        order: 3;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 40;
        width: 100% !important;
        flex: none !important;
        height: auto;
        border-right: 0;
        border-top: 1px solid rgba(38, 42, 51, .7);
        padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
        background: rgba(12, 14, 18, .97);
        backdrop-filter: blur(15px);
    }
    body.rail-expanded .side-rail {
        width: 100% !important;
        flex-basis: auto !important;
    }
    .rail-nav {
        flex-direction: row;
        gap: 2px;
        padding: 0;
    }
    .rail-btn {
        flex: 1 1 0;
        flex-direction: column;
        justify-content: center;
        gap: 2px;
        min-height: 48px;
        padding: 6px 2px;
        border-radius: 8px;
    }
    .rail-label {
        display: block !important;
        font-size: .55rem;
        white-space: normal;
        line-height: 1.1;
        text-align: center;
    }
    .menu-toggle { display: none; }
    .rail-top { display: none; }
    .app-main {
        order: 1;
        padding-bottom: 58px;
        min-height: 0;
    }
    .topbar {
        min-height: auto;
        height: auto;
        padding: 8px 10px;
        flex-wrap: wrap;
        gap: 8px;
        position: sticky;
        width: 100%;
        max-width: 100vw;
        overflow: hidden;
    }
    .topbar .eyebrow { display: none; }
    .brand-block { flex: 1 1 auto; min-width: 0; }
    .brand-title { flex: 1 1 auto; min-width: 0; overflow: hidden; }
    .brand-title h1 {
        font-size: 1.05rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .summary-top {
        order: 3;
        flex: 1 1 100%;
        max-width: 100%;
        gap: 5px;
    }
    .summary-top article { padding: 4px 6px; }
    .summary-top span { font-size: .85rem; }
    .summary-top small { font-size: .52rem; }
    .top-actions {
        gap: 6px;
        margin-left: auto;
        flex: 0 0 auto;
    }
    .top-actions .primary {
        padding: 8px 10px;
        font-size: .72rem;
        white-space: nowrap;
    }
    .top-actions .ghost { font-size: 0; padding: 8px 10px; }
    .top-actions .ghost::after { content: "Salir"; font-size: .72rem; }
    .workspace,
    .module-view,
    #tasks-view,
    #clients-view,
    #download-view {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
        box-sizing: border-box;
    }
    .workspace {
        padding: 10px 10px 16px;
        max-width: 100vw;
    }
    .toolbar {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 8px;
        margin-bottom: 10px;
        width: 100%;
        max-width: 100%;
    }
    .search {
        grid-column: 1 / -1;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0;
    }
    .search input,
    .toolbar select,
    .date-range input,
    .modal input:not([type=range]),
    .modal textarea,
    .modal select {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box;
    }
    .toolbar select {
        font-size: .72rem;
        padding: 10px 26px 10px 8px;
    }
    .check-filter {
        grid-column: 1 / -1;
        font-size: .78rem;
    }
    #clear-filters { grid-column: 1 / -1; width: 100%; }
    .date-range {
        flex-direction: column;
        gap: 8px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    .date-range label {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 5px;
        width: 100%;
        min-width: 0;
    }
    .date-range input { width: 100%; margin-left: 0; }

    .status-tabs {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    .status-tab {
        width: 100%;
        min-width: 0;
        padding: 11px 6px;
        font-size: .74rem;
        white-space: nowrap;
        overflow: hidden;
    }
    .board {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        overflow: hidden;
        height: auto !important;
    }
    .column {
        display: none !important;
        min-height: 0;
        height: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }
    .column.is-active { display: flex !important; }
    .column > header { display: none; }
    .cards {
        min-height: 160px;
        max-height: calc(100vh - 280px);
        padding: 8px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    .task-card {
        margin-bottom: 5px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow: hidden;
    }
    .title-input,
    .client-badge {
        max-width: 100%;
        overflow-wrap: anywhere;
        word-break: break-word;
    }
    .quick-move {
        display: block;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    .add-column {
        width: calc(100% - 20px);
        max-width: 100%;
    }
    .form-grid,
    .form-grid-3 { grid-template-columns: 1fr; }
    .modal {
        width: 100%;
        max-width: 100%;
        max-height: calc(100vh - 24px);
        border-radius: 14px;
    }
    .modal-backdrop {
        padding: 12px;
        align-items: end;
        width: 100%;
        max-width: 100vw;
        box-sizing: border-box;
    }
    .modal form { padding: 8px 16px 18px; }
    .modal > header { padding: 18px 16px 8px; }
    .modal footer { flex-wrap: wrap; }
    .modal footer .primary { flex: 1; }
    .module-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        max-width: 100%;
    }
    .module-header .muted { display: none; }
    .module-header button { width: 100%; }
    .clients-grid,
    .download-grid,
    .client-search {
        grid-template-columns: 1fr;
        max-width: 100% !important;
        width: 100%;
    }
    .login-card { padding: 28px 22px; max-width: 100%; }
    .notice {
        left: 12px;
        right: 12px;
        bottom: 78px;
        max-width: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
