/* Dev Solution Code — sistema interno de projetos
   Ver .devin/skills/design-sistema/SKILL.md para as diretrizes. */

:root {
    --bg: #F7F6F3;
    --surface: #FFFFFF;
    --ink: #191817;
    --muted: #6E6A63;
    --line: #E7E4DE;
    --accent: #4F46E5;
    --accent-ink: #3730A3;
    --accent-soft: #EEF0FE;
    --danger: #B42318;
    --danger-soft: #FEF3F2;
    --ok: #067647;
    --ok-soft: #EDF9F1;
    --warn: #B54708;
    --warn-soft: #FDF4E7;
    --info: #175CD3;
    --info-soft: #EFF6FF;
    --radius: 10px;
    --radius-sm: 7px;
    --rail: #1B1A17;
    --rail-ink: #C9C6BF;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--ink);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Layout ---------- */
.shell { display: flex; min-height: 100vh; }

.rail {
    width: 236px;
    flex-shrink: 0;
    background: var(--rail);
    color: var(--rail-ink);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 22px 14px;
}

.rail .brand {
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: .2px;
    padding: 4px 10px 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.rail .brand .mark {
    width: 26px; height: 26px; border-radius: 8px;
    background: linear-gradient(135deg, #6D64F0, #4F46E5);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 800; color: #fff;
}
.rail .brand small { display: block; color: #8B8880; font-weight: 500; font-size: 11px; }

.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.nav .nav-label {
    font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em;
    color: #7A776F; padding: 16px 10px 6px;
}
.nav a {
    color: var(--rail-ink);
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 500;
    display: flex; align-items: center; gap: 9px;
}
.nav a:hover { background: #2A2823; color: #fff; text-decoration: none; }
.nav a.active { background: #35322B; color: #fff; }
.nav a svg { width: 16px; height: 16px; opacity: .8; flex-shrink: 0; }

.rail .rail-foot { margin-top: auto; border-top: 1px solid #2E2C27; padding-top: 12px; }
.rail .user-chip { display: flex; align-items: center; gap: 9px; padding: 6px 10px; }
.rail .avatar {
    width: 28px; height: 28px; border-radius: 50%;
    background: #3C3932; color: #E8E6E0;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.rail .user-chip .who { min-width: 0; }
.rail .user-chip .who b { display: block; color: #EFEDE8; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail .user-chip .who span { font-size: 11px; color: #8B8880; }
.rail form.logout { margin: 4px 0 0; }
.rail form.logout button {
    width: 100%; text-align: left; background: none; border: 0; cursor: pointer;
    color: #8B8880; font: inherit; font-size: 12.5px; padding: 7px 10px; border-radius: var(--radius-sm);
}
.rail form.logout button:hover { background: #2A2823; color: #fff; }

.main { flex: 1; min-width: 0; padding: 34px 40px 60px; }
.container { max-width: 1120px; margin: 0 auto; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.page-head .kicker {
    font-size: 11.5px; text-transform: uppercase; letter-spacing: .1em;
    color: var(--muted); font-weight: 600; margin-bottom: 4px;
}
.page-head h1 { font-size: 27px; font-weight: 650; letter-spacing: -.02em; margin: 0; line-height: 1.2; }
.page-head .sub { color: var(--muted); margin-top: 5px; font-size: 13.5px; }
.page-head .actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 7px;
    font: inherit; font-size: 13.5px; font-weight: 550;
    padding: 8px 14px; border-radius: var(--radius-sm);
    border: 1px solid transparent; cursor: pointer;
    transition: background .12s, border-color .12s;
    white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); }
.btn-secondary { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-secondary:hover { border-color: #CFCCC4; background: #FBFAF8; }
.btn-danger { background: none; border-color: var(--line); color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-link { background: none; border: 0; color: var(--accent-ink); cursor: pointer; font: inherit; font-size: 13px; padding: 0; }
.btn-link:hover { text-decoration: underline; }
.btn[disabled] { opacity: .55; cursor: default; }

/* ---------- Flash / errors ---------- */
.flash {
    padding: 11px 15px; border-radius: var(--radius-sm); margin-bottom: 18px;
    font-size: 13.5px; border: 1px solid;
}
.flash-ok { background: var(--ok-soft); border-color: #BEE7CD; color: var(--ok); }
.flash-err { background: var(--danger-soft); border-color: #F3C3BD; color: var(--danger); }
.flash-warn { background: var(--warn-soft); border-color: #F0D9B5; color: var(--warn); }

.field-error { color: var(--danger); font-size: 12.5px; margin-top: 4px; }

/* ---------- Cards & panels ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px 22px;
}
.card + .card { margin-top: 16px; }
.card h2 { font-size: 15px; font-weight: 650; margin: 0 0 14px; letter-spacing: -.01em; }
.card h3 { font-size: 13.5px; font-weight: 650; margin: 18px 0 8px; }

/* ---------- Tables / lists ---------- */
.list { border-top: 1px solid var(--line); }
.list-row {
    display: flex; align-items: center; gap: 14px;
    padding: 13px 4px; border-bottom: 1px solid var(--line);
}
.list-row:hover { background: #FBFAF7; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .title { font-weight: 580; font-size: 14px; }
.list-row .title a { color: var(--ink); }
.list-row .title a:hover { color: var(--accent-ink); }
.list-row .meta { color: var(--muted); font-size: 12.5px; margin-top: 2px; display: flex; gap: 12px; flex-wrap: wrap; }
.list-row .end { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.empty { color: var(--muted); font-size: 13.5px; padding: 22px 4px; text-align: center; }

/* ---------- Pills ---------- */
.pill {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 11.5px; font-weight: 600; line-height: 1;
    padding: 4.5px 9px; border-radius: 999px; white-space: nowrap;
}
.pill::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.pill-neutral { background: #F1F0EC; color: #57534A; }
.pill-info { background: var(--info-soft); color: var(--info); }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-danger { background: var(--danger-soft); color: var(--danger); }
.pill-accent { background: var(--accent-soft); color: var(--accent-ink); }
.pill-mute { background: #F4F3F0; color: var(--muted); }

.tag {
    display: inline-flex; font-size: 11px; font-weight: 600; color: var(--muted);
    border: 1px solid var(--line); border-radius: 6px; padding: 2.5px 7px; background: #FBFAF7;
}

/* ---------- Metrics ---------- */
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 26px; }
.metric { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.metric .num { font-size: 30px; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; }
.metric .lbl { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.metric.danger .num { color: var(--danger); }
.metric.warn .num { color: var(--warn); }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 5px; color: #3B3833; }
.field .hint { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.field input[type=text], .field input[type=email], .field input[type=password],
.field input[type=date], .field input[type=number], .field input[type=url],
.field select, .field textarea {
    width: 100%; font: inherit; font-size: 14px;
    padding: 8px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--ink);
}
.field textarea { min-height: 90px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
    outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent);
}
.checks { display: flex; gap: 14px; flex-wrap: wrap; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; cursor: pointer; }
.check input { accent-color: var(--accent); width: 15px; height: 15px; }

.filters {
    display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 14px 16px; margin-bottom: 18px;
}
.filters .field { min-width: 140px; flex: 0 1 auto; }
.filters .field.grow { flex: 1 1 180px; }
.filters label { font-size: 11px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 22px; overflow-x: auto; }
.tabs a {
    padding: 9px 13px; font-size: 13.5px; font-weight: 550; color: var(--muted);
    border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.active { color: var(--ink); border-bottom-color: var(--accent); }

/* ---------- Progress ---------- */
.progress { height: 6px; background: #EDECE8; border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.progress-label { font-size: 12px; color: var(--muted); }

/* ---------- Project overview ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-2 > .card { min-width: 0; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

.defs { display: grid; grid-template-columns: 130px 1fr; gap: 8px 14px; font-size: 13.5px; }
.defs dt { color: var(--muted); }
.defs dd { margin: 0; }

/* ---------- Members ---------- */
.member-list { display: flex; flex-direction: column; gap: 8px; }
.member-row { display: flex; gap: 10px; align-items: center; }
.member-row select { flex: 1; }
.member-row input { width: 180px; }

/* ---------- Doc checklist picker ---------- */
.docpick { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.docpick-group { border-bottom: 1px solid var(--line); }
.docpick-group:last-child { border-bottom: 0; }
.docpick-group > .gh { padding: 10px 16px; background: #FBFAF7; font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.docpick-item { display: flex; gap: 10px; align-items: center; padding: 9px 16px; border-top: 1px solid #F0EFEB; }
.docpick-item input[type=checkbox] { accent-color: var(--accent); flex-shrink: 0; }
.docpick-item input[type=text] {
    flex: 1; font: inherit; font-size: 13.5px; border: 1px solid transparent;
    border-radius: 6px; padding: 5px 8px; background: transparent;
}
.docpick-item input[type=text]:hover, .docpick-item input[type=text]:focus { border-color: var(--line); background: var(--surface); }
.docpick-item .cat { font-size: 11px; color: var(--muted); white-space: nowrap; }

/* ---------- Daily logs ---------- */
.log-entry { border-bottom: 1px solid var(--line); padding: 16px 4px; }
.log-entry:last-child { border-bottom: 0; }
.log-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.log-head .date { font-weight: 650; font-size: 14px; }
.log-head .who { color: var(--muted); font-size: 12.5px; }
.log-body { margin-top: 7px; font-size: 14px; }
.log-extra { margin-top: 7px; font-size: 13px; color: var(--muted); }
.log-extra b { color: var(--warn); font-weight: 600; }
.log-extra .next b { color: var(--info); }
.log-tasks { margin-top: 7px; display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Chat ---------- */
.chat { display: flex; flex-direction: column; gap: 12px; margin-bottom: 18px; }
.chat-msg { max-width: 78%; padding: 11px 15px; border-radius: 14px; font-size: 14px; white-space: pre-wrap; }
.chat-msg.user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg.assistant { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.chat-msg .when { display: block; font-size: 10.5px; opacity: .65; margin-top: 5px; }
.chat-form { display: flex; gap: 10px; }
.chat-form textarea { flex: 1; min-height: 46px; max-height: 140px; }
.chat-suggest { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }

/* ---------- Pagination ---------- */
.pagination { display: flex; gap: 5px; margin-top: 18px; font-size: 13px; align-items: center; }
.pagination a, .pagination span {
    padding: 5px 10px; border-radius: 6px; border: 1px solid var(--line);
    background: var(--surface); color: var(--ink);
}
.pagination span.current { background: var(--ink); color: #fff; border-color: var(--ink); }
.pagination a:hover { text-decoration: none; border-color: #CFCCC4; }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card {
    width: 380px; background: var(--surface); border: 1px solid var(--line);
    border-radius: 14px; padding: 34px 32px;
}
.auth-card .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; margin-bottom: 6px; }
.auth-card .brand .mark {
    width: 30px; height: 30px; border-radius: 9px;
    background: linear-gradient(135deg, #6D64F0, #4F46E5);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 800; color: #fff;
}
.auth-card h1 { font-size: 19px; font-weight: 650; margin: 14px 0 2px; }
.auth-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 22px; }
.auth-card .field { margin-bottom: 14px; }
.auth-card .btn { width: 100%; justify-content: center; margin-top: 6px; }

/* ---------- Utility ---------- */
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.mb0 { margin-bottom: 0; }
.mt16 { margin-top: 16px; }
.overdue { color: var(--danger); font-weight: 600; }
.soon { color: var(--warn); font-weight: 600; }
.section-title { font-size: 16px; font-weight: 650; margin: 28px 0 12px; letter-spacing: -.01em; }
.inline-form { display: inline; }
.hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
    .shell { flex-direction: column; }
    .rail {
        width: 100%; height: auto; position: static; flex-direction: row;
        align-items: center; padding: 10px 14px; flex-wrap: wrap; gap: 4px;
    }
    .rail .brand { padding: 4px 8px; }
    .nav { flex-direction: row; flex-wrap: wrap; margin-top: 0; }
    .nav .nav-label { display: none; }
    .rail .rail-foot { margin: 0 0 0 auto; border: 0; padding: 0; display: flex; align-items: center; }
    .main { padding: 22px 16px 50px; }
    .metrics { grid-template-columns: repeat(2, 1fr); }
    .form-grid { grid-template-columns: 1fr; }
    .chat-msg { max-width: 92%; }
}
