:root {
    --bg-main: #f1f4f7;
    --bg-panel: #ffffff;

    --sidebar-bg: #18232f;
    --sidebar-hover: #243342;
    --sidebar-active: #2c4053;

    --topbar-bg: #ffffff;

    --text-main: #1b2733;
    --text-secondary: #6d7a86;
    --text-light: #b9c2ca;

    --border: #dce2e7;

    --primary: #1e5f8c;
    --primary-dark: #174b6e;

    --normal: #2f855a;
    --warning: #b7791f;
    --danger: #c53030;

    --sidebar-width: 260px;
    --topbar-height: 72px;
}

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

body {
    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Arial,
        sans-serif;

    background: var(--bg-main);
    color: var(--text-main);
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;

    width: var(--sidebar-width);
    height: 100vh;

    display: flex;
    flex-direction: column;

    background: var(--sidebar-bg);
    color: #ffffff;

    border-right: 1px solid rgba(255, 255, 255, 0.06);

    z-index: 1000;
}

.brand {
    min-height: var(--topbar-height);

    display: flex;
    align-items: center;
    gap: 12px;

    padding: 14px 20px;

    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-mark {
    width: 38px;
    height: 38px;

    display: flex;
    align-items: center;
    justify-content: center;

    border: 1px solid rgba(255, 255, 255, 0.35);
    background: #223547;

    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1px;
}

.brand-name {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.brand-subtitle {
    margin-top: 3px;

    color: var(--text-light);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;

    padding: 16px 12px;
}

.nav-item {
    min-height: 44px;

    display: flex;
    align-items: center;
    gap: 13px;

    margin-bottom: 4px;
    padding: 0 14px;

    color: #c8d1d9;
    text-decoration: none;

    border-left: 3px solid transparent;

    transition:
        background 0.15s ease,
        color 0.15s ease,
        border-color 0.15s ease;
}

.nav-item i {
    width: 18px;

    color: #95a8b8;
    text-align: center;
    font-size: 15px;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: #ffffff;
}

.nav-item.active {
    background: var(--sidebar-active);
    color: #ffffff;
    border-left-color: #4b9fd1;
}

.nav-item.active i {
    color: #7fc0e5;
}

.sidebar-footer {
    padding: 16px 20px;

    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.system-indicator {
    display: flex;
    align-items: center;
    gap: 8px;

    color: #dbe4ea;
    font-size: 12px;
}

.status-dot {
    width: 8px;
    height: 8px;

    display: inline-block;

    border-radius: 50%;
}

.status-dot.online {
    background: #48bb78;
}

.version {
    margin-top: 8px;

    color: #7f919f;
    font-size: 11px;
}

.main-area {
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;

    display: flex;
    flex-direction: column;

    margin-left: var(--sidebar-width);
}

.topbar {
    position: sticky;
    top: 0;

    min-height: var(--topbar-height);

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;

    padding: 0 28px;

    background: var(--topbar-bg);
    border-bottom: 1px solid var(--border);

    z-index: 900;
}

.topbar-left,
.topbar-right {
    display: flex;
    align-items: center;
}

.topbar-left {
    gap: 14px;
}

.topbar-left h1 {
    font-size: 18px;
    font-weight: 600;
}

.topbar-left p {
    margin-top: 3px;

    color: var(--text-secondary);
    font-size: 12px;
}

.topbar-right {
    gap: 16px;
}

.menu-button {
    display: none;

    width: 38px;
    height: 38px;

    border: 1px solid var(--border);
    background: #ffffff;
    color: var(--text-main);
}

.search-box {
    width: 310px;
    height: 40px;

    display: flex;
    align-items: center;
    gap: 10px;

    padding: 0 13px;

    background: #f7f9fa;
    border: 1px solid var(--border);
}

.search-box i {
    color: #87939d;
    font-size: 14px;
}

.search-box input {
    width: 100%;

    border: none;
    outline: none;
    background: transparent;

    color: var(--text-main);
    font-size: 13px;
}

.icon-button {
    position: relative;

    width: 40px;
    height: 40px;

    border: 1px solid var(--border);
    background: #ffffff;
    color: #50606d;
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;

    min-width: 18px;
    height: 18px;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0 4px;

    background: var(--danger);
    color: #ffffff;

    border: 2px solid #ffffff;
    border-radius: 10px;

    font-size: 10px;
}

.user-block {
    display: flex;
    align-items: center;
    gap: 10px;

    padding-left: 2px;
}

.user-avatar {
    width: 38px;
    height: 38px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: #263b4e;
    color: #ffffff;

    font-size: 12px;
    font-weight: 600;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
}

.user-role {
    margin-top: 2px;

    color: var(--text-secondary);
    font-size: 11px;
}

.content {
    flex: 1;

    padding: 28px;
}

.page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;

    margin-bottom: 22px;
}

.page-heading h2 {
    font-size: 22px;
    font-weight: 600;
}

.page-heading p {
    margin-top: 5px;

    color: var(--text-secondary);
    font-size: 13px;
}

.last-update {
    display: flex;
    align-items: center;
    gap: 7px;

    color: var(--text-secondary);
    font-size: 12px;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(150px, 1fr));
    gap: 16px;

    margin-bottom: 20px;
}

.metric-card {
    min-height: 150px;

    padding: 20px;

    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-top: 3px solid #506b80;
}

.metric-card.status-normal {
    border-top-color: var(--normal);
}

.metric-card.status-warning {
    border-top-color: var(--warning);
}

.metric-card.status-danger {
    border-top-color: var(--danger);
}

.metric-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.metric-header i {
    font-size: 16px;
}

.metric-value {
    margin-top: 22px;

    font-size: 34px;
    font-weight: 600;
    line-height: 1;
}

.metric-description {
    margin-top: 10px;

    color: var(--text-secondary);
    font-size: 12px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
    gap: 20px;

    margin-bottom: 20px;
}

.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
}

.panel-header {
    min-height: 74px;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;

    padding: 16px 20px;

    border-bottom: 1px solid var(--border);
}

.panel-header h3 {
    font-size: 15px;
    font-weight: 600;
}

.panel-header p {
    margin-top: 4px;

    color: var(--text-secondary);
    font-size: 12px;
}

.text-button {
    display: flex;
    align-items: center;
    gap: 7px;

    border: none;
    background: transparent;
    color: var(--primary);

    font-size: 12px;
    font-weight: 600;
}

.object-row,
.system-row {
    display: flex;
    align-items: center;

    min-height: 74px;

    padding: 14px 20px;

    border-bottom: 1px solid #edf0f2;
}

.object-row:last-child,
.system-row:last-child {
    border-bottom: none;
}

.object-icon {
    width: 38px;
    height: 38px;

    display: flex;
    align-items: center;
    justify-content: center;

    margin-right: 14px;

    background: #eef3f6;
    color: #35566f;
}

.object-info {
    flex: 1;
    min-width: 0;
}

.object-name,
.system-name {
    font-size: 13px;
    font-weight: 600;
}

.object-meta,
.system-meta {
    margin-top: 5px;

    color: var(--text-secondary);
    font-size: 11px;
}

.system-row {
    justify-content: space-between;
    gap: 14px;
}

.status-label {
    display: inline-flex;
    align-items: center;
    gap: 7px;

    white-space: nowrap;

    font-size: 11px;
    font-weight: 600;
}

.status-label span {
    width: 7px;
    height: 7px;

    border-radius: 50%;
}

.status-label.normal {
    color: var(--normal);
}

.status-label.normal span {
    background: var(--normal);
}

.status-label.warning {
    color: var(--warning);
}

.status-label.warning span {
    background: var(--warning);
}

.status-label.danger {
    color: var(--danger);
}

.status-label.danger span {
    background: var(--danger);
}

.events-panel {
    margin-bottom: 20px;
}

.table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.events-table {
    width: 100%;
    border-collapse: collapse;

    font-size: 12px;
}

.events-table th {
    padding: 13px 16px;

    background: #f7f9fa;
    color: #566470;

    border-bottom: 1px solid var(--border);

    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.35px;
}

.events-table td {
    padding: 15px 16px;

    border-bottom: 1px solid #edf0f2;

    vertical-align: middle;
}

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

.table-status {
    display: inline-flex;

    padding: 5px 8px;

    border: 1px solid currentColor;

    font-size: 10px;
    font-weight: 600;
}

.table-status.normal {
    color: var(--normal);
    background: #f2faf6;
}

.table-status.warning {
    color: var(--warning);
    background: #fffaf0;
}

.table-status.danger {
    color: var(--danger);
    background: #fff5f5;
}

.footer {
    min-height: 52px;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;

    padding: 0 28px;

    background: #ffffff;
    color: var(--text-secondary);

    border-top: 1px solid var(--border);

    font-size: 11px;
}

@media (max-width: 1200px) {
    .metrics-grid {
        grid-template-columns: repeat(3, minmax(150px, 1fr));
    }

    .search-box {
        width: 230px;
    }
}

@media (max-width: 960px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.2s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-area {
        width: 100%;
        margin-left: 0;
    }

    .menu-button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .user-details {
        display: none;
    }
}

@media (max-width: 720px) {
    .topbar {
        padding: 0 16px;
    }

    .topbar-left p {
        display: none;
    }

    .search-box {
        display: none;
    }

    .content {
        padding: 20px 14px;
    }

    .page-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .metrics-grid {
        grid-template-columns: repeat(2, minmax(130px, 1fr));
    }

    .metric-card {
        min-height: 135px;
        padding: 16px;
    }

    .metric-value {
        font-size: 29px;
    }

    .footer {
        align-items: flex-start;
        flex-direction: column;

        padding: 14px 16px;
    }
}

@media (max-width: 460px) {
    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .topbar-left h1 {
        font-size: 15px;
    }

    .object-row {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .object-info {
        width: calc(100% - 52px);
    }

    .object-row .status-label {
        margin-top: 10px;
        margin-left: 52px;
    }
}

/* SmartHub v0.2 additions */

.brand {
    color: #ffffff;
    text-decoration: none;
}

.metrics-grid-four {
    grid-template-columns: repeat(4, minmax(170px, 1fr));
}

.metric-link {
    display: block;
    color: inherit;
    text-decoration: none;
    transition:
        transform 0.15s ease,
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}

.metric-link:hover {
    transform: translateY(-2px);
    border-color: #aebbc5;
    box-shadow: 0 5px 14px rgba(24, 35, 47, 0.08);
}

.primary-button {
    min-height: 40px;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    padding: 0 16px;

    border: 1px solid var(--primary);
    background: var(--primary);
    color: #ffffff;

    text-decoration: none;
    font-size: 12px;
    font-weight: 600;

    transition:
        background 0.15s ease,
        border-color 0.15s ease;
}

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

.primary-button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.empty-state {
    min-height: 310px;

    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;

    padding: 40px 24px;

    text-align: center;
}

.empty-state-icon {
    width: 58px;
    height: 58px;

    display: flex;
    align-items: center;
    justify-content: center;

    margin-bottom: 18px;

    background: #edf2f5;
    color: #4c687d;

    font-size: 22px;
}

.empty-state h3 {
    font-size: 15px;
    font-weight: 600;
}

.empty-state p {
    max-width: 460px;

    margin: 9px 0 20px;

    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.6;
}

.empty-table {
    min-height: 150px;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 30px;

    color: var(--text-secondary);
    font-size: 12px;
}

.status-label.neutral {
    color: #718096;
}

.status-label.neutral span {
    background: #718096;
}

.settings-list {
    width: 100%;
}

.settings-row {
    min-height: 72px;

    display: flex;
    align-items: center;

    padding: 14px 20px;

    border-bottom: 1px solid #edf0f2;
}

.settings-row:last-child {
    border-bottom: none;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;

    display: none;

    background: rgba(10, 18, 25, 0.5);

    z-index: 950;
}

.sidebar-overlay.visible {
    display: block;
}

@media (max-width: 1200px) {
    .metrics-grid-four {
        grid-template-columns: repeat(2, minmax(170px, 1fr));
    }
}

@media (max-width: 600px) {
    .metrics-grid-four {
        grid-template-columns: 1fr;
    }
}

/* SmartHub v0.3 — database and setup */

.setup-wrapper {
    max-width: 980px;
    margin: 0 auto;
}

.setup-header {
    margin-bottom: 24px;
}

.setup-header h2 {
    margin-top: 8px;
    font-size: 24px;
    font-weight: 600;
}

.setup-header p {
    max-width: 700px;
    margin-top: 8px;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.6;
}

.setup-step {
    color: var(--primary);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.7px;
}

.setup-form,
.form-panel {
    margin-bottom: 20px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    padding: 24px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group-wide {
    grid-column: 1 / -1;
}

.form-group label {
    color: #344451;
    font-size: 12px;
    font-weight: 600;
}

.form-group label span {
    color: var(--danger);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;

    border: 1px solid var(--border);
    background: #ffffff;
    color: var(--text-main);
    outline: none;

    font: inherit;
    font-size: 13px;
}

.form-group textarea {
    min-height: 96px;
    resize: vertical;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(30, 95, 140, 0.1);
}

.form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;

    margin: 20px 0;
}

.secondary-button {
    min-height: 40px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 0 16px;

    border: 1px solid var(--border);
    background: #ffffff;
    color: var(--text-main);

    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
}

.secondary-button:hover {
    background: #f6f8fa;
}

.organization-panel {
    margin-bottom: 20px;
}

.object-table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.objects-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.objects-table th {
    padding: 13px 16px;

    background: #f7f9fa;
    color: #566470;

    border-bottom: 1px solid var(--border);

    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.objects-table td {
    padding: 15px 16px;

    border-bottom: 1px solid #edf0f2;

    vertical-align: middle;
}

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

.table-main-value {
    font-weight: 600;
}

.table-secondary-value {
    max-width: 420px;
    margin-top: 4px;

    color: var(--text-secondary);
    font-size: 11px;
}

.table-actions {
    width: 60px;
    text-align: right;
}

.danger-icon-button {
    width: 34px;
    height: 34px;

    border: 1px solid #e2b8b8;
    background: #ffffff;
    color: var(--danger);
}

.danger-icon-button:hover {
    background: #fff5f5;
}

.table-status.neutral {
    color: #718096;
    background: #f7f9fa;
}

@media (max-width: 720px) {
    .form-grid {
        grid-template-columns: 1fr;
        padding: 18px;
    }

    .form-group-wide {
        grid-column: auto;
    }

    .form-actions {
        align-items: stretch;
        flex-direction: column-reverse;
    }

    .form-actions .primary-button,
    .form-actions .secondary-button {
        width: 100%;
    }
}

/* SmartHub universal owner interface */

.owner-type-selector {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.owner-type-option {
    display: block;
    cursor: pointer;
}

.owner-type-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.owner-type-card {
    min-height: 84px;

    display: flex;
    align-items: center;
    gap: 14px;

    padding: 16px;

    border: 1px solid var(--border);
    background: #ffffff;

    transition:
        border-color 0.15s ease,
        background 0.15s ease,
        box-shadow 0.15s ease;
}

.owner-type-card > i {
    width: 38px;
    height: 38px;

    display: flex;
    align-items: center;
    justify-content: center;

    flex-shrink: 0;

    background: #edf3f7;
    color: var(--primary);

    font-size: 16px;
}

.owner-type-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.owner-type-text strong {
    color: var(--text-main);
    font-size: 13px;
    font-weight: 600;
}

.owner-type-text small {
    color: var(--text-secondary);
    font-size: 11px;
    line-height: 1.4;
}

.owner-type-option input:checked + .owner-type-card {
    border-color: var(--primary);
    background: #f4f8fb;
    box-shadow: 0 0 0 2px rgba(30, 95, 140, 0.09);
}

.owner-type-option:hover .owner-type-card {
    border-color: #9eafbb;
}

.owner-heading {
    display: flex;
    align-items: center;
    gap: 12px;
}

.owner-heading-icon {
    width: 38px;
    height: 38px;

    display: flex;
    align-items: center;
    justify-content: center;

    flex-shrink: 0;

    background: #edf3f7;
    color: var(--primary);
}

.owner-description {
    padding: 14px 20px;

    border-bottom: 1px solid var(--border);
    background: #fbfcfd;

    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.6;
}

.form-message {
    margin-bottom: 18px;
    padding: 12px 14px;

    border: 1px solid var(--border);

    font-size: 12px;
}

.error-message {
    border-color: #e1b1b1;
    background: #fff5f5;
    color: #a53636;
}

@media (max-width: 720px) {
    .owner-type-selector {
        grid-template-columns: 1fr;
    }
}

/* SmartHub object search and editing */

.objects-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;

    margin-bottom: 18px;
}

.search-form {
    width: min(760px, 100%);

    display: flex;
    align-items: center;
    gap: 10px;
}

.search-input-wrapper {
    position: relative;
    flex: 1;
}

.search-input-wrapper > i {
    position: absolute;
    top: 50%;
    left: 14px;

    color: #82909b;
    font-size: 13px;

    transform: translateY(-50%);
    pointer-events: none;
}

.search-input-wrapper input {
    width: 100%;
    min-height: 42px;

    padding: 10px 42px 10px 40px;

    border: 1px solid var(--border);
    background: #ffffff;
    color: var(--text-main);

    outline: none;
    font: inherit;
    font-size: 12px;
}

.search-input-wrapper input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(30, 95, 140, 0.1);
}

.search-clear {
    position: absolute;
    top: 50%;
    right: 12px;

    width: 26px;
    height: 26px;

    display: flex;
    align-items: center;
    justify-content: center;

    color: #71808b;
    text-decoration: none;

    transform: translateY(-50%);
}

.search-clear:hover {
    color: var(--danger);
}

.search-summary {
    flex-shrink: 0;

    color: var(--text-secondary);
    font-size: 11px;
}

.actions-column {
    width: 110px;
    text-align: right !important;
}

.table-actions {
    width: 110px;
}

.object-action-buttons {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 7px;
}

.object-action-buttons form {
    margin: 0;
}

.edit-icon-button,
.danger-icon-button {
    width: 34px;
    height: 34px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    text-decoration: none;
    cursor: pointer;
}

.edit-icon-button {
    border: 1px solid #b8ccd9;
    background: #ffffff;
    color: var(--primary);
}

.edit-icon-button:hover {
    background: #f1f7fa;
    border-color: var(--primary);
}

.checkbox-option {
    display: flex;
    align-items: center;
    gap: 12px;

    cursor: pointer;
}

.checkbox-option > input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.checkbox-visual {
    width: 22px;
    height: 22px;

    display: flex;
    align-items: center;
    justify-content: center;

    flex-shrink: 0;

    border: 1px solid var(--border);
    background: #ffffff;
    color: transparent;

    font-size: 11px;
}

.checkbox-option > input:checked + .checkbox-visual {
    border-color: var(--primary);
    background: var(--primary);
    color: #ffffff;
}

.checkbox-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.checkbox-text strong {
    color: var(--text-main);
    font-size: 12px;
    font-weight: 600;
}

.checkbox-text small {
    color: var(--text-secondary);
    font-size: 11px;
}

@media (max-width: 850px) {
    .objects-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .search-form {
        width: 100%;
    }

    .search-summary {
        padding-left: 2px;
    }
}

@media (max-width: 560px) {
    .search-form {
        align-items: stretch;
        flex-direction: column;
    }

    .search-form .secondary-button {
        width: 100%;
    }
}

/* SmartHub v0.4 owner and object actions */

.owner-panel-header {
    align-items: center;
}

.owner-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
}

.owner-actions form,
.owner-empty-actions form {
    margin: 0;
}

.compact-button {
    min-height: 34px;
    padding: 0 12px;
    gap: 7px;
    font-size: 11px;
}

.danger-button {
    min-height: 40px;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    padding: 0 16px;

    border: 1px solid #d8a8a8;
    background: #ffffff;
    color: var(--danger);

    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.danger-button:hover {
    border-color: var(--danger);
    background: #fff5f5;
}

.owner-empty-state {
    min-height: 250px;

    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;

    padding: 35px 24px;
    text-align: center;
}

.owner-empty-state h3 {
    font-size: 15px;
    font-weight: 600;
}

.owner-empty-state p {
    max-width: 460px;

    margin: 9px 0 20px;

    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.6;
}

.owner-empty-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

@media (max-width: 900px) {
    .owner-panel-header {
        align-items: stretch;
        flex-direction: column;
        gap: 15px;
    }

    .owner-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 600px) {
    .owner-actions,
    .owner-empty-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .owner-actions a,
    .owner-actions button,
    .owner-empty-actions a,
    .owner-empty-actions button {
        width: 100%;
    }
}

/* SmartHub v0.5 — equipment and expandable objects */

.objects-accordion-list {
    width: 100%;
}

.object-accordion {
    border-bottom: 1px solid var(--border);
}

.object-accordion:last-child {
    border-bottom: none;
}

.object-summary {
    min-height: 78px;

    display: flex;
    align-items: center;
    gap: 12px;

    padding: 14px 18px;

    cursor: pointer;
    list-style: none;

    transition: background 0.15s ease;
}

.object-summary::-webkit-details-marker {
    display: none;
}

.object-summary:hover {
    background: #f7f9fa;
}

.object-summary-chevron {
    width: 20px;

    color: #7d8a94;
    font-size: 11px;

    transition: transform 0.15s ease;
}

.object-accordion[open] .object-summary-chevron {
    transform: rotate(90deg);
}

.object-summary-icon {
    width: 38px;
    height: 38px;

    display: flex;
    align-items: center;
    justify-content: center;

    flex-shrink: 0;

    background: #edf3f7;
    color: var(--primary);
}

.object-summary-main {
    min-width: 0;
    flex: 1;
}

.object-summary-title {
    color: var(--text-main);
    font-size: 13px;
    font-weight: 600;
}

.object-summary-meta {
    margin-top: 4px;

    color: var(--text-secondary);
    font-size: 11px;
}

.object-summary-counters {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;

    flex-shrink: 0;
}

.object-counter {
    display: inline-flex;
    align-items: center;
    gap: 6px;

    color: var(--text-secondary);
    font-size: 11px;
}

.object-expanded-content {
    border-top: 1px solid var(--border);
    background: #fafcfd;
}

.object-expanded-toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;

    padding: 18px 20px;

    border-bottom: 1px solid var(--border);
}

.object-expanded-title {
    color: var(--text-main);
    font-size: 13px;
    font-weight: 600;
}

.object-expanded-meta,
.object-expanded-description {
    margin-top: 5px;

    color: var(--text-secondary);
    font-size: 11px;
    line-height: 1.5;
}

.object-expanded-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
}

.object-expanded-actions form {
    margin: 0;
}

.equipment-table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.equipment-table {
    width: 100%;
    border-collapse: collapse;

    background: #ffffff;

    font-size: 11px;
}

.equipment-table th {
    padding: 12px 14px;

    border-bottom: 1px solid var(--border);
    background: #f4f7f9;
    color: #5a6873;

    text-align: left;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.equipment-table td {
    padding: 14px;

    border-bottom: 1px solid #edf0f2;

    vertical-align: middle;
}

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

.equipment-name {
    display: flex;
    align-items: center;
    gap: 8px;

    color: var(--text-main);
    font-weight: 600;
}

.equipment-name i {
    color: var(--primary);
}

.equipment-empty-state {
    min-height: 220px;

    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;

    padding: 30px 20px;

    text-align: center;
}

.equipment-empty-state h3 {
    font-size: 14px;
    font-weight: 600;
}

.equipment-empty-state p {
    max-width: 450px;

    margin: 8px 0 18px;

    color: var(--text-secondary);
    font-size: 11px;
    line-height: 1.6;
}

.table-status.warning {
    border-color: #dfc379;
    background: #fff9e8;
    color: #8b6b11;
}

.table-status.danger {
    border-color: #dfa9a9;
    background: #fff4f4;
    color: #b13b3b;
}

.equipment-metrics-grid {
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    margin-bottom: 18px;
}

.equipment-registry-table {
    min-width: 1200px;
}

@media (max-width: 1000px) {
    .object-summary {
        align-items: flex-start;
    }

    .object-summary-counters {
        align-items: flex-start;
        flex-direction: column;
    }

    .object-expanded-toolbar {
        flex-direction: column;
    }

    .object-expanded-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 720px) {
    .equipment-metrics-grid {
        grid-template-columns: 1fr;
    }

    .object-summary {
        flex-wrap: wrap;
    }

    .object-summary-main {
        width: calc(100% - 85px);
        flex: none;
    }

    .object-summary-counters {
        width: 100%;
        padding-left: 70px;
    }

    .object-expanded-actions {
        align-items: stretch;
        flex-direction: column;
        width: 100%;
    }

    .object-expanded-actions a,
    .object-expanded-actions button {
        width: 100%;
    }
}
