/* ==========================================================================
   Kanban — tema escuro
   ========================================================================== */

:root {
    --bg-app: #14151a;
    --bg-panel: #1b1c22;
    --bg-elevated: #22232b;
    --bg-hover: #292a33;
    --border: #2c2d36;
    --border-soft: #34353f;
    --text-primary: #ececed;
    --text-secondary: #9a9ba5;
    --text-muted: #6b6c78;
    --accent: #7c6cf0;
    --accent-hover: #8f81f5;
    --accent-soft: rgba(124, 108, 240, 0.15);
    --success: #00b894;
    --warning: #e1b12c;
    --danger: #e74c3c;
    --danger-soft: rgba(231, 76, 60, 0.15);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    background: var(--bg-app);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ---------- layout shell ---------- */

.app-shell {
    display: flex;
    min-height: 100vh;
}

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

/* ---------- sidebar ---------- */

.sidebar {
    width: 220px;
    flex-shrink: 0;
    background: var(--bg-panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 18px 12px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px 22px;
}

.brand-mark {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--accent), var(--brand-secondary, #4834d4));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.brand-logo {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

.brand-name {
    font-weight: 600;
    font-size: 15px;
    letter-spacing: 0.2px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}

.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-soft);
    color: var(--accent-hover);
}

.sidebar-footer {
    border-top: 1px solid var(--border);
    padding-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
}

.avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--brand-tertiary-soft, var(--accent-soft));
    color: var(--brand-tertiary, var(--accent-hover));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.user-chip-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.user-chip-name {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-chip-role {
    font-size: 11px;
    color: var(--text-muted);
}

.logout-link:hover { color: var(--danger); }

/* ---------- topbar / page header ---------- */

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 28px;
    border-bottom: 1px solid var(--border);
    gap: 16px;
    flex-wrap: wrap;
}

.page-header h1 {
    font-size: 19px;
    font-weight: 700;
    margin: 0;
}

.page-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-body {
    padding: 24px 28px;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* ---------- flash messages ---------- */

.flash-stack {
    padding: 14px 28px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.flash {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
}

.flash-success { background: rgba(0,184,148,0.15); color: #55efc4; border: 1px solid rgba(0,184,148,0.3); }
.flash-error { background: var(--danger-soft); color: #ff7675; border: 1px solid rgba(231,76,60,0.3); }
.flash-info { background: var(--accent-soft); color: var(--accent-hover); border: 1px solid var(--accent-soft); }

/* ---------- buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-soft);
    background: var(--bg-elevated);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.btn:hover { background: var(--bg-hover); }

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-danger {
    background: transparent;
    border-color: rgba(231,76,60,0.4);
    color: #ff7675;
}

.btn-danger:hover { background: var(--danger-soft); }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 7px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- forms ---------- */

.form-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 520px;
}

.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-row.inline { flex-direction: row; gap: 16px; }
.form-row.inline > * { flex: 1; }

label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
}

input[type=text], input[type=email], input[type=password], input[type=date], input[type=color],
textarea, select {
    background: var(--bg-elevated);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    color: var(--text-primary);
    font-size: 13.5px;
    font-family: inherit;
    width: 100%;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent);
}

textarea { resize: vertical; min-height: 80px; }

.checkbox-group { display: flex; flex-wrap: wrap; gap: 8px; }
.checkbox-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--border-soft);
    background: var(--bg-elevated);
    font-size: 12.5px;
    cursor: pointer;
}
.checkbox-pill input { width: auto; }

.form-actions {
    display: flex;
    gap: 10px;
    padding-top: 6px;
}

.form-error {
    color: #ff7675;
    font-size: 12.5px;
}

/* ---------- tables ---------- */

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.data-table th, .data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 13.5px;
}

.data-table th {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    background: var(--bg-elevated);
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-hover); }

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-admin { background: var(--accent-soft); color: var(--accent-hover); }
.badge-user { background: rgba(154,155,165,0.15); color: var(--text-secondary); }
.badge-active { background: rgba(0,184,148,0.15); color: #55efc4; }
.badge-inactive { background: var(--danger-soft); color: #ff7675; }

.table-actions { display: flex; gap: 8px; }

.empty-state {
    padding: 48px 20px;
    text-align: center;
    color: var(--text-muted);
}

/* ---------- login ---------- */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 20% 20%, var(--accent-soft), transparent 45%),
                radial-gradient(circle at 80% 80%, var(--brand-tertiary-soft, rgba(72,52,212,0.12)), transparent 45%),
                var(--bg-app);
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 36px 32px;
    box-shadow: var(--shadow-md);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    margin-bottom: 6px;
}

.login-card h1 {
    text-align: center;
    font-size: 18px;
    margin: 6px 0 26px;
    color: var(--text-secondary);
    font-weight: 500;
}

.login-card .form-grid { max-width: none; }
.login-card .btn-primary { width: 100%; justify-content: center; padding: 10px; margin-top: 6px; }

.login-hint {
    margin-top: 18px;
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
}

/* ---------- board ---------- */

.board-wrap {
    flex: 1;
    overflow-x: auto;
    padding-bottom: 10px;
}

.board-columns {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    min-height: 60vh;
}

.board-column {
    width: 280px;
    flex-shrink: 0;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 190px);
}

.board-column.drag-over {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.column-header {
    padding: 14px 14px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.column-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 13.5px;
}

.column-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}

.column-count {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    background: var(--bg-elevated);
    border-radius: 999px;
    padding: 1px 8px;
}

.column-add-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 4px;
}

.column-add-btn:hover { color: var(--accent-hover); background: var(--bg-hover); }

.column-cards {
    flex: 1;
    overflow-y: auto;
    padding: 4px 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 40px;
}

.card-item {
    background: var(--bg-elevated);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    padding: 12px 12px 10px;
    cursor: grab;
    transition: border-color 0.15s, transform 0.1s;
}

.card-item:hover { border-color: var(--accent); }
.card-item.dragging { opacity: 0.4; }

.card-tags {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
}

.card-tag-dot {
    height: 4px;
    width: 22px;
    border-radius: 2px;
}

.card-title {
    font-size: 13.5px;
    font-weight: 600;
    margin-bottom: 6px;
    word-break: break-word;
}

.card-description {
    font-size: 12px;
    line-height: 1.4;
    color: var(--text-secondary);
    margin-bottom: 8px;
    white-space: pre-line;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.card-meta {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-top: 4px;
    min-width: 0;
}

.card-meta-label {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.card-meta-value {
    font-size: 11.5px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-meta-value.card-due.overdue { color: #ff7675; font-weight: 600; }

/* ---------- modal ---------- */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 14, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}

.modal-overlay.open { display: flex; }

.modal {
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.modal-header h2 { font-size: 16px; margin: 0; }

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
}

.modal-close:hover { color: var(--text-primary); }

.modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* ---------- misc ---------- */

.text-muted { color: var(--text-muted); }
.hidden { display: none !important; }

.color-swatch-input {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-swatch-input input[type=color] {
    width: 44px;
    padding: 3px;
    height: 38px;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-soft); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ---------- toggle do menu lateral ---------- */

.sidebar-toggle-btn {
    position: fixed;
    top: 50%;
    left: 220px;
    transform: translate(-50%, -50%);
    z-index: 70;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: 1px solid var(--border-soft);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: left 0.2s ease, background 0.15s, color 0.15s;
}

.sidebar-toggle-btn svg {
    width: 14px;
    height: 14px;
    transition: transform 0.2s ease;
}

.sidebar-toggle-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

html.sidebar-collapsed .sidebar { display: none; }

html.sidebar-collapsed .sidebar-toggle-btn { left: 13px; }

html.sidebar-collapsed .sidebar-toggle-btn svg { transform: rotate(180deg); }

@media (max-width: 760px) {
    html:not(.sidebar-collapsed) .sidebar {
        position: fixed;
        z-index: 60;
        height: 100vh;
    }
}
