/* Минимальные общие стили - без фреймворков. Приоритет: читаемость, а не красота,
   т.к. интерфейс - MVP, который позже целиком переделают (см. ТЗ). */

:root {
    --color-bg: #f5f6f8;
    --color-surface: #ffffff;
    --color-border: #dcdfe4;
    --color-text: #1f2328;
    --color-muted: #656d76;
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-danger: #dc2626;
    --color-success: #15803d;
    --radius: 6px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
}

header.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}

header.topbar nav a {
    margin-right: 16px;
    color: var(--color-muted);
    text-decoration: none;
    font-size: 14px;
}

header.topbar nav a.active,
header.topbar nav a:hover {
    color: var(--color-primary);
}

main {
    max-width: 960px;
    margin: 24px auto;
    padding: 0 16px 48px;
}

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
}

.card h2 {
    margin-top: 0;
    font-size: 16px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
}

.stat-card .value {
    font-size: 28px;
    font-weight: 600;
}

.stat-card .label {
    font-size: 13px;
    color: var(--color-muted);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th, td {
    text-align: left;
    padding: 8px 10px;
    border-bottom: 1px solid var(--color-border);
}

th {
    color: var(--color-muted);
    font-weight: 600;
}

.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.status-RUNNING { background: #dcfce7; color: var(--color-success); }
.status-PAUSED_CIRCUIT_BREAKER { background: #fef3c7; color: #92400e; }
.status-STOPPED, .status-FAILED_PROVISIONING { background: #fee2e2; color: var(--color-danger); }
.status-PROVISIONING { background: #e0e7ff; color: #3730a3; }

label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
    margin-top: 12px;
}

input[type="text"], input[type="number"], input[type="url"], textarea, select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
}

textarea { min-height: 90px; resize: vertical; }

button {
    margin-top: 14px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius);
    background: var(--color-primary);
    color: white;
    font-size: 14px;
    cursor: pointer;
}

button:hover { background: var(--color-primary-hover); }

button.secondary {
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

button.danger { background: var(--color-danger); }

button:disabled { opacity: 0.6; cursor: not-allowed; }

#error-banner {
    padding: 10px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
}

#error-banner.error { background: #fee2e2; color: var(--color-danger); border: 1px solid #fecaca; }
#error-banner.success { background: #dcfce7; color: var(--color-success); border: 1px solid #bbf7d0; }
.hidden { display: none; }

.image-slot {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--color-border);
}

.image-slot img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    background: #f0f0f0;
}

.login-page {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.login-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 32px;
    text-align: center;
    min-width: 320px;
}

.progress-bar-track {
    width: 100%;
    height: 10px;
    background: var(--color-border);
    border-radius: 999px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-bar-fill {
    height: 100%;
    background: var(--color-primary);
    transition: width 0.3s ease;
}

.muted { color: var(--color-muted); font-size: 13px; }
.row-actions button { margin-right: 6px; }
