:root {
    --bg: #0d0f18;
    --surface: #151825;
    --surface2: #1e2235;
    --line: #2a2f4a;
    --text: #e6e9f4;
    --muted: #858dab;
    --blue: #4f8ef7;
    --green: #44c59a;
    --red: #f47575; 
    --gold: #e9b949
}

* {
    box-sizing: border-box
}

body {
    margin: 0;
    background: radial-gradient(ellipse at 70% 0, #1b2140 0, #0d0f18 55%);
    color: var(--text);
    font: 14px "Be Vietnam Pro", sans-serif;
    min-height: 100vh
}

.hidden {
    display: none !important
}

.login-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px
}

.back-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    color: var(--muted);
    text-decoration: none;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 9px 14px
}

.login-card {
    width: min(430px, 100%);
    background: rgba(21, 24, 37, .96);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 35px;
    box-shadow: 0 20px 70px #0008
}

.login-logo {
    margin: auto auto 18px;
    width: 66px;
    height: 66px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background: linear-gradient(135deg, #1e40af, var(--blue));
    font-size: 30px
}

.login-card h1 {
    text-align: center;
    font-size: 22px;
    margin: 0 0 8px
}

.login-card p {
    text-align: center;
    color: var(--muted);
    margin: 0 0 28px
}

.login-card label,
.filter-grid label,
.modal-card label {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 16px
}

.login-card input,
.filter-grid input,
.filter-grid select,
.modal-card input,
.modal-card select {
    width: 100%;
    padding: 12px 13px;
    border-radius: 9px;
    border: 1px solid var(--line);
    background: var(--surface2);
    color: var(--text);
    outline: 0;
    font: inherit
}

.login-card input:focus,
.filter-grid input:focus,
.filter-grid select:focus,
.modal-card input:focus,
.modal-card select:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px #4f8ef726
}

.remember {
    display: flex !important;
    align-items: center;
    grid-template-columns: auto 1fr
}

.remember input {
    width: auto
}

.primary-btn,
.secondary-btn,
.ghost-btn {
    border: 0;
    border-radius: 9px;
    padding: 11px 16px;
    color: #fff;
    background: var(--blue);
    font: 600 13px inherit;
    cursor: pointer;
    text-decoration: none;
}

.primary-btn:hover {
    filter: brightness(1.12)
}

.secondary-btn,
.ghost-btn {
    background: var(--surface2);
    border: 1px solid var(--line);
    color: var(--text)
}

.ghost-btn {
    padding: 9px 12px
}

.login-card .primary-btn {
    width: 100%;
    margin-top: 5px
}

.error-text {
    color: var(--red);
    min-height: 20px;
    text-align: center;
    margin-top: 13px
}

.app {
    min-height: 100vh
}

.topbar {
    padding: 25px clamp(20px, 5vw, 70px);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #111421cc
}

.eyebrow {
    color: var(--blue);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.6px
}

.topbar h1 {
    font-size: 25px;
    margin: 5px 0 0
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 18px;
    color: var(--muted)
}

.content {
    max-width: 1400px;
    margin: auto;
    padding: 32px clamp(20px, 5vw, 70px) 60px
}

.toolbar,
.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px
}

.toolbar h2,
.panel h2 {
    font-size: 19px;
    margin: 0 0 5px
}

.muted {
    color: var(--muted);
    margin: 0
}

.filter-card,
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 22px;
    margin-top: 22px
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr) auto;
    align-items: end;
    gap: 14px
}

.filter-grid label {
    margin: 0
}

.filter-grid .primary-btn {
    height: 42px;
    white-space: nowrap
}

.filter-actions {
    display: flex;
    gap: 8px;
    align-items: center
}

.filter-actions button {
    height: 42px;
    white-space: nowrap
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-top: 18px
}

.view-tabs {
    display: flex;
    gap: 8px;
    margin-top: 22px;
    border-bottom: 1px solid var(--line)
}

.view-tab {
    border: 0;
    border-bottom: 2px solid transparent;
    padding: 11px 14px;
    background: transparent;
    color: var(--muted);
    font: 600 13px inherit;
    cursor: pointer
}

.view-tab:hover,
.view-tab.active {
    color: var(--text);
    border-bottom-color: var(--blue)
}

.stat-card {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, var(--surface), #1a1f32);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 20px
}

.one-star-rating{
    border-color: var(--red);
    color: var(--red);
}

.four-star-rating{
    border-color: var(--green);
    color: var(--green);
}

.stat-card span {
    color: var(--muted);
    font-size: 12px
}

.stat-card strong {
    display: block;
    font-size: 29px;
    margin-top: 8px
}

.stat-card i {
    position: absolute;
    right: 18px;
    bottom: 16px;
    color: var(--blue);
    font-size: 27px;
    opacity: .6
}

.table-wrap {
    overflow: auto;
    margin-top: 18px
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px
}

th,
td {
    text-align: left;
    padding: 14px 10px;
    border-bottom: 1px solid var(--line);
    vertical-align: top
}

th {
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .5px
}

td {
    font-size: 13px
}

.score {
    color: var(--gold);
    white-space: nowrap
}

.feedback {
    max-width: 250px;
    color: #c7cbe0;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word
}

.tag {
    display: inline-block;
    margin: 2px 4px 2px 0;
    padding: 4px 7px;
    border-radius: 5px;
    background: #4f8ef71f;
    color: #9bbcff;
    font-size: 11px
}

.pagination {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px
}

.page-info {
    color: var(--muted);
    font-size: 12px
}

.criteria-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
    margin-top: 18px
}

.criteria-card {
    background: var(--surface2);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 15px
}

.criteria-card h3 {
    font-size: 14px;
    margin: 0 0 12px
}

.criteria-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--muted);
    font-size: 11px
}

.criteria-actions {
    display: flex;
    gap: 7px;
    margin-top: 14px
}

.icon-btn {
    border: 1px solid var(--line);
    background: transparent;
    color: var(--muted);
    border-radius: 7px;
    padding: 7px 9px;
    cursor: pointer
}

.icon-btn:hover {
    color: var(--text);
    border-color: var(--blue)
}

.status-active {
    color: var(--green)
}

.status-off {
    color: var(--red)
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: grid;
    place-items: center;
    background: #0009;
    padding: 20px
}

.modal-card {
    position: relative;
    width: min(450px, 100%);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 15px;
    padding: 28px;
    box-shadow: 0 20px 80px #000b
}

.modal-card h2 {
    margin: 0 0 24px
}

.modal-close {
    position: absolute;
    right: 16px;
    top: 16px;
    background: transparent;
    border: 0;
    color: var(--muted);
    cursor: pointer;
    font-size: 16px
}

.detail-card {
    width: min(650px, 100%);
    max-height: calc(100vh - 40px);
    overflow-y: auto
}

.detail-row {
    padding: 11px 0;
    border-bottom: 1px solid var(--line);
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: pre-wrap
}

.detail-row b {
    display: block;
    color: var(--muted);
    font-size: 11px;
    margin-bottom: 4px
}

.toast {
    position: fixed;
    right: 24px;
    top: 24px;
    z-index: 30;
    padding: 13px 18px;
    border-radius: 9px;
    background: var(--green);
    color: #07140f;
    transform: translateY(-20px);
    opacity: 0;
    pointer-events: none;
    transition: .2s
}

.toast.show {
    transform: none;
    opacity: 1
}

.toast.error {
    background: var(--red);
    color: #250707
}

@media(max-width:900px) {
    .filter-grid {
        grid-template-columns: repeat(2, 1fr)
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr)
    }

    .topbar {
        align-items: flex-start;
        gap: 15px;
        flex-direction: column
    }

    .top-actions {
        width: 100%;
        justify-content: space-between
    }
}

@media(max-width:560px) {
    .filter-grid {
        grid-template-columns: 1fr
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr
    }

    .content {
        padding: 22px 14px
    }

    .panel-heading {
        align-items: flex-start;
        flex-direction: column
    }

    .login-card {
        padding: 25px
    }

    .topbar {
        padding: 22px 16px
    }
}
