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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0f172a;
    color: #e2e8f0;
    min-height: 100vh;
}

.hidden {
    display: none !important;
}

.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-box {
    background: #1e293b;
    padding: 2.5rem;
    border-radius: 12px;
    text-align: center;
    width: 100%;
    max-width: 360px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.login-box h1 {
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.login-box p {
    color: #94a3b8;
    margin-bottom: 1.5rem;
}

.login-box input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #334155;
    border-radius: 8px;
    background: #0f172a;
    color: #e2e8f0;
    font-size: 1rem;
    margin-bottom: 1rem;
}

.login-box input:focus {
    outline: none;
    border-color: #3b82f6;
}

.login-box button {
    width: 100%;
    padding: 0.75rem;
    border: none;
    border-radius: 8px;
    background: #3b82f6;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.login-box button:hover {
    background: #2563eb;
}

.error {
    color: #ef4444;
    margin-top: 0.75rem;
    font-size: 0.875rem;
}

header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 2rem;
    background: #1e293b;
    border-bottom: 1px solid #334155;
}

header h1 {
    font-size: 1.25rem;
    font-weight: 700;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.badge {
    background: #334155;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8rem;
    color: #94a3b8;
}

.badge.clickable {
    cursor: pointer;
    transition: background 0.2s;
}

.badge.clickable:hover {
    background: #475569;
}

.btn-secondary {
    padding: 0.5rem 1rem;
    border: 1px solid #475569;
    border-radius: 6px;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.btn-secondary:hover {
    border-color: #94a3b8;
    color: #e2e8f0;
}

.btn-primary {
    padding: 0.5rem 1.25rem;
    border: none;
    border-radius: 6px;
    background: #3b82f6;
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: #2563eb;
}

.btn-icon {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: #3b82f6;
    color: white;
    font-size: 1.5rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: background 0.2s;
    padding: 0;
}

.btn-icon:hover {
    background: #2563eb;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.875rem;
    color: #94a3b8;
}

.form-group input {
    width: 100%;
    padding: 0.65rem 1rem;
    border: 1px solid #334155;
    border-radius: 8px;
    background: #0f172a;
    color: #e2e8f0;
    font-size: 0.95rem;
}

.form-group input:focus {
    outline: none;
    border-color: #3b82f6;
}

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.add-site {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.add-site input {
    padding: 0.65rem 1rem;
    border: 1px solid #334155;
    border-radius: 8px;
    background: #1e293b;
    color: #e2e8f0;
    font-size: 0.95rem;
}

.add-site input:focus {
    outline: none;
    border-color: #3b82f6;
}

#site-name {
    flex: 1;
    min-width: 180px;
}

#site-url {
    flex: 2;
    min-width: 240px;
}

.add-site button {
    padding: 0.65rem 1.5rem;
    border: none;
    border-radius: 8px;
    background: #3b82f6;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.add-site button:hover {
    background: #2563eb;
}

.settings {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding: 1rem 1.25rem;
    background: #1e293b;
    border-radius: 10px;
    flex-wrap: wrap;
}

.settings label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #94a3b8;
}

.settings input {
    width: 70px;
    padding: 0.4rem 0.6rem;
    border: 1px solid #334155;
    border-radius: 6px;
    background: #0f172a;
    color: #e2e8f0;
    font-size: 0.875rem;
    text-align: center;
}

.settings input:focus {
    outline: none;
    border-color: #3b82f6;
}

#save-settings-btn {
    padding: 0.5rem 1.25rem;
    border: none;
    border-radius: 6px;
    background: #10b981;
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.2s;
}

#save-settings-btn:hover {
    background: #059669;
}

.sites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}

.site-card {
    background: #1e293b;
    border-radius: 12px;
    padding: 1.25rem;
    border-left: 4px solid #475569;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.site-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.site-card.up {
    border-left-color: #10b981;
}

.site-card.down {
    border-left-color: #ef4444;
}

.site-card.unknown {
    border-left-color: #f59e0b;
}

.site-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.site-name {
    font-weight: 600;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot.up {
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
}

.status-dot.down {
    background: #ef4444;
    box-shadow: 0 0 8px #ef4444;
}

.status-dot.unknown {
    background: #f59e0b;
    box-shadow: 0 0 8px #f59e0b;
}

.site-url {
    font-size: 0.8rem;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.75rem;
}

.site-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: #94a3b8;
}

.site-meta span {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.incident-badge {
    color: #f59e0b !important;
    font-weight: 500;
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 1rem;
}

#add-modal,
#settings-modal {
    z-index: 110;
}

.modal-content {
    background: #1e293b;
    border-radius: 12px;
    width: 100%;
    max-width: 640px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-content.modal-small {
    max-width: 420px;
}

.modal-body {
    padding: 1.5rem;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #334155;
}

.modal-header h2 {
    flex: 1;
    min-width: 0;
    margin-right: 1rem;
    font-size: 1.1rem;
    overflow-wrap: anywhere;
}

.modal-header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.modal-header button {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

.modal-header button:hover {
    color: #e2e8f0;
}

.modal-header .modal-action-btn {
    padding: 0.35rem 0.8rem;
    border: 1px solid #3b82f6;
    border-radius: 6px;
    background: transparent;
    color: #60a5fa;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    line-height: 1.2;
    transition: all 0.2s;
}

.modal-header .modal-action-btn:hover {
    background: #3b82f6;
    color: white;
}

#modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.history-table th,
.history-table td {
    padding: 0.6rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid #334155;
}

.history-table th {
    color: #64748b;
    font-weight: 500;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.history-table td {
    color: #cbd5e1;
}

.history-status {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.history-status .status-dot {
    width: 8px;
    height: 8px;
}

.site-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.site-actions .delete-btn {
    margin-top: 0;
}

.delete-btn {
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    border: 1px solid #ef4444;
    border-radius: 6px;
    background: transparent;
    color: #ef4444;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.delete-btn:hover {
    background: #ef4444;
    color: white;
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #64748b;
}

.empty-state h3 {
    margin-bottom: 0.5rem;
    color: #94a3b8;
}
