:root {
    --bg-dark: #030711;
    --bg-deep: #060b16;
    --bg-panel: rgba(18, 28, 45, 0.88);
    --bg-panel-light: rgba(28, 42, 66, 0.88);
    --chrome: #dce3ee;
    --chrome-soft: #aeb8c8;
    --blue: #1268b7;
    --blue-bright: #27a8ff;
    --blue-glow: rgba(39, 168, 255, 0.42);
    --red: #d51f2a;
    --red-glow: rgba(213, 31, 42, 0.35);
    --green: #39b54a;
    --text: #eef3fb;
    --muted: #a9b6c8;
    --border: rgba(255, 255, 255, 0.13);
    --shadow: rgba(0, 0, 0, 0.48);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--text);
    min-height: 100vh;
    background:
        radial-gradient(circle at top center, rgba(39, 168, 255, 0.22), transparent 32%),
        radial-gradient(circle at bottom center, rgba(213, 31, 42, 0.12), transparent 34%),
        linear-gradient(135deg, #02050c 0%, #071120 48%, #02050c 100%);
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(90deg, rgba(39, 168, 255, 0.05) 1px, transparent 1px),
        linear-gradient(rgba(39, 168, 255, 0.035) 1px, transparent 1px);
    background-size: 54px 54px;
    opacity: 0.18;
    mask-image: radial-gradient(circle at top, black 0%, transparent 72%);
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 12% 26%, rgba(39, 168, 255, 0.18), transparent 18%),
        radial-gradient(circle at 86% 20%, rgba(213, 31, 42, 0.14), transparent 18%),
        linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.25) 100%);
    opacity: 0.9;
}

a {
    color: inherit;
}

/* LOGIN */

.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
}

.login-shell {
    width: 100%;
    max-width: 620px;
    position: relative;
    z-index: 1;
}

.login-card {
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.025)),
        var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 34px;
    box-shadow:
        0 0 48px rgba(39, 168, 255, 0.18),
        0 0 22px rgba(213, 31, 42, 0.10),
        0 28px 65px var(--shadow);
    backdrop-filter: blur(8px);
    overflow: hidden;
    position: relative;
}

.login-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 8%;
    right: 8%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.75), transparent);
}

.login-logo-wrap {
    display: flex;
    justify-content: center;
    margin: -8px auto 4px;
}

.login-logo {
    width: min(100%, 520px);
    max-height: 260px;
    object-fit: contain;
    filter:
        drop-shadow(0 0 20px rgba(39, 168, 255, 0.28))
        drop-shadow(0 0 14px rgba(213, 31, 42, 0.14));
}

.tagline {
    color: var(--chrome-soft);
    margin: 2px 0 28px;
    text-align: center;
    font-size: 15px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

label {
    display: block;
    margin-top: 18px;
    margin-bottom: 7px;
    color: var(--chrome);
    font-weight: 700;
    font-size: 14px;
}

input,
select,
textarea {
    width: 100%;
    background: rgba(3, 8, 18, 0.86);
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 12px;
    padding: 13px 14px;
    font-size: 15px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--blue-bright);
    box-shadow:
        0 0 0 3px rgba(39, 168, 255, 0.18),
        inset 0 1px 0 rgba(255,255,255,0.07);
}

.btn-primary,
.action-button {
    display: inline-block;
    margin-top: 24px;
    width: 100%;
    text-align: center;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.18), transparent 45%),
        linear-gradient(135deg, #1268b7, #27a8ff);
    color: white;
    border: 1px solid rgba(179, 229, 255, 0.36);
    border-radius: 12px;
    padding: 13px 18px;
    font-weight: 900;
    font-size: 15px;
    text-decoration: none;
    cursor: pointer;
    box-shadow:
        0 0 22px rgba(39, 168, 255, 0.26),
        inset 0 1px 0 rgba(255,255,255,0.28);
    text-shadow: 0 1px 2px rgba(0,0,0,0.45);
}

.btn-primary:hover,
.action-button:hover {
    filter: brightness(1.08);
    box-shadow:
        0 0 30px rgba(39, 168, 255, 0.36),
        inset 0 1px 0 rgba(255,255,255,0.32);
}

.alert {
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 16px;
}

.alert-error {
    background: rgba(213, 31, 42, 0.15);
    border: 1px solid rgba(213, 31, 42, 0.45);
    color: #ffd9dc;
}

/* TOP BAR */

.topbar {
    min-height: 98px;
    padding: 10px 26px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.045), transparent),
        rgba(2, 6, 15, 0.94);
    border-bottom: 1px solid rgba(255,255,255,0.10);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow:
        0 10px 28px rgba(0,0,0,0.45),
        0 0 24px rgba(39, 168, 255, 0.08);
    position: relative;
    z-index: 2;
}

.topbar::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(39,168,255,0.45), rgba(213,31,42,0.32), transparent);
}

.brand-logo-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.brand-logo {
    height: 70px;
    width: auto;
    max-width: 360px;
    object-fit: contain;
    filter:
        drop-shadow(0 0 14px rgba(39, 168, 255, 0.38))
        drop-shadow(0 0 7px rgba(213, 31, 42, 0.18));
}

.nav {
    display: flex;
    gap: 20px;
    align-items: center;
}

.nav a {
    color: var(--chrome);
    text-decoration: none;
    font-weight: 800;
    font-size: 14px;
    opacity: 0.9;
    position: relative;
}

.nav a::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -8px;
    height: 2px;
    background: var(--blue-bright);
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.16s ease;
    box-shadow: 0 0 10px var(--blue-glow);
}

.nav a:hover {
    color: white;
    opacity: 1;
}

.nav a:hover::after {
    transform: scaleX(1);
}

/* PAGE */

.page {
    padding: 34px;
    max-width: 1220px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.page-header {
    margin-bottom: 26px;
}

.page-header h1 {
    margin: 0;
    font-size: 36px;
    color: var(--chrome);
    text-shadow:
        0 1px 0 rgba(255,255,255,0.45),
        0 0 18px rgba(39,168,255,0.12);
}

.page-header p {
    color: var(--muted);
    font-size: 16px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}

.stat-card,
.panel {
    background:
        linear-gradient(145deg, rgba(255,255,255,0.08), rgba(255,255,255,0.025)),
        var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 17px;
    padding: 24px;
    box-shadow:
        0 0 30px rgba(39, 168, 255, 0.10),
        0 18px 44px rgba(0,0,0,0.28),
        inset 0 1px 0 rgba(255,255,255,0.07);
    backdrop-filter: blur(6px);
}

.stat-card {
    min-height: 125px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-card.warning {
    box-shadow:
        0 0 30px rgba(213, 31, 42, 0.18),
        0 18px 44px rgba(0,0,0,0.28),
        inset 0 1px 0 rgba(255,255,255,0.07);
}

.stat-number {
    font-size: 44px;
    font-weight: 900;
    color: var(--blue-bright);
    text-shadow: 0 0 14px rgba(39,168,255,0.32);
}

.warning .stat-number {
    color: #ff4c59;
    text-shadow: 0 0 14px rgba(213,31,42,0.32);
}

.stat-label {
    color: var(--chrome);
    font-weight: 800;
    margin-top: 6px;
}

.panel h2 {
    margin-top: 0;
    color: var(--chrome);
    font-size: 24px;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.quick-actions .action-button {
    margin-top: 0;
}

/* RESPONSIVE */

@media (max-width: 900px) {
    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
    }

    .nav {
        flex-wrap: wrap;
        gap: 14px;
    }

    .dashboard-grid,
    .quick-actions {
        grid-template-columns: 1fr;
    }

    .page {
        padding: 24px;
    }

    .brand-logo {
        height: 60px;
        max-width: 300px;
    }
}

@media (max-width: 560px) {
    .login-card {
        padding: 24px;
    }

    .tagline {
        font-size: 12px;
        letter-spacing: 0.08em;
    }

    .brand-logo {
        height: 46px;
    }
}

.stat-link {
    text-decoration: none;
    color: var(--text);
    transition:
        transform 0.16s ease,
        border-color 0.16s ease,
        box-shadow 0.16s ease,
        background 0.16s ease;
    cursor: pointer;
}

.stat-link:hover {
    transform: translateY(-3px);
    border-color: rgba(39, 168, 255, 0.45);
    box-shadow:
        0 0 34px rgba(39, 168, 255, 0.20),
        0 20px 48px rgba(0,0,0,0.34),
        inset 0 1px 0 rgba(255,255,255,0.09);
}

.stat-link.warning:hover {
    border-color: rgba(213, 31, 42, 0.55);
    box-shadow:
        0 0 36px rgba(213, 31, 42, 0.24),
        0 20px 48px rgba(0,0,0,0.34),
        inset 0 1px 0 rgba(255,255,255,0.09);
}

.stat-hint {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    margin-top: 8px;
}

/* MODULE PAGES */

.page-header-row {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: center;
}

.button-small,
.button-secondary {
    display: inline-block;
    text-align: center;
    border-radius: 12px;
    padding: 12px 18px;
    font-weight: 900;
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
}

.button-small {
    background:
        linear-gradient(180deg, rgba(255,255,255,0.18), transparent 45%),
        linear-gradient(135deg, #1268b7, #27a8ff);
    color: white;
    border: 1px solid rgba(179, 229, 255, 0.36);
    box-shadow:
        0 0 22px rgba(39, 168, 255, 0.24),
        inset 0 1px 0 rgba(255,255,255,0.28);
}

.button-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--chrome);
    border: 1px solid var(--border);
}

.button-small:hover,
.button-secondary:hover {
    filter: brightness(1.08);
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    color: var(--text);
}

.data-table th,
.data-table td {
    padding: 14px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.09);
    text-align: left;
    vertical-align: middle;
}

.data-table th {
    color: var(--chrome);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: rgba(255,255,255,0.035);
}

.data-table tr:hover td {
    background: rgba(39, 168, 255, 0.045);
}

.muted-row {
    opacity: 0.55;
}

.actions-col {
    min-width: 170px;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.actions a {
    color: var(--blue-bright);
    text-decoration: none;
    font-weight: 800;
    font-size: 13px;
}

.actions a:hover {
    color: white;
}

.pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 5px 9px;
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
}

.pill-blue {
    background: rgba(39, 168, 255, 0.13);
    border: 1px solid rgba(39, 168, 255, 0.35);
    color: #bfe9ff;
}

.pill-green {
    background: rgba(57, 181, 74, 0.13);
    border: 1px solid rgba(57, 181, 74, 0.38);
    color: #c9ffd1;
}

.pill-red {
    background: rgba(213, 31, 42, 0.15);
    border: 1px solid rgba(213, 31, 42, 0.42);
    color: #ffd0d4;
}

.form-panel {
    max-width: 900px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 22px;
}

.checkbox-block {
    display: flex;
    align-items: center;
    padding-top: 31px;
}

.checkbox-block label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.checkbox-block input[type="checkbox"] {
    width: auto;
}

.field-help {
    margin: 7px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.form-actions {
    margin-top: 26px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.alert-success {
    background: rgba(57, 181, 74, 0.14);
    border: 1px solid rgba(57, 181, 74, 0.42);
    color: #d5ffdc;
}

@media (max-width: 760px) {
    .page-header-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .checkbox-block {
        padding-top: 0;
    }
}

/* ITEMS */

.item-table-cell {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 220px;
}

.item-thumb {
    width: 58px;
    height: 42px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.06);
    box-shadow: 0 0 12px rgba(39,168,255,0.12);
}

.item-thumb-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
}

.current-image-wrap {
    margin-bottom: 22px;
}

.current-item-image {
    max-width: 360px;
    width: 100%;
    border-radius: 14px;
    border: 1px solid var(--border);
    box-shadow:
        0 0 30px rgba(39,168,255,0.16),
        0 20px 45px rgba(0,0,0,0.32);
}

.item-detail-grid {
    display: grid;
    grid-template-columns: minmax(280px, 420px) 1fr;
    gap: 22px;
    margin-bottom: 28px;
}

.item-detail-image {
    width: 100%;
    max-height: 420px;
    object-fit: contain;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: rgba(0,0,0,0.24);
    box-shadow:
        0 0 32px rgba(39,168,255,0.16),
        inset 0 1px 0 rgba(255,255,255,0.06);
}

.item-detail-image-empty {
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-weight: 900;
    text-transform: uppercase;
}

.detail-list {
    display: grid;
    grid-template-columns: 170px 1fr;
    gap: 12px 18px;
    margin: 0 0 24px;
}

.detail-list dt {
    color: var(--muted);
    font-weight: 800;
}

.detail-list dd {
    margin: 0;
    color: var(--text);
}

.no-margin {
    margin-top: 0;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    color: var(--text);
    table-layout: auto;
}

.data-table th,
.data-table td {
    padding: 14px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.09);
    text-align: left;
    vertical-align: middle;
}

.actions-col {
    min-width: 170px;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.item-table-cell {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 170px;
}

@media (max-width: 900px) {
    .item-detail-grid {
        grid-template-columns: 1fr;
    }

    .detail-list {
        grid-template-columns: 1fr;
    }
}

/* INVENTORY */

.filter-form {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) minmax(200px, 280px) auto;
    gap: 18px;
    align-items: end;
}

.filter-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.filter-actions .button-small,
.filter-actions .button-secondary {
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.muted-text {
    color: var(--muted);
    font-size: 13px;
}

@media (max-width: 850px) {
    .filter-form {
        grid-template-columns: 1fr;
    }

    .filter-actions {
        flex-wrap: wrap;
    }
}

/* HISTORY TABLE REFINEMENT */

.data-table th,
.data-table td {
    line-height: 1.25;
}

.data-table td {
    font-size: 15px;
}

.data-table th {
    white-space: nowrap;
}

.data-table td:nth-child(1),
.data-table td:nth-child(2) {
    min-width: 120px;
}

.data-table td:nth-child(10) {
    min-width: 220px;
}

.data-table a {
    color: var(--text);
    font-weight: 900;
}

.data-table a:hover {
    color: var(--blue-bright);
}