/* =========================================================================
   Buttons
   ========================================================================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    background: var(--navy-800);
    color: var(--ivory);
    transition: background 120ms, border-color 120ms, transform 80ms;
    user-select: none;
    text-decoration: none;
}
.btn:hover { background: var(--navy-700); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 12px 20px; font-size: 15px; }
.btn-block { width: 100%; }

.btn-primary {
    background: var(--sage);
    color: var(--navy-950);
    font-weight: 600;
}
.btn-primary:hover { background: var(--sage); filter: brightness(1.1); }

.btn-ghost {
    background: transparent;
    border-color: var(--navy-700);
    color: var(--ivory-dim);
}
.btn-ghost:hover { background: var(--navy-800); color: var(--ivory); border-color: var(--navy-600); }

.btn-danger { background: var(--red); color: var(--ivory); }
.btn-danger:hover { background: var(--red); filter: brightness(1.1); }

.btn-warn { background: var(--amber); color: var(--navy-950); font-weight: 600; }

/* =========================================================================
   Cards, badges, pills
   ========================================================================= */

.card {
    background: var(--navy-900);
    border: 1px solid var(--navy-700);
    border-radius: var(--radius-lg);
    padding: 16px;
}
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.card-title {
    font-family: var(--font-display);
    font-size: 16px;
    margin: 0;
}
.card-sub {
    color: var(--ivory-muted);
    font-size: 12px;
    font-family: var(--font-mono);
}
.stat-card {
    padding: 14px;
    text-align: left;
}
.stat-value {
    font-family: var(--font-mono);
    font-size: 26px;
    color: var(--ivory);
    line-height: 1.2;
}
.stat-label {
    color: var(--ivory-muted);
    font-size: 11px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-family: var(--font-mono);
    letter-spacing: 0.03em;
    background: var(--navy-800);
    color: var(--ivory-dim);
    border: 1px solid var(--navy-700);
}
.badge-online { background: rgba(126, 200, 176, 0.14); color: var(--sage); border-color: transparent; }
.badge-warning { background: rgba(239, 159, 39, 0.16); color: var(--amber); border-color: transparent; }
.badge-critical { background: rgba(226, 75, 74, 0.16); color: var(--red); border-color: transparent; }
.badge-offline { background: rgba(226, 75, 74, 0.12); color: var(--red); border-color: transparent; }
.badge-maintenance { background: rgba(74, 158, 255, 0.14); color: var(--blue); border-color: transparent; }
.badge-provisioned { background: var(--navy-800); color: var(--ivory-muted); border-color: transparent; }
.badge-decommissioned { background: var(--navy-800); color: var(--ivory-muted); border-color: transparent; text-decoration: line-through; }
.badge-success { background: rgba(126, 200, 176, 0.14); color: var(--sage); border-color: transparent; }
.badge-info { background: rgba(74, 158, 255, 0.14); color: var(--blue); border-color: transparent; }
.badge-neutral { background: var(--navy-800); color: var(--ivory-dim); }

/* =========================================================================
   Status dot
   ========================================================================= */

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ivory-muted);
    box-shadow: 0 0 0 3px transparent;
    vertical-align: middle;
    flex-shrink: 0;
}
.status-dot.status-online { background: var(--sage); box-shadow: 0 0 0 3px var(--sage-glow); }
.status-dot.status-warning { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-glow); }
.status-dot.status-critical,
.status-dot.status-offline { background: var(--red); box-shadow: 0 0 0 3px var(--red-glow); }
.status-dot.status-maintenance { background: var(--blue); box-shadow: 0 0 0 3px var(--blue-glow); }
.status-dot.status-provisioned,
.status-dot.status-decommissioned { background: var(--ivory-muted); }

/* =========================================================================
   Progress bars
   ========================================================================= */

.progress {
    height: 6px;
    background: var(--navy-800);
    border-radius: 3px;
    overflow: hidden;
    flex: 1;
}
.progress-fill {
    height: 100%;
    background: var(--sage);
    transition: width 240ms ease-out, background 240ms;
}
.progress-fill.warn { background: var(--amber); }
.progress-fill.crit { background: var(--red); }

.metric-row {
    display: grid;
    grid-template-columns: 40px 1fr 44px;
    gap: 8px;
    align-items: center;
    font-size: 12px;
    color: var(--ivory-dim);
    font-family: var(--font-mono);
}
.metric-row .label { color: var(--ivory-muted); }
.metric-row .value {
    text-align: right;
    color: var(--ivory);
    font-family: var(--font-mono);
}

/* =========================================================================
   Tables
   ========================================================================= */

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--navy-900);
    border: 1px solid var(--navy-800);
    border-radius: var(--radius-lg);
    overflow: hidden;
    font-size: 13px;
}
.table th, .table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--navy-800);
}
.table th {
    background: var(--navy-900);
    color: var(--ivory-muted);
    font-weight: 500;
    font-size: 11px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--navy-800); }
.table td.mono, .table th.mono { font-family: var(--font-mono); font-size: 12px; }
.table .right { text-align: right; }

/* =========================================================================
   Toast notifications
   ========================================================================= */

.toast-stack {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 100;
    max-width: 360px;
}
.toast {
    background: var(--navy-800);
    border: 1px solid var(--navy-700);
    border-left: 3px solid var(--sage);
    border-radius: var(--radius);
    padding: 12px 16px;
    font-size: 13px;
    box-shadow: var(--shadow-pop);
    animation: toast-in 180ms ease-out;
}
.toast-title {
    font-weight: 600;
    margin-bottom: 2px;
}
.toast-body { color: var(--ivory-dim); }
.toast.toast-warning { border-left-color: var(--amber); }
.toast.toast-error { border-left-color: var(--red); }
.toast.toast-info { border-left-color: var(--blue); }

@keyframes toast-in {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* =========================================================================
   Modal
   ========================================================================= */

.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(6, 15, 30, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}
.modal {
    background: var(--navy-900);
    border: 1px solid var(--navy-700);
    border-radius: var(--radius-lg);
    width: min(560px, 90vw);
    max-height: 85vh;
    overflow: auto;
    padding: 20px;
    box-shadow: var(--shadow-pop);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.modal-close {
    background: transparent; border: 0; color: var(--ivory-muted);
    font-size: 18px; cursor: pointer;
}

/* =========================================================================
   Dropdown / menu
   ========================================================================= */

.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    min-width: 180px;
    background: var(--navy-900);
    border: 1px solid var(--navy-700);
    border-radius: var(--radius);
    box-shadow: var(--shadow-pop);
    padding: 4px;
    z-index: 20;
}
.dropdown-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 10px;
    background: transparent;
    border: 0;
    color: var(--ivory-dim);
    font-size: 13px;
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.dropdown-item:hover { background: var(--navy-800); color: var(--ivory); }
.dropdown-sep { height: 1px; background: var(--navy-800); margin: 4px 0; }

/* =========================================================================
   Pills / filter chips
   ========================================================================= */

.pill-row { display: flex; gap: 6px; flex-wrap: wrap; }
.pill {
    background: var(--navy-800);
    border: 1px solid var(--navy-700);
    padding: 5px 12px;
    border-radius: 16px;
    color: var(--ivory-dim);
    font-size: 12px;
    cursor: pointer;
    transition: background 120ms, color 120ms;
}
.pill:hover { background: var(--navy-700); color: var(--ivory); }
.pill.active { background: var(--sage-glow); color: var(--sage); border-color: transparent; }

/* =========================================================================
   Form elements (shared)
   ========================================================================= */

input[type=text],
input[type=email],
input[type=password],
input[type=number],
input[type=url],
select,
textarea {
    background: var(--navy-800);
    border: 1px solid var(--navy-700);
    border-radius: var(--radius);
    padding: 8px 10px;
    color: var(--ivory);
    font-family: var(--font-ui);
    font-size: 13px;
    outline: none;
    width: 100%;
    transition: border-color 120ms;
}
textarea { resize: vertical; min-height: 80px; font-family: var(--font-mono); font-size: 12px; }
input:focus, select:focus, textarea:focus { border-color: var(--sage-dim); }
input[disabled], select[disabled], textarea[disabled] { opacity: 0.55; }

.checkbox {
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--ivory-dim); font-size: 13px; cursor: pointer;
}
.checkbox input { width: auto; }

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