:root {
    --background: #060b14;
    --panel: #101b2c;
    --accent: #2dd4bf;
    --text: #f1f5f9;
    --muted: #8494ab;
    --border: #243449;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    background: var(--background);
    color: var(--text);
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
    padding: 30px 20px 80px;
    background:
        radial-gradient(ellipse at top, #102b39, transparent 55%),
        #060b14;
}

.ambient {
    position: fixed;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    filter: blur(120px);
    opacity: .12;
    pointer-events: none;
    animation: float 8s ease-in-out infinite;
}

.ambient-one {
    background: #14b8a6;
    top: -100px;
    left: -100px;
}

.ambient-two {
    background: #2563eb;
    bottom: -100px;
    right: -100px;
    animation-delay: -4s;
}

.login-card {
    position: relative;
    width: 440px;
    max-width: 100%;
    padding: 40px;
    border: 1px solid var(--border);
    border-radius: 24px;
    background: rgba(16, 27, 44, .88);
    backdrop-filter: blur(24px);
    box-shadow:
        0 25px 100px #0008,
        0 0 50px #14b8a60b;
}

.brand-icon {
    width: 76px;
    height: 76px;
    margin: 0 auto 24px;
    display: grid;
    place-items: center;
    border-radius: 20px;
    background: linear-gradient(145deg, #2dd4bf, #0f766e);
    color: #06151a;
    font-size: 30px;
    font-weight: 900;
    box-shadow: 0 0 35px #14b8a64d;
}

.eyebrow {
    color: var(--accent);
    text-align: center;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 3px;
}

h1 {
    text-align: center;
    font-size: 30px;
    margin: 12px 0 6px;
}

h1 span {
    color: var(--accent);
}

.subtitle {
    text-align: center;
    color: var(--muted);
    font-size: 14px;
}

.separator {
    height: 1px;
    background: var(--border);
    margin: 28px 0;
}

h2 {
    margin: 0 0 8px;
    font-size: 21px;
}

.description {
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 26px;
}

label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 9px;
}

input {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #080f1c;
    color: var(--text);
    font-size: 14px;
    outline: none;
    margin-bottom: 20px;
    transition: .2s;
}

input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 15px #14b8a61c;
}

button {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #2dd4bf, #0d9488);
    color: #06201d;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    transition: .2s;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 25px #14b8a64d;
}

button:disabled {
    opacity: .5;
    cursor: wait;
    transform: none;
}

#loginError {
    color: #fca5a5;
    font-size: 13px;
    margin-bottom: 12px;
}

#loginError:empty {
    display: none;
}

.secure-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--muted);
    font-size: 11px;
    margin-top: 25px;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #2dd4bf;
    box-shadow: 0 0 12px #2dd4bf;
}

.login-footer {
    position: fixed;
    bottom: 24px;
    text-align: center;
    font-size: 11px;
    color: var(--muted);
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(40px); }
}

@media (max-width: 480px) {
    .login-card {
        padding: 28px;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}

/* DASHBOARD */

.dashboard-page {
    min-height: 100vh;
    display: flex;
}

.sidebar {
    width: 265px;
    position: fixed;
    inset: 0 auto 0 0;
    background: #0a1220;
    border-right: 1px solid var(--border);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    z-index: 20;
    transition: transform .25s;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
}

.small-logo {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: linear-gradient(145deg,#2dd4bf,#0f766e);
    color: #06201d;
    font-weight: 900;
    box-shadow: 0 0 25px #14b8a633;
}

.sidebar-brand strong {
    font-size: 15px;
}

.sidebar-brand span {
    color: var(--accent);
}

.sidebar-brand small {
    display: block;
    font-size: 9px;
    letter-spacing: 1px;
    color: var(--muted);
    margin-top: 5px;
}

.nav-heading {
    color: var(--muted);
    font-size: 10px;
    letter-spacing: 2px;
    padding: 12px;
    margin-top: 8px;
}

.nav-item {
    text-align: left;
    background: transparent;
    color: #9aacc3;
    margin: 3px 0;
    font-weight: 500;
    border: 1px solid transparent;
}

.nav-item:hover,
.nav-item.active {
    background: #123038;
    border-color: #20524e;
    color: var(--accent);
    box-shadow: none;
    transform: none;
}

.sidebar-bottom {
    margin-top: auto;
    padding: 12px;
}

.sidebar-bottom small {
    color: var(--muted);
    display: block;
    margin: 12px 0;
}

.system-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--accent);
    font-size: 10px;
    letter-spacing: 1px;
}

.workspace {
    margin-left: 265px;
    width: calc(100% - 265px);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: 76px;
    padding: 0 30px;
    border-bottom: 1px solid var(--border);
    background: #0b1422;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.status-pill {
    color: var(--accent);
    border: 1px solid #20524e;
    background: #102c30;
    border-radius: 30px;
    padding: 8px 14px;
    font-size: 12px;
}

.workspace-content {
    padding: 32px;
    flex: 1;
}

.hero-panel {
    padding: 40px;
    border: 1px solid #20524e;
    border-radius: 20px;
    background:
        radial-gradient(ellipse at right,#14454b,transparent 65%),
        #101b2c;
    margin-bottom: 28px;
}

.hero-panel .eyebrow {
    text-align: left;
}

.hero-panel h2 {
    font-size: 34px;
    margin-top: 18px;
}

.hero-panel h2 span {
    color: var(--accent);
}

.hero-panel p,
.muted {
    color: var(--muted);
}

.launch-button {
    width: auto;
    margin-top: 15px;
    padding: 14px 24px;
}

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

.stat-card,
.content-panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
}

.stat-card small {
    font-size: 10px;
    letter-spacing: 2px;
    color: var(--muted);
}

.stat-card h3 {
    font-size: 24px;
    color: var(--accent);
    margin: 15px 0 8px;
}

.stat-card p {
    color: var(--muted);
    font-size: 12px;
    margin: 0;
}

.content-panel {
    margin: 22px 0;
}

.quick-grid {
    display: grid;
    grid-template-columns: repeat(2,1fr);
    gap: 15px;
    margin-top: 20px;
}

.quick-grid button,
.secondary-button {
    background: #0a1322;
    color: var(--accent);
    border: 1px solid var(--border);
}

textarea,
select {
    width: 100%;
    background: #080f1c;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    font: inherit;
    margin-bottom: 20px;
    outline: none;
}

textarea {
    resize: vertical;
}

textarea:focus,
select:focus {
    border-color: var(--accent);
}

.response-box {
    background: #080f1c;
    border: 1px solid #20524e;
    border-radius: 12px;
    min-height: 150px;
    padding: 20px;
    margin: 20px 0;
    white-space: pre-wrap;
    line-height: 1.7;
}

.rule-list {
    color: #cbd5e1;
    line-height: 2;
}

.workspace-footer {
    padding: 20px 32px;
    color: var(--muted);
    font-size: 11px;
    border-top: 1px solid var(--border);
}

.sidebar-collapsed .sidebar {
    transform: translateX(-100%);
}

.sidebar-collapsed .workspace {
    margin-left: 0;
    width: 100%;
}

[hidden] {
    display: none !important;
}

@media(max-width:1100px) {
    .stats-grid {
        grid-template-columns: repeat(2,1fr);
    }
}

@media(max-width:760px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

    .sidebar-collapsed .sidebar {
        transform: translateX(0);
    }

    .workspace-content {
        padding: 18px;
    }

    .hero-panel {
        padding: 25px;
    }

    .hero-panel h2 {
        font-size: 25px;
    }

    .topbar {
        padding: 0 15px;
    }

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

.moderator-panel {
    border-color: #20524e;
    background: linear-gradient(
        145deg, #10232c, #101b2c
    );
}

.moderator-panel .eyebrow {
    text-align: left;
    margin-bottom: 15px;
}

.moderator-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-top: 20px;
}

.moderator-grid > div {
    background: #080f1c;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
}

.moderator-grid small {
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.moderator-grid h3 {
    color: var(--accent);
    margin-bottom: 0;
}

#modAction {
    min-height: 80px;
}

#productList {
    display: grid;
    grid-template-columns: repeat(auto-fit,minmax(240px,1fr));
    gap: 16px;
}

.product-record {
    background: #080f1c;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 22px;
    transition: .2s;
}

.product-record:hover {
    border-color: var(--accent);
    box-shadow: 0 0 20px #14b8a612;
}

.product-record h3 {
    color: var(--accent);
    margin-top: 0;
    overflow-wrap: anywhere;
}

.product-record p {
    color: var(--muted);
    font-size: 13px;
}

.product-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

#productEditor button {
    margin-top: 10px;
}

#productEditor {
    border-color: #20524e;
}


#knowledgeList {
    display: grid;
    grid-template-columns: repeat(auto-fit,minmax(320px,1fr));
    gap: 18px;
}

.knowledge-record {
    background: #080f1c;
    border: 1px solid #253447;
    border-radius: 14px;
    padding: 22px;
    transition: .2s;
}

.knowledge-record:hover {
    border-color: #2dd4bf;
    box-shadow: 0 0 20px #14b8a612;
}

.knowledge-record h3 {
    color: #2dd4bf;
    margin-top: 0;
}

.knowledge-category {
    color: #8495ad;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.knowledge-active,
.knowledge-pending {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
}

.knowledge-active {
    background: #103a35;
    color: #2dd4bf;
}

.knowledge-pending {
    background: #3b3018;
    color: #fbbf24;
}

.knowledge-content {
    color: #cbd5e1;
    font-size: 14px;
    line-height: 1.7;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    margin: 20px 0;
}

#knowledgeEditor button {
    margin-top: 10px;
}


.product-recognition-panel {
    border-color: #20524e;
    margin-top: 20px;
}

.recognition-label {
    color: #8495ad;
    font-size: 11px;
    letter-spacing: 1.5px;
    margin-top: 20px;
    margin-bottom: 8px;
}

#matchedProductNames {
    color: #2dd4bf;
    font-size: 18px;
    font-weight: 600;
}

#productInformationSource,
#aiKnowledgeReferences {
    color: #cbd5e1;
    font-size: 14px;
    line-height: 1.8;
    overflow-wrap: anywhere;
}


/* Phase 15 - Knowledge Management */

.knowledge-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.knowledge-approve {
    background: #0d9488;
    color: #ffffff;
    border: 1px solid #2dd4bf;
}

.knowledge-approve:hover {
    background: #14b8a6;
    box-shadow: 0 0 16px #14b8a633;
}

.knowledge-disable {
    background: #351c25;
    color: #fca5a5;
    border: 1px solid #7f3342;
}

.knowledge-disable:hover {
    background: #54232f;
}

#knowledgeEditor label {
    display: block;
    margin-top: 16px;
    margin-bottom: 8px;
}

#knowledgeEditor input,
#knowledgeEditor textarea {
    width: 100%;
    box-sizing: border-box;
}

#addKnowledgeButton {
    margin-bottom: 16px;
}

#knowledgeEditor[hidden] {
    display: none !important;
}
