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

body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background: #f0f2f5; color: #333; }

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

.sidebar {
    width: 240px; background: #1a1f36; color: #fff; flex-shrink: 0;
    display: flex; flex-direction: column;
}
.sidebar-brand {
    padding: 24px 20px; font-size: 18px; font-weight: 700;
    border-bottom: 1px solid rgba(255,255,255,0.1); color: #7c83fd;
}
.sidebar-brand span { display: block; font-size: 11px; color: #8892b0; font-weight: 400; margin-top: 2px; }
.sidebar nav { padding: 16px 0; flex: 1; }
.sidebar nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 20px; color: #8892b0; text-decoration: none;
    font-size: 14px; transition: all .2s;
}
.sidebar nav a:hover, .sidebar nav a.active { background: rgba(124,131,253,.15); color: #fff; }
.sidebar nav a .icon { width: 18px; text-align: center; }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.1); }
.sidebar-footer a { color: #8892b0; font-size: 13px; text-decoration: none; }

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

.topbar {
    background: #fff; padding: 16px 28px; display: flex; align-items: center;
    justify-content: space-between; border-bottom: 1px solid #e8ecf0;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.topbar h1 { font-size: 20px; font-weight: 600; color: #1a1f36; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.admin-badge { background: #7c83fd20; color: #7c83fd; padding: 6px 12px; border-radius: 20px; font-size: 13px; }

.content { padding: 28px; overflow-y: auto; flex: 1; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 28px; }
.stat-card {
    background: #fff; border-radius: 12px; padding: 20px 24px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06); border: 1px solid #e8ecf0;
}
.stat-card .label { font-size: 12px; color: #8892b0; text-transform: uppercase; letter-spacing: .5px; }
.stat-card .value { font-size: 32px; font-weight: 700; color: #1a1f36; margin-top: 6px; }
.stat-card .sub { font-size: 12px; color: #8892b0; margin-top: 4px; }

.card {
    background: #fff; border-radius: 12px; padding: 24px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06); border: 1px solid #e8ecf0; margin-bottom: 24px;
}
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.card-title { font-size: 16px; font-weight: 600; color: #1a1f36; }

.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: 8px; font-size: 14px; font-weight: 500;
    cursor: pointer; text-decoration: none; border: none; transition: all .2s;
}
.btn-primary { background: #7c83fd; color: #fff; }
.btn-primary:hover { background: #6366f1; }
.btn-success { background: #10b981; color: #fff; }
.btn-success:hover { background: #059669; }
.btn-danger { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-secondary { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
.btn-secondary:hover { background: #e2e8f0; }
.btn-warning { background: #f59e0b; color: #fff; }
.btn-warning:hover { background: #d97706; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

table { width: 100%; border-collapse: collapse; }
table th { background: #f8fafc; padding: 12px 16px; text-align: left; font-size: 12px; color: #8892b0; text-transform: uppercase; letter-spacing: .5px; border-bottom: 2px solid #e8ecf0; }
table td { padding: 14px 16px; border-bottom: 1px solid #f1f5f9; font-size: 14px; }
table tr:last-child td { border-bottom: none; }
table tr:hover td { background: #f8fafc; }

.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 500;
}
.badge::before { content: '●'; font-size: 8px; }
.badge-active { background: #d1fae5; color: #065f46; }
.badge-inactive { background: #fee2e2; color: #991b1b; }
.badge-expired { background: #fef3c7; color: #92400e; }
.badge-failed { background: #fee2e2; color: #991b1b; }
.badge-pending { background: #e0e7ff; color: #3730a3; }

.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: #374151; margin-bottom: 6px; }
.form-control {
    width: 100%; padding: 10px 14px; border: 1px solid #d1d5db; border-radius: 8px;
    font-size: 14px; color: #1f2937; transition: border .2s;
    background: #fff;
}
.form-control:focus { outline: none; border-color: #7c83fd; box-shadow: 0 0 0 3px rgba(124,131,253,.1); }
.form-control select { cursor: pointer; }
select.form-control { cursor: pointer; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

.alert { padding: 14px 18px; border-radius: 8px; font-size: 14px; margin-bottom: 16px; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }

.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.5);
    display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.modal { background: #fff; border-radius: 12px; padding: 28px; width: 90%; max-width: 520px; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-title { font-size: 18px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: #9ca3af; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }

.courier-key-item {
    border: 1px solid #e8ecf0; border-radius: 8px; padding: 14px;
    margin-bottom: 10px; display: flex; align-items: center; gap: 12px;
}
.courier-key-info { flex: 1; }
.courier-key-label { font-weight: 600; font-size: 14px; }
.courier-key-meta { font-size: 12px; color: #8892b0; margin-top: 3px; }
.courier-key-actions { display: flex; gap: 6px; }

.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.status-dot.active { background: #10b981; }
.status-dot.failed { background: #ef4444; }
.status-dot.unknown { background: #f59e0b; }

.progress-bar { background: #e5e7eb; border-radius: 999px; height: 6px; overflow: hidden; }
.progress-bar-inner { height: 100%; background: linear-gradient(90deg, #7c83fd, #10b981); border-radius: 999px; }

.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #1a1f36 0%, #2d3561 100%); }
.login-box { background: #fff; border-radius: 16px; padding: 40px; width: 400px; box-shadow: 0 25px 60px rgba(0,0,0,.3); }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo h1 { font-size: 24px; font-weight: 700; color: #1a1f36; }
.login-logo p { color: #8892b0; font-size: 14px; margin-top: 4px; }

.empty-state { text-align: center; padding: 60px 20px; color: #8892b0; }
.empty-state .icon { font-size: 48px; margin-bottom: 16px; }
.empty-state p { font-size: 16px; }

.search-box { display: flex; gap: 10px; margin-bottom: 16px; }
.search-box .form-control { flex: 1; }

.pagination { display: flex; gap: 4px; margin-top: 20px; justify-content: center; }
.pagination a, .pagination span {
    padding: 8px 12px; border-radius: 6px; font-size: 13px; text-decoration: none;
    border: 1px solid #e2e8f0; color: #374151;
}
.pagination a:hover { background: #f1f5f9; }
.pagination .current { background: #7c83fd; color: #fff; border-color: #7c83fd; }

.key-display {
    font-family: monospace; background: #f8fafc; border: 1px solid #e2e8f0;
    padding: 10px 14px; border-radius: 8px; font-size: 13px; color: #1a1f36;
    word-break: break-all;
}

.copy-btn { cursor: pointer; }

.tabs { display: flex; gap: 0; margin-bottom: 24px; border-bottom: 2px solid #e8ecf0; }
.tab-btn {
    padding: 12px 20px; font-size: 14px; font-weight: 500; color: #8892b0;
    background: none; border: none; cursor: pointer; border-bottom: 2px solid transparent;
    margin-bottom: -2px; transition: all .2s;
}
.tab-btn.active { color: #7c83fd; border-bottom-color: #7c83fd; }
.tab-content { display: none; }
.tab-content.active { display: block; }

.renewal-page { min-height: 100vh; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); padding: 40px 20px; }
.renewal-box { max-width: 600px; margin: 0 auto; background: #fff; border-radius: 16px; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.renewal-header { background: linear-gradient(135deg, #1a1f36, #2d3561); padding: 30px; color: #fff; text-align: center; }
.renewal-header h1 { font-size: 22px; font-weight: 700; }
.renewal-header p { color: #8892b0; margin-top: 4px; font-size: 14px; }
.renewal-body { padding: 30px; }
.plan-card {
    border: 2px solid #e8ecf0; border-radius: 10px; padding: 20px;
    margin-bottom: 12px; cursor: pointer; transition: all .2s;
}
.plan-card:hover, .plan-card.selected { border-color: #7c83fd; background: #f0f0ff; }
.plan-card .plan-name { font-weight: 600; font-size: 16px; }
.plan-card .plan-price { font-size: 24px; font-weight: 700; color: #7c83fd; }
.plan-card .plan-duration { font-size: 13px; color: #8892b0; }

@media (max-width: 768px) {
    .sidebar { width: 200px; }
    .form-row { grid-template-columns: 1fr; }
    .form-row-3 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}
