﻿:root {
    --page-content-max-width: 1240px;
    --page-hero-min-height: 108px;
    --device-action-button-width: 207px;
    --device-action-button-height: 42px;
    --on-surface: #191c1e;
    --on-primary: #ffffff;
    --surface: #f7f9fb;
    --on-surface-variant: #444653;
    --surface-container-highest: #e0e3e5;
    --surface-container-high: #e6e8ea;
    --surface-container: #eceef0;
    --surface-container-lowest: #ffffff;
    --primary: #00288e;
    --primary-container: #1e40af;
    --outline: #757684;
    --outline-variant: #c4c5d5;
    --error: #ba1a1a;
    --ok: #1f7a38;
    --shadow: 0 12px 32px rgba(25, 28, 30, 0.08);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: "Be Vietnam Pro", "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scrollbar-gutter: stable;
    color: var(--on-surface);
    background: var(--surface);
}

html {
    overflow-y: scroll;
}

.material-symbols-outlined {
    font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
}

.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(500px circle at 0% 100%, rgba(0, 40, 142, 0.12), transparent 60%),
        radial-gradient(460px circle at 100% 0%, rgba(83, 95, 116, 0.18), transparent 60%),
        linear-gradient(180deg, #f9fbff 0%, #f1f5fb 100%);
}

.login-wrapper {
    width: 100%;
    max-width: 560px;
    min-height: 560px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.brand-header {
    width: 100%;
    text-align: center;
    min-height: 168px;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.brand-title {
    margin: 0;
    font-family: "Be Vietnam Pro", "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.35;
    letter-spacing: 0.04em;
    outline: none;
    white-space: nowrap;
}

.brand-subtitle {
    margin: 14px 0 0;
    font-size: 1.18rem;
    letter-spacing: 0.28em;
    color: #0284c7;
    font-weight: 700;
}

.login-card {
    width: min(100%, 460px);
    background: rgba(255, 255, 255, 0.82);
    border-radius: 14px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(14px);
    padding: 28px;
    animation: rise 320ms ease-out;
}

.login-head h2 {
    margin: 0;
    font-family: "Be Vietnam Pro", "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
    font-size: 1.4rem;
}

.login-head p {
    margin: 8px 0 0;
    color: var(--on-surface-variant);
    font-size: 0.92rem;
}

.status-banner {
    margin-top: 16px;
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 0.86rem;
    font-weight: 600;
}

.status-banner.error {
    background: rgba(186, 26, 26, 0.08);
    color: var(--error);
}

.status-banner.ok {
    background: rgba(31, 122, 56, 0.12);
    color: var(--ok);
}

.login-form {
    margin-top: 18px;
    display: grid;
    gap: 16px;
}

.field-block label {
    display: block;
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--outline);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.input-wrap {
    position: relative;
}

.input-wrap .material-symbols-outlined {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--outline);
    font-size: 20px;
    pointer-events: none;
}

.input-wrap input {
    width: 100%;
    border: none;
    outline: none;
    border-radius: 10px;
    padding: 14px 14px 14px 44px;
    background: var(--surface-container-high);
    color: var(--on-surface);
    font-size: 0.94rem;
    font-weight: 500;
    transition: box-shadow 180ms ease;
}

.input-wrap input:focus {
    box-shadow: 0 0 0 3px rgba(0, 40, 142, 0.2);
}

.validation-message {
    display: block;
    margin-top: 6px;
    font-size: 0.78rem;
    color: var(--error);
}

.remember-row {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--on-surface-variant);
    font-size: 0.9rem;
    user-select: none;
}

.remember-row input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.login-btn {
    border: none;
    width: min(100%, 320px);
    justify-self: center;
    border-radius: 10px;
    padding: 12px 20px;
    color: var(--on-primary);
    font-family: "Be Vietnam Pro", "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
    font-weight: 800;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-container) 100%);
    box-shadow: 0 12px 24px rgba(0, 40, 142, 0.26);
    transition: transform 120ms ease, opacity 120ms ease;
}

.login-btn:hover {
    opacity: 0.94;
}

.login-btn:active {
    transform: scale(0.985);
}

.login-btn:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.login-foot {
    margin-top: 22px;
    border-top: 1px dashed var(--surface-container-highest);
    padding-top: 16px;
    text-align: center;
}

.login-foot p {
    margin: 0;
    color: var(--outline);
    font-size: 0.8rem;
    font-weight: 600;
}

#blazor-error-ui {
    background: #fff3cd;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

@media (max-width: 640px) {
    .login-shell {
        padding: 14px;
    }

    .login-wrapper {
        min-height: auto;
        max-width: 460px;
    }

    .brand-header {
        min-height: 142px;
    }

    .login-card {
        padding: 24px 18px;
        border-radius: 12px;
    }

    .login-btn {
        width: 100%;
    }

    .brand-title {
        font-size: 1.12rem;
    }
}

@keyframes rise {
    from {
        transform: translateY(10px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.inventory-shell {
    min-height: 100vh;
    padding: 0 24px 28px;
    background:
        radial-gradient(620px circle at 100% -10%, rgba(83, 95, 116, 0.12), transparent 58%),
        linear-gradient(180deg, #f7f9fc 0%, #eef2f8 100%);
}

.topbar {
    height: 64px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #dde2eb;
    margin: 0 -24px 20px;
    padding: 0 24px;
    background: rgba(255, 255, 255, 0.9);
}

.topbar-left {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.icon-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: #5f6f87;
    cursor: pointer;
}

.icon-btn:hover {
    background: #eef2f9;
}

.icon-btn .material-symbols-outlined {
    font-size: 20px;
}

.topbar-user {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.topbar-user-menu {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.topbar-user-button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 0;
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;
}

.topbar-user-button:focus-visible {
    outline: 2px solid rgba(17, 63, 187, 0.35);
    outline-offset: 4px;
    border-radius: 14px;
}

.user-menu-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 220px;
    padding: 12px;
    border: 1px solid #d9e0ec;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 18px 32px rgba(25, 28, 30, 0.12);
    z-index: 20;
}

.user-menu-header {
    display: grid;
    gap: 2px;
    padding-bottom: 10px;
    margin-bottom: 10px;
    border-bottom: 1px solid #e5ebf4;
}

.user-menu-name {
    font-size: 0.92rem;
    font-weight: 800;
    color: #202636;
}

.user-menu-role {
    font-size: 0.78rem;
    color: #7b879a;
}

.user-menu-action {
    width: 100%;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
    border-radius: 10px;
    padding: 10px 12px;
    background: #f5f7fb;
    color: #21324d;
    font-weight: 700;
    cursor: pointer;
}

.user-menu-action:hover {
    background: #eaf0fb;
}

.user-menu-action .material-symbols-outlined {
    font-size: 18px;
}

.topbar-user-info {
    display: grid;
    text-align: right;
}

.topbar-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: #202636;
}

.topbar-role {
    font-size: 0.75rem;
    color: #7b879a;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #ffffff;
    background: linear-gradient(135deg, #113fbb 0%, #0f60cf 100%);
}

.inventory-wrapper {
    max-width: var(--page-content-max-width);
    margin: 0 auto;
    background: transparent;
}

.page-top-row {
    min-height: 31px;
    display: flex;
    align-items: center;
    margin-bottom: 18px;
}

.page-top-row > .back-link {
    min-height: 31px;
    display: inline-flex;
    align-items: center;
}

.page-top-row-placeholder {
    height: 31px;
    min-height: 31px;
    display: block;
}

.page-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    min-height: var(--page-hero-min-height);
    margin-bottom: 18px;
}

.page-hero-content {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    min-height: var(--page-hero-min-height);
}

.page-hero-actions {
    min-height: var(--page-hero-min-height);
    display: inline-flex;
    align-items: center;
}

.page-title {
    margin-bottom: 18px;
    font-family: "Be Vietnam Pro", "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
    font-size: 2rem;
    line-height: 1.15;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 0;
}

.page-subtitle {
    margin: 6px 0 0;
    font-size: 1rem;
    line-height: 1.35;
    color: #5b6880;
}

.inventory-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 18px;
}

.add-device-btn {
    border: none;
    border-radius: 8px;
    padding: 10px 16px;
    width: var(--device-action-button-width);
    height: var(--device-action-button-height);
    min-width: var(--device-action-button-width);
    min-height: var(--device-action-button-height);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, #1a4acc 0%, #1f5be0 100%);
    color: #ffffff;
    font-family: "Be Vietnam Pro", "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 8px 22px rgba(31, 91, 224, 0.24);
}

.add-device-btn .material-symbols-outlined {
    font-size: 20px;
}

.add-device-btn:hover {
    filter: brightness(1.03);
}

.inventory-filters {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr) minmax(0, 1.35fr) 148px;
    gap: 12px;
    margin-bottom: 18px;
    background: #ffffff;
    border: 1px solid #d9e0ec;
    border-radius: 12px;
    padding: 10px;
    align-items: center;
}

.search-wrap {
    position: relative;
    min-width: 0;
}

.search-wrap .material-symbols-outlined {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #7c8799;
    font-size: 18px;
}

.inventory-filters input,
.inventory-filters select {
    width: 100%;
    height: 48px;
    border: 1px solid #dbe2ee;
    outline: none;
    border-radius: 8px;
    padding: 10px 12px;
    background: #f9fbff;
    font-size: 0.9rem;
    color: #354156;
}

.search-wrap input {
    padding-left: 36px;
}

.inventory-filters select {
    min-width: 0;
}

.clear-filter-btn {
    border: 1px solid #cfd9ea;
    border-radius: 8px;
    background: linear-gradient(180deg, #ffffff 0%, #f4f7fc 100%);
    color: #344767;
    font-family: "Be Vietnam Pro", "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
    font-size: 0.86rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    font-weight: 700;
    font-variant-ligatures: none;
    cursor: pointer;
    padding: 0 14px;
    width: 148px;
    min-width: 0;
    height: 48px;
    min-height: 0;
    white-space: nowrap;
    box-shadow: 0 6px 14px rgba(37, 55, 92, 0.1);
}

.clear-filter-btn:hover {
    background: #eef4ff;
    border-color: #b9c8e4;
    color: #1f4fbf;
}

.inventory-table-wrap {
    overflow: hidden;
    border: 1px solid #d7deea;
    border-radius: 12px;
    background: #ffffff;
}

.inventory-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 860px;
}

.inventory-table th,
.inventory-table td {
    text-align: left;
    padding: 14px 16px;
    border-bottom: 1px solid #e4e9f3;
}

.inventory-table th {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #6f7e95;
    font-weight: 700;
    background: #f7f9fd;
}

.inventory-table tbody tr:hover {
    background: #f9fbff;
}

.device-main {
    font-weight: 700;
    color: #1f2634;
}

.device-sub {
    margin-top: 2px;
    font-size: 0.78rem;
    color: #7d899e;
    font-style: italic;
}

.chip {
    display: inline-flex;
    align-items: center;
    border-radius: 6px;
    padding: 4px 8px;
    background: #edf2fb;
    color: #3e4c66;
    font-size: 0.78rem;
    font-weight: 600;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.status-pill.is-new {
    background: #e8f6ec;
    color: #1e8740;
}

.status-pill.is-stock {
    background: #e9f7f4;
    color: #147567;
}

.status-pill.is-active {
    background: #e7eefc;
    color: #2353c6;
}

.status-pill.is-maintenance {
    background: #fff1de;
    color: #c26b00;
}

.status-pill.is-reserved {
    background: #ececff;
    color: #504dc8;
}

.status-pill.is-retired {
    background: #ffe6e6;
    color: #ca3939;
}

.status-pill.is-default {
    background: #edf0f6;
    color: #556179;
}

.row-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.action-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #647591;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.action-btn:hover {
    background: #edf2fb;
    color: #243a69;
}

.action-btn .material-symbols-outlined {
    font-size: 18px;
}

.text-right {
    text-align: right !important;
}

.inventory-footer {
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    color: #69788f;
    font-size: 0.88rem;
    padding: 0 6px;
}

.pager-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.pager-nav,
.pager-page {
    width: 30px;
    height: 30px;
    border: 1px solid #d5dcec;
    border-radius: 8px;
    background: #ffffff;
    color: #5d6f8b;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.pager-page.active {
    background: #1f56d4;
    color: #ffffff;
    border-color: #1f56d4;
}

.pager-nav .material-symbols-outlined {
    font-size: 18px;
}

.pager-nav:disabled,
.pager-page:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

@media (max-width: 768px) {
    .inventory-shell {
        padding: 0 14px 20px;
    }

    .topbar {
        margin: 0 -14px 14px;
        padding: 0 14px;
    }

    .page-top-row {
        min-height: 27px;
        margin-bottom: 14px;
    }

    .inventory-header,
    .inventory-filters {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .inventory-header,
    .inventory-header > div:first-child {
        min-height: unset;
    }

    .inventory-wrapper::before {
        height: 27px;
    }

    .inventory-header h1 {
        font-size: 1.55rem;
    }

    .search-wrap,
    .inventory-filters select {
        min-width: 0;
        width: 100%;
    }

    .inventory-footer {
        flex-direction: column;
        align-items: flex-start;
    }
}

.device-form-shell {
    max-width: var(--page-content-max-width);
    margin: 0 auto;
    padding-bottom: 28px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #315ac7;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.back-link .material-symbols-outlined {
    font-size: 18px;
}

.device-form-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    min-height: var(--page-hero-min-height);
    margin-bottom: 18px;
}

.inventory-header > div:first-child {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: var(--page-hero-min-height);
}

.device-form-header h1 {
    margin: 0;
    font-family: "Be Vietnam Pro", "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
    font-size: 2.3rem;
    letter-spacing: -0.03em;
}

.device-form-header p {
    margin: 8px 0 0;
    max-width: 520px;
    color: #65738a;
}

.device-form-actions {
    display: inline-flex;
    gap: 10px;
    align-items: center;
}

.primary-btn,
.secondary-btn {
    min-width: 112px;
    min-height: 42px;
    border-radius: 10px;
    padding: 10px 18px;
    font-weight: 800;
    cursor: pointer;
    transition: transform 120ms ease, filter 120ms ease, opacity 120ms ease;
}

.primary-btn {
    border: none;
    color: #ffffff;
    background: linear-gradient(135deg, #1748cb 0%, #0d3fb7 100%);
    box-shadow: 0 10px 24px rgba(23, 72, 203, 0.24);
}

.secondary-btn {
    border: 1px solid #d5ddee;
    color: #41506c;
    background: rgba(255, 255, 255, 0.88);
}

.primary-btn:hover,
.secondary-btn:hover {
    filter: brightness(1.02);
}

.primary-btn:disabled,
.secondary-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.device-form {
    display: grid;
    gap: 16px;
}

.device-form-card {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid #e0e6f1;
    border-radius: 16px;
    padding: 22px;
    box-shadow: 0 14px 28px rgba(35, 53, 92, 0.06);
}
/* add spacing between cards for better visual separation */
.device-form-card + .device-form-card,
.device-form-card + .detail-card,
.detail-card + .detail-card {
    margin-top: 16px;
}

.card-title {
    position: relative;
    margin-bottom: 18px;
    padding-left: 14px;
    font-family: "Be Vietnam Pro", "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
    font-size: 1.1rem;
    font-weight: 800;
}

.card-title::before {
    content: "";
    position: absolute;
    left: 0;
    top: 3px;
    width: 4px;
    height: 20px;
    border-radius: 999px;
}

.card-title.is-blue::before {
    background: linear-gradient(180deg, #2f62de 0%, #163da9 100%);
}

.card-title.is-amber::before {
    background: linear-gradient(180deg, #d08d21 0%, #b86810 100%);
}

.device-form-grid {
    display: grid;
    gap: 16px;
}

.device-form-grid.two-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.device-form-grid.three-columns {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.nested-grid {
    grid-column: span 1;
}

.device-form-card .field-block {
    margin: 0;
}

.device-form-card .field-block > input,
.device-form-card .field-block > select,
.device-form-card .field-block > textarea,
.device-form-card .field-block > .input-with-icon,
.device-form-card .field-block > .input-with-icon input {
    width: 100%;
}

.device-form-card .field-block > input,
.device-form-card .field-block > select,
.device-form-card .field-block > textarea,
.input-with-icon {
    border: 1px solid #dde4ef;
    border-radius: 10px;
    background: #f4f7fb;
    min-height: 48px;
    padding: 12px 14px;
    color: #243146;
    font-size: 0.94rem;
    outline: none;
    transition: box-shadow 160ms ease, border-color 160ms ease;
}

.device-form-card .field-block > textarea {
    min-height: 124px;
    resize: vertical;
}

.device-form-card .field-block > input:focus,
.device-form-card .field-block > select:focus,
.device-form-card .field-block > textarea:focus,
.input-with-icon:focus-within {
    border-color: #b4c5ea;
    box-shadow: 0 0 0 3px rgba(31, 91, 224, 0.12);
}

.input-with-icon {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 14px;
}

.input-with-icon .material-symbols-outlined {
    color: #7f8aa0;
    font-size: 18px;
}

.input-with-icon input {
    border: none;
    outline: none;
    background: transparent;
    min-height: 46px;
    padding: 0;
}

.helper-banner {
    margin-top: 14px;
    border: 1px solid #ebd4bf;
    background: #fbf2e8;
    color: #94602b;
    border-radius: 10px;
    padding: 11px 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.86rem;
    font-weight: 600;
}

.helper-banner .material-symbols-outlined {
    font-size: 18px;
}

@media (max-width: 768px) {
    .device-form-header {
        flex-direction: column;
    }

    .device-form-actions {
        width: 100%;
    }

    .primary-btn,
    .secondary-btn {
        flex: 1;
    }

    .device-form-grid.two-columns,
    .device-form-grid.three-columns,
    .nested-grid {
        grid-template-columns: 1fr;
    }
}

.create-device-page {
    min-height: 100vh;
    padding: 0 24px 28px;
    background:
        radial-gradient(620px circle at 100% -10%, rgba(83, 95, 116, 0.12), transparent 58%),
        linear-gradient(180deg, #f7f9fc 0%, #eef2f8 100%);
}

.create-device-page .device-form-shell {
    max-width: var(--page-content-max-width);
    margin: 0 auto;
    padding-bottom: 28px;
}

.create-device-page .back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #315ac7;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 18px;
}

.create-device-page .back-link .material-symbols-outlined {
    font-size: 18px;
}

.create-device-page .device-form-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    min-height: var(--page-hero-min-height);
    margin-bottom: 18px;
}

.create-device-page .page-subtitle {
    max-width: none;
    white-space: nowrap;
}

.create-device-page .device-form-actions {
    display: inline-flex;
    gap: 10px;
    align-items: center;
}

.create-device-page .primary-btn,
.create-device-page .secondary-btn {
    min-width: 112px;
    min-height: 42px;
    border-radius: 10px;
    padding: 10px 18px;
    font-weight: 800;
    cursor: pointer;
    transition: transform 120ms ease, filter 120ms ease, opacity 120ms ease;
}

.create-device-page .primary-btn {
    border: none;
    color: #ffffff;
    width: var(--device-action-button-width);
    height: var(--device-action-button-height);
    min-width: var(--device-action-button-width);
    min-height: var(--device-action-button-height);
    max-width: var(--device-action-button-width);
    max-height: var(--device-action-button-height);
    border-radius: 8px;
    padding: 10px 16px;
    font-family: "Be Vietnam Pro", "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1;
    background: linear-gradient(135deg, #1a4acc 0%, #1f5be0 100%);
    box-shadow: 0 8px 22px rgba(31, 91, 224, 0.24);
}

.create-device-page .secondary-btn {
    border: 1px solid #d5ddee;
    color: #41506c;
    background: rgba(255, 255, 255, 0.88);
}

.create-device-page .primary-btn:disabled,
.create-device-page .secondary-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.create-device-page .device-form {
    display: grid;
    gap: 16px;
}

.create-device-page .device-form-card {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid #e0e6f1;
    border-radius: 16px;
    padding: 22px;
    box-shadow: 0 14px 28px rgba(35, 53, 92, 0.06);
}

.create-device-page .card-title {
    position: relative;
    margin-bottom: 18px;
    padding-left: 14px;
    font-family: "Be Vietnam Pro", "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
    font-size: 1.1rem;
    font-weight: 800;
}

.create-device-page .card-title::before {
    content: "";
    position: absolute;
    left: 0;
    top: 3px;
    width: 4px;
    height: 20px;
    border-radius: 999px;
}

.create-device-page .card-title.is-blue::before {
    background: linear-gradient(180deg, #2f62de 0%, #163da9 100%);
}

.create-device-page .card-title.is-amber::before {
    background: linear-gradient(180deg, #d08d21 0%, #b86810 100%);
}

.create-device-page .device-form-grid {
    display: grid;
    gap: 16px;
}

.create-device-page .two-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.create-device-page .three-columns {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.create-device-page .nested-grid {
    grid-column: span 1;
}

.create-device-page .field-block {
    margin: 0;
}

.create-device-page .field-block label {
    display: block;
    font-size: 0.72rem;
    font-weight: 800;
    color: #72809a;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.create-device-page .device-input,
.create-device-page .device-select,
.create-device-page .device-textarea {
    width: 100%;
    border: 1px solid #dde4ef;
    border-radius: 10px;
    background: #f4f7fb;
    min-height: 48px;
    padding: 12px 14px;
    color: #243146;
    font-size: 0.94rem;
    outline: none;
    box-sizing: border-box;
}

.create-device-page .device-textarea {
    min-height: 124px;
    resize: vertical;
}

.create-device-page .device-input:focus,
.create-device-page .device-select:focus,
.create-device-page .device-textarea:focus {
    border-color: #b4c5ea;
    box-shadow: 0 0 0 3px rgba(31, 91, 224, 0.12);
}

.create-device-page .validation-message {
    display: block;
    margin-top: 6px;
    font-size: 0.78rem;
    color: #ba1a1a;
}

.create-device-page .helper-banner {
    margin-top: 14px;
    border: 1px solid #ebd4bf;
    background: #fbf2e8;
    color: #94602b;
    border-radius: 10px;
    padding: 11px 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.86rem;
    font-weight: 600;
}

.create-device-page .helper-banner .material-symbols-outlined {
    font-size: 18px;
}

@media (max-width: 768px) {
    .create-device-page {
        padding: 0 14px 20px;
    }

    .create-device-page .topbar {
        margin: 0 -14px 14px;
        padding: 0 14px;
    }

    .create-device-page .device-form-header {
        flex-direction: column;
    }

    .create-device-page .device-form-header,
    .create-device-page .device-form-header > div:first-child {
        min-height: unset;
    }

    .create-device-page .device-form-header p {
        white-space: normal;
    }

    .create-device-page .device-form-actions {
        width: 100%;
    }

    .create-device-page .primary-btn,
    .create-device-page .secondary-btn {
        flex: 1;
    }

    .create-device-page .primary-btn {
        flex: 0 0 var(--device-action-button-width);
    }

    .create-device-page .two-columns,
    .create-device-page .three-columns,
    .create-device-page .nested-grid {
        grid-template-columns: 1fr;
    }
}

/* Lock shared page layout so both screens render on the same frame. */
.page-layout {
    max-width: var(--page-content-max-width);
    margin: 0 auto;
    padding-bottom: 28px;
}

.page-layout .page-hero-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    column-gap: 16px;
    margin: 0 0 18px;
}

.page-layout .page-hero-main {
    display: grid;
    grid-template-rows: 31px auto;
    row-gap: 18px;
}

.page-layout .page-top-row {
    min-height: 31px;
    display: flex;
    align-items: center;
}

.page-layout .page-top-row > .back-link {
    min-height: 31px;
    display: inline-flex;
    align-items: center;
    margin: 0;
}

.page-layout .page-hero-copy {
    min-height: var(--page-hero-min-height);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.page-layout .page-hero-actions {
    min-height: calc(31px + 18px + var(--page-hero-min-height));
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
}

.page-layout .page-title {
    margin: 0;
    font-family: "Be Vietnam Pro", "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
    font-size: 2rem;
    line-height: 1.15;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.page-layout .page-subtitle {
    margin: 6px 0 0;
    font-size: 1rem;
    line-height: 1.35;
    color: #5b6880;
    white-space: nowrap;
    max-width: none;
}

.page-layout .back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #315ac7;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0;
}

.page-layout .back-link .material-symbols-outlined {
    font-size: 18px;
}

.page-layout .page-top-row-placeholder {
    height: 31px;
    min-height: 31px;
    display: block;
}

@media (max-width: 768px) {
    .page-layout .page-top-row {
        min-height: 27px;
    }

    .page-layout .page-top-row > .back-link {
        min-height: 27px;
    }

    .page-layout .page-top-row-placeholder {
        height: 27px;
        min-height: 27px;
    }

    .page-layout .page-hero-shell {
        grid-template-columns: 1fr;
        row-gap: 14px;
    }

    .page-layout .page-hero-main {
        grid-template-rows: 27px auto;
        row-gap: 14px;
    }

    .page-layout .page-hero-copy,
    .page-layout .page-hero-actions {
        min-height: unset;
    }

    .page-layout .page-subtitle {
        white-space: normal;
    }
}

/* Final override: neutralize legacy page-specific header rules. */
.page-layout .page-top-row,
.page-layout .page-top-row-placeholder {
    height: 31px;
    min-height: 31px;
    max-height: 31px;
}

.page-layout .page-top-row > .back-link,
.create-device-page .page-layout .back-link {
    height: 31px;
    min-height: 31px;
    max-height: 31px;
    margin: 0 !important;
}

.page-layout .page-hero-copy {
    min-height: var(--page-hero-min-height);
}

.page-layout .page-title {
    margin: 0;
    line-height: 1.15;
}

.page-layout .page-subtitle {
    margin: 6px 0 0;
}

@media (max-width: 768px) {
    .page-layout .page-top-row,
    .page-layout .page-top-row-placeholder {
        height: 27px;
        min-height: 27px;
        max-height: 27px;
    }

    .page-layout .page-top-row > .back-link,
    .create-device-page .page-layout .back-link {
        height: 27px;
        min-height: 27px;
        max-height: 27px;
    }
}

/* Single shared header layout for Devices/CreateDevice pages. */
.page-layout .strict-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 16px;
    align-items: start;
    margin: 0 0 12px;
}

.page-layout .strict-header-main {
    display: grid;
    grid-template-rows: 27px auto;
    row-gap: 10px;
}

.page-layout .strict-header-row,
.page-layout .strict-header-row-placeholder {
    height: 27px;
    min-height: 27px;
    max-height: 27px;
    display: flex;
    align-items: center;
}

.page-layout .strict-header-row-placeholder {
    display: block;
}

.page-layout .strict-back-link {
    height: 27px;
    min-height: 27px;
    max-height: 27px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    color: #315ac7;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.page-layout .strict-back-link .material-symbols-outlined {
    font-size: 18px;
}

.page-layout .strict-header-copy {
    min-height: 74px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.page-layout .strict-title {
    margin: 0;
    font-family: "Be Vietnam Pro", "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
    font-size: 1.8rem;
    line-height: 1.15;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.page-layout .strict-subtitle {
    margin: 6px 0 0;
    font-size: 1rem;
    line-height: 1.35;
    color: #5b6880;
    white-space: nowrap;
}

.page-layout .strict-header-actions {
    min-height: 111px;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
}

@media (max-width: 768px) {
    .page-layout .strict-header {
        grid-template-columns: 1fr;
        row-gap: 14px;
    }

    .page-layout .strict-header-main {
        grid-template-rows: 27px auto;
        row-gap: 14px;
    }

    .page-layout .strict-header-row,
    .page-layout .strict-header-row-placeholder,
    .page-layout .strict-back-link {
        height: 27px;
        min-height: 27px;
        max-height: 27px;
    }

    .page-layout .strict-header-copy,
    .page-layout .strict-header-actions {
        min-height: unset;
    }

    .page-layout .strict-subtitle {
        white-space: normal;
    }
}

.device-detail-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    background: rgba(9, 16, 31, 0.46);
    backdrop-filter: blur(3px);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 26px;
    overflow-y: auto;
}

.device-detail-panel {
    width: min(1120px, 100%);
    border-radius: 18px;
    border: 1px solid #d3dbe9;
    background: linear-gradient(180deg, #f2f5fa 0%, #edf1f7 100%);
    box-shadow: 0 28px 60px rgba(7, 16, 32, 0.28);
    padding: 22px;
}

.device-detail-header {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 16px;
}

.device-detail-header h2 {
    margin: 0;
    color: #10307e;
    font-size: 1.24rem;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.device-detail-header p {
    margin: 6px 0 0;
    color: #5f6b82;
    font-size: 0.9rem;
}

.detail-loading {
    border: 1px dashed #cdd8eb;
    border-radius: 12px;
    background: #f8fbff;
    padding: 22px;
    color: #43629e;
    font-weight: 600;
}

.detail-hero-grid {
    display: grid;
    grid-template-columns: minmax(320px, 0.95fr) minmax(0, 1.05fr);
    gap: 18px;
    align-items: stretch;
}

.detail-card {
    background: rgba(255, 255, 255, 0.92);
}

.device-detail-page .detail-card {
    margin-bottom: 16px;
}

.device-detail-page .detail-card:last-child {
    margin-bottom: 0;
}

.detail-content-block {
    display: grid;
    gap: 8px;
}

.detail-device-photo {
    width: 100%;
    aspect-ratio: 16 / 9;
    min-height: 260px;
    border-radius: 8px;
    border: 1px solid #d8e1ef;
    background: #f6f8fc;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.detail-device-photo .material-symbols-outlined {
    color: #6f7f99;
    font-size: 64px;
}

.detail-device-photo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 18px;
    display: block;
}

.detail-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    align-content: stretch;
}

.detail-meta-item {
    border: 1px solid #e3e9f3;
    border-radius: 8px;
    padding: 14px 16px;
    display: grid;
    gap: 8px;
    align-content: flex-start;
    justify-items: start;
    min-height: 112px;
    background: #ffffff;
}

.detail-technical-item {
    border-top: 1px solid #e5ebf5;
    padding-top: 8px;
    display: grid;
    gap: 4px;
}

.detail-meta-item strong {
    color: #101728;
    font-size: 1rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.detail-meta-item .status-pill {
    justify-self: start;
    max-width: 100%;
}

.detail-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #6f7b93;
    font-size: 0.68rem;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    font-weight: 800;
}

.detail-name {
    margin-top: 8px;
    color: #101728;
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.detail-technical-grid {
    margin-top: 12px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.detail-note-block {
    margin-top: 12px;
    border-top: 1px solid #e5ebf5;
    padding-top: 10px;
}

.detail-note-block p {
    margin: 8px 0 0;
    color: #39455d;
    font-size: 0.84rem;
    line-height: 1.48;
    font-style: italic;
}

.detail-owner-card {
    margin-top: 12px;
}

.owner-row {
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.owner-avatar {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: #2e415f;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
}

.owner-name {
    color: #0f233f;
    font-weight: 700;
    font-size: 0.95rem;
}

.owner-row p {
    margin: 3px 0 0;
    color: #68758e;
    font-size: 0.79rem;
}

.detail-history {
    margin-top: 0;
}

.detail-history-card {
    padding: 0;
    overflow-x: auto;
    border: 1px solid #d9e0ec;
    border-radius: 10px;
}

.detail-history-card table {
    width: max(100%, 860px);
    border-collapse: collapse;
    table-layout: fixed;
}

.detail-history-card th,
.detail-history-card td {
    border-bottom: 1px solid #e1e8f3;
    padding: 10px 12px;
    text-align: left;
    vertical-align: top;
}

.history-change-cell {
    min-width: 200px;
    color: #33415b;
    line-height: 1.45;
    white-space: normal;
    word-break: break-word;
}

.detail-history-card th {
    font-size: 0.67rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: #6f7d95;
    background: #f7f9fd;
}

.detail-history-card th:nth-child(1),
.detail-history-card td:nth-child(1) {
    width: 220px;
    min-width: 220px;
}

.detail-history-card th:nth-child(2),
.detail-history-card td:nth-child(2) {
    width: 220px;
    min-width: 220px;
}

.detail-history-card th:nth-child(1),
.detail-history-card td:nth-child(1),
.detail-history-card th:nth-child(2),
.detail-history-card td:nth-child(2) {
    white-space: nowrap;
}

.detail-history-card th,
.detail-history-card td {
    resize: horizontal;
    overflow: auto;
}

.detail-history-card td,
.detail-history-card th {
    padding: 14px 18px !important;
}

.device-form-card {
    padding: 28px !important;
}

.create-device-page .device-form-card {
    padding: 18px !important;
}

.detail-history-card tbody tr:last-child td {
    border-bottom: none;
}

@media (max-width: 900px) {
    .device-detail-overlay {
        padding: 12px;
    }

    .device-detail-panel {
        padding: 14px;
        border-radius: 14px;
    }

    .detail-hero-grid {
        grid-template-columns: 1fr;
    }

    .detail-device-photo {
        min-height: 180px;
    }

    .detail-meta-grid,
    .detail-technical-grid {
        grid-template-columns: 1fr;
    }

    .detail-history-card {
        overflow-x: auto;
    }

    .detail-history-card table {
        min-width: 620px;
    }
}

