@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
    color-scheme: light;
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-soft: #f0f4fa;
    --text: #172033;
    --muted: #778197;
    --border: #e4e9f2;
    --primary: #6558e8;
    --primary-hover: #5145d2;
    --primary-soft: #eeecff;
    --green: #16865b;
    --green-soft: #e4f7ee;
    --red: #d94747;
    --shadow: 0 8px 28px rgba(26, 36, 64, .055);
    --sidebar-width: 248px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: "DM Sans", sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
}

button,
input,
textarea,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

button:disabled {
    opacity: .55;
    cursor: not-allowed;
}

a {
    color: inherit;
    text-decoration: none;
}

h1,
h2,
h3,
h4,
p {
    margin-top: 0;
}

h1,
h2,
h3,
h4 {
    font-family: "Manrope", sans-serif;
}

h1 {
    font-size: clamp(25px, 3vw, 34px);
    line-height: 1.25;
    margin-bottom: 8px;
}

h2 {
    font-size: 20px;
}

h3 {
    font-size: 16px;
}

p {
    color: var(--muted);
}

.app-shell {
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    width: var(--sidebar-width);
    padding: 24px 17px;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-right: 1px solid var(--border);
    transition: transform .25s ease;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 2px 9px 28px;
}

.brand-icon {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: var(--primary);
    color: white;
    font-size: 22px;
    font-weight: 800;
}

.brand h2 {
    margin: 0;
    font-size: 19px;
    letter-spacing: -.7px;
}

.brand p {
    margin: 1px 0 0;
    font-size: 11px;
}

.nav-label {
    padding: 12px 12px 8px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.sidebar nav {
    display: grid;
    gap: 5px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 11px 13px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    text-align: left;
    font-weight: 600;
    transition: .2s ease;
}

.nav-link:hover {
    background: var(--surface-soft);
    color: var(--text);
}

.nav-link.active {
    background: var(--primary-soft);
    color: var(--primary);
}

.nav-icon {
    width: 23px;
    text-align: center;
    font-size: 17px;
}

.sidebar-bottom {
    margin-top: auto;
}

.local-card {
    padding: 15px;
    margin: 18px 0 12px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 13px;
}

.local-card strong {
    display: block;
    font-size: 12px;
    margin-bottom: 4px;
}

.local-card p {
    font-size: 11px;
    margin-bottom: 0;
}

.local-dot,
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 6px;
    border-radius: 50%;
    background: #e2a33a;
    vertical-align: middle;
}

.local-dot {
    background: var(--green);
}

.main-area {
    min-height: 100vh;
    margin-left: var(--sidebar-width);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    min-height: 72px;
    padding: 14px 34px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(14px);
}

.topbar-left,
.topbar-right,
.row-between,
.inline-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-right {
    justify-content: flex-end;
    flex-wrap: wrap;
}

.breadcrumb {
    color: var(--muted);
    font-size: 12px;
}

.connection-status {
    font-size: 12px;
    color: var(--muted);
}

.icon-button {
    display: inline-grid;
    place-items: center;
    width: 39px;
    height: 39px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface);
    color: var(--text);
}

.icon-button:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.page-content {
    max-width: 1440px;
    margin: 0 auto;
    padding: 34px;
}

.page {
    display: none;
    animation: fade-in .2s ease;
}

.page.active {
    display: block;
}

@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 26px;
}

.page-heading p {
    margin-bottom: 0;
    max-width: 660px;
}

.hero {
    position: relative;
    overflow: hidden;
    padding: 30px;
    margin-bottom: 25px;
    border-radius: 20px;
    background: linear-gradient(120deg, #6558e8, #8878f4);
    color: #fff;
}

.hero::after {
    content: "✦";
    position: absolute;
    right: 7%;
    top: -36px;
    font-size: 190px;
    color: rgba(255, 255, 255, .09);
    pointer-events: none;
}

.hero h1,
.hero p {
    color: white;
}

.hero p {
    max-width: 570px;
    opacity: .85;
    margin-bottom: 20px;
}

.hero .eyebrow {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.7px;
    text-transform: uppercase;
    opacity: .8;
}

.hero .btn {
    position: relative;
    z-index: 1;
}

.grid {
    display: grid;
    gap: 20px;
}

.grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.dashboard-grid {
    margin-bottom: 24px;
}

.card {
    min-width: 0;
    padding: 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.card+.card {
    margin-top: 0;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.card-header h2,
.card-header h3 {
    margin: 0;
}

.card-description {
    margin: 6px 0 18px;
    font-size: 12px;
}

.feature-card {
    transition: transform .2s, border-color .2s;
}

.feature-card:hover {
    transform: translateY(-3px);
    border-color: #c8c2ff;
}

.feature-icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin-bottom: 17px;
    border-radius: 13px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 21px;
}

.feature-card h3 {
    margin-bottom: 7px;
}

.feature-card p {
    font-size: 12px;
    min-height: 39px;
    margin-bottom: 16px;
}

.stat-card {
    padding: 20px;
}

.stat-label {
    font-size: 12px;
    color: var(--muted);
}

.stat-value {
    font-family: "Manrope", sans-serif;
    font-size: 29px;
    font-weight: 800;
    margin: 7px 0 0;
}

.stat-foot {
    font-size: 11px;
    color: var(--muted);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    font-size: 12px;
    transition: background .2s, transform .2s;
}

.btn:hover {
    background: var(--primary-hover);
}

.btn:active {
    transform: scale(.98);
}

.btn-secondary {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text);
}

.btn-secondary:hover {
    background: var(--surface-soft);
}

.btn-ghost {
    background: transparent;
    color: var(--muted);
}

.btn-ghost:hover {
    background: var(--surface-soft);
    color: var(--text);
}

.btn-small {
    min-height: 32px;
    padding: 6px 11px;
    font-size: 11px;
}

.btn-light {
    background: #fff;
    color: var(--primary);
}

.btn-light:hover {
    background: #f4f2ff;
}

.btn-danger {
    background: #fff0f0;
    color: var(--red);
    border-color: #f4dada;
}

.full-width {
    width: 100%;
}

.field {
    display: grid;
    gap: 7px;
    margin-bottom: 18px;
}

.field label {
    font-size: 12px;
    font-weight: 700;
}

.field small,
.helper-text {
    color: var(--muted);
    font-size: 11px;
}

input,
textarea,
select {
    width: 100%;
    min-width: 0;
    padding: 12px 13px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}

textarea {
    min-height: 160px;
    resize: vertical;
    line-height: 1.7;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(101, 88, 232, .11);
}

textarea::placeholder,
input::placeholder {
    color: #a3adbd;
}

.input-footer {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 7px;
}

.input-footer small {
    color: var(--muted);
}

.result-panel {
    min-height: 130px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-soft);
    overflow-wrap: anywhere;
}

.result-panel h3 {
    margin-bottom: 10px;
}

.result-panel p:last-child {
    margin-bottom: 0;
}

.result-content {
    white-space: pre-wrap;
    line-height: 1.8;
}

.empty-state {
    text-align: center;
    padding: 30px 15px;
    color: var(--muted);
}

.empty-state .empty-icon {
    font-size: 30px;
    margin-bottom: 10px;
}

.empty-state p {
    margin-bottom: 0;
    font-size: 12px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 9px;
    border-radius: 30px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 10px;
    font-weight: 700;
}

.badge-success {
    background: var(--green-soft);
    color: var(--green);
}

.badge-neutral {
    background: var(--surface-soft);
    color: var(--muted);
}

.task-list,
.file-list {
    display: grid;
    gap: 10px;
}

.task-item,
.file-item {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 13px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface);
}

.task-item input[type="checkbox"] {
    width: 17px;
    margin-top: 4px;
    accent-color: var(--primary);
}

.task-item-content {
    flex: 1;
    min-width: 0;
}

.task-item-content p {
    margin: 4px 0 0;
    font-size: 12px;
}

.task-item.done .task-title {
    text-decoration: line-through;
    color: var(--muted);
}

.task-title {
    font-weight: 600;
    overflow-wrap: anywhere;
}

.task-meta {
    margin-top: 6px;
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
}

.task-delete {
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 17px;
}

.task-delete:hover {
    color: var(--red);
}

.drop-zone {
    padding: 36px 18px;
    border: 2px dashed var(--border);
    border-radius: 14px;
    text-align: center;
    background: var(--surface-soft);
    transition: border-color .2s, background .2s;
}

.drop-zone.dragover {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.drop-zone .drop-icon {
    font-size: 34px;
    margin-bottom: 8px;
}

.drop-zone h3 {
    margin-bottom: 5px;
}

.drop-zone p {
    font-size: 12px;
    margin-bottom: 15px;
}

.file-item {
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

.file-name {
    min-width: 0;
    overflow-wrap: anywhere;
}

.file-name small {
    display: block;
    color: var(--muted);
}

.file-arrow {
    color: var(--primary);
    font-size: 17px;
    padding: 0 6px;
}

.setup-step {
    display: flex;
    gap: 13px;
    margin: 18px 0;
}

.step-number {
    flex: 0 0 30px;
    display: grid;
    place-items: center;
    height: 30px;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 800;
}

.setup-step h3 {
    margin-bottom: 5px;
}

.setup-step p {
    margin-bottom: 8px;
    font-size: 12px;
}

pre,
code {
    font-family: Consolas, "Courier New", monospace;
}

code {
    padding: 2px 5px;
    border-radius: 5px;
    background: var(--surface-soft);
    color: var(--primary);
    overflow-wrap: anywhere;
}

pre {
    overflow-x: auto;
    padding: 13px;
    background: #172033;
    color: #e7eaff;
    border-radius: 10px;
    font-size: 12px;
    line-height: 1.7;
}

pre code {
    padding: 0;
    background: transparent;
    color: inherit;
}

.toast {
    position: fixed;
    z-index: 100;
    right: 24px;
    bottom: 24px;
    max-width: min(380px, calc(100vw - 32px));
    padding: 13px 18px;
    background: #172033;
    color: #fff;
    border-radius: 12px;
    box-shadow: var(--shadow);
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: .25s ease;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.error {
    background: #a72d38;
}

.toast.success {
    background: #176b4d;
}

hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 22px 0;
}

.muted {
    color: var(--muted);
}

.hidden {
    display: none !important;
}

.text-small {
    font-size: 12px;
}

.mt-16 {
    margin-top: 16px;
}

.mb-0 {
    margin-bottom: 0;
}

body.dark {
    color-scheme: dark;
    --bg: #10131c;
    --surface: #181d29;
    --surface-soft: #202637;
    --text: #edf0fa;
    --muted: #a0a9bd;
    --border: #2b3345;
    --primary: #958aff;
    --primary-hover: #8073f0;
    --primary-soft: #302b50;
    --green: #62d4a0;
    --green-soft: #193d32;
    --red: #ff7777;
    --shadow: 0 8px 28px rgba(0, 0, 0, .16);
}

body.dark .hero {
    background: linear-gradient(120deg, #4538b5, #6a57cc);
}

body.dark .btn-light {
    background: #fff;
    color: #5145d2;
}

body.dark pre {
    background: #0b0e15;
}

body.dark .toast {
    background: #edf0fa;
    color: #172033;
}

body.dark .toast.error {
    background: #a72d38;
    color: #fff;
}

body.dark .toast.success {
    background: #176b4d;
    color: #fff;
}

@media (max-width: 1150px) {
    .grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .page-content {
        padding: 26px;
    }

    .topbar {
        padding-inline: 26px;
    }
}

@media (max-width: 850px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: var(--shadow);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-area {
        margin-left: 0;
    }

    .topbar {
        padding: 12px 18px;
    }

    .page-content {
        padding: 22px 18px;
    }

    .grid-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 580px) {

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }

    .page-heading {
        flex-direction: column;
    }

    .hero {
        padding: 23px;
    }

    .card {
        padding: 17px;
    }

    .topbar {
        align-items: flex-start;
    }

    .topbar-right {
        gap: 7px;
    }

    .connection-status {
        display: none;
    }

    .stat-value {
        font-size: 25px;
    }

    .inline-actions {
        flex-wrap: wrap;
    }

    .page-content {
        padding: 18px 13px;
    }
}