:root {
    --bg: #0b1220;
    --bg-2: #10192a;
    --sidebar: #0a101c;
    --card: #151d2e;
    --card-2: #1b2538;
    --line: #273349;
    --text: #e8eef8;
    --muted: #8b9bb4;
    --blue: #3b82f6;
    --blue-2: #60a5fa;
    --cyan: #22d3ee;
    --green: #34d399;
    --orange: #f59e0b;
    --red: #f87171;
    --ink: var(--text);
    --navy: #1e3a5f;
    --gold: #3b82f6;
    --gold-2: #93c5fd;
    --paper: var(--bg);
    --ok: #059669;
    --warn: #d97706;
    --danger: #dc2626;
    --info: #2563eb;
    --shadow: 0 16px 40px rgba(0, 0, 0, .35);
    --radius: 14px;
    --sidebar-w: 248px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: "DM Sans", "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
}
a { color: var(--blue-2); }
img { max-width: 100%; }

h1, h2, h3, .serif {
    font-family: "DM Sans", "Segoe UI", sans-serif;
    font-weight: 700;
    letter-spacing: -.02em;
    color: var(--text);
}

.auth-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background:
        radial-gradient(900px 400px at 80% -10%, rgba(59,130,246,.18), transparent 45%),
        linear-gradient(180deg, #0b1220, #0a0f18);
}
.auth-wrap { width: min(420px, calc(100% - 32px)); }
.auth-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 32px;
    box-shadow: var(--shadow);
}
.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 22px; }
.brand-mark {
    width: 40px; height: 40px; border-radius: 12px;
    display: grid; place-items: center;
    background: linear-gradient(135deg, #2563eb, #22d3ee);
    color: #fff;
    font-size: 15px; font-weight: 800;
}
.brand strong { display: block; font-size: 20px; line-height: 1.1; }
.brand small { color: var(--muted); }

.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
    background: var(--sidebar);
    color: #c5d0e2;
    padding: 18px 12px;
    position: sticky; top: 0; height: 100vh;
    display: flex; flex-direction: column; gap: 14px;
    border-right: 1px solid var(--line);
}
.sidebar .brand { padding: 4px 8px 10px; margin: 0; }
.sidebar .brand strong { color: #fff; font-size: 18px; }
.sidebar .brand small { color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 14px; overflow: auto; padding-right: 4px; }
.nav-group { display: grid; gap: 2px; }
.nav-label {
    font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
    color: #66758d; padding: 0 10px 4px; font-weight: 700;
}
.nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; border-radius: 10px;
    text-decoration: none; color: #b8c4d8; font-size: 13.5px; font-weight: 500;
}
.nav a svg { width: 18px; height: 18px; flex: none; opacity: .8; }
.nav a:hover { background: rgba(255,255,255,.04); color: #fff; }
.nav a.active { background: rgba(59,130,246,.16); color: #fff; }
.sidebar-foot { margin-top: auto; padding: 10px 6px 0; border-top: 1px solid var(--line); }
.user-chip { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #c5d0e2; }
.user-chip b { display: block; color: #fff; font-weight: 600; }
.user-chip span { color: var(--muted); }

.main { min-width: 0; background: var(--bg); }
.chrome {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 22px;
    border-bottom: 1px solid var(--line);
    background: rgba(11, 18, 32, .92);
    position: sticky; top: 0; z-index: 15;
    backdrop-filter: blur(10px);
}
.top-search {
    flex: 1;
    display: flex; align-items: center; gap: 8px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0 14px;
    max-width: 560px;
}
.top-search svg { width: 16px; height: 16px; color: var(--muted); }
.top-search input {
    border: 0; background: transparent; color: var(--text);
    padding: 10px 0; outline: none;
}
.topbar-page { display: none; }
.top-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.content { padding: 18px 22px 40px; }
.page-head { margin-bottom: 16px; }
.page-head h1 { margin: 0; font-size: 22px; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.bell, .icon-btn {
    width: 40px; height: 40px; border-radius: 12px;
    border: 1px solid var(--line); background: var(--card);
    display: grid; place-items: center; position: relative; cursor: pointer; color: var(--text);
}
.bell svg, .icon-btn svg { width: 18px; height: 18px; }
.bell .dot {
    position: absolute; top: 8px; right: 8px; width: 8px; height: 8px;
    background: #f43f5e; border-radius: 50%;
}
.drop {
    display: none; position: absolute; right: 0; top: 48px; width: 340px;
    background: var(--card-2); border: 1px solid var(--line); border-radius: 14px;
    box-shadow: var(--shadow); z-index: 20; overflow: hidden;
}
.drop.open { display: block; }
.drop h4 { margin: 0; padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 13px; }
.drop a, .drop .empty { display: block; padding: 10px 14px; text-decoration: none; font-size: 13px; border-bottom: 1px solid var(--line); color: var(--text); }
.drop a small { display: block; color: var(--muted); }
.add-menu { min-width: 220px; }
.who {
    display: flex; align-items: center; gap: 8px;
    color: var(--muted); font-size: 13px; padding-left: 6px;
}
.who b { color: var(--text); font-weight: 600; }

.avatar {
    width: 28px; height: 28px; border-radius: 50%;
    display: grid; place-items: center;
    font-size: 11px; font-weight: 700; color: #0b1220;
}
.avatar.lg { width: 36px; height: 36px; font-size: 13px; }
.av-0 { background: #67e8f9; }
.av-1 { background: #86efac; }
.av-2 { background: #fde047; }
.av-3 { background: #fda4af; }
.av-4 { background: #c4b5fd; }
.av-5 { background: #93c5fd; }
.av-6 { background: #fdba74; }
.av-7 { background: #5eead4; }

.chips { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.chip {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--card); border: 1px solid var(--line);
    border-radius: 999px; padding: 8px 12px; font-size: 13px; color: var(--muted);
}
.chip b { color: var(--text); font-size: 15px; }
.chip .mark { width: 8px; height: 8px; border-radius: 50%; }
.mark.green { background: var(--green); }
.mark.orange { background: var(--orange); }
.mark.blue { background: var(--blue); }

.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.card, .panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.kpi { padding: 16px 16px 14px; }
.kpi small { color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-size: 10px; }
.kpi strong { display: block; font-size: 28px; line-height: 1.1; margin: 6px 0 2px; color: #fff; }
.kpi span { color: var(--muted); font-size: 12px; }
.panel { padding: 16px; }
.panel h2 { margin: 0 0 12px; font-size: 16px; }

.grid-2 { display: grid; grid-template-columns: 1.4fr .9fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.mt { margin-top: 14px; }
.stack { display: grid; gap: 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

.btn, button.btn, a.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border: 0; border-radius: 10px; padding: 9px 13px; cursor: pointer;
    text-decoration: none; font-weight: 600; font-size: 13px;
    background: var(--blue); color: #fff;
}
.btn.gold { background: var(--blue); color: #fff; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: #b91c1c; }
.btn.ok { background: #059669; }
.btn.sm { padding: 6px 9px; font-size: 12px; }

label { display: grid; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 600; }
input, select, textarea {
    width: 100%; border: 1px solid var(--line); background: #0f1726;
    border-radius: 10px; padding: 10px 12px; font: inherit; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 1px solid rgba(59,130,246,.6); }
textarea { min-height: 88px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: 8px; border-bottom: 1px solid var(--line); }
td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:hover td { background: rgba(255,255,255,.03); }
.table-wrap { overflow: auto; }

.badge {
    display: inline-flex; align-items: center; padding: 3px 8px;
    border-radius: 999px; font-size: 11px; font-weight: 600; background: #243044; color: #dbe7f6;
}
.badge.ok { background: rgba(52,211,153,.15); color: #6ee7b7; }
.badge.warn { background: rgba(245,158,11,.15); color: #fbbf24; }
.badge.danger { background: rgba(248,113,113,.15); color: #fca5a5; }
.badge.info { background: rgba(59,130,246,.18); color: #93c5fd; }
.badge.navy { background: rgba(147,197,253,.12); color: #bfdbfe; }
.badge.gold { background: rgba(34,211,238,.15); color: #67e8f9; }
.badge.muted { background: #243044; color: var(--muted); }

.flash { padding: 10px 12px; border-radius: 10px; margin-bottom: 12px; font-size: 14px; }
.flash.ok { background: rgba(52,211,153,.12); color: #6ee7b7; }
.flash.erro { background: rgba(248,113,113,.12); color: #fca5a5; }
.hint { color: var(--muted); font-size: 13px; }
.plain { padding-left: 18px; color: var(--muted); }
.tabs { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.tabs a, .tabs button {
    border: 0; background: transparent; border-radius: 0;
    padding: 8px 0 12px; text-decoration: none; font-size: 13px; cursor: pointer;
    color: var(--muted); font-weight: 600;
}
.tabs a.active, .tabs button.active { color: #fff; box-shadow: inset 0 -2px 0 var(--blue); }

.alert-list { display: grid; gap: 8px; }
.alert-item {
    padding: 10px 12px; border-radius: 12px; background: var(--card-2);
    border: 1px solid var(--line); font-size: 13px;
}
.alert-item b { display: block; }
.searchbar { display: flex; gap: 8px; }
.searchbar input { max-width: 360px; }

.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.pje-box {
    background: rgba(59,130,246,.08); border: 1px dashed var(--line); border-radius: 12px; padding: 12px; font-size: 13px;
}

.file-head {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px 18px;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
}
.file-kicker {
    font-size: 11px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 600;
}
.file-head strong {
    display: block;
    font-size: 24px;
    line-height: 1.1;
    margin: 2px 0 8px;
}
.file-meta { display: flex; flex-wrap: wrap; gap: 8px 14px; color: var(--muted); font-size: 13px; }
.file-tabs {
    display: flex;
    gap: 0;
    margin: 14px 0;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: auto;
}
.file-tabs a {
    flex: 1;
    min-width: 140px;
    text-align: center;
    text-decoration: none;
    padding: 12px 16px;
    font-weight: 600;
    font-size: 13px;
    color: var(--muted);
    border-right: 1px solid var(--line);
}
.file-tabs a:last-child { border-right: 0; }
.file-tabs a:hover { background: var(--card-2); color: var(--text); }
.file-tabs a.active { background: rgba(59,130,246,.16); color: #fff; }
.file-tabs a em {
    display: inline-grid;
    place-items: center;
    min-width: 20px;
    height: 20px;
    margin-left: 6px;
    padding: 0 6px;
    border-radius: 999px;
    font-style: normal;
    font-size: 11px;
    background: rgba(255,255,255,.08);
}
.file-tabs a:not(.active) em { background: #243044; color: var(--text); }
.insert-box {
    background: var(--card-2);
    border: 1px dashed var(--line);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 8px;
}

.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.kanban {
    display: grid;
    grid-template-columns: repeat(5, minmax(220px, 1fr));
    gap: 12px;
    overflow: auto;
    padding-bottom: 8px;
    align-items: start;
}
.kanban-col {
    background: rgba(15, 23, 38, .7);
    border: 1px solid var(--line);
    border-radius: 14px;
    min-height: 280px;
    padding: 10px;
    transition: border-color .15s ease, background .15s ease;
}
.kanban-col.drag-over {
    border-color: var(--blue);
    background: rgba(59, 130, 246, .08);
}
.kanban-list { display: grid; gap: 10px; min-height: 140px; align-content: start; }
.kanban-empty { color: var(--muted); font-size: 12px; padding: 18px 8px; text-align: center; display: none; }
.kanban-list:not(:has(.task-card)) .kanban-empty { display: block; }
.task-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px;
    cursor: grab;
}
.task-card:active { cursor: grabbing; }
.task-card.dragging { opacity: .35; }
.task-top { display: flex; align-items: flex-start; gap: 8px; }
.task-top h3 { flex: 1; }
.task-grip {
    width: 10px; height: 16px; margin-top: 2px; flex: none;
    background: radial-gradient(circle, var(--muted) 1.2px, transparent 1.4px);
    background-size: 5px 5px;
    opacity: .7;
}
.task-card h3 { margin: 0 0 6px; font-size: 14px; font-weight: 650; }
.task-card p { margin: 0; color: var(--muted); font-size: 12px; }
.task-sub { margin-top: 2px !important; }
.task-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.task-date { font-size: 12px; color: var(--muted); }
.task-date.late { color: #f87171; }
.task-actions { display: flex; gap: 6px; margin-top: 10px; }

.timeline { display: grid; gap: 10px; }
.tl-item {
    display: grid; grid-template-columns: 120px 1fr;
    gap: 12px; padding: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 12px;
}
.tl-item small { color: var(--muted); }

.task-meta { display: flex; align-items: center; gap: 8px; }
.task-docs { font-size: 12px; color: var(--muted); }
.task-overlay {
    position: fixed; inset: 0; z-index: 50;
    background: rgba(4, 8, 16, .72);
    display: grid; place-items: center;
    padding: 24px 16px;
}
.task-overlay[hidden] { display: none; }
.task-dialog {
    width: min(860px, 100%);
    max-height: calc(100vh - 48px);
    overflow: auto;
    background: #1a2436;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 22px 22px 18px;
    position: relative;
    box-shadow: var(--shadow);
}
.task-close {
    position: absolute; top: 12px; right: 12px;
    width: 36px; height: 36px; border: 0; border-radius: 10px;
    background: var(--card); color: var(--text); font-size: 22px; cursor: pointer;
}
.task-layout { display: grid; grid-template-columns: 1fr 220px; gap: 18px; }
.task-title {
    font-size: 22px; font-weight: 700; background: transparent;
    border: 0; border-bottom: 1px solid transparent; padding: 4px 0 8px;
}
.task-title:focus { border-bottom-color: var(--blue); }
.task-main h3 { font-size: 14px; margin: 16px 0 8px; }
.task-side { display: grid; gap: 10px; align-content: start; }
.task-files, .task-comments { display: grid; gap: 8px; }
.file-row, .comment-row {
    display: flex; gap: 10px; align-items: center;
    background: var(--card); border: 1px solid var(--line);
    border-radius: 10px; padding: 8px 10px; font-size: 13px;
}
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}
.media-card {
    display: grid;
    gap: 6px;
    text-decoration: none;
    color: var(--text);
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    font-size: 12px;
}
.media-card img { width: 100%; height: 110px; object-fit: cover; background: #0b1220; display: block; }
.media-card a { color: inherit; text-decoration: none; }
.media-card span { display: block; padding: 8px; }
.media-card form { padding: 0 8px 8px; }
.media-video video { width: 100%; max-height: 320px; border-radius: 12px; background: #000; }
.file-row audio { width: min(320px, 100%); }
.comment-row .avatar { flex: none; }
.comment-row div { flex: 1; }
.comment-row b { display: block; }
.comment-row small { color: var(--muted); }

.menu-btn { display: none; }

@media (max-width: 1200px) {
    .kanban { grid-template-columns: repeat(5, 240px); }
}
@media (max-width: 860px) {
    .task-layout { grid-template-columns: 1fr; }
}
@media (max-width: 1100px) {
    .cards, .grid-3 { grid-template-columns: 1fr 1fr; }
    .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
    .app { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed; inset: 0 auto 0 0; transform: translateX(-105%);
        z-index: 30; transition: .2s ease; width: var(--sidebar-w);
    }
    .sidebar.open { transform: none; }
    .menu-btn { display: inline-flex; }
    .content, .chrome { padding-left: 16px; padding-right: 16px; }
    .cards, .form-grid, .grid-3 { grid-template-columns: 1fr; }
    .top-search { max-width: none; }
    .who span { display: none; }
    .tl-item { grid-template-columns: 1fr; }
}
