:root {
    --Accent: #4FB7C5;
    --AccentDark: #2D95A3;
    --White: #FFFFFF;
    --Soft: #F5F7F8;
    --Text: #1F2937;
    --Muted: #6B7280;
    --Line: rgba(31, 41, 55, .1);
    --Shadow: 0 18px 50px rgba(31, 41, 55, .12);
    --Radius: 18px;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "Inter", "Josefin Sans";
    font-size: 13px;
    color: var(--Text);
    background: linear-gradient(135deg, #EAE5C9 0%, #6CC6CB 100%);
    min-height: 100vh;
}
a { color: inherit; text-decoration: none; }

.AppShell { display: flex; min-height: 100vh; }
.Sidebar {
    width: 280px;
    padding: 22px;
    background: rgba(255,255,255,.56);
    backdrop-filter: blur(18px);
    border-right: 1px solid rgba(255,255,255,.55);
    position: sticky;
    top: 0;
    height: 100vh;
    transition: width .2s ease;
}
.Brand { display: flex; gap: 12px; align-items: center; }
.BrandMark {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--Accent), #FFFFFF);
    font-weight: 900;
    color: #0f5964;
    box-shadow: var(--Shadow);
}
.BrandLogo {
    width: 46px;
    height: 46px;
    object-fit: contain;
    border-radius: 14px;
    background: rgba(255,255,255,.76);
    padding: 6px;
    box-shadow: var(--Shadow);
}
.BrandText strong, .BrandText span { display: block; }
.BrandText span { color: var(--Muted); font-size: 13px; margin-top: 2px; }
.Menu { margin-top: 34px; display: grid; gap: 8px; }
.Menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 14px;
    border-radius: 14px;
    color: var(--Muted);
    font-weight: 700;
}
.Menu a span { width: 24px; text-align: center; font-size: 18px; }
.Menu a.Active, .Menu a:hover { background: var(--White); color: var(--Text); box-shadow: 0 10px 28px rgba(31,41,55,.08); }
.Main { flex: 1; min-width: 0; }
.Topbar {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 24px 30px;
}
.Topbar h1 { margin: 0; font-size: 21px; }
.Topbar p { margin: 4px 0 0; color: var(--Muted); }
.UserBadge {
    margin-left: auto;
    background: rgba(255,255,255,.72);
    border: 1px solid rgba(255,255,255,.7);
    padding: 10px 14px;
    border-radius: 999px;
    font-weight: 800;
}
.IconButton {
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 13px;
    background: var(--White);
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(31,41,55,.08);
}
.Content { padding: 0 30px 34px; }
.Panel, .StatCard, .PromptCard, .LoginCard {
    background: rgba(255,255,255,.78);
    border: 1px solid rgba(255,255,255,.8);
    border-radius: var(--Radius);
    box-shadow: var(--Shadow);
    backdrop-filter: blur(18px);
}
.Panel { padding: 22px; }
.PanelHeader { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; }
.PanelHeader h2, .PanelHeader p { margin: 0; }
.PanelHeader h2 { font-size: 20px; }
.Panel p { color: var(--Muted); line-height: 1.6; }
.StatsGrid, .PromptGrid, .SettingsGrid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 18px;
}
.StatCard { padding: 22px; }
.StatCard span { color: var(--Muted); display: block; }
.StatCard strong { display: block; font-size: 38px; margin-top: 8px; }
.TwoColumn { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr); gap: 18px; }
.List, .Timeline { display: grid; gap: 10px; }
.ListItem, .TimelineItem, .TreePrompt {
    display: block;
    padding: 14px;
    border: 1px solid var(--Line);
    border-radius: 14px;
    background: rgba(255,255,255,.56);
}
.ListItem strong, .ListItem span, .TimelineItem strong, .TimelineItem span, .TimelineItem small { display: block; }
.ListItem span, .TimelineItem span, .TimelineItem small { color: var(--Muted); margin-top: 4px; }
.Toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.Form { display: grid; gap: 10px; }
label { font-weight: 800; font-size: 14px; }
input, textarea, select {
    width: 100%;
    border: 1px solid var(--Line);
    background: rgba(255,255,255,.82);
    border-radius: 13px;
    padding: 12px 13px;
    color: var(--Text);
    font: inherit;
    outline: none;
}
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--Accent); box-shadow: 0 0 0 4px rgba(79,183,197,.16); }
.Check { display: inline-flex; align-items: center; gap: 8px; color: var(--Muted); }
.Check input { width: auto; }
.Button {
    border: 0;
    border-radius: 13px;
    padding: 11px 15px;
    font-weight: 900;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
}
.Button.Primary { background: var(--Accent); color: white; }
.Button.Primary:hover { background: var(--AccentDark); }
.Button.Soft { background: rgba(255,255,255,.82); color: var(--Text); }
.Button.Danger { background: #EF4444; color: white; }
.Button.Mini { min-height: 32px; padding: 7px 10px; font-size: 12px; }
.PromptCard { padding: 18px; display: grid; gap: 12px; }
.PromptCard h2 { margin: 0; font-size: 19px; }
.PromptCard p { margin: 0; color: var(--Muted); line-height: 1.55; }
.PromptMeta { display: flex; justify-content: space-between; gap: 10px; color: var(--Muted); font-size: 13px; }
.PromptMeta b { color: var(--AccentDark); }
.Tags { color: var(--Muted); font-size: 13px; }
.CardActions, .FormActions, .TreeActions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.CardActions form, .TreeActions form { margin: 0; }
.CodeBlock {
    white-space: pre-wrap;
    overflow: auto;
    background: #102027;
    color: #ECFEFF;
    padding: 18px;
    border-radius: 16px;
    line-height: 1.6;
}
.Tree { list-style: none; padding-left: 0; display: grid; gap: 10px; }
.Tree .Tree { padding-left: 24px; margin-top: 10px; }
.Tree summary {
    cursor: pointer;
    padding: 13px 14px;
    border-radius: 14px;
    background: rgba(255,255,255,.66);
    border: 1px solid var(--Line);
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-weight: 900;
}
.Tree summary em { color: var(--Muted); font-style: normal; font-size: 13px; }
.TreeActions { padding: 10px 0 0 12px; }
.TreeActions p { flex-basis: 100%; margin: 0; }
.TreePrompt { margin-top: 10px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.Empty { color: var(--Muted); padding: 18px; text-align: center; }
.Alert { padding: 12px 14px; border-radius: 13px; margin: 14px 0; }
.Alert.Danger { background: #FEE2E2; color: #991B1B; }
.DangerPanel { border-color: rgba(239,68,68,.26); }
.LoginBody { display: grid; place-items: center; padding: 24px; }
.LoginCard { width: min(440px, 100%); padding: 30px; }
.LoginBrand { margin-bottom: 24px; }
.LoginCard h1 { margin: 0 0 8px; }
.LoginCard p { color: var(--Muted); margin: 0 0 18px; }
.Collapsed .Sidebar { width: 88px; }
.Collapsed .BrandText, .Collapsed .Menu b { display: none; }
.Collapsed .Menu a { justify-content: center; }

@media (max-width: 960px) {
    .AppShell { display: block; }
    .Sidebar { position: relative; width: 100%; height: auto; }
    .Collapsed .Sidebar { width: 100%; }
    .Collapsed .BrandText, .Collapsed .Menu b { display: block; }
    .Menu { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .StatsGrid, .PromptGrid, .SettingsGrid, .TwoColumn { grid-template-columns: 1fr; }
    .Topbar { padding: 18px; align-items: flex-start; }
    .Content { padding: 0 18px 24px; }
    .Toolbar { display: grid; }
}

h1, h2, h3, .BrandText strong, .Menu a, .Button, label, .StatCard strong {
    font-family: "Josefin Sans", "Inter";
}

.Topbar {
    align-items: stretch;
}

.PageHero {
    flex: 1;
    min-height: 76px;
    display: flex;
    align-items: center;
    padding: 18px 22px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(234,229,201,.94), rgba(108,198,203,.94));
    border: 1px solid rgba(255,255,255,.76);
    box-shadow: var(--Shadow);
}

.PageHero h1 {
    color: #11323A;
    line-height: 1;
}

.IconButton {
    align-self: center;
    color: var(--AccentDark);
}

.IconAction {
    width: 34px;
    height: 34px;
    border: 1px solid rgba(31,41,55,.09);
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,.86);
    color: #2B5961;
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
    box-shadow: 0 8px 18px rgba(31,41,55,.07);
    font-size: 13px;
}

.IconAction:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(31,41,55,.11);
    background: #FFFFFF;
}

.IconAction.Copied {
    background: #16A34A;
    color: #FFFFFF;
}

.IconAction.Primary {
    background: var(--Accent);
    color: #FFFFFF;
    border-color: rgba(255,255,255,.42);
}

.IconAction.Danger {
    background: #EF4444;
    color: #FFFFFF;
    border-color: rgba(255,255,255,.42);
}

.IconGroup {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.IconGroup form {
    margin: 0;
    display: inline-flex;
}

.Menu a,
input,
textarea,
select,
.Button,
.Panel p,
.ListItem span,
.TimelineItem span,
.TimelineItem small,
.Tree summary,
.PromptTreeCard,
.BashPreview,
.CodeBlock {
    font-size: 12px;
}

label {
    font-size: 12px;
}

.BrandText strong {
    font-size: 14px;
}

.BrandText span,
.UserBadge,
.PromptMeta,
.Tags,
.Tree summary em {
    font-size: 11px;
}

.Panel {
    padding: 18px;
}

.PanelHeader {
    margin-bottom: 14px;
}

.PanelHeader h2 {
    font-size: 16px;
}

.StatsGrid,
.PromptGrid,
.SettingsGrid,
.TwoColumn {
    gap: 14px;
}

.StatCard {
    padding: 18px;
}

.StatCard strong {
    font-size: 25px;
}

.Button {
    min-height: 36px;
    padding: 9px 12px;
}

input,
textarea,
select {
    padding: 10px 11px;
}

.Tree {
    gap: 8px;
}

.Tree .Tree {
    padding-left: 28px;
    margin-top: 8px;
    border-left: 1px dashed rgba(45,149,163,.36);
}

.Tree li {
    position: relative;
}

.Tree summary {
    min-height: 42px;
    align-items: center;
    transition: background .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.Tree summary:hover {
    background: rgba(255,255,255,.9);
    border-color: rgba(79,183,197,.34);
    box-shadow: 0 10px 22px rgba(31,41,55,.08);
}

.Tree summary span {
    display: inline-flex;
    align-items: center;
    gap: 9px;
}

details[open] > .NestedPromptList,
details[open] > .Tree,
details[open] > .TreeActions {
    animation: TreeReveal .22s ease both;
}

@keyframes TreeReveal {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.NestedPromptList {
    display: grid;
    gap: 10px;
    margin: 10px 0 4px 30px;
    padding-left: 14px;
    border-left: 3px solid rgba(79,183,197,.32);
}

.PromptIndexTree > li > details > .NestedPromptList {
    margin-left: 34px;
}

.PromptTreeCard {
    background: rgba(255,255,255,.72);
    border: 1px solid rgba(31,41,55,.09);
    border-radius: 15px;
    padding: 12px;
    box-shadow: 0 10px 24px rgba(31,41,55,.07);
}

.PromptTreeTop {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.PromptTreeTop strong {
    font-family: "Josefin Sans", "Inter";
    font-size: 13px;
    line-height: 1.25;
}

.BashPreview,
.CodeBlock {
    margin: 0;
    white-space: pre-wrap;
    overflow: auto;
    background: linear-gradient(135deg, #0E252C, #123D45);
    color: #ECFEFF;
    padding: 13px;
    border-radius: 13px;
    line-height: 1.55;
    font-family: "Inter", "Josefin Sans";
}

.TreeActions {
    padding-left: 34px;
}

.TreeActions p,
.PromptCard p,
.Tags {
    display: none;
}

.UncategorizedBlock {
    margin-top: 18px;
}

.UncategorizedBlock h3 {
    font-size: 14px;
    margin: 0 0 10px;
}

.Collapsed .BrandLogo {
    width: 42px;
    height: 42px;
}

@media (max-width: 960px) {
    body {
        font-size: 12px;
    }
    .Topbar {
        display: grid;
        grid-template-columns: 42px 1fr;
    }
    .UserBadge {
        grid-column: 1 / -1;
        margin-left: 0;
        width: max-content;
    }
    .PageHero {
        min-height: 58px;
        padding: 14px 16px;
    }
    .Topbar h1 {
        font-size: 18px;
    }
    .NestedPromptList {
        margin-left: 12px;
        padding-left: 10px;
    }
    .Tree .Tree {
        padding-left: 16px;
    }
}
