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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

header {
    background: #1a1a2e;
    color: #fff;
    padding: 0 2rem;
}

nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    height: 56px;
}

.logo {
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.5px;
}

nav ul {
    list-style: none;
    display: flex;
    gap: 1.5rem;
}

nav a {
    color: #aaa;
    text-decoration: none;
    font-size: 0.9rem;
}

nav a.active,
nav a:hover {
    color: #fff;
}

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

h1 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

h2 {
    font-size: 1.15rem;
    margin-bottom: 1rem;
}

.loading {
    color: #888;
}

.error {
    color: #c62828;
}

/* Queue list table */
.queue-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

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

.queue-table th {
    background: #fafafa;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #666;
}

.queue-table td {
    font-size: 0.9rem;
}

.queue-table tr:last-child td {
    border-bottom: none;
}

.queue-table tr:hover td {
    background: #f9f9f9;
}

/* Status badges */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-ok {
    background: #e6f9e6;
    color: #2d7a2d;
}

.badge-warn {
    background: #fff3e0;
    color: #b36b00;
}

.badge-critical {
    background: #fde8e8;
    color: #c62828;
}

.badge-aging {
    background: #ede7f6;
    color: #6a1b9a;
}

.badge-ack {
    background: #e3f2fd;
    color: #1565c0;
}

.badge-muted {
    background: #f5f5f5;
    color: #888;
}

/* Cards */
.card {
    background: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem;
}

/* Forms */
input, select, textarea {
    font-family: inherit;
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 100%;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #1a1a2e;
}

button {
    font-family: inherit;
    font-size: 0.9rem;
    padding: 0.5rem 1.25rem;
    background: #1a1a2e;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

button:hover {
    background: #2a2a4e;
}

/* Login / Register */
.login-container {
    max-width: 400px;
    margin: 2rem auto;
}

.google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.65rem 1rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    color: #333;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s;
}

.google-btn:hover {
    background: #f8f8f8;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.login-divider {
    display: flex;
    align-items: center;
    margin: 1.25rem 0;
    color: #aaa;
    font-size: 0.8rem;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #ddd;
}

.login-divider span {
    padding: 0 0.75rem;
}

.divider {
    text-align: center;
    color: #aaa;
    font-size: 0.85rem;
    margin: 1.5rem 0;
}

.logout-link {
    color: #aaa;
    text-decoration: none;
    font-size: 0.85rem;
    cursor: pointer;
}

.logout-link:hover {
    color: #fff;
}

/* Queue grid */
.queue-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.queue-card {
    cursor: pointer;
    transition: box-shadow 0.15s, transform 0.15s;
    padding: 1rem 1.25rem;
}

.queue-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    transform: translateY(-1px);
}

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

.queue-card-name {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70%;
}

.queue-card-stats {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 0.5rem;
}

.stat {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
}

.sparkline-container {
    height: 40px;
    margin: 0.5rem 0;
}

.queue-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: #888;
    margin-top: 0.25rem;
}

.queue-card-footer a {
    color: #1a1a2e;
    text-decoration: underline;
}

/* Detail view */
.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.detail-stats {
    display: flex;
    gap: 2rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
}

.stat-box .stat-value {
    font-size: 1.5rem;
}

.stat-box .stat-label {
    margin-top: 0.25rem;
}

.queue-notes {
    color: #666;
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

.chart-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 1rem;
}

.chart-container {
    background: #fafafa;
    border-radius: 8px;
    padding: 1rem;
    height: 280px;
}

.chart-container h3 {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.chart-container canvas {
    height: 220px !important;
}

.btn-secondary {
    background: #eee;
    color: #333;
    font-size: 0.8rem;
    padding: 0.4rem 1rem;
}

.btn-secondary:hover {
    background: #ddd;
}

/* Auth type tabs */
.auth-type-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1rem;
    border-bottom: 2px solid #eee;
}

.tab-btn {
    background: none;
    color: #888;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
}

.tab-btn:hover {
    color: #333;
    background: none;
}

.tab-btn.active {
    color: #1a1a2e;
    border-bottom-color: #1a1a2e;
    background: none;
}

/* Muted text */
.muted {
    color: #888;
    font-size: 0.85rem;
}

/* Replay section */
.replay-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 0.75rem 0;
}

.replay-table {
    margin-top: 0.75rem;
}

/* Queue settings (detail view) */
.settings-section {
    border-top: 1px solid #eee;
    padding-top: 1rem;
    margin-top: 1rem;
    margin-bottom: 1rem;
}

.settings-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: flex-end;
}

.settings-row .form-group {
    flex: 1;
}

.settings-row .form-group:first-child {
    flex: 3;
}

.inline-edit {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.inline-edit input {
    flex: 1;
}

.inline-link {
    font-size: 0.8rem;
    white-space: nowrap;
}

.settings-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.75rem;
}

.save-success {
    color: #2d7a2d;
    font-size: 0.85rem;
}

/* Alert channels */
.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: flex-end;
}

.form-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #666;
}

.channel-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.25rem;
}

.channel-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.channel-type-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-slack { background: #e8d5f5; color: #611f69; }
.badge-email { background: #d5e8f5; color: #1a5276; }
.badge-pagerduty { background: #e6f9e6; color: #06ac38; }

.channel-target {
    font-weight: 500;
    font-size: 0.9rem;
}

.channel-target-detail {
    font-size: 0.75rem;
    color: #888;
}

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

.toggle-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    font-size: 0.8rem;
    color: #666;
}

.btn-danger {
    background: #c62828;
    color: #fff;
}

.btn-danger:hover {
    background: #a52222;
}

.btn-small {
    font-size: 0.75rem;
    padding: 0.3rem 0.75rem;
}

/* Help page */
.help-toc ul {
    list-style: none;
    columns: 2;
}

.help-toc a {
    color: #1a1a2e;
    text-decoration: none;
    font-size: 0.9rem;
    line-height: 2;
}

.help-toc a:hover {
    text-decoration: underline;
}

.help-steps {
    margin: 0.75rem 0;
    padding-left: 1.5rem;
}

.help-steps li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.help-list {
    margin: 0.75rem 0;
    padding-left: 1.5rem;
}

.help-list li {
    margin-bottom: 0.4rem;
}

.code-block {
    background: #1a1a2e;
    color: #e0e0e0;
    padding: 1rem 1.25rem;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 0.8rem;
    line-height: 1.5;
    margin: 0.75rem 0;
}

.faq-item {
    border-top: 1px solid #eee;
    padding-top: 0.75rem;
    margin-top: 0.75rem;
}

.faq-item:first-child {
    border-top: none;
    padding-top: 0;
    margin-top: 0;
}

.faq-item h3 {
    font-size: 0.9rem;
    margin-bottom: 0.35rem;
}

.faq-item p {
    font-size: 0.85rem;
    color: #555;
}

.card h3 {
    font-size: 0.95rem;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.card code {
    background: #f0f0f0;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    font-size: 0.8rem;
}

/* Guide page styles */
.guide-tip {
    background: #e8f5e9;
    border-left: 3px solid #2d7a2d;
    padding: 0.75rem 1rem;
    margin: 1rem 0;
    font-size: 0.85rem;
    border-radius: 0 4px 4px 0;
}

.guide-warning {
    background: #fff3e0;
    border-left: 3px solid #b36b00;
    padding: 0.75rem 1rem;
    margin: 1rem 0;
    font-size: 0.85rem;
    border-radius: 0 4px 4px 0;
}

.alert-preview {
    background: #1a1a2e;
    color: #fff;
    border-radius: 6px;
    padding: 1rem;
    margin: 1rem 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    max-width: 500px;
}

.alert-preview-header {
    font-weight: bold;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.15);
}

.alert-preview-body {
    font-size: 0.85rem;
    line-height: 1.7;
    color: #ccc;
}

/* Action bar (acknowledge / mute) */
.action-bar {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0.75rem 0;
    flex-wrap: wrap;
}

.ack-info {
    font-size: 0.8rem;
    color: #1565c0;
}

.mute-options {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.mute-label {
    font-size: 0.8rem;
    color: #888;
}

.incident-root-cause {
    max-width: 250px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Retention mismatch warnings */
.retention-warning {
    background: #fff3e0;
    color: #b36b00;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    margin-top: 0.4rem;
    cursor: help;
}

.retention-warning-detail {
    background: #fff3e0;
    border-left: 3px solid #b36b00;
    color: #7a4a00;
    font-size: 0.85rem;
    padding: 0.6rem 1rem;
    border-radius: 0 4px 4px 0;
    margin-bottom: 1rem;
}

@media (max-width: 768px) {
    .chart-grid {
        grid-template-columns: 1fr;
    }
    .queue-grid {
        grid-template-columns: 1fr;
    }
    .form-row {
        flex-direction: column;
    }
    .channel-card {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }
    .help-toc ul {
        columns: 1;
    }
}
