* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Tahoma, "MS Sans Serif", Arial, sans-serif;
    font-size: 12px;
    background: #3a6ea5;
    color: #000;
}

.desktop {
    min-height: 100vh;
    padding: 35px;
    background:
        linear-gradient(135deg, #5b8fc4 0%, #3a6ea5 45%, #24558a 100%);
}

.window {
    width: min(1250px, 96vw);
    height: calc(100vh - 70px);
    min-height: 650px;
    margin: auto;
    background: #ece9d8;
    border: 3px solid #083b8c;
    border-radius: 7px 7px 0 0;
    box-shadow:
        3px 3px 0 #12345b,
        8px 8px 18px rgba(0, 0, 0, 0.45);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* XP TITLE BAR */

.titlebar {
    height: 32px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 3px 4px 3px 7px;

    color: white;
    font-weight: bold;

    background:
        linear-gradient(
            to bottom,
            #3f8eea 0%,
            #1768c5 45%,
            #0b4da5 100%
        );
}

.titlebar-left {
    display: flex;
    align-items: center;
    gap: 6px;
}

.shield {
    font-size: 17px;
}

.window-buttons {
    display: flex;
    gap: 2px;
}

.window-buttons button {
    width: 23px;
    height: 22px;
    padding: 0;
    border: 1px solid #fff;
    border-radius: 3px;
    background: linear-gradient(#6ca9ed, #1658a9);
    color: white;
    font-weight: bold;
    font-size: 13px;
}

/* MENUBAR */

.menubar {
    height: 25px;
    display: flex;
    align-items: center;
    gap: 22px;
    padding-left: 9px;
    background: #ece9d8;
    border-bottom: 1px solid #aaa;
}

.menubar span {
    cursor: pointer;
}

.menubar span:hover {
    text-decoration: underline;
}

/* TOOLBAR */

.toolbar {
    height: 42px;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 7px;
    background: #f1f0e8;
    border-bottom: 1px solid #aaa;
}

.toolbar button,
.xp-button,
.nav-item {
    font-family: Tahoma, Arial, sans-serif;
}

.toolbar button {
    padding: 4px 10px;
    background: #ece9d8;
    border: 1px solid #777;
    border-top-color: white;
    border-left-color: white;
    cursor: pointer;
}

.toolbar button:active,
.xp-button:active {
    border-top-color: #555;
    border-left-color: #555;
    border-bottom-color: white;
    border-right-color: white;
}

.address {
    flex: 1;
    height: 27px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 5px;
}

.address span {
    flex: 1;
    height: 24px;
    padding: 5px 8px;
    background: white;
    border: 1px solid #777;
    color: #444;
}

/* CONTENT */

.content {
    flex: 1;
    min-height: 0;
    display: flex;
    overflow: hidden;
}

.hidden {
    display: none !important;
}

.app-view {
    min-height: 100%;
}

.app-view:not(.hidden) {
    animation: view-enter 320ms ease-out both;
}

.history-item,
.tool-item,
.settings-row {
    padding: 9px;
    border-bottom: 1px solid #c7d5e2;
}

.tool-item {
    display: flex;
    gap: 12px;
}

.tool-item span,
.settings-row span {
    color: #444;
}

.settings-row {
    display: grid;
    grid-template-columns: minmax(150px, 0.7fr) 1fr;
    align-items: center;
    gap: 14px;
}

.settings-row label {
    margin: 0;
}

.settings-row select {
    width: 100%;
    padding: 6px;
    font-family: Tahoma, Arial, sans-serif;
    background: white;
    border: 1px solid #777;
}

.volume-row {
    grid-template-columns: minmax(150px, 0.7fr) 1fr auto;
}

.volume-row input {
    width: 100%;
}

.volume-row output {
    min-width: 38px;
    color: #444;
    text-align: right;
}

.settings-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
}

.settings-saved {
    color: #126012;
    font-weight: bold;
}

.settings-note {
    margin: 14px 0 0;
    color: #555;
    font-size: 11px;
}

body.font-modern {
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
}

body.font-mono {
    font-family: Consolas, "Courier New", monospace;
}

body.font-small {
    font-size: 11px;
}

body.font-large {
    font-size: 14px;
}

body.theme-dark {
    background: #142238;
    color: #e8eef7;
}

body.theme-dark .desktop {
    background: linear-gradient(135deg, #263f63 0%, #142238 55%, #0c1524 100%);
}

body.theme-dark .window,
body.theme-dark .main-panel {
    background: #202d3d;
}

body.theme-dark .main-panel {
    color: #e8eef7;
}

body.theme-dark .sidebar {
    background: linear-gradient(to bottom, #263c56, #1c2c40);
    border-right-color: #496b8d;
}

body.theme-dark .hero-panel,
body.theme-dark .panel,
body.theme-dark .result-box,
body.theme-dark .result-text,
body.theme-dark input,
body.theme-dark textarea,
body.theme-dark select {
    color: #e8eef7;
    background: #2c3b4d;
    border-color: #607b98;
}

body.theme-dark .hero-panel {
    background: linear-gradient(135deg, #294866 0%, #263747 65%);
}

body.theme-dark .page-heading p,
body.theme-dark .hero-panel p:not(.hero-lead),
body.theme-dark .tool-item span,
body.theme-dark .settings-row output,
body.theme-dark .settings-note {
    color: #bdcce0;
}

body.theme-dark .notice {
    color: #f4df83;
    background: #4b4422;
    border-color: #847438;
}

body.theme-dark .statusbar,
body.theme-dark .menubar {
    color: #d9e5f2;
    background: #263747;
    border-color: #536b83;
}

/* SIDEBAR */

.sidebar {
    width: 210px;
    flex-shrink: 0;
    padding: 10px;
    background:
        linear-gradient(
            to bottom,
            #dce9f7,
            #edf3fa
        );
    border-right: 1px solid #7b9ebd;
}

.sidebar-title {
    padding: 7px 8px;
    margin-bottom: 6px;
    color: white;
    font-weight: bold;
    background: linear-gradient(#6da4d9, #3977b5);
    border-radius: 3px 3px 0 0;
}

.sidebar-title.second {
    margin-top: 18px;
}

.nav-item {
    width: 100%;
    display: block;
    padding: 8px;
    margin-bottom: 3px;
    text-align: left;
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
}

.nav-item:hover,
.nav-item.active {
    background: #d5e8fa;
    border: 1px solid #7aa7d5;
}

.nav-item {
    transition: background-color 160ms ease, border-color 160ms ease,
        transform 160ms ease;
}

.nav-item:hover {
    transform: translateX(2px);
}

.system-status {
    padding: 8px;
    line-height: 1.9;
    color: #174d17;
}

/* MAIN */

.main-panel {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    padding: 18px;
    background: #fff;
}

.page-heading {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 18px;
}

.big-icon {
    font-size: 43px;
}

.page-heading h1 {
    margin: 0 0 4px;
    color: #164a8b;
    font-size: 22px;
}

.page-heading p {
    margin: 0;
    color: #555;
}

/* HOME */

.hero-panel {
    margin-bottom: 15px;
    padding: 24px 26px;
    color: #173b64;
    background:
        linear-gradient(135deg, #e8f3ff 0%, #ffffff 65%);
    border: 1px solid #8daecc;
    box-shadow: inset 1px 1px white, inset -1px -1px #c6d8e8;
    animation: hero-enter 500ms ease-out both;
}

.hero-kicker {
    margin-bottom: 8px;
    color: #3974ad;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 1px;
}

.hero-panel h1 {
    margin: 0 0 7px;
    color: #164a8b;
    font-size: 30px;
}

.hero-lead {
    margin: 0 0 12px;
    color: #333;
    font-size: 17px;
    font-weight: bold;
}

.hero-panel p:not(.hero-lead) {
    max-width: 720px;
    margin: 0;
    line-height: 1.6;
}

.hero-actions {
    margin-top: 18px;
}

.home-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.home-card {
    margin-bottom: 15px;
    animation: panel-enter 420ms ease-out both;
}

.home-card:nth-child(2) {
    animation-delay: 90ms;
}

.workflow-step {
    display: flex;
    gap: 10px;
    padding: 9px 0;
    border-bottom: 1px solid #c7d5e2;
}

.workflow-step:last-child {
    border-bottom: 0;
}

.workflow-step b {
    min-width: 88px;
    color: #164a8b;
}

.workflow-step span {
    color: #444;
}

.feature-list {
    margin: 0;
    padding-left: 22px;
    line-height: 1.9;
}

.notice {
    padding: 10px 12px;
    color: #5c4c00;
    background: #fffbe0;
    border: 1px solid #d5c36a;
    line-height: 1.5;
    animation: panel-enter 480ms ease-out 160ms both;
}

/* XP PANELS */

.panel {
    margin-bottom: 15px;
    padding: 12px;
    background: #f7f7f7;
    border: 1px solid #919191;
    box-shadow:
        inset 1px 1px white,
        inset -1px -1px #ccc;
}

.panel-title {
    margin: -12px -12px 12px;
    padding: 6px 9px;
    color: white;
    font-weight: bold;
    background: linear-gradient(#659bd0, #3974ad);
}

label {
    display: block;
    margin: 10px 0 4px;
    font-weight: bold;
}

input,
textarea {
    width: 100%;
    font-family: Consolas, "Courier New", monospace;
    font-size: 12px;
    background: white;
    border: 1px solid #777;
    padding: 7px;
}

textarea {
    resize: vertical;
}

/* BUTTONS */

.button-row {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.xp-button {
    min-width: 100px;
    padding: 6px 15px;
    background: #ece9d8;
    border: 2px solid;
    border-top-color: white;
    border-left-color: white;
    border-right-color: #666;
    border-bottom-color: #666;
    cursor: pointer;
    transition: background-color 160ms ease, transform 120ms ease,
        box-shadow 160ms ease;
}

.xp-button.primary {
    font-weight: bold;
    color: #003b80;
}

.xp-button:hover {
    background: #f5f2df;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.18);
    transform: translateY(-1px);
}

.xp-button:active {
    box-shadow: none;
    transform: translateY(1px);
}

.xp-button:disabled {
    cursor: wait;
    opacity: 0.65;
    transform: none;
}

/* AGENT ACTIVITY */

.status {
    padding: 8px;
    margin-bottom: 8px;
    border: 1px solid #999;
    background: white;
    font-family: Consolas, "Courier New", monospace;
}

.status.running {
    color: #003b80;
    background: #e5f0ff;
    animation: status-pulse 1.8s ease-in-out infinite;
}

.status.success {
    color: #126012;
    background: #e8f8e8;
}

.status.error {
    color: #8b0000;
    background: #ffe8e8;
}

.activity {
    min-height: 100px;
    max-height: 230px;
    overflow-y: auto;
    padding: 8px;
    background: #111;
    color: #00ff66;
    border: 2px inset #aaa;
    font-family: Consolas, "Courier New", monospace;
    font-size: 12px;
    scroll-behavior: smooth;
}

.activity-line {
    margin-bottom: 6px;
}

.activity-line.tool {
    color: #66b3ff;
}

.activity-line.result {
    color: #dddddd;
}

.activity-line.warning {
    color: #ffcc00;
}

.activity-item {
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #222;
    color: #dddddd;
    animation: activity-enter 280ms ease-out both;
}

.activity-item .activity-title {
    font-weight: bold;
}

.activity-item .activity-detail {
    color: #9a9a9a;
    word-break: break-word;
}

.activity-item.decision .activity-title {
    color: #66b3ff;
}

.activity-item.result .activity-title {
    color: #00ff66;
}

.activity-item.success .activity-title {
    color: #7CFC00;
}

.activity-item.warning .activity-title {
    color: #ffcc00;
}

.activity-item.error {
    background: #3a0000;
    border-bottom-color: #660000;
}

.activity-item.error .activity-title {
    color: #ff5c5c;
}

.activity-item.error .activity-detail {
    color: #ffb3b3;
}

/* RESULTS */

.result-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 14px;
}

.result-box {
    padding: 10px;
    text-align: center;
    background: white;
    border: 1px solid #999;
}

.result-box span {
    display: block;
    color: #555;
    margin-bottom: 5px;
}

.result-box strong {
    font-size: 20px;
    color: #555;
}

.result-box strong.critical {
    color: #b00000;
}

.result-box strong.high {
    color: #d46b00;
}

.result-box strong.medium {
    color: #9a7a00;
}

.result-box strong.low {
    color: #147014;
}

h3 {
    color: #164a8b;
    font-size: 13px;
    margin: 14px 0 6px;
}

.result-text {
    padding: 8px;
    background: white;
    border: 1px solid #aaa;
    line-height: 1.5;
}

#evidence {
    margin: 0;
    padding-left: 28px;
}

#evidence li {
    margin-bottom: 7px;
}

@keyframes view-enter {
    from {
        opacity: 0;
        transform: translateY(7px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes hero-enter {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes panel-enter {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes activity-enter {
    from {
        opacity: 0;
        transform: translateX(-8px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes status-pulse {
    0%, 100% {
        box-shadow: 0 0 0 rgba(72, 137, 207, 0);
    }
    50% {
        box-shadow: 0 0 0 3px rgba(72, 137, 207, 0.13);
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}

/* STATUS BAR */

.statusbar {
    height: 23px;
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 7px;
    background: #ece9d8;
    border-top: 1px solid #999;
    color: #444;
    font-size: 11px;
}

@media (max-width: 760px) {
    .home-grid {
        grid-template-columns: 1fr;
    }
}

/* SCROLLBAR */

::-webkit-scrollbar {
    width: 16px;
}

::-webkit-scrollbar-track {
    background: #ece9d8;
}

::-webkit-scrollbar-thumb {
    background: #c5c2b8;
    border: 2px solid #ece9d8;
}

::-webkit-scrollbar-button {
    background: #ece9d8;
    height: 16px;
}

/* MOBILE */

@media (max-width: 800px) {

    .desktop {
        padding: 0;
    }

    .window {
        width: 100%;
        height: 100vh;
        min-height: 0;
        border-radius: 0;
    }

    .sidebar {
        display: none;
    }

    .main-panel {
        padding: 10px;
    }

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