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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    color: #1a1a2e;
    background: #f0f2f5;
}

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

/* Sidebar */
.sidebar {
    width: 220px;
    background: #1a1a2e;
    color: #fff;
    padding: 0;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px 16px;
    font-size: 16px;
    font-weight: 700;
    border-bottom: 1px solid #2d2d44;
    letter-spacing: 0.5px;
}

.nav-item {
    display: block;
    padding: 10px 16px;
    color: #a0a0b8;
    text-decoration: none;
    font-size: 13px;
    transition: background 0.15s, color 0.15s;
}

.nav-item:hover { background: #2d2d44; color: #fff; }
.nav-item.active { background: #16213e; color: #fff; border-left: 3px solid #4f8cff; }

/* Content */
.content {
    flex: 1;
    padding: 24px 32px;
    overflow-x: auto;
}

h1 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 16px;
}

h2 {
    font-size: 16px;
    font-weight: 600;
    margin: 24px 0 12px;
}

.count { font-weight: 400; color: #666; font-size: 14px; }

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.page-header h1 { margin-bottom: 0; }

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #1a1a2e;
}

.stat-label {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 16px;
}

th {
    text-align: left;
    padding: 10px 12px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #666;
    background: #f8f9fa;
    border-bottom: 2px solid #e9ecef;
    white-space: nowrap;
}

td {
    padding: 8px 12px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
}

tr:hover td { background: #f8f9ff; }

.mono { font-family: "SF Mono", "Cascadia Code", "Consolas", monospace; font-size: 12px; }

.truncate { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.empty { text-align: center; color: #999; padding: 24px; }

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-pending, .badge-processing { background: #fff3cd; color: #856404; }
.badge-sent, .badge-published, .badge-ACCEPTD { background: #d1ecf1; color: #0c5460; }
.badge-delivered, .badge-DELIVRD, .badge-success, .badge-active { background: #d4edda; color: #155724; }
.badge-failed, .badge-REJECTD, .badge-UNDELIV, .badge-disabled { background: #f8d7da; color: #721c24; }
.badge-expired, .badge-EXPIRED, .badge-suspended { background: #fde8c8; color: #7c4a00; }
.badge-undelivered { background: #f8d7da; color: #721c24; }

/* Buttons */
.btn {
    padding: 6px 14px;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.15s;
}

.btn:hover { background: #f0f0f0; }

.btn-primary {
    background: #4f8cff;
    color: #fff;
    border-color: #4f8cff;
}

.btn-primary:hover { background: #3a7be0; }

.btn-sm { padding: 3px 8px; font-size: 12px; }

/* Search bar */
.search-bar {
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-bar form {
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-bar input[type="text"] {
    padding: 5px 10px;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    font-size: 13px;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    font-size: 13px;
}

.pagination a {
    color: #4f8cff;
    text-decoration: none;
}

.pagination a:hover { text-decoration: underline; }

/* Modal */
.modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    width: 420px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}

.modal-content h2 {
    margin: 0 0 16px;
    font-size: 18px;
}

.modal-content label {
    display: block;
    margin-bottom: 12px;
    font-size: 13px;
    font-weight: 500;
}

.modal-content input,
.modal-content select {
    display: block;
    width: 100%;
    margin-top: 4px;
    padding: 7px 10px;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    font-size: 13px;
}

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 16px;
}

/* Login page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

.login-wrapper {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-card {
    background: #fff;
    border-radius: 14px;
    padding: 40px 36px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.25);
    text-align: center;
}

.login-logo {
    margin-bottom: 16px;
}

.login-card h1 {
    font-size: 22px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 4px;
}

.login-subtitle {
    color: #666;
    font-size: 14px;
    margin-bottom: 24px;
}

.login-error {
    background: #fff0f0;
    border: 1px solid #fcc;
    color: #c00;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 18px;
}

.form-group {
    text-align: left;
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.form-group input {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d0d0d0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input:focus {
    outline: none;
    border-color: #4f8cff;
    box-shadow: 0 0 0 3px rgba(79,140,255,0.15);
}

.btn-login {
    display: block;
    width: 100%;
    padding: 11px;
    border: none;
    border-radius: 8px;
    background: #4f8cff;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s;
    margin-top: 4px;
}

.btn-login:hover {
    background: #3a7be0;
    box-shadow: 0 4px 12px rgba(79,140,255,0.35);
}

.login-footer {
    text-align: center;
    color: rgba(255,255,255,0.45);
    font-size: 12px;
    margin-top: 20px;
}

/* Logout link in sidebar */
.sidebar-footer {
    border-top: 1px solid #2d2d44;
    padding: 12px 16px;
    margin-top: auto;
}

.sidebar-user {
    display: block;
    font-size: 12px;
    color: #a0a0b8;
    margin-bottom: 6px;
}

.sidebar-footer .nav-item,
.sidebar-footer .btn-logout {
    color: #a0a0b8;
    font-size: 12px;
    padding: 4px 0;
}

.sidebar-footer .btn-logout:hover {
    color: #ff6b6b;
}
