/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 14px; background: #f0f2f5; color: #333; }
a { text-decoration: none; color: inherit; }

/* ===== LAYOUT ===== */
.sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 200px;
    background: #1e2a3a; color: #cdd6e0; z-index: 100;
    display: flex; flex-direction: column;
}
.sidebar-brand {
    padding: 16px; background: #162030; font-size: 13px; font-weight: 700;
    color: #fff; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid #2d3f52;
}
.sidebar-brand .icon { background: #3b82f6; border-radius: 4px; padding: 4px 7px; font-size: 12px; }
.sidebar-nav { flex: 1; padding: 8px 0; }
.sidebar-nav a {
    display: block; padding: 10px 20px; color: #94a3b8; font-size: 13px;
    transition: all 0.15s; border-left: 3px solid transparent;
}
.sidebar-nav a:hover, .sidebar-nav a.active {
    background: #243447; color: #fff; border-left-color: #3b82f6;
}
.sidebar-footer { padding: 12px 20px; border-top: 1px solid #2d3f52; font-size: 12px; color: #64748b; cursor: pointer; }
.sidebar-footer:hover { color: #94a3b8; }

.main { margin-left: 200px; min-height: 100vh; }
.topbar {
    background: #1e2a3a; color: #fff; padding: 0 24px; height: 46px;
    display: flex; align-items: center; gap: 8px; font-size: 13px;
    border-bottom: 1px solid #162030;
}
.topbar-icon { background: #3b82f6; border-radius: 4px; padding: 3px 6px; font-size: 11px; }
.content { padding: 24px; }
.page-title { font-size: 22px; font-weight: 700; color: #1e293b; margin-bottom: 20px; }

/* ===== FLASH MESSAGE ===== */
.flash { padding: 10px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; }
.flash.success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.flash.error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* ===== CARDS ===== */
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
    border-radius: 12px; padding: 24px 28px; color: #fff;
    display: flex; flex-direction: column; gap: 8px;
}
.stat-card.blue { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.stat-card.green { background: linear-gradient(135deg, #22c55e, #15803d); }
.stat-card.orange { background: linear-gradient(135deg, #f97316, #c2410c); }
.stat-card .num { font-size: 36px; font-weight: 800; line-height: 1; }
.stat-card .label { font-size: 15px; opacity: 0.9; }

/* ===== DASHBOARD GRID ===== */
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.card {
    background: #fff; border-radius: 12px; padding: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.card-title { font-size: 15px; font-weight: 700; color: #1e293b; margin-bottom: 14px; }

/* ===== TABLES ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
    padding: 10px 12px; text-align: left; font-size: 12px; font-weight: 600;
    color: #64748b; border-bottom: 2px solid #e2e8f0; background: #f8fafc;
}
tbody td { padding: 10px 12px; border-bottom: 1px solid #f1f5f9; font-size: 13px; }
tbody tr:hover { background: #f8fafc; }
.link-domain { color: #3b82f6; }
.link-domain:hover { text-decoration: underline; }
.link-domain::before { content: '🌐 '; font-size: 11px; }

/* ===== STATUS BADGES ===== */
.badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-active { background: #dcfce7; color: #15803d; }
.badge-warning { background: #fef3c7; color: #b45309; }
.badge-expired { background: #fee2e2; color: #dc2626; }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.dot-green { background: #22c55e; }
.dot-orange { background: #f97316; }
.dot-red { background: #ef4444; }

.expiry-text { font-weight: 600; }
.expiry-text.expired { color: #dc2626; }
.expiry-text.warning { color: #f97316; }
.expiry-text.active { color: #16a34a; }

/* ===== FORMS ===== */
.form-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.form-row input, .form-row select, .form-row textarea {
    padding: 8px 12px; border: 1px solid #d1d5db; border-radius: 6px;
    font-size: 13px; color: #374151; outline: none; background: #fff;
    transition: border-color 0.15s;
}
.form-row input:focus, .form-row select:focus { border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59,130,246,0.1); }
.form-row input[type=text], .form-row input[type=email], .form-row input[type=tel] { min-width: 150px; }

.btn {
    padding: 8px 16px; border: none; border-radius: 6px; cursor: pointer;
    font-size: 13px; font-weight: 600; transition: all 0.15s; white-space: nowrap;
}
.btn-primary { background: #3b82f6; color: #fff; }
.btn-primary:hover { background: #2563eb; }
.btn-secondary { background: #e2e8f0; color: #475569; }
.btn-secondary:hover { background: #cbd5e1; }
.btn-success { background: #22c55e; color: #fff; }
.btn-success:hover { background: #16a34a; }
.btn-danger { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-warning { background: #f59e0b; color: #fff; }
.btn-warning:hover { background: #d97706; }

/* ===== FILTER BAR ===== */
.filter-bar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.filter-bar input { padding: 7px 12px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 13px; min-width: 180px; }
.filter-bar input:focus { outline: none; border-color: #3b82f6; }

/* ===== CALENDAR ===== */
.calendar { width: 100%; border-collapse: collapse; }
.calendar th {
    padding: 10px; text-align: center; background: #f8fafc;
    font-weight: 600; color: #64748b; border: 1px solid #e2e8f0; font-size: 13px;
}
.calendar td {
    width: 14.28%; min-height: 100px; vertical-align: top; padding: 8px;
    border: 1px solid #e2e8f0; font-size: 13px;
}
.calendar td .day-num { font-weight: 600; color: #374151; margin-bottom: 4px; display: block; }
.calendar td.today { background: #eff6ff; }
.calendar td.today .day-num {
    background: #3b82f6; color: #fff; border-radius: 50%;
    width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
}
.cal-event {
    background: #dbeafe; color: #1d4ed8; border-radius: 4px; padding: 2px 6px;
    font-size: 11px; margin-bottom: 2px; overflow: hidden; white-space: nowrap;
    text-overflow: ellipsis; display: block; cursor: pointer;
}
.cal-event.expired { background: #fee2e2; color: #dc2626; }
.cal-event.warning { background: #fef3c7; color: #b45309; }
.cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.cal-nav h3 { font-size: 17px; font-weight: 700; }

/* ===== MODAL ===== */
.modal-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    z-index: 999; align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
    background: #fff; border-radius: 12px; padding: 24px; width: 500px;
    max-width: 95vw; max-height: 90vh; overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.modal-header h3 { font-size: 17px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: #64748b; }
.modal-close:hover { color: #333; }
.modal label { display: block; font-size: 12px; font-weight: 600; color: #64748b; margin-bottom: 4px; margin-top: 12px; }
.modal input, .modal select, .modal textarea {
    width: 100%; padding: 9px 12px; border: 1px solid #d1d5db; border-radius: 6px;
    font-size: 13px; outline: none;
}
.modal input:focus, .modal select:focus, .modal textarea:focus { border-color: #3b82f6; }
.modal textarea { height: 80px; resize: vertical; }
.modal-actions { margin-top: 18px; display: flex; gap: 10px; justify-content: flex-end; }

/* ===== INLINE EDIT MODAL ===== */
.edit-modal { width: 600px; }

/* ===== TABS ===== */
.tabs { display: flex; gap: 4px; margin-bottom: 16px; }
.tab-btn {
    padding: 8px 16px; border: none; border-radius: 6px; cursor: pointer;
    font-size: 13px; font-weight: 600; transition: all 0.15s;
    background: #e2e8f0; color: #64748b;
}
.tab-btn.active { background: #3b82f6; color: #fff; }
.tab-btn.warning-tab { }
.tab-btn.warning-tab.active { background: #f59e0b; }

/* ===== SEARCH HIGHLIGHT ===== */
mark { background: #fef08a; padding: 0 2px; border-radius: 2px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .sidebar { width: 0; overflow: hidden; }
    .main { margin-left: 0; }
    .stats-grid { grid-template-columns: 1fr; }
    .dash-grid { grid-template-columns: 1fr; }
}
