:root {
    --bg-color: #0f172a;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --success: #10b981;
    --success-hover: #059669;
    --warning: #f59e0b;
    --card-bg: rgba(30, 41, 59, 0.9);
    --border-color: rgba(255, 255, 255, 0.12);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Background Animation */
.background-animation {
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 50% 50%, rgba(59, 130, 246, 0.15), transparent 60%);
    animation: rotateBg 30s linear infinite;
    z-index: -1;
}

@keyframes rotateBg {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1.5rem;
    font-weight: 700;
}

.logo i {
    color: var(--primary);
    font-size: 2rem;
}

.server-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--glass-bg);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    font-weight: 600;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--success);
}

.pulsing {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 0.75rem;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(59, 130, 246, 0.4) transparent;
    flex-wrap: nowrap;
}
.tabs::-webkit-scrollbar {
    height: 4px;
}
.tabs::-webkit-scrollbar-track {
    background: transparent;
}
.tabs::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.4);
    border-radius: 2px;
}
.tabs::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.tab-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    color: var(--primary);
    background: rgba(59, 130, 246, 0.1);
}

.tab-content {
    display: none;
    animation: fadeIn 0.4s;
}

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

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Cards & Layout */
.grid-2-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

.glass-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.large-card {
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding-bottom: 0.8rem;
}

.card-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
    transition: color 0.2s;
}
.icon-btn:hover {
    color: var(--primary);
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    flex: 1;
}

.stat-box {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.02);
}

.stat-box i {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

.stat-box h3 {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.stat-box p {
    font-size: 1.5rem;
    font-weight: 700;
}

/* Terminal / Pre */
.terminal-output {
    background: #000;
    color: #0f0;
    padding: 1rem;
    border-radius: 8px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    overflow-y: auto;
    border: 1px solid #333;
    white-space: pre-wrap;
}
.large-terminal {
    flex: 1;
    min-height: 200px;
}

/* Buttons */
.actions-row {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    justify-content: center;
}

.btn {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: var(--success-hover); }

/* Fail2Ban */
.f2b-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.jail-card {
    background: rgba(0,0,0,0.2);
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

.jail-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    font-weight: bold;
    color: var(--primary);
}

.banned-ip {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(239, 68, 68, 0.1);
    padding: 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    border-left: 3px solid var(--danger);
}

/* Editor v2 */
.editor-card {
    height: 700px;
    display: flex;
    flex-direction: column;
}
.editor-layout {
    display: flex;
    gap: 1.5rem;
    flex: 1;
    overflow: hidden;
}

.editor-sidebar {
    width: 250px;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    padding: 1rem;
    display: flex;
    flex-direction: column;
}

.editor-sidebar h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 0.5rem;
}

.file-tree {
    list-style: none;
    overflow-y: auto;
}
.file-item {
    padding: 0.6rem 0.8rem;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.file-item:hover {
    background: rgba(255,255,255,0.05);
}
.file-item.selected {
    background: rgba(59, 130, 246, 0.2);
    color: #fff;
    border-left: 3px solid var(--primary);
}

.editor-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

textarea {
    flex: 1;
    width: 100%;
    background: #1e1e1e;
    color: #d4d4d4;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 1rem;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1rem;
    resize: none;
    outline: none;
}
textarea:focus { border-color: var(--primary); }

.editor-tools {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.badge {
    background: rgba(255,255,255,0.1);
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--primary);
}

/* Table */
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
th { color: var(--text-muted); font-weight: 600; }
tr:hover { background: rgba(255, 255, 255, 0.02); }
#cdr-table th, #cdr-table td { white-space: nowrap; }

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--success);
    color: white;
    padding: 1rem 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s;
    z-index: 1000;
}
.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.mb-4 { margin-bottom: 2rem; }

/* Date Input */
.date-input {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 0.5rem;
    border-radius: 4px;
    font-family: inherit;
    outline: none;
}
.date-input::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}

/* Simple DataTables Dark Mode Overrides */
.dataTable-wrapper {
    color: var(--text-main);
    font-family: inherit;
}
.dataTable-selector, .dataTable-input {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 0.5rem;
    border-radius: 4px;
}
.dataTable-pagination a {
    color: var(--text-main);
}
.dataTable-pagination a:hover {
    background: rgba(255, 255, 255, 0.1);
}
.dataTable-pagination .active a, 
.dataTable-pagination .active a:focus, 
.dataTable-pagination .active a:hover {
    background: var(--primary);
}
.dataTable-sorter::before, .dataTable-sorter::after {
    opacity: 0.5;
}
.dataTable-table > tbody > tr > td, 
.dataTable-table > tbody > tr > th, 
.dataTable-table > tfoot > tr > td, 
.dataTable-table > tfoot > tr > th, 
.dataTable-table > thead > tr > td, 
.dataTable-table > thead > tr > th {
    border-color: rgba(255, 255, 255, 0.1);
}
.dataTable-info {
    color: var(--text-muted);
}
.dataTable-dropdown label {
    color: var(--text-main);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
}

.modal-content {
    margin: 5% auto;
    width: 80%;
    max-width: 900px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: fadeIn 0.3s;
}

.close-modal {
    color: var(--text-muted);
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

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

@media (max-width: 900px) {
    .grid-2-col { grid-template-columns: 1fr; }
    .editor-layout { flex-direction: column; }
    .editor-sidebar { width: 100%; height: 200px; }
    .user-drawer { width: 100%; }
}

/* ============================================================
   USER MANAGEMENT DRAWER
   ============================================================ */

.drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 900;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.drawer-overlay.open {
    display: block;
    opacity: 1;
}

.user-drawer {
    position: fixed;
    top: 0;
    right: -500px;
    width: 460px;
    max-width: 95vw;
    height: 100vh;
    background: var(--card-bg);
    border-left: 1px solid var(--border-color);
    backdrop-filter: blur(20px);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: right 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: -8px 0 40px rgba(0,0,0,0.5);
}

.user-drawer.open {
    right: 0;
}

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    background: rgba(30, 41, 59, 0.95);
}

.drawer-header h2 {
    font-size: 1.1rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.drawer-body::-webkit-scrollbar { width: 6px; }
.drawer-body::-webkit-scrollbar-track { background: transparent; }
.drawer-body::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }

.drawer-section-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 1.5rem 0 0.75rem 0;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border-color);
}

.drawer-section-label:first-child {
    margin-top: 0;
}

.form-group {
    margin-bottom: 1rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.required {
    color: var(--danger);
}

.form-input {
    width: 100%;
    padding: 0.65rem 0.9rem;
    border-radius: 6px;
    font-size: 0.9rem;
    border: 1px solid var(--border-color);
    background: rgba(15, 23, 42, 0.6);
    color: var(--text-main);
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: 'Inter', sans-serif;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-input::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

.form-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
    font-style: italic;
}

.drawer-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* Admin action buttons inside drawer */
#drawer-admin-actions .btn {
    width: 100%;
    display: flex;
    align-items: center;
    padding: 0.65rem 1rem;
    font-size: 0.88rem;
    border-radius: 6px;
    transition: all 0.2s;
}

#drawer-admin-actions .btn:hover {
    transform: translateX(3px);
    filter: brightness(1.1);
}

/* Simple DataTables Layout Fixes */
.datatable-wrapper, .dataTable-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
}
.datatable-top, .dataTable-top, .datatable-bottom, .dataTable-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    width: 100%;
}
.datatable-container, .dataTable-container {
    width: 100%;
    overflow-x: auto;
    margin: 1rem 0;
}
.datatable-top > div, .dataTable-top > div, .datatable-bottom > div, .dataTable-bottom > div {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.datatable-table, .dataTable-table {
    table-layout: auto !important;
    width: 100% !important;
}

/* ============================================================
   CLASSES AUSENTES NO CSS ORIGINAL
   ============================================================ */
.card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 4px 6px rgba(0,0,0,.1);
}
input.editor, select.editor {
    background: rgba(15,23,42,.8);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    font-size: .95rem;
    transition: border-color .2s, box-shadow .2s;
    outline: none;
}
input.editor:focus, select.editor:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
input.editor::placeholder { color: var(--text-muted); opacity: .7; }
.pass-toggle {
    position: absolute; right: .75rem; top: 50%;
    transform: translateY(-50%);
    cursor: pointer; color: var(--text-muted); transition: color .2s;
}
.pass-toggle:hover { color: var(--primary); }
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tab-content-container { width: 100%; }
.cdr-date { white-space: nowrap; }

/* Editor mobile select */
.editor-mobile-select { display: none; margin-bottom: .75rem; }
.editor-mobile-select select {
    width: 100%;
    padding: .65rem 2.5rem .65rem .9rem;
    border-radius: 6px;
    background: rgba(15,23,42,.8);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    font-size: .95rem;
    outline: none; cursor: pointer;
    appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .9rem center;
}
.editor-mobile-select select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}

/* CDR tools */
.cdr-tools { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

/* Header */
#site-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1rem 2rem;
    background: var(--glass-bg);
    border-bottom: 1px solid var(--glass-border);
    backdrop-filter: blur(12px);
    margin-bottom: 2rem;
    position: sticky; top: 0; z-index: 100;
}
.header-brand { display: flex; align-items: center; gap: .75rem; }
.header-actions { display: flex; gap: .75rem; align-items: center; }

/* Hamburger */
.hamburger-btn {
    display: none;
    background: transparent; border: none;
    color: var(--text-main); font-size: 1.2rem;
    cursor: pointer; padding: .4rem .5rem;
    border-radius: 6px; transition: background .2s; line-height: 1;
}
.hamburger-btn:hover { background: rgba(255,255,255,.08); }

.nav-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.55); z-index: 1099;
    backdrop-filter: blur(2px);
    opacity: 0; transition: opacity .3s;
}
.nav-overlay.open { display: block; opacity: 1; }

.nav-drawer {
    position: fixed; top: 0; left: -290px;
    width: 270px; height: 100dvh;
    background: var(--card-bg);
    border-right: 1px solid var(--border-color);
    backdrop-filter: blur(20px);
    z-index: 1100;
    display: flex; flex-direction: column;
    transition: left .3s cubic-bezier(.16,1,.3,1);
    box-shadow: 4px 0 24px rgba(0,0,0,.4);
}
.nav-drawer.open { left: 0; }
.nav-drawer-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    background: rgba(30,41,59,.95);
}
.nav-drawer-brand { display: flex; align-items: center; gap: .65rem; font-weight: 700; font-size: 1rem; }
.nav-drawer-brand i { color: var(--primary); font-size: 1.1rem; }
.nav-drawer-body {
    flex: 1; overflow-y: auto; padding: .5rem 0;
    scrollbar-width: thin; scrollbar-color: var(--border-color) transparent;
}
.nav-item {
    display: flex; align-items: center; gap: .85rem;
    padding: .85rem 1.25rem;
    color: var(--text-muted); text-decoration: none;
    font-size: .93rem; font-weight: 500; cursor: pointer;
    transition: background .15s, color .15s;
    border-left: 3px solid transparent;
    user-select: none;
}
.nav-item:hover { background: rgba(255,255,255,.05); color: var(--text-main); }
.nav-item.active { color: var(--primary); background: rgba(59,130,246,.1); border-left-color: var(--primary); }
.nav-item i { width: 1rem; text-align: center; font-size: .9rem; }

/* CEL table */
#cel-table td, #cel-table th {
    word-break: normal; overflow-wrap: normal;
    white-space: nowrap; max-width: none;
}
#cel-modal .table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Feature Codes table */
.glass-card table:not(#cdr-table):not(#contacts-table):not(#blacklist-table):not(#users-table):not(#cel-table) {
    table-layout: fixed; width: 100%;
}
.glass-card table:not(#cdr-table):not(#contacts-table):not(#blacklist-table):not(#users-table):not(#cel-table) td {
    word-break: break-word; overflow-wrap: break-word;
}

/* ============================================================
   900px
   ============================================================ */
@media (max-width: 900px) {
    .grid-2-col       { grid-template-columns: 1fr; }
    .editor-layout    { flex-direction: column; }
    .editor-sidebar   { width: 100%; height: 180px; }
    .user-drawer      { width: 100%; right: -100%; }
    .user-drawer.open { right: 0; }
    .editor-card      { height: auto; }
}

/* ============================================================
   768px
   ============================================================ */
@media (max-width: 768px) {
    .dashboard-container { padding: 1rem; }
    #site-header         { padding: .75rem 1rem; }
    .card-header         { flex-wrap: wrap; gap: .75rem; }
    .cdr-tools           { width: 100%; }
    .date-input          { flex: 1 1 130px; }
    .actions-row         { flex-wrap: wrap; justify-content: flex-start; }
    .form-row            { grid-template-columns: 1fr; }
    .modal-content       { width: 95%; margin: 3% auto; max-height: 90vh; }
    .f2b-grid            { grid-template-columns: 1fr; }
    .editor-mobile-select { display: block; }
    .editor-sidebar      { display: none; }
    .editor-card         { min-height: 520px; }
    #config-editor       { min-height: 350px; }
    /* CDR: datas lado a lado */
    .cdr-tools {
        display: grid;
        grid-template-columns: 1fr auto 1fr;
        grid-auto-rows: auto;
        align-items: center;
        gap: .5rem;
    }
    .cdr-tools > span    { white-space: nowrap; text-align: center; font-size: .8rem; }
    .cdr-tools > input[type="date"] { width: 100%; min-width: 0; height: 40px; padding: 0 .5rem; font-size: .85rem; box-sizing: border-box; }
    #filter-cdr, #export-cdr { grid-column: 1 / -1; width: 100%; box-sizing: border-box; }
    #refresh-cdr         { grid-column: 1 / -1; justify-self: start; }
    /* Tabelas */
    #users-table         { min-width: unset; }
    #users-table th:nth-child(2), #users-table td:nth-child(2),
    #users-table th:nth-child(3), #users-table td:nth-child(3),
    #users-table th:nth-child(4), #users-table td:nth-child(4),
    #users-table th:nth-child(5), #users-table td:nth-child(5),
    #users-table th:nth-child(6), #users-table td:nth-child(6) { display: none; }
}

/* ============================================================
   600px
   ============================================================ */
@media (max-width: 600px) {
    .dashboard-container { padding: .5rem; }

    /* Header */
    #site-header    { padding: .6rem .75rem; margin-bottom: .75rem; }
    .hamburger-btn  { display: block; }
    .tabs           { display: none; }

    /* Header buttons: só ícone */
    .header-brand h1    { font-size: 1rem; }
    #profile-btn, #logout-btn { padding: .5rem .65rem; font-size: 0; }
    #profile-btn i, #logout-btn i { font-size: 1rem; }

    /* Cards e botões */
    .glass-card { padding: 1rem; border-radius: 12px; }
    .btn        { padding: .55rem .85rem; font-size: .85rem; }

    /* Stats: sempre 2 colunas */
    .stats-grid { gap: .5rem; }
    .stat-box   { padding: .75rem; }
    .stat-box i { font-size: 1.4rem; margin-bottom: .3rem; }
    .stat-box p { font-size: .9rem; word-break: break-word; }
    .stat-box h3{ font-size: .75rem; }

    /* Tabelas */
    #cdr-table th:nth-child(3), #cdr-table td:nth-child(3),
    #cdr-table th:nth-child(4), #cdr-table td:nth-child(4) { display: none; }
    #contacts-table th:nth-child(3), #contacts-table td:nth-child(3) { display: none; }
    #blacklist-table th:nth-child(3), #blacklist-table td:nth-child(3) { display: none; }

    /* Terminal */
    .large-terminal, .terminal-output { font-size: .75rem; }

    /* Toast */
    .toast { left: .75rem; right: .75rem; bottom: .75rem; text-align: center; }

    /* Drawer safe area */
    .drawer-body { padding-bottom: max(2rem, env(safe-area-inset-bottom, 1rem)); }
    .nav-drawer  { height: 100dvh; }
}

/* ============================================================
   FIREFOX ANDROID FIX: backdrop-filter cria overflow:hidden
   implicito — remove no mobile para nao clipar 2a coluna
   ============================================================ */
@media (max-width: 900px) {
    .glass-card {
        -webkit-backdrop-filter: none !important;
        backdrop-filter: none !important;
        overflow: hidden;
    }
}

/* ============================================================
   CRITICAL: terminal causava overflow horizontal da pagina
   inteira, quebrando todos os layouts de 2 colunas
   ============================================================ */
html, body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
}
.terminal-output,
#ast-status,
#live-logs {
    overflow-x: hidden !important;
    word-break: break-all !important;
    white-space: pre-wrap !important;
    max-width: 100% !important;
}
.glass-card,
.dashboard-container,
#status,
#history,
#security,
#contacts,
#blacklist,
#editor,
#logs,
#users,
#settings {
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* ============================================================
   FIX DEFINITIVO: contem overflow de cada card individualmente
   ============================================================ */
.glass-card {
    overflow: hidden;
    max-width: 100%;
}
#ast-status,
#live-logs,
.terminal-output {
    overflow-x: hidden !important;
    word-break: break-all !important;
    white-space: pre-wrap !important;
    max-width: 100% !important;
}
html { overflow-x: hidden; }

/* ============================================================
   DESKTOP: layout compacto + menu centralizado
   ============================================================ */
@media (min-width: 601px) {
    /* Centraliza as tabs */
    .tabs {
        justify-content: center;
    }

    /* Header menos espaçoso */
    #site-header {
        padding: 0.75rem 2rem;
        margin-bottom: 1rem;
    }

    /* Container com menos padding vertical */
    .dashboard-container {
        padding: 0 2rem 1.5rem;
    }

    /* Stat boxes mais compactos */
    .stat-box {
        padding: 1rem;
    }
    .stat-box i {
        font-size: 1.8rem;
        margin-bottom: 0.3rem;
    }
    .stat-box p {
        font-size: 1.2rem;
    }
    .stat-box h3 {
        font-size: 0.85rem;
    }

    /* Reduz espaço interno dos cards */
    .glass-card {
        padding: 1.25rem;
    }
}

/* Espaçamento entre botões de ação nas tabelas */
.icon-btn {
    padding: 0.2rem 0.4rem;
}
.icon-btn + .icon-btn {
    margin-left: 0.25rem;
}
