:root {
    --navy-950: #071126;
    --navy-900: #0b1630;
    --navy-850: #101c36;
    --navy-800: #15213c;
    --red-700: #c60018;
    --red-600: #e5001a;
    --red-500: #f20b27;
    --red-100: #ffe7eb;
    --green-700: #087a49;
    --green-600: #0aa760;
    --green-500: #18bd70;
    --green-100: #ddf8e9;
    --orange-600: #ee8a08;
    --orange-500: #ff9e18;
    --orange-100: #fff0d5;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --page-bg: #f2f6fb;
    --line: #dfe6ef;
    --line-soft: #e9eef5;
    --text: #111a2e;
    --muted: #687489;
    --shadow: 0 10px 28px rgba(13, 28, 55, 0.08);
    --shadow-soft: 0 4px 16px rgba(13, 28, 55, 0.06);
    --radius: 13px;
    --header-height: 108px;
    --sidebar-width: 220px;
    font-family: "Segoe UI", Inter, Arial, Helvetica, sans-serif;
    color: var(--text);
    background: var(--page-bg);
    line-height: 1.45;
    font-synthesis: none;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    color: var(--text);
    background: var(--page-bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
summary,
a {
    -webkit-tap-highlight-color: transparent;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

.icon {
    width: 1.2em;
    height: 1.2em;
    flex: 0 0 auto;
}

/* Top header */
.app-header {
    position: relative;
    z-index: 30;
    height: var(--header-height);
    display: flex;
    align-items: center;
    overflow: visible;
    background: linear-gradient(112deg, #091329 0%, #0d1830 38%, #111a31 100%);
    box-shadow: 0 3px 12px rgba(2, 9, 24, 0.2);
}

.header-brand {
    position: relative;
    z-index: 4;
    display: flex;
    align-items: center;
    gap: 34px;
    width: 540px;
    height: 100%;
    padding: 8px 26px 7px 38px;
}

.header-logo {
    width: 188px;
    max-height: 92px;
    object-fit: contain;
}

.header-slogan {
    width: 150px;
    max-height: 77px;
    object-fit: contain;
}

.header-red-art {
    position: absolute;
    z-index: 1;
    inset: 0 0 0 34%;
    overflow: hidden;
    clip-path: polygon(12% 0, 100% 0, 100% 100%, 0 100%);
    background:
        linear-gradient(105deg, rgba(35, 0, 8, 0.55) 0 8%, transparent 8% 100%),
        repeating-linear-gradient(132deg,
            rgba(255, 255, 255, 0) 0 58px,
            rgba(255, 53, 73, 0.25) 58px 96px,
            rgba(255, 255, 255, 0) 96px 128px),
        linear-gradient(100deg, #41000e 0%, #9b0014 23%, #f0001e 55%, #8d0015 100%);
}

.header-red-art::before {
    content: "";
    position: absolute;
    left: 5%;
    top: 10px;
    width: 150px;
    height: 62px;
    opacity: 0.35;
    background-image: radial-gradient(circle, rgba(255, 81, 99, 0.75) 1.2px, transparent 1.5px);
    background-size: 9px 9px;
    mask-image: linear-gradient(90deg, transparent, #000, transparent);
}

.header-red-art::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(6, 15, 33, 0.35), transparent 22%, transparent 78%, rgba(6, 15, 33, 0.48));
}

.header-actions {
    position: relative;
    z-index: 5;
    margin-left: auto;
    padding-right: 34px;
    display: flex;
    align-items: center;
    gap: 22px;
    color: #fff;
}

.notification-button {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    color: #fff;
    opacity: 0.97;
}

.notification-button .icon {
    width: 24px;
    height: 24px;
}

.admin-menu {
    position: relative;
}

.admin-menu summary {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 175px;
    height: 45px;
    padding: 4px 13px 4px 6px;
    border: 1px solid rgba(255, 255, 255, 0.32);
    border-radius: 24px;
    background: rgba(10, 20, 43, 0.58);
    color: #fff;
    cursor: pointer;
    user-select: none;
}

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

.admin-avatar {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
}

.admin-avatar .icon {
    width: 21px;
    height: 21px;
}

.admin-label {
    flex: 1;
    font-size: 14px;
    white-space: nowrap;
}

.admin-chevron {
    width: 15px;
    height: 15px;
    transition: transform 0.2s ease;
}

.admin-menu[open] .admin-chevron {
    transform: rotate(180deg);
}

.admin-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 218px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    color: var(--text);
    box-shadow: 0 18px 45px rgba(4, 13, 31, 0.24);
}

.admin-dropdown::before {
    content: "";
    position: absolute;
    right: 22px;
    top: -6px;
    width: 11px;
    height: 11px;
    transform: rotate(45deg);
    border-left: 1px solid var(--line);
    border-top: 1px solid var(--line);
    background: #fff;
}

.admin-name {
    padding: 9px 11px 10px;
    color: var(--muted);
    font-size: 12px;
    border-bottom: 1px solid var(--line-soft);
    margin-bottom: 5px;
}

.admin-dropdown a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 11px;
    border-radius: 8px;
    color: #28344b;
    font-size: 13px;
}

.admin-dropdown a:hover {
    background: #f3f6fa;
    color: var(--red-600);
}

.mobile-menu-button {
    display: none;
    position: relative;
    z-index: 6;
    margin-left: 16px;
    width: 42px;
    height: 42px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    cursor: pointer;
}

/* Main shell and sidebar */
.app-layout {
    min-height: calc(100vh - var(--header-height));
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.app-sidebar {
    position: relative;
    z-index: 20;
    min-height: calc(100vh - var(--header-height));
    overflow: hidden;
    background:
        radial-gradient(circle at 4% 52%, rgba(242, 11, 39, 0.16), transparent 20%),
        linear-gradient(180deg, #101c36 0%, #0a142a 100%);
    color: #fff;
    box-shadow: 4px 0 18px rgba(9, 20, 42, 0.08);
}

.side-nav {
    position: relative;
    z-index: 3;
    padding: 24px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.side-nav-link {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 50px;
    padding: 0 16px;
    border-radius: 11px;
    color: rgba(255, 255, 255, 0.94);
    font-size: 15px;
    font-weight: 500;
    transition: background 0.18s ease, transform 0.18s ease, color 0.18s ease;
}

.side-nav-link .icon {
    width: 25px;
    height: 25px;
    stroke-width: 2.2;
}

.side-nav-link:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(2px);
}

.side-nav-link.is-active {
    background: linear-gradient(90deg, #ff1530, #d90019);
    box-shadow: 0 8px 18px rgba(221, 0, 26, 0.32), inset 0 0 0 1px rgba(255, 255, 255, 0.13);
    color: #fff;
    font-weight: 700;
}

.sidebar-decoration {
    position: absolute;
    inset: auto 0 0;
    height: 54%;
    pointer-events: none;
}

.sidebar-globe {
    position: absolute;
    width: 290px;
    max-width: none;
    left: -68px;
    bottom: 76px;
    opacity: 0.9;
}

.sidebar-logo {
    position: absolute;
    left: 25px;
    bottom: 16px;
    width: 170px;
    max-height: 92px;
    object-fit: contain;
}

.sidebar-overlay {
    display: none;
}

.app-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(circle at 18% 3%, rgba(206, 221, 241, 0.32), transparent 30%),
        linear-gradient(180deg, #f5f8fc 0%, #f1f5fa 100%);
}

.content-wrap {
    width: 100%;
    max-width: 1510px;
    margin: 0 auto;
    padding: 23px 25px 12px;
    flex: 1;
}

.app-footer {
    min-height: 76px;
    padding: 12px 27px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    color: #7b8799;
    font-size: 12px;
}

.app-footer img {
    width: 150px;
    max-height: 56px;
    object-fit: contain;
}

/* Dashboard heading */
.dashboard-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    margin-bottom: 15px;
}

.dashboard-heading h1 {
    margin: 0 0 2px;
    color: #11182b;
    font-size: clamp(25px, 2.1vw, 34px);
    line-height: 1.12;
    letter-spacing: -0.03em;
}

.dashboard-heading p {
    margin: 4px 0 0;
    color: #616d81;
    font-size: 15px;
}

.date-card {
    flex: 0 0 auto;
    min-width: 235px;
    min-height: 56px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 14px;
    border: 1px solid #dce4ee;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.78);
    box-shadow: var(--shadow-soft);
}

.date-icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #f7f9fc;
    color: #11182b;
}

.date-icon .icon {
    width: 24px;
    height: 24px;
}

.current-date {
    display: block;
    color: #424e62;
    font-size: 11px;
}

.current-time {
    display: block;
    margin-top: 2px;
    color: #172034;
    font-size: 16px;
    line-height: 1;
}

/* Alerts */
.alert {
    margin: 0 0 15px;
    padding: 12px 15px;
    border: 1px solid;
    border-radius: 10px;
    font-size: 13px;
    box-shadow: var(--shadow-soft);
}

.alert.success {
    color: #08623c;
    border-color: #9fdfbd;
    background: #e7f8ef;
}

.alert.error {
    color: #991b2d;
    border-color: #f1abb6;
    background: #fff0f2;
}

.alert.warning {
    color: #785407;
    border-color: #efd08b;
    background: #fff8e6;
}

/* Statistics */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.stat-card {
    position: relative;
    isolation: isolate;
    min-height: 106px;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 17px 18px;
    border: 1px solid #e1e7ef;
    border-radius: 12px;
    background: #fff;
    box-shadow: var(--shadow-soft);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(13, 28, 55, 0.1);
}

.stat-card::after {
    content: "";
    position: absolute;
    z-index: -1;
    left: -8%;
    right: -8%;
    bottom: -48px;
    height: 80px;
    border-radius: 50% 48% 0 0;
    transform: rotate(-2deg);
    opacity: 0.86;
}

.stat-icon {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    flex: 0 0 auto;
    border-radius: 14px;
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24), 0 7px 14px rgba(11, 24, 48, 0.12);
}

.stat-icon .icon {
    width: 35px;
    height: 35px;
}

.stat-content {
    min-width: 0;
    display: block;
}

.stat-content > span {
    display: block;
    color: #20293c;
    font-size: 14px;
    font-weight: 650;
    white-space: nowrap;
}

.stat-content strong {
    display: block;
    margin-top: 1px;
    color: #10182a;
    font-size: 31px;
    line-height: 1.05;
}

.stat-total .stat-icon,
.stat-inactive .stat-icon {
    background: linear-gradient(145deg, #ff1732, #cd0017);
}

.stat-active .stat-icon {
    background: linear-gradient(145deg, #22c77a, #079554);
}

.stat-pending .stat-icon {
    background: linear-gradient(145deg, #ffad29, #f17d00);
}

.stat-total::after,
.stat-inactive::after {
    background: linear-gradient(90deg, #fff, #ffd9df 55%, #ffe9ec);
}

.stat-active::after {
    background: linear-gradient(90deg, #fff, #d9f6e8 55%, #ecfbf4);
}

.stat-pending::after {
    background: linear-gradient(90deg, #fff, #ffe7c2 55%, #fff3df);
}

/* Cards */
.panel-card {
    overflow: hidden;
    margin-bottom: 16px;
    border: 1px solid #e0e7ef;
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow);
}

.card-title-bar {
    min-height: 50px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 18px;
    border-bottom: 1px solid #f1dce0;
}

.card-title-red {
    background: linear-gradient(90deg, #fff 0%, #fff7f8 52%, #fff1f3 100%);
}

.card-title-icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    border-radius: 7px;
    color: #fff;
    background: linear-gradient(145deg, #ff1631, #d40019);
    box-shadow: 0 5px 12px rgba(226, 0, 27, 0.22);
}

.card-title-icon .icon {
    width: 21px;
    height: 21px;
}

.card-title-bar h2,
.card-title-inline h2 {
    margin: 0;
    color: #151d30;
    font-size: 19px;
    letter-spacing: -0.015em;
}

/* Add box form */
.add-device-form {
    display: grid;
    grid-template-columns: minmax(250px, 1.1fr) minmax(280px, 1.25fr) minmax(230px, 0.95fr);
    gap: 12px 16px;
    align-items: end;
    padding: 14px 18px 17px;
}

.form-field {
    min-width: 0;
}

.form-field label {
    display: block;
    margin-bottom: 6px;
    color: #273146;
    font-size: 12px;
    font-weight: 700;
}

.form-field label span {
    color: #6d7890;
    font-weight: 500;
}

.field-note {
    grid-column: 1 / 3;
}

input,
select,
textarea {
    width: 100%;
    min-height: 43px;
    border: 1px solid #d4dce7;
    border-radius: 7px;
    outline: none;
    background: #fff;
    color: #1b2539;
    font-size: 13px;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

input,
select {
    padding: 9px 12px;
}

textarea {
    padding: 10px 12px;
    resize: vertical;
}

input::placeholder,
textarea::placeholder {
    color: #9ba5b5;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #ed5367;
    box-shadow: 0 0 0 3px rgba(231, 0, 28, 0.1);
}

.single-line-textarea {
    min-height: 43px;
    max-height: 130px;
    padding-right: 48px;
    overflow-y: auto;
    resize: none;
    line-height: 21px;
}

.field-hint {
    display: block;
    height: 0;
    overflow: hidden;
    color: #7d889a;
    font-size: 10px;
}

.input-with-icon,
.status-select-wrap {
    position: relative;
}

.input-with-icon .input-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    color: #8994a6;
    pointer-events: none;
}

.input-with-icon .input-icon .icon {
    width: 18px;
    height: 18px;
}

.input-icon-left .input-icon {
    left: 12px;
}

.input-icon-left input {
    padding-left: 41px;
}

.input-icon-right .input-icon {
    right: 12px;
}

.status-select-wrap .status-dot {
    position: absolute;
    z-index: 2;
    top: 50%;
    left: 13px;
    transform: translateY(-50%);
}

.status-select-wrap select {
    padding-left: 40px;
    appearance: auto;
}

.button {
    min-height: 43px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    border: 1px solid transparent;
    border-radius: 7px;
    padding: 9px 17px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 750;
    transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
}

.button:hover {
    filter: brightness(1.03);
    transform: translateY(-1px);
}

.button:active {
    transform: translateY(0);
}

.button-primary {
    color: #fff;
    background: linear-gradient(90deg, #f20b27, #dd001b);
    box-shadow: 0 7px 15px rgba(221, 0, 27, 0.2);
}

.button-secondary {
    color: #273247;
    border-color: #d4dce7;
    background: #fff;
}

.button-danger {
    color: #fff;
    background: linear-gradient(90deg, #e30b26, #b90017);
}

.add-box-button {
    grid-column: 3;
    align-self: end;
    width: 100%;
}

/* Device list */
.devices-card-head {
    min-height: 55px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 9px 18px;
    border-bottom: 1px solid var(--line-soft);
}

.card-title-inline {
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-form {
    position: relative;
    width: min(310px, 42%);
}

.search-form input {
    min-height: 37px;
    padding-left: 39px;
    border-radius: 7px;
    font-size: 12px;
}

.search-icon {
    position: absolute;
    z-index: 2;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    color: #667387;
    pointer-events: none;
}

.search-icon .icon {
    width: 17px;
    height: 17px;
}

.active-filter-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 9px 18px;
    border-bottom: 1px solid var(--line-soft);
    background: #fbfcfe;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    min-height: 27px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #edf2f8;
    color: #475469;
    font-size: 11px;
    font-weight: 650;
}

.clear-filter {
    margin-left: auto;
    color: var(--red-600);
    font-size: 11px;
    font-weight: 700;
}

.table-wrap {
    overflow-x: auto;
    padding: 0 18px;
}

.device-table {
    width: 100%;
    min-width: 870px;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
}

.device-table thead th {
    height: 37px;
    padding: 8px 15px;
    border: 0;
    background: linear-gradient(180deg, #101a33, #0a142a);
    color: #fff;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
}

.device-table thead th:first-child {
    border-radius: 7px 0 0 0;
    width: 18%;
}

.device-table thead th:nth-child(2) {
    width: 14%;
}

.device-table thead th:nth-child(3) {
    width: 20%;
}

.device-table thead th:nth-child(4) {
    width: 25%;
}

.device-table thead th:last-child {
    border-radius: 0 7px 0 0;
    width: 23%;
}

.device-table tbody td {
    min-height: 42px;
    padding: 8px 15px;
    border-bottom: 1px solid #e4e9f0;
    color: #2b3548;
    background: #fff;
    vertical-align: middle;
    font-size: 12px;
    overflow-wrap: anywhere;
}

.device-table tbody tr:hover td {
    background: #fbfcfe;
}

.mac-link {
    color: #202a3e;
    font-weight: 600;
}

.mac-link:hover {
    color: var(--red-600);
    text-decoration: underline;
}

.online-indicator {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-left: 6px;
    border-radius: 50%;
    background: var(--green-500);
    box-shadow: 0 0 0 3px rgba(24, 189, 112, 0.12);
    vertical-align: middle;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-width: 86px;
    min-height: 27px;
    justify-content: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 750;
}

.status-pill.active {
    color: #087447;
    background: var(--green-100);
}

.status-pill.inactive {
    color: #c00720;
    background: #ffe4e8;
}

.status-pill.pending {
    color: #c36b00;
    background: var(--orange-100);
}

.status-dot {
    width: 10px;
    height: 10px;
    display: inline-block;
    flex: 0 0 auto;
    border-radius: 50%;
}

.status-dot.active {
    background: var(--green-500);
    box-shadow: 0 0 0 2px rgba(24, 189, 112, 0.12);
}

.status-dot.inactive {
    background: var(--red-500);
    box-shadow: 0 0 0 2px rgba(242, 11, 39, 0.12);
}

.status-dot.pending {
    background: var(--orange-500);
    box-shadow: 0 0 0 2px rgba(255, 158, 24, 0.15);
}

.note-cell {
    color: #536077;
}

.row-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.row-actions form {
    margin: 0;
    flex: 1;
}

.action-button {
    width: 100%;
    min-width: 94px;
    min-height: 29px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 4px 9px;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    font-size: 11px;
    font-weight: 750;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.action-button .icon {
    width: 13px;
    height: 13px;
}

.action-activate {
    color: #07804c;
    border: 1px solid #9bd1b8;
}

.action-activate:hover:not(:disabled) {
    color: #fff;
    background: #099b5a;
    transform: translateY(-1px);
}

.action-deactivate {
    color: #d10723;
    border: 1px solid #f08b99;
}

.action-deactivate:hover:not(:disabled) {
    color: #fff;
    background: #e20a27;
    transform: translateY(-1px);
}

.action-button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
    background: #f6f8fa;
}

.empty-state {
    padding: 35px 15px !important;
    text-align: center;
    color: #778399 !important;
}

.empty-state .icon {
    display: block;
    width: 36px;
    height: 36px;
    margin: 0 auto 9px;
}

.empty-state strong,
.empty-state span {
    display: block;
}

.empty-state strong {
    color: #3d485d;
    margin-bottom: 3px;
}

.table-footer {
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 18px 15px;
    color: #788398;
    font-size: 11px;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 7px;
}

.page-button {
    min-width: 31px;
    height: 31px;
    display: grid;
    place-items: center;
    padding: 0 8px;
    border: 1px solid #dbe2eb;
    border-radius: 6px;
    background: #fff;
    color: #445066;
    font-size: 12px;
    font-weight: 650;
}

.page-button:hover:not(.current):not(.disabled) {
    border-color: #ee9aa6;
    color: var(--red-600);
}

.page-button.current {
    border-color: var(--red-600);
    background: linear-gradient(180deg, #f51a34, #dc001b);
    color: #fff;
    box-shadow: 0 4px 10px rgba(220, 0, 27, 0.2);
}

.page-button.disabled {
    opacity: 0.42;
}

.page-arrow {
    font-size: 20px;
    line-height: 1;
}

/* Secondary pages */
.page-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 16px;
}

.page-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-title-group h1 {
    margin: 0;
    font-size: 28px;
    letter-spacing: -0.025em;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #6d788b;
    font-size: 12px;
    font-weight: 650;
}

.back-link:hover {
    color: var(--red-600);
}

.form-card {
    padding: 20px;
}

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

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

.form-card label,
.settings-card label,
.delete-card label {
    display: block;
    margin-bottom: 6px;
    color: #273146;
    font-size: 12px;
    font-weight: 700;
}

.form-card textarea {
    min-height: 120px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 13px;
    padding: 18px;
}

.detail-box {
    min-height: 82px;
    padding: 14px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #f9fbfd;
}

.detail-box span {
    display: block;
    color: #7b8798;
    font-size: 11px;
}

.detail-box strong {
    display: block;
    margin-top: 6px;
    color: #263147;
    font-size: 13px;
    overflow-wrap: anywhere;
}

.danger-card {
    padding: 18px;
    border-color: #f1b7bf;
    background: #fffafa;
}

.danger-card h2 {
    margin: 0 0 5px;
    color: #a31225;
    font-size: 17px;
}

.danger-card p {
    margin: 0 0 13px;
    color: #7d4a52;
    font-size: 12px;
}

.settings-wrap,
.delete-wrap {
    max-width: 680px;
    margin: 20px auto;
}

.settings-card,
.delete-card {
    padding: 24px;
}

.settings-card h1,
.delete-card h1 {
    margin: 0 0 6px;
    font-size: 25px;
}

.settings-card p,
.delete-card p {
    color: #707c90;
    font-size: 13px;
}

.settings-card .form-field,
.delete-card .form-field {
    margin-top: 14px;
}

.full-width {
    width: 100%;
    margin-top: 18px;
}

/* Login */
.login-page {
    min-height: 100vh;
    overflow-x: hidden;
    background: #f4f7fb;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(480px, 1.15fr) minmax(430px, 0.85fr);
}

.login-brand-panel {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
    color: #fff;
    background:
        radial-gradient(circle at 25% 80%, rgba(238, 0, 28, 0.28), transparent 28%),
        linear-gradient(135deg, #071126 0%, #101c37 58%, #35000b 100%);
}

.login-brand-panel::before {
    content: "";
    position: absolute;
    inset: 0 0 52% 36%;
    opacity: 0.9;
    clip-path: polygon(22% 0, 100% 0, 100% 100%, 0 100%);
    background:
        repeating-linear-gradient(132deg, transparent 0 56px, rgba(255, 87, 103, 0.22) 56px 94px, transparent 94px 126px),
        linear-gradient(105deg, #760012, #f0001f 55%, #800013);
}

.login-brand-panel::after {
    content: "";
    position: absolute;
    width: 620px;
    height: 620px;
    left: -160px;
    bottom: -185px;
    background: url('/assets/sidebar-globe.svg') center / contain no-repeat;
    opacity: 0.75;
}

.login-brand-content {
    position: relative;
    z-index: 2;
    width: min(650px, 92%);
    text-align: center;
}

.login-main-logo {
    width: min(500px, 88%);
    margin: 0 auto 14px;
}

.login-main-slogan {
    width: 250px;
    margin: 0 auto 30px;
}

.login-brand-content h1 {
    margin: 0 0 7px;
    font-size: clamp(28px, 3.1vw, 44px);
    line-height: 1.12;
}

.login-brand-content p {
    margin: 0 auto;
    max-width: 520px;
    color: rgba(255, 255, 255, 0.76);
    font-size: 15px;
}

.login-form-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 35px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(247, 249, 252, 0.98)),
        url('/assets/nvision-logo-original.svg') center / cover no-repeat;
}

.login-card {
    width: min(440px, 100%);
    padding: 34px;
    border: 1px solid #e0e6ee;
    border-radius: 17px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 24px 60px rgba(14, 28, 53, 0.17);
}

.login-card-mark {
    width: 180px;
    margin: 0 auto 20px;
}

.login-card h2 {
    margin: 0;
    text-align: center;
    font-size: 25px;
}

.login-card > p {
    margin: 7px 0 22px;
    text-align: center;
    color: #768195;
    font-size: 13px;
}

.login-card .form-field {
    margin-top: 14px;
}

.login-card-footer {
    margin-top: 24px;
    color: #929cad;
    text-align: center;
    font-size: 10px;
}

/* Focus visibility */
a:focus-visible,
button:focus-visible,
summary:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid rgba(237, 42, 70, 0.25);
    outline-offset: 2px;
}

/* Responsive */
@media (max-width: 1180px) {
    :root {
        --sidebar-width: 205px;
    }

    .header-brand {
        width: 465px;
        gap: 22px;
        padding-left: 24px;
    }

    .header-logo {
        width: 170px;
    }

    .header-slogan {
        width: 125px;
    }

    .header-red-art {
        left: 31%;
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .add-device-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .field-note {
        grid-column: 1 / 2;
    }

    .field-status {
        grid-column: 2;
        grid-row: 2;
    }

    .add-box-button {
        grid-column: 2;
        grid-row: 3;
    }
}

@media (max-width: 920px) {
    :root {
        --header-height: 82px;
    }

    .app-header {
        overflow: hidden;
    }

    .mobile-menu-button {
        display: grid;
        place-items: center;
    }

    .header-brand {
        width: auto;
        padding: 4px 12px;
        gap: 14px;
    }

    .header-logo {
        width: 145px;
        max-height: 70px;
    }

    .header-slogan {
        width: 105px;
        max-height: 62px;
    }

    .header-red-art {
        inset: 0 0 0 47%;
    }

    .header-actions {
        padding-right: 15px;
        gap: 8px;
    }

    .notification-button {
        display: none;
    }

    .admin-menu summary {
        min-width: 45px;
        width: 45px;
        padding: 4px;
    }

    .admin-label,
    .admin-chevron {
        display: none;
    }

    .app-layout {
        grid-template-columns: 1fr;
    }

    .app-sidebar {
        position: fixed;
        z-index: 60;
        top: var(--header-height);
        bottom: 0;
        left: 0;
        width: 235px;
        min-height: 0;
        transform: translateX(-102%);
        transition: transform 0.23s ease;
        box-shadow: 12px 0 35px rgba(4, 12, 28, 0.28);
    }

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

    .sidebar-overlay {
        position: fixed;
        z-index: 55;
        inset: var(--header-height) 0 0;
        display: block;
        background: rgba(3, 10, 24, 0.48);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
    }

    body.sidebar-open .sidebar-overlay {
        opacity: 1;
        pointer-events: auto;
    }

    .content-wrap {
        padding: 20px 18px 10px;
    }

    .login-shell {
        grid-template-columns: 1fr;
    }

    .login-brand-panel {
        min-height: 330px;
        padding: 35px 25px;
    }

    .login-form-panel {
        min-height: 590px;
    }
}

@media (max-width: 690px) {
    .header-slogan {
        display: none;
    }

    .header-logo {
        width: 138px;
    }

    .header-red-art {
        left: 43%;
    }

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

    .date-card {
        width: 100%;
        min-width: 0;
    }

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

    .stat-card {
        min-height: 92px;
    }

    .add-device-form {
        grid-template-columns: 1fr;
    }

    .field-note,
    .field-status,
    .add-box-button {
        grid-column: 1;
        grid-row: auto;
    }

    .devices-card-head {
        align-items: stretch;
        flex-direction: column;
    }

    .search-form {
        width: 100%;
    }

    .table-wrap {
        padding: 0 12px;
        overflow: visible;
    }

    .device-table,
    .device-table tbody,
    .device-table tr,
    .device-table td {
        display: block;
        width: 100%;
        min-width: 0;
    }

    .device-table thead {
        display: none;
    }

    .device-table tbody tr {
        margin: 12px 0;
        overflow: hidden;
        border: 1px solid #dfe5ed;
        border-radius: 10px;
        box-shadow: var(--shadow-soft);
    }

    .device-table tbody td {
        position: relative;
        min-height: 44px;
        padding: 12px 12px 12px 42%;
        border-bottom: 1px solid #edf1f5;
    }

    .device-table tbody td::before {
        content: attr(data-label);
        position: absolute;
        left: 12px;
        top: 12px;
        width: 36%;
        color: #758196;
        font-size: 10px;
        font-weight: 750;
        text-transform: uppercase;
    }

    .device-table tbody td:last-child {
        border-bottom: 0;
    }

    .row-actions {
        flex-direction: column;
    }

    .row-actions form,
    .action-button {
        width: 100%;
    }

    .empty-state {
        padding-left: 15px !important;
    }

    .empty-state::before {
        display: none;
    }

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

    .details-grid,
    .form-grid {
        grid-template-columns: 1fr;
    }

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

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

    .login-brand-panel {
        min-height: 280px;
    }

    .login-brand-content h1 {
        font-size: 27px;
    }

    .login-main-logo {
        width: 330px;
    }

    .login-main-slogan {
        width: 190px;
    }

    .login-form-panel {
        min-height: 540px;
        padding: 24px 16px;
    }

    .login-card {
        padding: 27px 22px;
    }
}
