* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

#loginContainer {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 40px);
}

.login-card {
    width: 400px;
}

.btn-block {
    width: 100%;
}

.card {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    border-radius: 12px;
    padding: 20px 30px;
    margin-bottom: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.header h1 {
    color: #333;
    font-size: 28px;
}

.header-actions {
    display: flex;
    gap: 10px;
}

h1 {
    color: #333;
    margin-bottom: 20px;
    font-size: 24px;
}

h2 {
    color: #555;
    margin-bottom: 20px;
    font-size: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.form-group small {
    display: block;
    margin-top: 6px;
    color: #888;
    font-size: 12px;
}

.btn-primary, .btn-secondary, .btn-danger, .btn-warning, .btn-success, .btn-orange {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover { background: #5a6268; }

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover { background: #c82333; }

.btn-warning {
    background: #ffc107;
    color: #212529;
}

.btn-warning:hover { background: #e0a800; }

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover { background: #218838; }

.btn-orange {
    background: #fd7e14;
    color: white;
}

.btn-orange:hover { background: #e8690b; }

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
    border-radius: 6px;
}

.action-cell {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    align-items: center;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.stat-value {
    font-size: 40px;
    font-weight: bold;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}

.stat-color-active {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-color-expired {
    background: linear-gradient(135deg, #fd7e14 0%, #e83e8c 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-color-revoked {
    background: linear-gradient(135deg, #dc3545 0%, #721c24 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-label {
    color: #888;
    font-size: 13px;
    font-weight: 500;
}

.search-box {
    margin-bottom: 20px;
}

.search-box input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: #f8f9fa;
}

th {
    padding: 14px 12px;
    text-align: left;
    font-weight: 600;
    color: #555;
    font-size: 13px;
    border-bottom: 2px solid #e0e0e0;
    white-space: nowrap;
}

td {
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
    color: #333;
}

tr:hover {
    background: #f8f9fa;
}

.mono {
    font-family: 'Courier New', monospace;
    font-size: 12px;
}

.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.status-active {
    background: #d4edda;
    color: #155724;
}

.status-expired {
    background: #fff3cd;
    color: #856404;
}

.status-revoked {
    background: #f8d7da;
    color: #721c24;
}

.online-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.online-badge.online {
    background: #d4edda;
    color: #155724;
}

.online-badge.offline {
    background: #e9ecef;
    color: #6c757d;
}

.license-key {
    font-family: 'Courier New', monospace;
    background: #f0f0f0;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    display: inline-block;
}

.license-key:hover {
    background: #e0e0e0;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 500;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.modal-box {
    position: relative;
    background: white;
    border-radius: 12px;
    padding: 30px;
    width: 440px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 501;
}

.modal-box h2 {
    margin-bottom: 24px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 10px;
}

.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 14px 22px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: none;
    z-index: 1000;
    animation: slideIn 0.3s ease;
    max-width: 360px;
}

@keyframes slideIn {
    from { transform: translateX(400px); opacity: 0; }
    to   { transform: translateX(0);     opacity: 1; }
}

.toast.success { border-left: 4px solid #28a745; }
.toast.error   { border-left: 4px solid #dc3545; }

.btn-screenshot {
    background: #17a2b8;
    color: white;
}

.btn-screenshot:hover { background: #138496; }

.screenshot-modal-box {
    width: 90vw;
    max-width: 1200px;
}

.screenshot-status {
    text-align: center;
    color: #555;
    padding: 20px 0;
    font-size: 14px;
}

.screenshot-meta {
    font-size: 12px;
    color: #888;
    margin-bottom: 10px;
    text-align: center;
}

.screenshot-img {
    width: 100%;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    display: block;
}

@media (max-width: 768px) {
    .form-row { grid-template-columns: 1fr; }
    .stats { grid-template-columns: 1fr 1fr; }
    .header { flex-direction: column; gap: 12px; }
    .header-actions { flex-wrap: wrap; }
    .modal-box { width: 90%; }
}
