:root {
    --navy: #0B1E3D;
    --navy-2: #16305C;
    --blue: #2E5EAA;
    --teal: #1CA9C9;
    --teal-dark: #157F97;
    --bg: #EEF1F5;
    --card: #FFFFFF;
    --border: #E1E6EC;
    --text: #1B2430;
    --text-muted: #6B7480;
    --danger: #C0392B;
    --success: #1E8A55;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 1px 2px rgba(16,24,40,0.04), 0 1px 3px rgba(16,24,40,0.06);
    --shadow-md: 0 4px 12px rgba(16,24,40,0.08);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

/* ---------- App shell: sidebar + main ---------- */

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

.sidebar {
    width: 236px;
    flex-shrink: 0;
    background: linear-gradient(180deg, var(--navy) 0%, var(--navy-2) 100%);
    display: flex;
    flex-direction: column;
    padding: 22px 0 20px;
}

.sidebar-logo {
    padding: 0 24px 22px;
    margin-bottom: 6px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo img {
    height: 26px;
    width: auto;
    filter: brightness(0) invert(1);
    opacity: 0.95;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 16px 12px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #C7D2E3;
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-nav a .nav-icon {
    width: 18px;
    text-align: center;
    font-size: 14px;
    opacity: 0.85;
}

.sidebar-nav a:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}

.sidebar-nav a.active {
    background: var(--teal);
    color: #fff;
}

.sidebar-nav a.disabled {
    opacity: 0.4;
    cursor: default;
    pointer-events: none;
}

.sidebar-divider {
    height: 1px;
    background: rgba(255,255,255,0.08);
    margin: 10px 12px;
}

.sidebar-version {
    margin-top: auto;
    padding: 12px 24px 0;
    font-size: 11px;
    color: rgba(255,255,255,0.35);
}

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

header.topbar {
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 16px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topbar-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--navy);
}

header.topbar .user-info {
    font-size: 13.5px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 18px;
}

header.topbar .user-info a {
    color: var(--teal-dark);
    text-decoration: none;
    font-weight: 600;
}

header.topbar .user-info a:hover { text-decoration: underline; }

.container {
    max-width: 1180px;
    min-width: 0;
    padding: 28px 32px 40px;
    width: 100%;
}

/* ---------- Auth pages (no sidebar) ---------- */

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 30% 20%, #16305C 0%, #0B1E3D 55%, #061225 100%);
    padding: 20px;
}

.auth-container {
    max-width: 400px;
    width: 100%;
    padding: 36px 34px;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
}

.auth-container .logo {
    display: block;
    height: 38px;
    width: auto;
    margin: 0 auto 22px;
}

.auth-container h1 {
    font-size: 20px;
    margin: 0 0 4px;
    color: var(--navy);
    text-align: center;
}

.auth-container .subtitle {
    font-size: 13.5px;
    color: var(--text-muted);
    margin: 0 0 24px;
    text-align: center;
}

/* ---------- Forms ---------- */

label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.2px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 16px 0 6px;
}

input[type=text], input[type=email], input[type=password], input[type=date], select, textarea {
    width: 100%;
    padding: 10px 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: #fff;
    color: var(--text);
    font-family: inherit;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(28,169,201,0.15);
}

button, .btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--teal);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s ease;
}

button:hover, .btn:hover { background: var(--teal-dark); }

.btn-secondary {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.btn-secondary:hover { background: #F5F7FA; color: var(--text); }

.actions-row {
    margin-top: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.auth-container .actions-row a {
    color: var(--teal-dark);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 600;
}

.alert {
    padding: 11px 15px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    margin-bottom: 18px;
}

.alert-error { background: #FBE9E7; color: var(--danger); border: 1px solid #F1C4BE; }
.alert-success { background: #E7F5EC; color: var(--success); border: 1px solid #BFE3CD; }

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

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card-title {
    background: linear-gradient(90deg, var(--navy) 0%, var(--navy-2) 100%);
    color: #fff;
    padding: 16px 22px;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.3px;
    border-radius: var(--radius) var(--radius) 0 0;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 22px;
    border-bottom: 1px solid var(--border);
    background: #FAFBFC;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

thead th {
    background: #F5F7FA;
    color: var(--text-muted);
    text-align: left;
    padding: 11px 22px;
    font-weight: 700;
    font-size: 11.5px;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
}

tbody td {
    padding: 13px 22px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #F7FAFC; }

.badge {
    display: inline-block;
    padding: 3px 11px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.2px;
}

.badge-alta { background: #FBE9E7; color: var(--danger); }
.badge-media { background: #FFF4E0; color: #9A6A00; }
.badge-baixa { background: #E7F5EC; color: var(--success); }

.badge-pendente { background: #EDEDED; color: #555; }
.badge-execucao { background: #E1F0FA; color: #1467A0; }
.badge-concluido { background: #E7F5EC; color: var(--success); }
.badge-entregue { background: #E9E4F7; color: #5B3FA3; }

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

.card-form {
    padding: 28px 32px;
}

.card-form h2 {
    margin-top: 0;
    color: var(--navy);
    font-size: 18px;
}

.table-scroll {
    overflow-x: auto;
    border-radius: 0 0 var(--radius) var(--radius);
    scrollbar-width: thin;
}

.table-scroll::-webkit-scrollbar {
    height: 10px;
}

.table-scroll::-webkit-scrollbar-thumb {
    background: #C7CFD9;
    border-radius: 6px;
}

.table-scroll::-webkit-scrollbar-track {
    background: #F0F2F5;
}

.table-scroll table {
    border-radius: 0;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 20px;
}

.field {
    min-width: 0;
}

.field-full {
    grid-column: 1 / -1;
}

.form-grid label {
    margin: 16px 0 6px;
}

.form-actions {
    grid-column: 1 / -1;
}

@media (max-width: 640px) {
    .form-grid { grid-template-columns: 1fr; }
}
