:root {
    --bg: #0b0f1a;
    --panel: #0f172a;
    --accent: #00e6ff;
    --accent2: #7c3aed;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --danger: #ff477e;
    --ok: #22c55e;
    --shadow: 0 10px 30px rgba(0,0,0,.4), inset 0 0 30px rgba(124,58,237,.2);
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    margin: 0;
    font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, Helvetica, sans-serif;
    background: radial-gradient(1000px 600px at 10% 0%, rgba(0,230,255,.08), transparent),
                radial-gradient(800px 500px at 90% 20%, rgba(124,58,237,.08), transparent),
                linear-gradient(180deg, #070a12, #0b0f1a 50%, #0a0e19);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

.container {
    max-width: 1400px;
    margin: 24px auto;
    padding: 16px;
}

.app-card {
    background: linear-gradient(180deg, rgba(15,23,42,.85), rgba(15,23,42,.92));
    border: 1px solid rgba(124,58,237,.22);
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(6px);
    position: relative;
    overflow: hidden;
}

.app-card::before {
    content: "";
    position: absolute;
    inset: -2px -2px auto auto;
    width: 220px;
    height: 220px;
    background: radial-gradient(circle at 30% 30%, rgba(0,230,255,.25), transparent 60%),
                radial-gradient(circle at 70% 70%, rgba(124,58,237,.25), transparent 60%);
    filter: blur(30px);
    opacity: .4;
    pointer-events: none;
}

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.title {
    font-size: clamp(20px, 3vw, 28px);
    font-weight: 800;
    letter-spacing: .3px;
    text-shadow: 0 0 15px rgba(0,230,255,.25);
    margin: 0;
}

.btn {
    appearance: none;
    border: 1px solid rgba(0,230,255,.4);
    color: var(--text);
    background: linear-gradient(180deg, rgba(0,230,255,.1), rgba(124,58,237,.1));
    padding: 12px 16px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: transform .12s ease, box-shadow .15s ease, border-color .15s ease;
    box-shadow: 0 6px 20px rgba(0,230,255,.12), inset 0 0 20px rgba(0,230,255,.08);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
}

.btn:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    box-shadow: 0 10px 26px rgba(0,230,255,.22), inset 0 0 22px rgba(0,230,255,.12);
}

.btn:active {
    transform: translateY(0) scale(.98);
}

.btn-primary {
    border-color: rgba(124,58,237,.5);
}

.btn-danger {
    border-color: rgba(255,71,126,.5);
    background: linear-gradient(180deg, rgba(255,71,126,.12), rgba(124,58,237,.08));
}

.btn-danger:hover {
    border-color: var(--danger);
    box-shadow: 0 10px 26px rgba(255,71,126,.22), inset 0 0 22px rgba(255,71,126,.12);
}

.grid {
    margin-top: 18px;
    background: rgba(2,6,23,.35);
    border: 1px solid rgba(124,58,237,.18);
    border-radius: 14px;
    overflow: hidden;
}

.grid-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    text-align: left;
    padding: 14px 12px;
    font-size: 14px;
    color: var(--muted);
    background: linear-gradient(180deg, rgba(30,41,59,.6), rgba(15,23,42,.6));
}

tbody td {
    padding: 14px 12px;
    border-top: 1px solid rgba(124,58,237,.12);
    font-size: 15px;
}

.row-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    pointer-events: auto;
}

.header-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(0,230,255,.08), rgba(124,58,237,.08));
    border: 1px solid rgba(124,58,237,.24);
    box-shadow: inset 0 0 18px rgba(124,58,237,.12);
    font-weight: 600;
    color: var(--text);
}

.totais {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    flex-wrap: wrap;
    padding: 14px;
    background: linear-gradient(180deg, rgba(2,6,23,.5), rgba(15,23,42,.7));
    border-top: 1px solid rgba(124,58,237,.18);
}

.muted {
    color: var(--muted);
}

.modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: radial-gradient(60% 60% at 50% 50%, rgba(2,6,23,.7), rgba(2,6,23,.92));
    z-index: 50;
}

.modal.active {
    display: flex;
}

.modal-card {
    width: 100%;
    max-width: 520px;
    background: linear-gradient(180deg, rgba(15,23,42,.95), rgba(15,23,42,.98));
    border: 1px solid rgba(0,230,255,.25);
    border-radius: 16px;
    padding: 18px;
    box-shadow: var(--shadow);
}

#modalRelatorios .modal-card {
    max-width: 920px;
}

.form-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.field {
    flex: 1;
    min-width: 180px;
}

label {
    display: block;
    margin: 6px 4px;
    font-size: 13px;
    color: var(--muted);
}

input[type="text"], 
input[type="date"], 
input[type="number"],
input[type="password"],
input[type="email"],
textarea,
select {
    width: 100%;
    padding: 12px 12px;
    border-radius: 12px;
    border: 1px solid rgba(124,58,237,.28);
    background: linear-gradient(180deg, rgba(2,6,23,.6), rgba(15,23,42,.8));
    color: var(--text);
    font-family: inherit;
    font-size: 15px;
    transition: border-color .15s ease, box-shadow .15s ease;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 12px rgba(0,230,255,.15);
}

/* Kanban Board Styles adapted to new theme */
.board-view {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 20px;
    min-height: calc(100vh - 250px);
}

.list-container {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(124, 58, 237, 0.2);
    border-radius: 14px;
    width: 300px;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    max-height: fit-content;
    flex-shrink: 0;
}

.list-header {
    padding: 10px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(124, 58, 237, 0.15);
}

.list-title {
    font-weight: 700;
    font-size: 16px;
    color: var(--text);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.2s;
}

.list-title:hover {
    background: rgba(0, 230, 255, 0.1);
}

.cards-list {
    padding: 8px 12px;
    min-height: 30px;
    max-height: calc(100vh - 450px);
    overflow-y: auto;
}

.cards-list::-webkit-scrollbar {
    width: 4px;
}

.cards-list::-webkit-scrollbar-thumb {
    background: rgba(124, 58, 237, 0.2);
    border-radius: 4px;
}

.card {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(124, 58, 237, 0.1);
    border-radius: 6px;
    padding: 6px !important;
    margin-bottom: 6px;
    min-height: 0 !important;
    width: 100%;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(0, 230, 255, 0.15);
    transform: translateY(-1px);
}

.card-ghost {
    opacity: 0.4;
    background: var(--accent2) !important;
}

.list-ghost {
    opacity: 0.5;
    background: rgba(124, 58, 237, 0.2) !important;
    border: 2px dashed var(--accent2) !important;
}

.list-header {
    cursor: grab;
}

.list-header:active {
    cursor: grabbing;
}

.card-content {
    font-size: 12px;
    line-height: 1.2;
    color: var(--text);
    word-break: break-word;
}

.card-content strong {
    font-size: 13px;
    margin-bottom: 2px !important;
}

.card-content small {
    font-size: 11px;
}

.add-card-btn, .add-list-btn {
    width: 100%;
    background: transparent;
    border: 1px dashed rgba(124, 58, 237, 0.4);
    color: var(--muted);
    padding: 10px;
    border-radius: 10px;
    cursor: pointer;
    margin-top: 5px;
    transition: 0.2s;
}

.add-card-btn:hover, .add-list-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(0, 230, 255, 0.05);
}

/* Navbar */
.navbar {
    padding: 16px 0;
    border-bottom: 1px solid rgba(124, 58, 237, 0.15);
    background: rgba(7, 10, 18, 0.8);
    backdrop-filter: blur(10px);
}

.navbar .container {
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-weight: 800;
    font-size: 24px;
    text-decoration: none;
    color: var(--text);
    text-shadow: 0 0 10px rgba(0, 230, 255, 0.3);
}

.logo span {
    color: var(--accent);
}

.slogan {
    color: var(--muted);
    font-size: 12px;
    margin-left: 12px;
}

.nav-links {
    display: flex;
    gap: 20px;
    align-items: center;
}

.user-welcome {
    font-size: 14px;
    color: var(--muted);
}

/* SweetAlert Custom Styles */
.swal2-popup {
    border: 1px solid rgba(124, 58, 237, 0.4) !important;
    border-radius: 20px !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6) !important;
    padding: 20px !important;
}

.swal2-title {
    font-weight: 800 !important;
    letter-spacing: 0.5px !important;
}

.swal2-input, .swal2-textarea {
    background: #0b0f1a !important;
    color: white !important;
    border: 1px solid rgba(124, 58, 237, 0.3) !important;
    border-radius: 12px !important;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3) !important;
    width: 100% !important;
    margin: 0 0 0 0 !important;
    box-sizing: border-box !important;
    display: block !important;
    padding: 12px !important;
}

.swal2-input:focus, .swal2-textarea:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 10px rgba(0, 230, 255, 0.2) !important;
}

.swal2-confirm {
    border-radius: 12px !important;
    font-weight: 600 !important;
    padding: 12px 25px !important;
}

.swal2-cancel {
    border-radius: 12px !important;
    font-weight: 600 !important;
    padding: 12px 25px !important;
}

/* Responsividade Geral */
@media (max-width: 992px) {
    .container {
        padding: 12px;
        margin: 12px auto;
    }
    .board-view {
        flex-direction: column;
        gap: 20px;
        overflow-x: hidden;
    }
    .list-container {
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
    }
    .list-header,
    .cards-list {
        width: 100%;
    }
}

@media (min-width: 1920px) {
    .container {
        max-width: 1700px;
    }
}

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .header-actions {
        width: 100%;
        display: flex;
        gap: 10px;
    }

    .btn {
        flex: 1;
        width: 100%;
        justify-content: center;
    }

    .row-actions {
        width: 100%;
        display: flex;
        gap: 8px;
    }

    .row-actions .btn {
        flex: 1;
        padding: 10px;
    }

    /* Dashboard Table to Cards - RE-FORCED */
    .grid table {
        display: block !important;
        width: 100% !important;
    }

    .grid thead {
        display: none !important;
    }

    .grid tbody {
        display: block !important;
        width: 100% !important;
    }

    .grid tr {
        display: block !important;
        width: 100% !important;
        border-bottom: 1px solid rgba(124, 58, 237, 0.2) !important;
        padding: 15px 10px !important;
        margin-bottom: 5px;
    }

    .grid td {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        border: none !important;
        padding: 8px 0 !important;
        text-align: right !important;
        width: 100% !important;
    }

    .grid td::before {
        content: attr(data-label);
        font-weight: 700;
        color: var(--muted);
        text-align: left;
        margin-right: 15px;
    }

    .grid td:last-child {
        display: block !important;
        text-align: center !important;
        padding-top: 15px !important;
    }

    .grid td:last-child::before {
        display: none !important;
    }

    .totais {
        justify-content: center;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .chip {
        width: 100%;
        justify-content: center;
    }

    /* Kanban Board Mobile */
    .board-view {
        padding: 10px 5px;
        margin: 0; 
        display: flex;
        flex-direction: column; /* Stacked lists */
        gap: 20px;
        overflow-x: hidden;
    }

    .list-container {
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        scroll-snap-align: none;
    }

    .cards-list {
        max-height: none; /* Let cards flow naturally on mobile */
    }

    /* Navbar Mobile */
    .list-header,
    .cards-list {
        width: 100%;
        padding-left: 10px;
        padding-right: 10px;
    }
    .card { width: 100%; }
    .navbar .container {
        flex-direction: column;
        gap: 15px;
    }

    .nav-links {
        width: 100%;
        justify-content: center;
    }
}

/* List header action buttons slightly larger */
.list-header .row-actions button {
    font-size: 16px;
}
.list-header .row-actions button i {
    font-size: 18px;
}
@media (max-width: 480px) {
    .title {
        font-size: 22px;
    }

    .app-card {
        padding: 15px;
        overflow: visible;
    }

    .list-container {
        width: 90vw !important;
    }

    /* Auth pages centering */
    div[style*="margin: 60px auto"] {
        margin: 20px auto !important;
        padding: 0 10px;
    }
}
