* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --page-bg: #f5f5f4;
    --surface: #ffffff;
    --surface-muted: #f9fafb;
    --text: #0f172a;
    --muted: #6b7280;
    --border: #e5e7eb;
    --accent: #2563eb;
    --accent-dark: #1d4ed8;
    --danger: #dc2626;
    --success: #15803d;
    --warning: #b45309;
}

body {
    font-family: 'Inter', 'Segoe UI', BlinkMacSystemFont, -apple-system, sans-serif;
    background: var(--page-bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}

.hidden {
    display: none !important;
}

.container {
    width: min(1100px, 100% - 2rem);
    margin: 0 auto;
    padding: 2.5rem 0 4rem;
}

header {
    background: linear-gradient(135deg, #1e3a8a, #2563eb);
    border: none;
    border-radius: 18px;
    padding: 2rem 2.5rem;
    margin-bottom: 2.5rem;
    color: #fff;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.header-logo {
    width: 64px;
    height: 64px;
}

.header-text h1 {
    font-size: clamp(2rem, 3vw, 2.4rem);
    font-weight: 600;
    margin: 0;
}

.header-text p {
    margin-top: 0.25rem;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.95rem;
}

main {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.tabs {
    display: flex;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
    overflow-x: auto;
}

.tab-btn {
    border: none;
    background: transparent;
    padding: 0.85rem 0.25rem;
    font-size: 0.95rem;
    color: var(--muted);
    font-weight: 500;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.tab-btn:hover {
    color: var(--text);
}

.tab-btn.active {
    color: var(--accent);
    border-color: var(--accent);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 1.75rem;
}

.list-panel {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.section-header h2 {
    font-size: 1.4rem;
    font-weight: 600;
}

.section-description {
    color: var(--muted);
    font-size: 0.9rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1.2rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

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

.btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

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

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

.btn-secondary {
    background: var(--surface-muted);
    border-color: var(--border);
    color: var(--text);
}

.btn-success {
    background: rgba(21, 128, 61, 0.1);
    border-color: rgba(21, 128, 61, 0.4);
    color: var(--success);
}

.btn-danger {
    background: rgba(220, 38, 38, 0.1);
    border-color: rgba(220, 38, 38, 0.4);
    color: var(--danger);
}

.btn-warning {
    background: rgba(180, 83, 9, 0.12);
    border-color: rgba(180, 83, 9, 0.4);
    color: var(--warning);
}

.btn-info {
    background: rgba(37, 99, 235, 0.12);
    border-color: rgba(37, 99, 235, 0.4);
    color: var(--accent);
}

.btn-sm {
    font-size: 0.8rem;
    padding: 0.35rem 0.8rem;
}

.btn-group {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.btn-group .btn {
    border-radius: 999px;
}

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

.form-container,
.filter-form {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
}

.form-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.form-section + .form-section {
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.form-section h3 {
    font-size: 1rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

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

.form-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.9rem;
}

.form-field span {
    color: var(--muted);
    font-weight: 600;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.65rem 0.85rem;
    background: var(--surface);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
    outline: none;
}

input::placeholder,
textarea::placeholder {
    color: #9ca3af;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.form-group {
    flex: 1;
    min-width: 220px;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-group label {
    font-size: 0.85rem;
    color: var(--muted);
}

.form-control {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.65rem 0.85rem;
    background: var(--surface);
}

.filter-actions {
    display: flex;
    flex-direction: row;
    gap: 0.75rem;
    justify-content: flex-end;
    align-items: center;
    flex: 0 0 auto;
    align-self: flex-end;
}

.filter-actions .btn {
    flex: 0 0 auto;
}

.error-summary {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    font-size: 0.9rem;
}

.error-message {
    color: #b91c1c;
    font-size: 0.78rem;
}

.image-preview {
    display: inline-flex;
    align-items: center;
    gap: 1rem;
    border: 1px dashed var(--border);
    border-radius: 16px;
    padding: 1rem;
    background: var(--surface-muted);
}

.image-preview img {
    width: 96px;
    height: 128px;
    object-fit: cover;
    border-radius: 12px;
}

.checkbox-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    color: var(--muted);
}

table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid var(--border);
    border-radius: 16px;
    font-size: 0.95rem;
    background: var(--surface);
}

thead {
    background: var(--surface-muted);
}

th,
td {
    padding: 0.85rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    font-weight: 600;
}

tbody tr:hover {
    background: var(--surface-muted);
}

tbody tr:last-child td {
    border-bottom: none;
}

td.actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.table-container {
    border: 1px solid var(--border);
    border-radius: 18px;
    overflow: hidden;
    background: var(--surface);
}

.filter-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.text-center {
    text-align: center;
}

.loading,
.loading-cell {
    text-align: center;
    color: var(--muted);
    font-style: italic;
    padding: 1.25rem;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: capitalize;
}

.status-ativo {
    background: #ecfdf5;
    color: #047857;
}

.status-bloqueado,
.status-atrasado,
.status-cancelado {
    background: #fef2f2;
    color: #b91c1c;
}

.status-devolvido {
    background: #eef2ff;
    color: #4338ca;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
}

.notification-area {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 1000;
}

.notification {
    min-width: 240px;
    padding: 0.85rem 1.1rem;
    border-radius: 12px;
    color: #fff;
    font-weight: 500;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.15);
    transition: opacity 0.3s ease;
}

.notification.success {
    background: var(--success);
}

.notification.error {
    background: var(--danger);
}

.notification.info {
    background: var(--accent);
}

.toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    padding: 0.85rem 1.2rem;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.9);
    color: #fff;
    font-weight: 500;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 1000;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 720px) {
    .container {
        width: min(100%, 100% - 1rem);
        padding-top: 1.5rem;
    }

    header {
        padding: 1.75rem 1.25rem;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .form-actions {
        flex-direction: column;
        align-items: stretch;
    }

    td.actions {
        flex-direction: column;
    }

    .tabs {
        flex-wrap: wrap;
    }

    th,
    td {
        padding: 0.75rem;
    }
}
