/* shadcn-inspired theme on top of Bootstrap. Drives light/dark via [data-bs-theme]. */

:root,
[data-bs-theme="light"] {
    --background: 0 0% 100%;
    --foreground: 240 10% 3.9%;
    --card: 0 0% 100%;
    --card-foreground: 240 10% 3.9%;
    --popover: 0 0% 100%;
    --popover-foreground: 240 10% 3.9%;
    --primary: 240 5.9% 10%;
    --primary-foreground: 0 0% 98%;
    --secondary: 240 4.8% 95.9%;
    --secondary-foreground: 240 5.9% 10%;
    --muted: 240 4.8% 95.9%;
    --muted-foreground: 240 3.8% 46.1%;
    --accent: 240 4.8% 95.9%;
    --accent-foreground: 240 5.9% 10%;
    --destructive: 0 72% 51%;
    --destructive-foreground: 0 0% 98%;
    --success: 142 71% 45%;
    --success-foreground: 0 0% 98%;
    --warning: 38 92% 50%;
    --warning-foreground: 240 10% 3.9%;
    --degraded: 24 94% 50%;
    --info: 217 91% 60%;
    --info-foreground: 0 0% 98%;
    --border: 240 5.9% 90%;
    --input: 240 5.9% 90%;
    --ring: 240 5.9% 10%;
    --radius: 0.625rem;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, .04);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, .06), 0 1px 2px -1px rgba(0, 0, 0, .04);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, .08), 0 8px 10px -6px rgba(0, 0, 0, .06);
}

[data-bs-theme="dark"] {
    --background: 240 10% 3.9%;
    --foreground: 0 0% 98%;
    --card: 240 10% 5.5%;
    --card-foreground: 0 0% 98%;
    --popover: 240 10% 5.5%;
    --popover-foreground: 0 0% 98%;
    --primary: 0 0% 98%;
    --primary-foreground: 240 5.9% 10%;
    --secondary: 240 3.7% 15.9%;
    --secondary-foreground: 0 0% 98%;
    --muted: 240 3.7% 15.9%;
    --muted-foreground: 240 5% 64.9%;
    --accent: 240 3.7% 15.9%;
    --accent-foreground: 0 0% 98%;
    --destructive: 0 62% 50%;
    --destructive-foreground: 0 0% 98%;
    --success: 142 60% 45%;
    --success-foreground: 0 0% 98%;
    --warning: 38 92% 50%;
    --warning-foreground: 240 10% 3.9%;
    --degraded: 27 96% 56%;
    --info: 217 91% 60%;
    --info-foreground: 0 0% 98%;
    --border: 240 3.7% 18%;
    --input: 240 3.7% 18%;
    --ring: 240 4.9% 83.9%;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, .3);
    --shadow: 0 2px 6px 0 rgba(0, 0, 0, .35);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, .5);
}

/* Bootstrap variable bridges */
:root,
[data-bs-theme="light"],
[data-bs-theme="dark"] {
    --bs-body-bg: hsl(var(--background));
    --bs-body-color: hsl(var(--foreground));
    --bs-body-color-rgb: 17, 24, 39;
    --bs-border-color: hsl(var(--border));
    --bs-border-color-translucent: hsl(var(--border));
    --bs-secondary-bg: hsl(var(--secondary));
    --bs-secondary-color: hsl(var(--secondary-foreground));
    --bs-tertiary-bg: hsl(var(--muted));
    --bs-tertiary-color: hsl(var(--muted-foreground));
    --bs-emphasis-color: hsl(var(--foreground));
    --bs-link-color: hsl(var(--info));
    --bs-link-hover-color: hsl(var(--info) / .85);
    --bs-primary: hsl(var(--primary));
    --bs-primary-rgb: 17, 24, 39;
    --bs-focus-ring-color: hsl(var(--ring) / .25);
    --bs-border-radius: var(--radius);
    --bs-border-radius-sm: calc(var(--radius) - 4px);
    --bs-border-radius-lg: calc(var(--radius) + 4px);
}

/* Base */
html {
    background: hsl(var(--background));
}

body {
    background: hsl(var(--background));
    color: hsl(var(--foreground));
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Inter, "Helvetica Neue", Arial, sans-serif;
    font-feature-settings: "rlig" 1, "calt" 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color .2s ease, color .2s ease;
}

a {
    color: hsl(var(--info));
    text-decoration: none;
    transition: color .15s ease;
}

a:hover {
    color: hsl(var(--info) / .85);
    text-decoration: underline;
}

hr {
    border: none;
    border-top: 1px solid hsl(var(--border));
    opacity: 1;
    margin: 1rem 0;
}

code,
kbd,
samp,
pre {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
    font-size: .875em;
}

code {
    background: hsl(var(--muted));
    color: hsl(var(--foreground));
    padding: .15em .4em;
    border-radius: calc(var(--radius) - 4px);
    border: 1px solid hsl(var(--border));
}

pre {
    background: hsl(var(--muted));
    color: hsl(var(--foreground));
    padding: 1rem;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    overflow-x: auto;
}

pre code {
    background: transparent;
    border: none;
    padding: 0;
}

::selection {
    background: hsl(var(--primary) / .2);
    color: hsl(var(--foreground));
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: hsl(var(--border));
    border-radius: 999px;
    border: 2px solid hsl(var(--background));
}

::-webkit-scrollbar-thumb:hover {
    background: hsl(var(--muted-foreground) / .5);
}

/* Container override for tighter feel */
.container-fluid {
    padding-left: 0;
    padding-right: 0;
}

/* Headings */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    color: hsl(var(--foreground));
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* Buttons */
.btn {
    --bs-btn-padding-y: .45rem;
    --bs-btn-padding-x: .9rem;
    --bs-btn-font-size: .875rem;
    --bs-btn-font-weight: 500;
    --bs-btn-border-radius: calc(var(--radius) - 2px);
    border-radius: calc(var(--radius) - 2px);
    font-weight: 500;
    font-size: .875rem;
    padding: .45rem .9rem;
    border: 1px solid transparent;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease, opacity .15s ease;
    line-height: 1.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
}

.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px hsl(var(--ring) / .25);
}

.btn:disabled,
.btn.disabled {
    opacity: .55;
    pointer-events: none;
    box-shadow: none;
}

.btn-sm {
    --bs-btn-padding-y: .3rem;
    --bs-btn-padding-x: .6rem;
    --bs-btn-font-size: .8rem;
    padding: .3rem .65rem;
    font-size: .8rem;
    border-radius: calc(var(--radius) - 4px);
}

.btn-lg {
    --bs-btn-padding-y: .6rem;
    --bs-btn-padding-x: 1.2rem;
    --bs-btn-font-size: 1rem;
    padding: .6rem 1.2rem;
    font-size: 1rem;
    border-radius: var(--radius);
}

.btn-primary {
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    border-color: hsl(var(--primary));
}

.btn-primary:hover,
.btn-primary:focus {
    background: hsl(var(--primary) / .9);
    border-color: hsl(var(--primary) / .9);
    color: hsl(var(--primary-foreground));
}

.btn-primary:active,
.btn-primary.active {
    background: hsl(var(--primary) / .85);
    border-color: hsl(var(--primary) / .85);
    color: hsl(var(--primary-foreground));
}

.btn-secondary {
    background: hsl(var(--secondary));
    color: hsl(var(--secondary-foreground));
    border-color: hsl(var(--border));
}

.btn-secondary:hover,
.btn-secondary:focus {
    background: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
    border-color: hsl(var(--border));
}

.btn-secondary:active,
.btn-secondary.active {
    background: hsl(var(--muted));
    color: hsl(var(--accent-foreground));
    border-color: hsl(var(--border));
}

.btn-success {
    background: hsl(var(--success));
    color: hsl(var(--success-foreground));
    border-color: hsl(var(--success));
}

.btn-success:hover,
.btn-success:focus {
    background: hsl(var(--success) / .9);
    border-color: hsl(var(--success) / .9);
    color: hsl(var(--success-foreground));
}

.btn-danger,
.btn-destructive {
    background: hsl(var(--destructive));
    color: hsl(var(--destructive-foreground));
    border-color: hsl(var(--destructive));
}

.btn-danger:hover,
.btn-danger:focus,
.btn-destructive:hover,
.btn-destructive:focus {
    background: hsl(var(--destructive) / .9);
    border-color: hsl(var(--destructive) / .9);
    color: hsl(var(--destructive-foreground));
}

.btn-warning {
    background: hsl(var(--warning));
    color: hsl(var(--warning-foreground));
    border-color: hsl(var(--warning));
}

.btn-warning:hover,
.btn-warning:focus {
    background: hsl(var(--warning) / .9);
    border-color: hsl(var(--warning) / .9);
    color: hsl(var(--warning-foreground));
}

.btn-info {
    background: hsl(var(--info));
    color: hsl(var(--info-foreground));
    border-color: hsl(var(--info));
}

.btn-info:hover,
.btn-info:focus {
    background: hsl(var(--info) / .9);
    border-color: hsl(var(--info) / .9);
    color: hsl(var(--info-foreground));
}

.btn-light {
    background: hsl(var(--secondary));
    color: hsl(var(--secondary-foreground));
    border-color: hsl(var(--border));
}

.btn-light:hover,
.btn-light:focus {
    background: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
    border-color: hsl(var(--border));
}

.btn-dark {
    background: hsl(var(--foreground));
    color: hsl(var(--background));
    border-color: hsl(var(--foreground));
}

.btn-dark:hover,
.btn-dark:focus {
    background: hsl(var(--foreground) / .9);
    border-color: hsl(var(--foreground) / .9);
    color: hsl(var(--background));
}

.btn-outline,
.btn-outline-primary,
.btn-outline-secondary,
.btn-outline-dark,
.btn-outline-light {
    background: transparent;
    color: hsl(var(--foreground));
    border-color: hsl(var(--border));
}

.btn-outline:hover,
.btn-outline-primary:hover,
.btn-outline-secondary:hover,
.btn-outline-dark:hover,
.btn-outline-light:hover {
    background: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
    border-color: hsl(var(--border));
}

.btn-outline-success {
    background: transparent;
    color: hsl(var(--success));
    border-color: hsl(var(--success) / .4);
}

.btn-outline-success:hover {
    background: hsl(var(--success));
    color: hsl(var(--success-foreground));
    border-color: hsl(var(--success));
}

.btn-outline-danger {
    background: transparent;
    color: hsl(var(--destructive));
    border-color: hsl(var(--destructive) / .4);
}

.btn-outline-danger:hover {
    background: hsl(var(--destructive));
    color: hsl(var(--destructive-foreground));
    border-color: hsl(var(--destructive));
}

.btn-outline-warning {
    background: transparent;
    color: hsl(var(--warning));
    border-color: hsl(var(--warning) / .4);
}

.btn-outline-warning:hover {
    background: hsl(var(--warning));
    color: hsl(var(--warning-foreground));
    border-color: hsl(var(--warning));
}

.btn-outline-info {
    background: transparent;
    color: hsl(var(--info));
    border-color: hsl(var(--info) / .4);
}

.btn-outline-info:hover {
    background: hsl(var(--info));
    color: hsl(var(--info-foreground));
    border-color: hsl(var(--info));
}

.btn-ghost {
    background: transparent;
    color: hsl(var(--foreground));
    border-color: transparent;
}

.btn-ghost:hover,
.btn-ghost:focus {
    background: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
}

.btn-link {
    background: transparent;
    border-color: transparent;
    color: hsl(var(--info));
    text-decoration: none;
    padding-left: 0;
    padding-right: 0;
}

.btn-link:hover {
    color: hsl(var(--info) / .85);
    text-decoration: underline;
}

.btn-group > .btn {
    border-color: hsl(var(--border));
}

.btn-group > .btn:not(:first-child) {
    border-left-color: hsl(var(--border));
}

.btn-group > .btn:hover {
    z-index: 1;
}

.btn-group-sm > .btn {
    padding: .3rem .65rem;
    font-size: .8rem;
}

.btn-close {
    width: 1rem;
    height: 1rem;
    padding: .25rem;
    background: transparent;
    border: 0;
    border-radius: calc(var(--radius) - 4px);
    opacity: .6;
    box-sizing: content-box;
    --bs-btn-close-color: hsl(var(--foreground));
    background-image: none;
    position: relative;
    transition: opacity .15s ease, background-color .15s ease;
}

.btn-close::before,
.btn-close::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 14px;
    height: 1.5px;
    background: hsl(var(--foreground));
    transform-origin: center;
}

.btn-close::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

.btn-close::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.btn-close:hover {
    opacity: 1;
    background: hsl(var(--accent));
}

.btn-close:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px hsl(var(--ring) / .25);
    opacity: 1;
}

.btn-close-white::before,
.btn-close-white::after {
    background: hsl(var(--background));
}

/* Forms */
.form-control,
.form-select {
    background: hsl(var(--background));
    border: 1px solid hsl(var(--input));
    color: hsl(var(--foreground));
    border-radius: calc(var(--radius) - 2px);
    font-size: .875rem;
    padding: .45rem .75rem;
    box-shadow: none;
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}

.form-control::placeholder {
    color: hsl(var(--muted-foreground));
    opacity: 1;
}

.form-control:focus,
.form-select:focus {
    background-color: hsl(var(--background));
    color: hsl(var(--foreground));
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 3px hsl(var(--ring) / .2);
    outline: none;
}

.form-control:disabled,
.form-select:disabled {
    background-color: hsl(var(--muted));
    color: hsl(var(--muted-foreground));
    cursor: not-allowed;
    opacity: .7;
}

.form-control-sm,
.form-select-sm {
    font-size: .8rem;
    padding: .3rem .6rem;
    border-radius: calc(var(--radius) - 4px);
}

.form-control-lg,
.form-select-lg {
    font-size: 1rem;
    padding: .6rem .9rem;
    border-radius: var(--radius);
}

textarea.form-control {
    font-family: inherit;
    min-height: 5rem;
}

.form-label {
    font-size: .825rem;
    font-weight: 500;
    color: hsl(var(--foreground));
    margin-bottom: .35rem;
}

.form-text {
    color: hsl(var(--muted-foreground));
    font-size: .8rem;
    margin-top: .35rem;
}

.form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23737380' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='4,6 8,10 12,6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right .75rem center;
    background-size: 1rem;
    padding-right: 2.25rem;
}

[data-bs-theme="dark"] .form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23a1a1aa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='4,6 8,10 12,6'/%3e%3c/svg%3e");
}

.form-check-input {
    background-color: hsl(var(--background));
    border: 1px solid hsl(var(--input));
    border-radius: calc(var(--radius) - 6px);
    width: 1rem;
    height: 1rem;
    margin-top: .2rem;
    transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.form-check-input:focus {
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 3px hsl(var(--ring) / .2);
}

.form-check-input:checked {
    background-color: hsl(var(--primary));
    border-color: hsl(var(--primary));
}

.form-check-input[type="checkbox"]:checked {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='3.5,8 7,11.5 12.5,5'/%3e%3c/svg%3e");
}

[data-bs-theme="dark"] .form-check-input[type="checkbox"]:checked {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%2318181b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='3.5,8 7,11.5 12.5,5'/%3e%3c/svg%3e");
}

.form-check-input[type="radio"] {
    border-radius: 50%;
}

.form-check-input[type="radio"]:checked {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3ccircle cx='8' cy='8' r='3' fill='white'/%3e%3c/svg%3e");
}

.form-check-label {
    color: hsl(var(--foreground));
    font-size: .875rem;
    user-select: none;
}

.form-switch .form-check-input {
    width: 2rem;
    height: 1.15rem;
    border-radius: 999px;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23a1a1aa'/%3e%3c/svg%3e");
}

.form-switch .form-check-input:checked {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='white'/%3e%3c/svg%3e");
}

.input-group > .form-control,
.input-group > .form-select {
    border-color: hsl(var(--input));
}

.input-group-text {
    background: hsl(var(--muted));
    border: 1px solid hsl(var(--input));
    color: hsl(var(--muted-foreground));
    font-size: .875rem;
    border-radius: calc(var(--radius) - 2px);
}

.is-invalid,
.form-control.is-invalid,
.form-select.is-invalid {
    border-color: hsl(var(--destructive));
}

.form-control.is-invalid:focus,
.form-select.is-invalid:focus {
    border-color: hsl(var(--destructive));
    box-shadow: 0 0 0 3px hsl(var(--destructive) / .2);
}

.invalid-feedback {
    color: hsl(var(--destructive));
    font-size: .8rem;
}

.is-valid,
.form-control.is-valid,
.form-select.is-valid {
    border-color: hsl(var(--success));
}

.form-control.is-valid:focus,
.form-select.is-valid:focus {
    border-color: hsl(var(--success));
    box-shadow: 0 0 0 3px hsl(var(--success) / .2);
}

.valid-feedback {
    color: hsl(var(--success));
    font-size: .8rem;
}

/* Cards */
.card {
    background: hsl(var(--card));
    color: hsl(var(--card-foreground));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
}

.card-header {
    background: transparent;
    border-bottom: 1px solid hsl(var(--border));
    padding: 1rem 1.25rem;
}

.card-body {
    padding: 1.25rem;
}

.card-footer {
    background: transparent;
    border-top: 1px solid hsl(var(--border));
    padding: 1rem 1.25rem;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 .15rem;
    color: hsl(var(--foreground));
}

.card-subtitle {
    color: hsl(var(--muted-foreground));
    font-size: .85rem;
    margin: 0;
}

.card-description {
    color: hsl(var(--muted-foreground));
    font-size: .85rem;
    margin-top: .15rem;
}

.card-img,
.card-img-top,
.card-img-bottom {
    border-radius: var(--radius);
}

/* Tables */
.table {
    --bs-table-bg: transparent;
    --bs-table-color: hsl(var(--foreground));
    --bs-table-border-color: hsl(var(--border));
    color: hsl(var(--foreground));
    margin-bottom: 0;
    border-color: hsl(var(--border));
}

.table > :not(caption) > * > * {
    background: transparent;
    border-bottom-color: hsl(var(--border));
    padding: .65rem .75rem;
    vertical-align: middle;
    color: hsl(var(--foreground));
}

.table > thead {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: hsl(var(--muted-foreground));
}

.table > thead > tr > th {
    font-weight: 500;
    color: hsl(var(--muted-foreground));
    border-bottom: 1px solid hsl(var(--border));
    background: transparent;
}

.table-hover > tbody > tr:hover > * {
    background: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
    background: hsl(var(--muted) / .4);
    color: hsl(var(--foreground));
}

.table-bordered,
.table-bordered > :not(caption) > * > * {
    border: 1px solid hsl(var(--border));
}

.table-sm > :not(caption) > * > * {
    padding: .4rem .5rem;
}

.card-body.p-0 .table th:first-child,
.card-body.p-0 .table td:first-child {
    padding-left: 1.25rem;
}

.card-body.p-0 .table th:last-child,
.card-body.p-0 .table td:last-child {
    padding-right: 1.25rem;
}

/* Modals */
.modal-content {
    background: hsl(var(--card));
    color: hsl(var(--card-foreground));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 1px solid hsl(var(--border));
    padding: 1rem 1.25rem;
}

.modal-title {
    font-size: 1rem;
    font-weight: 600;
    color: hsl(var(--foreground));
}

.modal-body {
    padding: 1.25rem;
    color: hsl(var(--foreground));
}

.modal-footer {
    border-top: 1px solid hsl(var(--border));
    padding: 1rem 1.25rem;
    gap: .5rem;
}

.modal-footer > * {
    margin: 0;
}

.modal-backdrop {
    background: hsl(0 0% 0%);
}

.modal-backdrop.show {
    opacity: .55;
}

.modal-header.bg-danger {
    background: hsl(var(--destructive)) !important;
    color: hsl(var(--destructive-foreground));
    border-bottom-color: hsl(var(--destructive));
}

.modal-header.bg-danger .modal-title,
.modal-header.bg-danger .btn-close::before,
.modal-header.bg-danger .btn-close::after {
    color: hsl(var(--destructive-foreground));
    background: hsl(var(--destructive-foreground));
}

/* Dropdowns */
.dropdown-menu {
    background: hsl(var(--popover));
    color: hsl(var(--popover-foreground));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: .35rem;
    font-size: .875rem;
    min-width: 12rem;
}

.dropdown-item {
    color: hsl(var(--popover-foreground));
    padding: .4rem .6rem;
    border-radius: calc(var(--radius) - 4px);
    transition: background-color .12s ease, color .12s ease;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
}

.dropdown-item.active,
.dropdown-item:active {
    background: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
    font-weight: 500;
}

.dropdown-item.disabled,
.dropdown-item:disabled {
    color: hsl(var(--muted-foreground));
    background: transparent;
    opacity: .6;
}

.dropdown-divider {
    border-top: 1px solid hsl(var(--border));
    margin: .35rem -.35rem;
}

.dropdown-header {
    color: hsl(var(--muted-foreground));
    font-size: .75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: .4rem .6rem;
}

.dropdown-item-text {
    color: hsl(var(--popover-foreground));
    padding: .4rem .6rem;
}

/* Alerts */
.alert {
    border: 1px solid hsl(var(--border));
    background: hsl(var(--card));
    color: hsl(var(--foreground));
    border-radius: var(--radius);
    padding: .85rem 1rem;
    font-size: .875rem;
}

.alert-link {
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
}

.alert-primary {
    background: hsl(var(--info) / .1);
    border-color: hsl(var(--info) / .35);
    color: hsl(var(--info));
}

.alert-secondary {
    background: hsl(var(--muted));
    border-color: hsl(var(--border));
    color: hsl(var(--foreground));
}

.alert-success {
    background: hsl(var(--success) / .1);
    border-color: hsl(var(--success) / .35);
    color: hsl(var(--success));
}

.alert-danger {
    background: hsl(var(--destructive) / .1);
    border-color: hsl(var(--destructive) / .35);
    color: hsl(var(--destructive));
}

.alert-warning {
    background: hsl(var(--warning) / .12);
    border-color: hsl(var(--warning) / .4);
    color: hsl(var(--warning));
}

.alert-info {
    background: hsl(var(--info) / .1);
    border-color: hsl(var(--info) / .35);
    color: hsl(var(--info));
}

.alert-light {
    background: hsl(var(--muted));
    border-color: hsl(var(--border));
    color: hsl(var(--foreground));
}

.alert-dark {
    background: hsl(var(--foreground));
    border-color: hsl(var(--foreground));
    color: hsl(var(--background));
}

.alert-dismissible .btn-close {
    padding: .85rem 1rem;
}

/* Badges */
.badge {
    font-weight: 500;
    font-size: .72rem;
    padding: .25em .55em;
    border-radius: calc(var(--radius) - 4px);
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    gap: .25em;
}

.badge.rounded-pill {
    border-radius: 999px;
    padding: .25em .65em;
}

.badge.bg-primary {
    background: hsl(var(--primary)) !important;
    color: hsl(var(--primary-foreground)) !important;
    border-color: hsl(var(--primary)) !important;
}

.badge.bg-secondary {
    background: hsl(var(--muted)) !important;
    color: hsl(var(--muted-foreground)) !important;
    border-color: hsl(var(--border)) !important;
}

.badge.bg-success {
    background: hsl(var(--success) / .15) !important;
    color: hsl(var(--success)) !important;
    border-color: hsl(var(--success) / .4) !important;
}

.badge.bg-danger {
    background: hsl(var(--destructive) / .15) !important;
    color: hsl(var(--destructive)) !important;
    border-color: hsl(var(--destructive) / .4) !important;
}

.badge.bg-warning {
    background: hsl(var(--warning) / .15) !important;
    color: hsl(var(--warning)) !important;
    border-color: hsl(var(--warning) / .4) !important;
}

.badge.bg-info {
    background: hsl(var(--info) / .15) !important;
    color: hsl(var(--info)) !important;
    border-color: hsl(var(--info) / .4) !important;
}

.badge.bg-light {
    background: hsl(var(--muted)) !important;
    color: hsl(var(--foreground)) !important;
    border-color: hsl(var(--border)) !important;
}

.badge.bg-dark {
    background: hsl(var(--foreground)) !important;
    color: hsl(var(--background)) !important;
    border-color: hsl(var(--foreground)) !important;
}

/* List group */
.list-group {
    border-radius: var(--radius);
    border: 1px solid hsl(var(--border));
    overflow: hidden;
}

.list-group-item {
    background: hsl(var(--card));
    border-color: hsl(var(--border));
    color: hsl(var(--card-foreground));
    padding: .75rem 1rem;
    font-size: .875rem;
}

.list-group-item + .list-group-item {
    border-top: 1px solid hsl(var(--border));
}

.list-group-item-action:hover,
.list-group-item-action:focus {
    background: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
}

.list-group-item.active {
    background: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
    border-color: hsl(var(--border));
    font-weight: 500;
}

.list-group-flush {
    border: 0;
}

.list-group-flush > .list-group-item {
    border-left: 0;
    border-right: 0;
    border-radius: 0;
}

.list-group-flush > .list-group-item:first-child {
    border-top: 0;
}

.list-group-flush > .list-group-item:last-child {
    border-bottom: 0;
}

/* Toasts */
.toast-container {
    z-index: 1080;
}

.toast {
    background: hsl(var(--card));
    color: hsl(var(--card-foreground));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    font-size: .875rem;
    overflow: hidden;
}

.toast-header {
    background: transparent;
    color: hsl(var(--foreground));
    border-bottom: 1px solid hsl(var(--border));
    padding: .6rem .85rem;
    font-size: .8125rem;
    font-weight: 500;
}

.toast-body {
    padding: .75rem .85rem;
    color: hsl(var(--foreground));
}

.toast-header .btn-close {
    margin-right: -.25rem;
}

/* Spinners */
.spinner-border {
    width: 1.25rem;
    height: 1.25rem;
    border-width: 2px;
    color: currentColor;
}

.spinner-border-sm {
    width: .85rem;
    height: .85rem;
    border-width: 2px;
}

.spinner-grow {
    color: currentColor;
}

.spinner-grow-sm {
    width: .85rem;
    height: .85rem;
}

/* Accordion */
.accordion {
    --bs-accordion-bg: transparent;
    --bs-accordion-border-color: hsl(var(--border));
    --bs-accordion-color: hsl(var(--foreground));
    --bs-accordion-btn-color: hsl(var(--foreground));
    --bs-accordion-active-bg: hsl(var(--card));
    --bs-accordion-active-color: hsl(var(--foreground));
    --bs-accordion-btn-focus-box-shadow: 0 0 0 3px hsl(var(--ring) / .2);
}

.accordion-item {
    background: transparent;
    border-color: hsl(var(--border));
}

.accordion-item:first-of-type {
    border-top-left-radius: var(--radius);
    border-top-right-radius: var(--radius);
}

.accordion-item:last-of-type {
    border-bottom-left-radius: var(--radius);
    border-bottom-right-radius: var(--radius);
}

.accordion-button {
    background: transparent;
    color: hsl(var(--foreground));
    font-weight: 500;
    padding: 1rem 1.25rem;
    box-shadow: none;
    border-radius: 0;
}

.accordion-button:not(.collapsed) {
    background: hsl(var(--card));
    color: hsl(var(--foreground));
    box-shadow: inset 3px 0 0 0 hsl(var(--primary));
}

.accordion-button:focus {
    box-shadow: 0 0 0 3px hsl(var(--ring) / .2);
    border-color: hsl(var(--ring));
}

.accordion-button::after {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23737380' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='4,6 8,10 12,6'/%3e%3c/svg%3e");
}

[data-bs-theme="dark"] .accordion-button::after {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23a1a1aa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='4,6 8,10 12,6'/%3e%3c/svg%3e");
}

.accordion-body {
    background: hsl(var(--card));
    color: hsl(var(--foreground));
    box-shadow: inset 3px 0 0 0 hsl(var(--primary));
    padding: 1rem 1.25rem;
}

/* Pagination */
.pagination {
    --bs-pagination-border-radius: calc(var(--radius) - 2px);
    gap: .15rem;
}

.page-link {
    background: transparent;
    color: hsl(var(--foreground));
    border: 1px solid hsl(var(--border));
    border-radius: calc(var(--radius) - 2px) !important;
    margin: 0;
    font-size: .875rem;
    padding: .35rem .65rem;
    transition: background-color .12s ease, color .12s ease, border-color .12s ease;
}

.page-link:hover {
    background: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
    border-color: hsl(var(--border));
}

.page-link:focus {
    box-shadow: 0 0 0 3px hsl(var(--ring) / .2);
    z-index: 1;
}

.page-item.active .page-link {
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    border-color: hsl(var(--primary));
}

.page-item.disabled .page-link {
    background: transparent;
    color: hsl(var(--muted-foreground));
    opacity: .6;
}

/* Nav / Tabs */
.nav-link {
    color: hsl(var(--muted-foreground));
    font-size: .875rem;
    font-weight: 500;
    padding: .5rem .75rem;
    border-radius: calc(var(--radius) - 2px);
    transition: background-color .12s ease, color .12s ease, border-color .12s ease;
}

.nav-link:hover,
.nav-link:focus {
    color: hsl(var(--foreground));
    background: hsl(var(--accent));
}

.nav-link.disabled {
    color: hsl(var(--muted-foreground));
    opacity: .6;
}

.nav-tabs {
    border-bottom: 1px solid hsl(var(--border));
    gap: .15rem;
}

.nav-tabs .nav-link {
    border: 1px solid transparent;
    border-radius: calc(var(--radius) - 2px) calc(var(--radius) - 2px) 0 0;
    margin-bottom: -1px;
    background: transparent;
}

.nav-tabs .nav-link:hover {
    background: hsl(var(--accent));
    border-color: transparent;
}

.nav-tabs .nav-link.active,
.nav-tabs .nav-item.show .nav-link {
    color: hsl(var(--foreground));
    background: hsl(var(--background));
    border-color: hsl(var(--border)) hsl(var(--border)) hsl(var(--background));
}

.nav-pills .nav-link {
    border-radius: calc(var(--radius) - 2px);
}

.nav-pills .nav-link.active,
.nav-pills .show > .nav-link {
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
}

/* Navbar (minimal — app uses sidebar) */
.navbar {
    background: hsl(var(--card));
    border-bottom: 1px solid hsl(var(--border));
}

.navbar-brand,
.navbar-nav .nav-link {
    color: hsl(var(--foreground));
}

/* Progress */
.progress {
    background: hsl(var(--muted));
    border-radius: 999px;
    height: .55rem;
    overflow: hidden;
}

.progress-bar {
    background: hsl(var(--primary));
}

.bg-success .progress-bar,
.progress-bar.bg-success {
    background: hsl(var(--success));
}

.progress-bar.bg-danger {
    background: hsl(var(--destructive));
}

.progress-bar.bg-warning {
    background: hsl(var(--warning));
}

.progress-bar.bg-info {
    background: hsl(var(--info));
}

/* Breadcrumb */
.breadcrumb {
    --bs-breadcrumb-divider-color: hsl(var(--muted-foreground));
    font-size: .85rem;
}

.breadcrumb-item {
    color: hsl(var(--muted-foreground));
}

.breadcrumb-item.active {
    color: hsl(var(--foreground));
}

.breadcrumb-item a {
    color: hsl(var(--muted-foreground));
}

.breadcrumb-item a:hover {
    color: hsl(var(--foreground));
}

/* Offcanvas */
.offcanvas {
    background: hsl(var(--card));
    color: hsl(var(--card-foreground));
    border-color: hsl(var(--border));
    box-shadow: var(--shadow-lg);
}

.offcanvas-header {
    border-bottom: 1px solid hsl(var(--border));
    padding: 1rem 1.25rem;
}

.offcanvas-title {
    font-size: 1rem;
    font-weight: 600;
}

.offcanvas-body {
    padding: 1.25rem;
}

/* Tooltips & popovers */
.tooltip {
    --bs-tooltip-bg: hsl(var(--foreground));
    --bs-tooltip-color: hsl(var(--background));
    font-size: .75rem;
}

.tooltip-inner {
    background: hsl(var(--foreground));
    color: hsl(var(--background));
    border-radius: calc(var(--radius) - 4px);
    padding: .35rem .55rem;
    box-shadow: var(--shadow);
}

.tooltip .tooltip-arrow::before {
    border-top-color: hsl(var(--foreground));
    border-bottom-color: hsl(var(--foreground));
    border-left-color: hsl(var(--foreground));
    border-right-color: hsl(var(--foreground));
}

.popover {
    background: hsl(var(--popover));
    color: hsl(var(--popover-foreground));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    font-size: .875rem;
}

.popover-header {
    background: transparent;
    color: hsl(var(--foreground));
    border-bottom: 1px solid hsl(var(--border));
    font-weight: 600;
}

.popover-body {
    color: hsl(var(--popover-foreground));
}

.popover-arrow::before,
.popover-arrow::after {
    border-top-color: hsl(var(--border));
    border-bottom-color: hsl(var(--border));
}

/* Utility overrides */
.bg-body {
    background: hsl(var(--background)) !important;
}

.bg-body-secondary,
.bg-light {
    background: hsl(var(--muted)) !important;
}

.bg-body-tertiary {
    background: hsl(var(--card)) !important;
}

.bg-secondary {
    background: hsl(var(--secondary)) !important;
    color: hsl(var(--secondary-foreground)) !important;
}

.bg-primary {
    background: hsl(var(--primary)) !important;
    color: hsl(var(--primary-foreground)) !important;
}

.bg-success {
    background: hsl(var(--success)) !important;
    color: hsl(var(--success-foreground)) !important;
}

.bg-danger {
    background: hsl(var(--destructive)) !important;
    color: hsl(var(--destructive-foreground)) !important;
}

.bg-warning {
    background: hsl(var(--warning)) !important;
    color: hsl(var(--warning-foreground)) !important;
}

.bg-info {
    background: hsl(var(--info)) !important;
    color: hsl(var(--info-foreground)) !important;
}

.bg-dark {
    background: hsl(var(--foreground)) !important;
    color: hsl(var(--background)) !important;
}

.bg-white {
    background: hsl(var(--card)) !important;
}

.text-muted,
.text-body-secondary {
    color: hsl(var(--muted-foreground)) !important;
}

.text-body {
    color: hsl(var(--foreground)) !important;
}

.text-primary {
    color: hsl(var(--primary)) !important;
}

.text-secondary {
    color: hsl(var(--muted-foreground)) !important;
}

.text-success {
    color: hsl(var(--success)) !important;
}

.text-danger {
    color: hsl(var(--destructive)) !important;
}

.text-warning {
    color: hsl(var(--warning)) !important;
}

.text-info {
    color: hsl(var(--info)) !important;
}

.text-light {
    color: hsl(var(--background)) !important;
}

.text-dark {
    color: hsl(var(--foreground)) !important;
}

.border {
    border-color: hsl(var(--border)) !important;
}

.border-top {
    border-top-color: hsl(var(--border)) !important;
}

.border-bottom {
    border-bottom-color: hsl(var(--border)) !important;
}

.border-start {
    border-left-color: hsl(var(--border)) !important;
}

.border-end {
    border-right-color: hsl(var(--border)) !important;
}

.border-primary {
    border-color: hsl(var(--primary)) !important;
}

.border-danger {
    border-color: hsl(var(--destructive)) !important;
}

.border-success {
    border-color: hsl(var(--success)) !important;
}

.border-warning {
    border-color: hsl(var(--warning)) !important;
}

.border-info {
    border-color: hsl(var(--info)) !important;
}

.shadow-sm {
    box-shadow: var(--shadow-sm) !important;
}

.shadow {
    box-shadow: var(--shadow) !important;
}

.shadow-lg {
    box-shadow: var(--shadow-lg) !important;
}

/* App-specific utilities */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.page-header h1 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 600;
}

.page-header .subtitle {
    color: hsl(var(--muted-foreground));
    font-size: .9rem;
    margin-top: .15rem;
}

.card-toolbar {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.card-toolbar .form-control,
.card-toolbar .form-select {
    max-width: 200px;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: hsl(var(--muted-foreground));
}

.empty-state i {
    font-size: 3rem;
    opacity: .5;
    margin-bottom: .75rem;
    display: inline-block;
}

.empty-state p {
    margin: 0;
}

.list-item {
    display: flex;
    align-items: center;
    padding: .875rem 1rem;
    border-bottom: 1px solid hsl(var(--border));
    transition: background-color .15s ease;
}

.list-item:last-child {
    border-bottom: none;
}

.list-item:hover {
    background: hsl(var(--accent) / .7);
}

.list-item-content {
    flex: 1;
    min-width: 0;
}

.list-item-actions {
    display: flex;
    gap: .25rem;
    opacity: 0;
    transition: opacity .15s ease;
}

.list-item:hover .list-item-actions,
.list-item:focus-within .list-item-actions {
    opacity: 1;
}

.list-item-actions .btn {
    padding: .25rem .5rem;
    line-height: 1;
}

.list-item-expand {
    cursor: pointer;
    user-select: none;
}

.list-item-expand .expand-icon {
    transition: transform .2s ease;
}

.list-item-expand.expanded .expand-icon {
    transform: rotate(90deg);
}

.list-item-detail {
    padding: .75rem 1rem 1rem 2.5rem;
    border-bottom: 1px solid hsl(var(--border));
    background: hsl(var(--muted) / .5);
}

.list-item-detail:last-child {
    border-bottom: none;
}

.inline-edit-row {
    padding: .75rem 1rem;
    border-bottom: 1px solid hsl(var(--border));
    background: hsl(var(--muted) / .5);
}

.inline-edit-row .form-control {
    background: hsl(var(--background));
}

.label-badge {
    display: inline-flex;
    align-items: center;
    padding: .25rem .625rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 500;
    background: hsl(var(--muted));
    color: hsl(var(--foreground));
    border: 1px solid hsl(var(--border));
}

.meta-text {
    font-size: .75rem;
    color: hsl(var(--muted-foreground));
}

.upload-dropzone {
    position: relative;
    border: 2px dashed hsl(var(--border));
    border-radius: var(--radius);
    padding: 2rem 1rem;
    text-align: center;
    cursor: pointer;
    background: hsl(var(--card));
    transition: border-color .15s ease, background-color .15s ease;
}

.upload-dropzone:hover,
.upload-dropzone.dragover {
    border-color: hsl(var(--ring));
    background: hsl(var(--accent) / .5);
}

.upload-dropzone.has-file {
    border-style: solid;
    border-color: hsl(var(--ring));
    background: hsl(var(--accent) / .5);
}

.upload-dropzone-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.upload-dropzone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .5rem;
    pointer-events: none;
}

.upload-dropzone-content i {
    font-size: 2rem;
    color: hsl(var(--muted-foreground));
}

.upload-dropzone.has-file .upload-dropzone-content i {
    color: hsl(var(--foreground));
}

.upload-dropzone-text {
    font-size: .875rem;
    color: hsl(var(--muted-foreground));
}

.upload-dropzone-filename {
    font-size: .875rem;
    font-weight: 500;
    color: hsl(var(--foreground));
}

.upload-dropzone-limit {
    margin-top: .25rem;
}

/* Auth screens */
.auth-screen {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 1rem;
    background: hsl(var(--background));
}

.auth-card {
    width: 100%;
    max-width: 420px;
}

/* Bootstrap dark-theme overrides that bleed through */
[data-bs-theme="dark"] .btn-close {
    filter: none;
}

/* Health monitoring — style-agnostic base (skinned per [data-view-style]) */
.hm-toolbar {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
}

.hm-toolbar-spacer {
    flex: 1 1 auto;
}

.hm-timeframes {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem;
}

.hm-tf {
    border: 1px solid hsl(var(--border));
    background: hsl(var(--card));
    color: hsl(var(--muted-foreground));
    border-radius: calc(var(--radius) - 4px);
    padding: .25rem .55rem;
    font-size: .78rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color .12s ease, color .12s ease, border-color .12s ease;
}

.hm-tf:hover {
    color: hsl(var(--foreground));
    background: hsl(var(--accent));
}

.hm-tf.active {
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    border-color: hsl(var(--primary));
}

.hm-refresh {
    max-width: 130px;
}

.hm-hero {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    background: hsl(var(--card));
    margin-bottom: 1.25rem;
}

.hm-hero-pulse {
    width: .9rem;
    height: .9rem;
    border-radius: 50%;
    flex: 0 0 auto;
}

.hm-hero-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0;
}

.hm-hero-sub {
    color: hsl(var(--muted-foreground));
    font-size: .85rem;
    margin: 0;
}

.hm-hero-counts {
    display: flex;
    gap: 1.25rem;
    margin-left: auto;
}

.hm-hero-count {
    text-align: center;
}

.hm-hero-count-value {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.hm-hero-count-label {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: hsl(var(--muted-foreground));
}

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

.hm-card {
    border: 1px solid hsl(var(--border));
    border-left: 3px solid hsl(var(--border));
    border-radius: var(--radius);
    background: hsl(var(--card));
    padding: 1rem 1.1rem;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.hm-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.hm-card:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px hsl(var(--ring) / .3);
}

.hm-card[data-status="UP"] { border-left-color: hsl(var(--success)); }
.hm-card[data-status="DEGRADED"] { border-left-color: hsl(var(--degraded)); }
.hm-card[data-status="DOWN"] { border-left-color: hsl(var(--destructive)); }
.hm-card[data-status="UNKNOWN"] { border-left-color: hsl(var(--muted-foreground)); }

.hm-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .5rem;
    margin-bottom: .25rem;
}

.hm-card-name {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: .5rem;
    min-width: 0;
}

.hm-card-name span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hm-card-url {
    font-size: .75rem;
    color: hsl(var(--muted-foreground));
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: .6rem;
}

.hm-status-dot {
    width: .65rem;
    height: .65rem;
    border-radius: 50%;
    flex: 0 0 auto;
}

.hm-metric-row {
    display: flex;
    gap: 1.25rem;
    margin: .5rem 0 .75rem;
}

.hm-metric-value {
    font-size: 1.15rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

.hm-metric-label {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: hsl(var(--muted-foreground));
}

.hm-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: .6rem;
    font-size: .72rem;
    color: hsl(var(--muted-foreground));
}

.hm-ribbon {
    display: flex;
    gap: 2px;
    align-items: stretch;
    height: 100%;
    width: 100%;
}

.hm-ribbon-wrap {
    height: 30px;
}

.hm-ribbon-cell {
    flex: 1 1 0;
    min-width: 1px;
    border-radius: 2px;
    background: hsl(var(--muted));
}

.hm-status-up { background-color: hsl(var(--success)); }
.hm-status-down { background-color: hsl(var(--destructive)); }
.hm-status-degraded { background-color: hsl(var(--degraded)); }
.hm-status-no_data,
.hm-status-unknown { background-color: hsl(var(--muted)); }

.badge.hm-badge-degraded {
    background: hsl(var(--degraded) / .15);
    color: hsl(var(--degraded));
    border-color: hsl(var(--degraded) / .4);
}

.hm-outage {
    color: hsl(var(--destructive));
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.hm-detail-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.hm-detail-title {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-size: 1.4rem;
    font-weight: 600;
    margin: 0;
}

.hm-detail-url {
    color: hsl(var(--muted-foreground));
    font-size: .85rem;
    margin: .15rem 0 0;
}

.hm-detail-headinfo {
    min-width: 0;
    flex: 1 1 auto;
}

.hm-detail-status {
    display: flex;
    align-items: center;
    gap: .6rem;
    flex-wrap: wrap;
}

.hm-detail-outage {
    font-size: .85rem;
    color: hsl(var(--muted-foreground));
}

.hm-config-actions {
    margin-top: 1rem;
}

.hm-back {
    margin-bottom: 1rem;
}

.hm-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: .75rem;
    margin-bottom: 1.25rem;
}

.hm-stat {
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    background: hsl(var(--card));
    padding: .85rem 1rem;
}

.hm-stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

.hm-stat-label {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: hsl(var(--muted-foreground));
    margin-top: .15rem;
}

.hm-panel {
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    background: hsl(var(--card));
    padding: 1.1rem 1.25rem;
    margin-bottom: 1.25rem;
}

.hm-panel-title {
    font-size: .8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: hsl(var(--muted-foreground));
    margin: 0 0 .85rem;
}

.hm-chart-wrap {
    position: relative;
    height: 320px;
}

.hm-timeline {
    height: 34px;
    margin-top: 1rem;
}

.hm-config {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: .75rem 1.5rem;
}

.hm-config-row {
    display: flex;
    flex-direction: column;
    gap: .15rem;
}

.hm-config-key {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: hsl(var(--muted-foreground));
}

.hm-config-value {
    font-size: .9rem;
    word-break: break-word;
}

.hm-incidents {
    display: flex;
    flex-direction: column;
}

.hm-incident {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .65rem 0;
    border-bottom: 1px solid hsl(var(--border));
}

.hm-incident:last-child {
    border-bottom: none;
}

.hm-incident-main {
    display: flex;
    flex-direction: column;
    gap: .1rem;
    min-width: 0;
}

.hm-incident-time {
    font-size: .85rem;
    font-weight: 500;
}

.hm-incident-detail {
    font-size: .78rem;
    color: hsl(var(--muted-foreground));
    overflow: hidden;
    text-overflow: ellipsis;
}

.hm-incident-meta {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .75rem;
    color: hsl(var(--muted-foreground));
    white-space: nowrap;
}

.hm-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: hsl(var(--muted-foreground));
}

@media (max-width: 575px) {
    .hm-grid { grid-template-columns: 1fr; }
    .hm-hero { flex-wrap: wrap; }
    .hm-hero-counts { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .hm-card:hover { transform: none; }
}
