@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=Raleway:wght@300;400;500;600;700&display=swap');

:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #111111;
    --bg-card: #161616;
    --bg-input: #1c1c1c;
    --gold: #b1955d;
    --gold-light: #d4b98a;
    --gold-dark: #8a7146;
    --text-light: #ededed;
    --text-muted: #a0a0a0;
    --border: #2a2a2a;
    --danger: #c0453a;
    --warning: #c98f2c;
    --success: #4a9d6e;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg-primary);
    color: var(--text-light);
    font-family: 'Raleway', sans-serif;
    min-height: 100vh;
}

h1, h2, h3, h4, .brand, .logo-text {
    font-family: 'Cinzel', serif;
    color: var(--gold-light);
    letter-spacing: 0.5px;
}

a { color: var(--gold-light); text-decoration: none; }
a:hover { color: var(--gold); }

::selection { background: var(--gold); color: #0a0a0a; }

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

.sidebar {
    width: 250px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    gap: 28px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar .brand-block {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
}

.sidebar .brand-block img {
    width: 44px;
    height: 44px;
    object-fit: contain;
    filter: drop-shadow(0 0 6px rgba(177, 149, 93, 0.5));
}

.sidebar .brand-block .brand-name {
    font-family: 'Cinzel', serif;
    font-size: 0.95rem;
    line-height: 1.25;
    color: var(--gold-light);
}

.nav-links { display: flex; flex-direction: column; gap: 6px; }

.nav-links a {
    padding: 10px 14px;
    border-radius: 6px;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.92rem;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.nav-links a:hover {
    background: rgba(177, 149, 93, 0.08);
    color: var(--gold-light);
}

.nav-links a.active {
    background: rgba(177, 149, 93, 0.12);
    border-color: rgba(177, 149, 93, 0.35);
    color: var(--gold-light);
    box-shadow: 0 0 12px rgba(177, 149, 93, 0.15);
}

.main-content {
    flex: 1;
    padding: 32px 40px;
    max-width: 1400px;
}

/* ---------- Landing ---------- */
.landing-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
    padding: 24px;
    background: radial-gradient(circle at 50% 30%, #151310 0%, #0a0a0a 65%);
}

.landing-logo {
    width: 220px;
    height: 220px;
    object-fit: contain;
    filter: drop-shadow(0 0 30px rgba(177, 149, 93, 0.45));
    margin-bottom: 12px;
    animation: floatLogo 5s ease-in-out infinite;
}

@keyframes floatLogo {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.landing-title {
    font-size: 2.1rem;
    margin: 6px 0 2px;
}

.landing-subtitle {
    color: var(--text-muted);
    font-weight: 300;
    margin-bottom: 34px;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-size: 0.85rem;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 28px;
    border-radius: 6px;
    border: 1px solid var(--gold);
    background: transparent;
    color: var(--gold-light);
    font-family: 'Raleway', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.25s ease;
    text-decoration: none;
    letter-spacing: 0.4px;
}

.btn:hover {
    background: var(--gold);
    color: #0a0a0a;
    box-shadow: 0 0 22px rgba(177, 149, 93, 0.45);
}

.btn-primary {
    background: linear-gradient(135deg, var(--gold-light), var(--gold-dark));
    color: #0a0a0a;
    border: none;
}

.btn-primary:hover {
    box-shadow: 0 0 22px rgba(177, 149, 93, 0.55);
    filter: brightness(1.08);
}

.btn-danger { border-color: var(--danger); color: #e08579; }
.btn-danger:hover { background: var(--danger); color: #fff; box-shadow: 0 0 18px rgba(192, 69, 58, 0.4); }

.btn-sm { padding: 7px 14px; font-size: 0.82rem; }

/* ---------- Cards / Dashboard ---------- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 12px;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 22px;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: "";
    position: absolute;
    top: -30%;
    right: -30%;
    width: 140px;
    height: 140px;
    background: radial-gradient(circle, rgba(177,149,93,0.18), transparent 70%);
}

.stat-card .stat-label {
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 6px;
}

.stat-card .stat-value {
    font-family: 'Cinzel', serif;
    font-size: 2rem;
    color: var(--gold-light);
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 22px;
    margin-bottom: 24px;
}

.card h3 {
    margin-top: 0;
    font-size: 1.05rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
    margin-bottom: 14px;
}

/* ---------- Alerts / flash ---------- */
.flash {
    padding: 12px 16px;
    border-radius: 6px;
    background: rgba(74, 157, 110, 0.12);
    border: 1px solid var(--success);
    color: #9fe0bb;
    margin-bottom: 20px;
}

.flash-erro {
    background: rgba(192, 69, 58, 0.12);
    border: 1px solid var(--danger);
    color: #e08579;
}

.alert-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    border-radius: 6px;
    margin-bottom: 8px;
    background: rgba(192, 69, 58, 0.1);
    border: 1px solid rgba(192, 69, 58, 0.4);
}

.alert-item .dias {
    font-weight: 700;
    color: #e08579;
}

.empty-state {
    color: var(--text-muted);
    text-align: center;
    padding: 30px 0;
    font-style: italic;
}

/* ---------- Tables ---------- */
.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 10px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    font-size: 0.88rem;
}

thead th {
    background: #1a1712;
    color: var(--gold-light);
    text-align: left;
    padding: 12px 14px;
    font-family: 'Cinzel', serif;
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text-light);
    white-space: nowrap;
}

tbody tr:hover { background: rgba(177, 149, 93, 0.05); }
tbody tr:last-child td { border-bottom: none; }

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-urgente {
    background: rgba(192, 69, 58, 0.18);
    color: #e08579;
    border: 1px solid rgba(192, 69, 58, 0.5);
    animation: pulseGold 1.6s ease-in-out infinite;
}

.badge-atencao {
    background: rgba(201, 143, 44, 0.15);
    color: #e0b35c;
    border: 1px solid rgba(201, 143, 44, 0.4);
}

.badge-normal {
    background: rgba(74, 157, 110, 0.12);
    color: #8fd6ab;
    border: 1px solid rgba(74, 157, 110, 0.35);
}

.badge-encerrado {
    background: rgba(120, 120, 120, 0.12);
    color: #a0a0a0;
    border: 1px solid rgba(120, 120, 120, 0.3);
}

.badge-semdata {
    background: rgba(177, 149, 93, 0.08);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

@keyframes pulseGold {
    0%, 100% { box-shadow: 0 0 0px rgba(192, 69, 58, 0.0); }
    50% { box-shadow: 0 0 12px rgba(192, 69, 58, 0.55); }
}

.row-urgente { border-left: 3px solid var(--danger); }

/* ---------- Filters / Forms ---------- */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    align-items: flex-end;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.field-group label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

input, select, textarea {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-light);
    padding: 10px 12px;
    border-radius: 6px;
    font-family: 'Raleway', sans-serif;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(177, 149, 93, 0.15);
}

textarea { resize: vertical; min-height: 70px; font-family: 'Raleway', sans-serif; }

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 4px 20px;
}

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

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 10px;
    justify-content: flex-end;
}

/* ---------- Detail page ---------- */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px 30px;
}

.detail-item .label {
    font-size: 0.76rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 3px;
}

.detail-item .value {
    color: var(--text-light);
    font-size: 0.95rem;
    word-break: break-word;
}

.detail-item .value a { color: var(--gold-light); }

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
}

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

/* ---------- Search ---------- */
.search-box {
    flex: 1;
    min-width: 220px;
}

@media (max-width: 900px) {
    .app-shell { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: relative; flex-direction: row; align-items: center; }
    .nav-links { flex-direction: row; flex-wrap: wrap; }
    .main-content { padding: 20px; }
}
