/* --------------------------------------------------
   COMPONENTS.CSS — Optimized UI Component Library
   -------------------------------------------------- */

/* ------------------------------
   BUTTONS
   ------------------------------ */

.btn {
    padding: 10px 18px;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    font-size: var(--font-size-sm);
    font-weight: 500;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    user-select: none;
    margin: 2px;
}

.btn-primary {
    background: var(--color-primary);
    color: #fff;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: var(--color-primary-hover);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--color-surface-2);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover {
    background: var(--color-border);
}

.btn-danger {
    background: var(--color-danger);
    color: #fff;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-small {
    padding: 6px 12px;
    font-size: var(--font-size-xs);
}

.btn-large {
    padding: 14px 22px;
    font-size: var(--font-size-md);
}

/* Logout button refinement */
.logout-btn,
.dropdown-logout {
    padding: 8px 14px;
    border-radius: var(--radius-md);
    font-size: var(--font-size-xs);
    background: var(--color-surface-2) !important;
}

/* ------------------------------
   ICON BUTTONS (topbar icons)
   ------------------------------ */

.topbar-icon {
    cursor: pointer;
    padding: 3px;
    border-radius: var(--radius-md);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.topbar-icon img {
    width: 20px;
    height: 20px;
    object-fit: contain;
    opacity: 0.85;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.topbar-icon:hover {
    background: var(--color-border);
}

.topbar-icon:hover img {
    opacity: 1;
    transform: scale(1.05);
}

/* ------------------------------
   INPUTS & FORMS
   ------------------------------ */

input, select, textarea {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    background: var(--color-surface);
    transition: var(--transition);
}

input:focus, select:focus, textarea:focus {
    border-color: var(--color-primary);
    outline: none;
}

input[readonly] {
    background: var(--color-surface-2);
    color: var(--color-text-secondary);
    cursor: default;
    opacity: 0.85;
}

input[readonly]:focus {
    border-color: var(--color-border);
    box-shadow: none;
}


label {
    font-size: var(--font-size-sm);
    font-weight: 500;
    margin-bottom: var(--space-1);
    display: block;
}

.form-group {
    margin-bottom: var(--space-4);
}
.form-group.required > label::after {
    content: " *";
    color: var(--color-danger);
    font-weight: bold;
}

/* Search input inside search bar */
.search-bar input {
    max-width: 400px;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    font-size: var(--font-size-md);
    margin-left: auto;
    float: right;
}

.input-control-make-larger {
    width: 60%;
}

/* Inline toggle row */
.toggle-inline {
    display: flex;
    align-items: center;
    gap: 10px; /* space between text and toggle */
}

/* Text label */
.toggle-inline .toggle-label {
    display: flex;
    align-items: center;
    font-size: 14px;
    margin: 0;
}

/* Toggle switch */
.switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 22px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .3s;
    border-radius: 22px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #2196F3;
}

input:checked + .slider:before {
    transform: translateX(20px);
}


@media (max-width: 768px) {
    .search-bar input {
        width: 100%;
        max-width: 100%;
        margin-left: 0;
    }

    .input-control-make-larger {
        width: 100%;
    }
}

/* ------------------------------
   CARDS
   ------------------------------ */

.card {
    background: var(--color-surface);
    padding: var(--space-4);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.card-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: var(--space-3);
}

/* ------------------------------
   CARD GRID SYSTEM
   ------------------------------ */

.card-row {
    display: grid;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}

/* ------------------------------
   PRESET LAYOUTS
   ------------------------------ */

.row-50-50 { grid-template-columns: 1fr 1fr; }
.row-33-33-33 { grid-template-columns: repeat(3, 1fr); }
.row-40-60 { grid-template-columns: 0.4fr 0.6fr; }
.row-60-40 { grid-template-columns: 0.6fr 0.4fr; }
.row-20-20-20-20-20 { grid-template-columns: repeat(5, 1fr); }
.row-30-70 { grid-template-columns: 0.3fr 0.7fr; }
.row-70-30 { grid-template-columns: 0.7fr 0.3fr; }

/* ------------------------------
   RESPONSIVE BEHAVIOR
   ------------------------------ */

@media (max-width: 1200px) {
    .row-20-20-20-20-20 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 900px) {
    .row-33-33-33,
    .row-20-20-20-20-20 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .card-row {
        grid-template-columns: 1fr !important;
    }
    .card {
        width: calc(100vw - 24px);
    }
}

/* ------------------------------
   STATUS CHIPS — Optimized
   ------------------------------ */

.status-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    font-weight: 600;
    width: fit-content;
}

.status-chip .chip-icon {
    font-size: 0.9rem;
}

.status-chip.normal {
    background: #ecfdf5;
    color: #047857;
}

.status-chip.warning {
    background: #fffbeb;
    color: #b45309;
}

.status-chip.maintenance {
    background: #fef3c7;
    color: #92400e;
}

.status-chip.offline {
    background: #fee2e2;
    color: #b91c1c;
}

.status-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-2);
}

.status-header-row h2 {
    margin: 0;
    font-size: var(--font-size-lg);
    font-weight: 600;
}

/* ------------------------------
   STATUS DETAILS — Compact
   ------------------------------ */

.status-details {
    margin-top: var(--space-2);
    padding: var(--space-3);
    background: var(--color-surface-2);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    line-height: 1.4;
}

.status-details .details-message {
    margin-bottom: 4px;
    font-weight: 500;
}

/* ------------------------------
   TABLES
   ------------------------------ */

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-surface);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.table th,
.table td {
    padding: var(--space-3);
    border-bottom: 1px solid var(--color-border);
    text-align: left;
    font-size: var(--font-size-sm);
}

.table td .subtext {
    display: block;
    margin-top: 4px;
    color: var(--color-text-secondary);
}

.table th {
    background: var(--color-surface-2);
    font-weight: 600;
}

.table tr:hover {
    background: var(--color-surface-2);
}

.table-actions {
    gap: var(--space-2);
}

/* Table header with action button */
.table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-3);
    height: 40px;
}

.table-header h3 {
    margin: 0;
}

.table-header button {
    white-space: nowrap;
}

/* Make tables scrollable on small screens */
@media (max-width: 768px) {
    .table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }

    .table::-webkit-scrollbar {
        height: 6px;
    }
    .table::-webkit-scrollbar-thumb {
        background: var(--color-border);
        border-radius: 3px;
    }
}

/* --------------------------------------------------
   SORTABLE TABLE STYLING (FINAL POLISHED VERSION)
-------------------------------------------------- */

.table th.sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    position: relative;
}

/* Base indicator (shown before sorting) */
.table th.sortable .sort-indicator::before {
    content: "▲▼";
    opacity: 0.28;
    font-size: 10px;
    margin-left: 6px;
    letter-spacing: -2px; /* visually tightens ▲▼ */
    position: relative;
    top: -1px;
    transition: opacity 0.15s ease;
}

/* Hide base indicator when sorted */
.table th.sortable.sorted-asc .sort-indicator::before,
.table th.sortable.sorted-desc .sort-indicator::before {
    content: "";
}

/* Active sort arrows */
.table th.sortable.sorted-asc .sort-indicator::after {
    content: "▲";
    opacity: 0.9;
    font-size: 11px;
    margin-left: 6px;
    position: relative;
    top: -1px;
}

.table th.sortable.sorted-desc .sort-indicator::after {
    content: "▼";
    opacity: 0.9;
    font-size: 11px;
    margin-left: 6px;
    position: relative;
    top: -1px;
}

/* Hover effect to reinforce interactivity */
.table th.sortable:hover {
    background-color: rgba(0, 0, 0, 0.04);
}

/* --------------------------------------------------
   SORTED COLUMN HIGHLIGHT
-------------------------------------------------- */

/* Highlight sorted header */
.table th.sorted-asc,
.table th.sorted-desc {
    background-color: rgba(0, 0, 0, 0.06); /* subtle highlight */
}

/* Highlight entire sorted column */
.table td.sorted-column {
    background-color: rgba(0, 0, 0, 0.03);
}

/* --------------------------------------------------
   SECTION HEADER STYLING
-------------------------------------------------- */

.section-header {
    padding: var(--space-1) var(--space-2);
    margin-top: var(--space-1);
    margin-bottom: var(--space-2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    margin-bottom: 8px;
    height: 40px;
}

/* --------------------------------------------------
   TABLE EDIT MODE — Premium inline editing
-------------------------------------------------- */

.table tr.editing {
    background: var(--color-surface-2);
}

.table tr.editing td {
    padding: 0;
}

.table tr.unread {
    background: #fff8e1;
    font-weight: 600;
}


.table tr.editing td > input,
.table tr.editing td > select,
.table tr.editing td > textarea {
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    padding: var(--space-3);
    border: none;
    background: transparent;
    font-size: var(--font-size-sm);
    border-radius: 0;
}

.table tr.editing td + td {
    border-left: 1px solid var(--color-border);
}

.table tr:not(.editing) td {
    padding: var(--space-3);
}

.table tr.editing td.updated-cell,
.table tr.editing td.actions-cell {
    padding: var(--space-3) !important;
    vertical-align: middle;
}

.highlight {
    animation: flash 1.2s ease;
}

@keyframes flash {
    0% { background: #ecfdf5; }
    100% { background: transparent; }
}

/* ------------------------------
   MODAL
   ------------------------------ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: none;
    z-index: 300;
    overscroll-behavior: contain;
    touch-action: none;
    overflow: hidden;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--color-surface);
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    width: 90%;
    max-width: 600px;
    display: none;
    z-index: 310;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: var(--space-3);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--color-border);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-2);
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px solid var(--color-border);
}

/* ------------------------------
   TOASTS
   ------------------------------ */

#toast-container {
    position: fixed;
    top: var(--space-16);
    right: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    z-index: 200;
}

.toast {
    position: relative;
    background: var(--color-surface);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    border-left: 4px solid var(--color-primary);
    font-size: var(--font-size-sm);
    min-width: 260px;
    animation: fadeIn 0.3s ease, shake 0.4s ease;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

/* ICON BASE */
.toast::before {
    content: "";
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

/* INFO */
.toast-info {
    border-left-color: var(--color-primary);
    background: #eff6ff;
    color: #1e3a8a;
}
.toast-info::before {
    background-image: url("/common/img/info-mark.png");
}

/* SUCCESS */
.toast-success {
    border-left-color: var(--color-success);
    background: #ecfdf5;
    color: #065f46;
}
.toast-success::before {
    background-image: url("/common/img/success-mark.png");
}

/* WARNING */
.toast-warning {
    border-left-color: var(--color-warning);
    background: #fffbeb;
    color: #92400e;
}
.toast-warning::before {
    background-image: url("/common/img/warning-mark.png");
}

/* ERROR */
.toast-error {
    border-left-color: var(--color-danger);
    background: #fee2e2;
    color: #991b1b;
    font-weight: 700;
}
.toast-error::before {
    background-image: url("/common/img/error-mark.png");
}

/* FADE OUT */
.fade-out {
    animation: fadeOut 0.3s ease forwards;
}

@keyframes fadeOut {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(-6px); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes shake {
    0% { transform: translateX(0); }
    20% { transform: translateX(-4px); }
    40% { transform: translateX(4px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
    100% { transform: translateX(0); }
}

/* ------------------------------
   BADGES
   ------------------------------ */

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: var(--radius-md);
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: #fff;
}

.badge-success { background: var(--color-success); }
.badge-danger  { background: var(--color-danger); }
.badge-warning { background: var(--color-warning); }
.badge-info    { background: var(--color-primary); }

/* -----------------------------------------
   DROPDOWN PANEL
----------------------------------------- */

.dropdown-panel {
    position: absolute;
    top: 100%;
    margin-top: 8px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    padding: var(--space-4);

    /* Start hidden */
    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px);
    max-height: 0;
    overflow: hidden;

    /* Apple-style easing */
    transition:
        opacity 0.45s cubic-bezier(0.32, 0.72, 0, 1),
        transform 0.45s cubic-bezier(0.32, 0.72, 0, 1),
        max-height 0.55s cubic-bezier(0.32, 0.72, 0, 1);
}

/* OPEN STATE — smooth slide-down + fade */
.dropdown-panel.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
    max-height: 800px; /* plenty for notifications */
}

/* -----------------------------------------
   ALIGNMENT
----------------------------------------- */

.dropdown-panel.align-right {
    text-align: right;
}

.dropdown-panel.align-right a,
.dropdown-panel.align-right .dropdown-lang {
    text-align: right;
    justify-content: flex-end;
}

.dropdown-panel.align-right button {
    text-align: center;
    width: 100%;
}

/* -----------------------------------------
   SETTINGS DROPDOWN
----------------------------------------- */

.settings-window {
    right: 5px;
    min-width: 220px;
}

/* ------------------------------
   NOTIFICATIONS
   ------------------------------ */

.notifications-wrapper {
    position: relative;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-md);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.notifications-wrapper:hover {
    background: var(--color-surface-2);
}

/* Red dot indicator */
.notifications-wrapper.has-new::after {
    content: "";
    position: absolute;
    top: 2px;
    right: 2px;
    width: 9px;
    height: 9px;
    background: var(--color-danger);
    border-radius: 50%;
    box-shadow: 0 0 0 2px var(--color-surface);
}

/* -----------------------------------------
   NOTIFICATION WINDOW BASE
----------------------------------------- */

.notifications-window {
    left: -8px;
    top: 48px;
    min-width: 500px;
    max-width: 600px;
    padding: var(--space-4);
}

/* Mobile override */
@media (max-width: 768px) {
    .notifications-window {
        min-width: 100% !important;
    }
}

/* List container */
#notifications-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin-top: var(--space-3);
}

/* READ */
.notification-item {
    padding: var(--space-3);
    background: var(--color-surface-2);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: background 0.15s ease;
}

.notification-item:hover {
    background: var(--color-border);
}

/* UNREAD */
.notification-item.unread {
    background: #eef4ff; /* soft blue */
    border-left: 3px solid var(--color-primary);
}

/* Title */
.notification-title {
    font-weight: 600;
    font-size: var(--font-size-sm);
    color: var(--color-text);
    margin-bottom: 2px;
}

/* Body */
.notification-body {
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
    margin-bottom: 4px;
    line-height: 1.3;
}

/* Timestamp */
.notification-time {
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
}

/* Empty */
.notification-empty {
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
    padding: var(--space-2) 0;
    text-align: center;
}

/* View all */
.notifications-view-all {
    display: block;
    margin-top: var(--space-4);
    font-size: var(--font-size-xs);
    color: var(--color-primary);
    text-align: right;
    cursor: pointer;
}

/* ------------------------------
   LANGUAGE SWITCHER
   ------------------------------ */

.lang-switcher,
.dropdown-lang {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    cursor: pointer;
}

.lang-option {
    padding: 4px 6px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.lang-option:hover {
    color: var(--color-primary);
}

.lang-option.active {
    color: var(--color-primary);
    font-weight: 600;
}

.lang-separator {
    color: var(--color-text-secondary);
}

/* ------------------------------
   LOADER
   ------------------------------ */

.loader {
    width: 32px;
    height: 32px;
    border: 4px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: auto;
}

.btn-loading {
    position: relative;
}

.btn-loading .btn-label {
    opacity: 1;
    transition: opacity 0.15s ease;
}

.btn-loading .btn-spinner {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 16px;
    height: 16px;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: none;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ------------------------------
   MOBILE MENU BUTTON
   ------------------------------ */

.mobile-menu-btn {
    display: none;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 6px;
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: block;
    }
}

/* -----------------------------------------
   MOBILE OVERRIDE
----------------------------------------- */

@media (max-width: 768px) {
    .dropdown-panel {
        position: fixed !important;
        top: 50px !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 0 !important;
        max-height: calc(100vh - 43px);
        overflow-y: auto;
        transform: translateY(-12px);
    }

    .dropdown-panel.open {
        transform: translateY(0);
    }
}

/* ------------------------------
   SKELETON LOADER
   ------------------------------ */

.skeleton {
    background: var(--color-border);
    border-radius: var(--radius-md);
    position: relative;
    overflow: hidden;
}

.skeleton::after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    height: 100%;
    width: 100%;
    background: linear-gradient(
        90deg,
        rgba(255,255,255,0) 0%,
        rgba(255,255,255,0.6) 50%,
        rgba(255,255,255,0) 100%
    );
    animation: skeletonShimmer 1.2s infinite;
}

@keyframes skeletonShimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.skeleton-card {
    background: var(--color-surface);
    padding: var(--space-4);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.skeleton-line {
    height: 14px;
    width: 100%;
}

.skeleton-line.short {
    width: 40%;
}

/* ------------------------------
   SETTINGS WINDOW
   ------------------------------ */

.settings-row {
    display: flex;
    align-items: center;
    width: 100%;
}

.settings-row-top {
    justify-content: space-between;
    margin-bottom: var(--space-3);
}

.settings-profile {
    font-size: var(--font-size-sm);
    color: var(--color-primary);
    text-align: right;
    cursor: pointer;
    transition: var(--transition);
}

.settings-lang {
    justify-content: flex-start;
}

.settings-link.subsystem-change {
    display: block;
    width: 100%;
    text-align: left !important;
    padding: 6px 0;
    font-size: var(--font-size-sm);
    color: var(--color-primary);
    background: none;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.settings-logout {
    display: block;
    width: 100%;
    text-align: center;
    margin-top: var(--space-3);
}

/* ------------------------------
   SUBSYSTEM SELECTOR
   ------------------------------ */

.subsystem-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 10px 0;
    cursor: pointer;
    transition: var(--transition);
    border-radius: var(--radius-md);
}

.subsystem-item:hover {
    background: var(--color-surface-2);
}

.subsystem-radio {
    width: 14px;
    height: 14px;
    border: 2px solid var(--color-border);
    border-radius: 50%;
    display: inline-block;
    position: relative;
    flex-shrink: 0;
    margin-left: 12px;
}

.subsystem-item.selected .subsystem-radio {
    border-color: var(--color-primary);
}

.subsystem-item.selected .subsystem-radio::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 6px;
    height: 6px;
    background: var(--color-primary);
    border-radius: 50%;
}

.subsystem-item span {
    font-size: var(--font-size-sm);
    color: var(--color-text);
}

/* ------------------------------
   DROPDOWN USER PROFILE
   ------------------------------ */

.dropdown-user {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.dropdown-user .display-name {
    font-weight: 600;
    font-size: var(--font-size-sm);
}

.dropdown-user .subsystem {
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
}

/* ------------------------------
   PROFILE AVATAR
   ------------------------------ */

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--color-text);
}

/* ------------------------------
   INLINE ALERTS
   ------------------------------ */

.alert {
    padding: var(--space-3);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-3);
}

.alert-success {
    background: #ecfdf5;
    color: #065f46;
    border-left: 4px solid var(--color-success);
}

.alert-warning {
    background: #fffbeb;
    color: #92400e;
    border-left: 4px solid var(--color-warning);
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid var(--color-danger);
}

/* ------------------------------
   PAGINATION
   ------------------------------ */

.pagination {
    display: flex;
    gap: var(--space-2);
    margin-top: var(--space-4);
}

.pagination button {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: var(--transition);
}

.pagination button:hover {
    background: var(--color-primary);
    color: #fff;
}

.pagination .active {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

/* ------------------------------
   EMPTY STATE
   ------------------------------ */

.empty-state {
    padding: var(--space-6);
    text-align: center;
    color: var(--color-text-secondary);
    font-size: var(--font-size-sm);
}

.empty-state img {
    width: 120px;
    opacity: 0.7;
    margin-bottom: var(--space-3);
}

/* ------------------------------
   TAGS
   ------------------------------ */

.tag {
    display: inline-block;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    background: var(--color-surface-2);
    color: var(--color-text-secondary);
}

.tag-primary {
    background: var(--color-primary);
    color: #fff;
}

.tag-danger {
    background: var(--color-danger);
    color: #fff;
}

.tag-success {
    background: var(--color-success);
    color: #fff;
}

/* ------------------------------
   DIVIDERS
   ------------------------------ */

.divider {
    height: 1px;
    background: var(--color-border);
    margin: var(--space-4) 0;
    opacity: 0.6;
}

.v-divider-right {
    border-right: 1px solid var(--color-border);
    border-right-color: color-mix(in srgb, var(--color-border) 60%, transparent);
    padding-right: var(--space-3);
}

@media (max-width: 900px) {
    .v-divider-right {
        border-right: 0px;
    }
}

/* ------------------------------
   LIST GROUP
   ------------------------------ */

.list-group {
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--color-border);
}

.list-group-item {
    padding: var(--space-3);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    font-size: var(--font-size-sm);
}

.list-group-item:last-child {
    border-bottom: none;
}

.list-group-item:hover {
    background: var(--color-surface-2);
}

/* ------------------------------
   SWITCH / TOGGLE
   ------------------------------ */

.switch {
    position: relative;
    width: 42px;
    height: 22px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--color-border);
    border-radius: 22px;
    transition: var(--transition);
}

.slider::before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 2px;
    top: 2px;
    background: #fff;
    border-radius: 50%;
    transition: var(--transition);
}

.switch input:checked + .slider {
    background: var(--color-primary);
}

.switch input:checked + .slider::before {
    transform: translateX(20px);
}

/* -----------------------------------------
   UNIVERSAL CONTROL LAYOUT SYSTEM
----------------------------------------- */

.control-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px 16px;
    align-items: end;
    padding: 16px 0;
}

.control-item input,
.control-item select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
}
.control-item.span-2 {
    grid-column: span 2;
}

.control-item.span-3 {
    grid-column: span 3;
}

.control-item.span-4 {
    grid-column: span 4;
}

.control-item.span-5 {
    grid-column: span 5;
}

.control-item label {
    display: block;
    margin-bottom: 4px;
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--color-text-secondary);
}

.control-actions {
    display: flex;
    justify-content: flex-end;
}

.control-actions .btn {
    width: 100%;
}

.subtext {
    font-size: 0.8em;
    color: var(--color-text-secondary);
    font-style: italic;
}

/* Inline control row (input + button on same line) */
.inline-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.inline-controls input {
    flex: 1;
}

.inline-controls .btn {
    flex-shrink: 0;
}

/* Save + Cancel inline container */
.edit-actions-inline {
    display: flex;
    gap: 8px;
}

/* --------------------------------------------------
   CUSTOMER VIEW — UNIVERSAL LAYOUT UTILITIES
   -------------------------------------------------- */

/* Header row inside cards */
.card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-3);
}

/* Header: name left, type + status right */
.header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
}

/* Row of badges under the title */
.meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

/* Summary grid layout */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: var(--space-4);
    margin-top: var(--space-4);
}

.summary-grid.col-5 {
    grid-template-columns: repeat(5, 1fr) !important;
}

/* Normalize text */
.summary-grid strong,
.summary-grid span {
    font-size: var(--font-size-sm);
    line-height: 1.4;
}

.summary-grid strong {
    font-weight: 600;
}

/* Stack content cleanly (but NOT the title row) */
.summary-grid div:not(.section-title-row) {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Ensure items align to the top */
.summary-grid > div {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

/* Fix title row spacing inside summary-grid */
.summary-grid .section-title-row {
    margin-top: 0;
    margin-bottom: var(--space-2);
}


@media (max-width: 900px) {
    .summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .summary-grid.col-5 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 600px) {
    .summary-grid {
        grid-template-columns: 1fr;
    }

    .summary-grid.col-5 {
        grid-template-columns: 1fr !important;
    }
}

/* One-column info grid */
.info-grid-1 {
    display: grid !important;
    grid-template-columns: 1fr;
    gap: var(--space-3) !important;
}
.info-grid-1.hidden {
    display: none !important;
}

/* Normalize text size inside info grids */
.info-grid-1 strong,
.info-grid-1 span {
    font-size: var(--font-size-sm);
    line-height: 1.4;
}

/* Two-column info grid */
.info-grid-2 {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3) !important;
}
.info-grid-2.hidden {
    display: none !important;
}

@media (max-width: 700px) {
    .info-grid-2 {
        grid-template-columns: 1fr;
    }
}

/* Normalize text size inside info grids */
.info-grid-2 strong,
.info-grid-2 span {
    font-size: var(--font-size-sm);
    line-height: 1.4;
}

/* Three-column info grid */
.info-grid-3 {
    display: grid !important;
    grid-template-columns: 1fr 1fr 1fr;
    gap: var(--space-3) !important;
}
.info-grid-3.hidden {
    display: none !important;
}

@media (max-width: 700px) {
    .info-grid-3 {
        grid-template-columns: 1fr;
    }
}

/* Normalize text size inside info grids */
.info-grid-3 strong,
.info-grid-3 span {
    font-size: var(--font-size-sm);
    line-height: 1.4;
}

/* Section titles inside cards */
.section-title {
    margin-top: var(--space-4);
    margin-bottom: var(--space-2);
}

/* Notes styling */
.note-item {
    padding: var(--space-3);
    background: var(--color-surface-2);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-3);
}

.note-header {
    display: flex;
    justify-content: space-between;
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
    margin-bottom: 6px;
}

.note-body {
    font-size: var(--font-size-sm);
    line-height: 1.4;
}

/* --------------------------------------------------
   CUSTOMER VIEW — MODERN INFO BLOCKS
   -------------------------------------------------- */

.info-block {
    padding: var(--space-3);
    background: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-3);
}

.info-block-title {
    font-weight: 600;
    font-size: var(--font-size-sm);
}

.info-block-meta {
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
    margin-top: -15px;
}

.info-block-default {
    display: inline-block;
    background: var(--color-primary);
    color: #fff;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    margin-left: 6px;
}

/* Contacts — expandable */
.contact-collapsed {
    margin-top: var(--space-2);
    display: none;
}

.contact-block {
    cursor: pointer;
}

.contact-block:hover {
    background: var(--color-surface-2);
}
