:root {
    --bg: #f6f7f9;
    --panel: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --line: #e2e8f0;
    --soft: #f1f5f9;
    --black: #0f172a;
    --green: #059669;
    --green-bg: #ecfdf5;
    --orange: #ea580c;
    --orange-bg: #fff7ed;
    --red: #dc2626;
    --amber: #f59e0b;
    --shadow: 0 20px 50px rgba(15, 23, 42, .10);
    --radius: 18px;
    --preview-width: 420px;
}

* {
    box-sizing: border-box
}

html,
body {
    height: 100%;
    margin: 0
}

body {
    font-family: "Poppins", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow: hidden;
    font-synthesis: none;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
    font-family: inherit
}

button {
    cursor: pointer
}

.material-symbols-rounded {
    font-variation-settings: 'FILL' 0, 'wght' 500, 'GRAD' 0, 'opsz' 24;
    font-size: 20px;
    line-height: 1;
}

.fill {
    font-variation-settings: 'FILL' 1, 'wght' 600, 'GRAD' 0, 'opsz' 24
}

.app {
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    background: linear-gradient(135deg, #f8fafc 0%, #f3f4f6 48%, #eef2ff 100%)
}

.header {
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, .82);
    backdrop-filter: blur(18px);
    position: relative;
    z-index: 20;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px
}

.logo {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    color: white;
    background: #0f172a;
    box-shadow: 0 12px 28px rgba(15, 23, 42, .22);
}

.brand-title {
    font-weight: 700;
    line-height: 1;
    font-size: 16px
}

.brand-sub {
    font-size: 12px;
    color: var(--muted);
    margin-top: 4px
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px
}

.pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--soft);
    color: #475569;
    border-radius: 999px;
    padding: 9px 13px;
    font-size: 13px;
    font-weight: 500;
}

.btn {
    border: 0;
    height: 40px;
    border-radius: 13px;
    padding: 0 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
    transition: .2s ease;
    white-space: nowrap;
}

.btn-primary {
    background: var(--black);
    color: white;
    box-shadow: 0 12px 24px rgba(15, 23, 42, .18)
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 30px rgba(15, 23, 42, .22)
}

.btn-light {
    background: white;
    border: 1px solid var(--line);
    color: var(--text)
}

.btn-light:hover {
    background: var(--soft)
}

.btn-danger {
    background: white;
    border: 1px solid var(--line);
    color: var(--red)
}

.btn-danger:hover {
    background: #fef2f2
}

.layout {
    height: calc(100vh - 64px);
    display: grid;
    grid-template-columns: 260px minmax(460px, 1fr) 10px var(--preview-width);
    overflow: hidden;
}

.sidebar {
    background: rgba(255, 255, 255, .9);
    border-right: 1px solid var(--line);
    padding: 20px 16px;
    overflow: auto;
    backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
}

.section-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #94a3b8;
    margin: 0 0 12px;
}

.nav-stack {
    display: flex;
    flex-direction: column;
    gap: 6px
}

.nav-btn {
    width: 100%;
    border: 0;
    background: transparent;
    color: #475569;
    border-radius: 13px;
    padding: 11px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    transition: .18s ease;
    font-weight: 500;
    font-size: 14px;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 10px
}

.nav-btn:hover {
    background: #f1f5f9
}

.nav-btn.active {
    background: #0f172a;
    color: white;
    box-shadow: 0 14px 28px rgba(15, 23, 42, .16)
}

.nav-count {
    font-size: 12px;
    color: #94a3b8
}

.nav-btn.active .nav-count {
    color: rgba(255, 255, 255, .72)
}

.mini-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
    margin-top: 28px;
}

.public-sidebar-bottom {
    margin-top: auto;
}

.public-sidebar-bottom .mini-stats {
    margin-top: 0;
}

.public-sidebar-bottom .admin-shortcut {
    margin-top: 14px;
}

.admin-shortcut {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 13px;
    border-radius: 15px;
    background: #0f172a;
    color: white;
    text-decoration: none;
    box-shadow: 0 14px 28px rgba(15, 23, 42, .16);
    transition: .18s ease;
}

.admin-shortcut:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 34px rgba(15, 23, 42, .22);
}

.admin-shortcut .material-symbols-rounded {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .12);
    display: grid;
    place-items: center;
}

.admin-shortcut strong,
.admin-shortcut small {
    display: block;
}

.admin-shortcut strong {
    font-size: 14px;
    line-height: 1;
}

.admin-shortcut small {
    margin-top: 4px;
    color: rgba(255, 255, 255, .68);
    font-size: 12px;
}

.mini-stat {
    border-radius: 15px;
    background: var(--soft);
    padding: 14px;
    transition: .2s ease;
}

.mini-stat:hover {
    transform: translateY(-2px)
}

.mini-value {
    font-size: 22px;
    font-weight: 700
}

.mini-label {
    font-size: 12px;
    color: var(--muted)
}

.main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.toolbar {
    background: rgba(255, 255, 255, .86);
    border-bottom: 1px solid var(--line);
    padding: 20px 24px;
    backdrop-filter: blur(18px);
}

.toolbar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

h1 {
    font-size: 26px;
    margin: 0;
    font-weight: 700;
    letter-spacing: 0
}

.result-pill {
    background: var(--soft);
    color: #475569;
    border-radius: 999px;
    padding: 8px 13px;
    font-size: 13px;
    font-weight: 600;
}

.filters {
    display: grid;
    grid-template-columns: 1fr 160px 150px;
    gap: 12px;
}

.field {
    position: relative
}

.field .material-symbols-rounded {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    background: rgba(248, 250, 252, .9);
    outline: none;
    border-radius: 13px;
    color: var(--text);
    transition: .18s ease;
}

input,
select {
    height: 44px;
    padding: 0 13px
}

.field input {
    padding-left: 42px
}

textarea {
    min-height: 210px;
    padding: 13px;
    resize: vertical;
    line-height: 1.55
}

input:focus,
select:focus,
textarea:focus {
    background: white;
    border-color: #94a3b8;
    box-shadow: 0 0 0 4px rgba(148, 163, 184, .15);
}

.list {
    flex: 1;
    overflow: auto;
    padding: 16px 24px;
}

.prompt-row {
    width: 100%;
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .86);
    border-radius: 18px;
    padding: 13px 14px;
    margin-bottom: 12px;
    text-align: left;
    transition: .18s ease;
    animation: fadeUp .28s ease both;
    backdrop-filter: blur(12px);
    cursor: pointer;
}

.prompt-row:hover {
    transform: translateY(-2px);
    border-color: #cbd5e1;
    box-shadow: 0 14px 34px rgba(15, 23, 42, .08);
}

.prompt-row.active {
    border-color: #0f172a;
    box-shadow: 0 0 0 3px rgba(15, 23, 42, .06), 0 18px 40px rgba(15, 23, 42, .08);
}

.prompt-row:focus-visible {
    outline: 3px solid rgba(15, 23, 42, .18);
    outline-offset: 2px;
}

.file-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: var(--soft);
    color: #475569;
}

.row-title {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0
}

.row-title b {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.row-prompt {
    font-size: 13px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 3px
}

.row-meta {
    display: flex;
    gap: 13px;
    align-items: center;
    flex-wrap: wrap;
    font-size: 11px;
    color: #94a3b8;
    margin-top: 8px
}

.meta-item {
    display: flex;
    gap: 4px;
    align-items: center
}

.row-actions {
    display: flex;
    align-items: center;
    gap: 5px
}

.icon-btn {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #94a3b8;
    display: grid;
    place-items: center;
    transition: .16s ease;
}

.icon-btn:hover {
    background: var(--soft);
    color: var(--text)
}

.icon-btn.starred {
    color: var(--amber)
}

.empty {
    height: 60%;
    display: grid;
    place-items: center;
    color: #94a3b8;
    font-weight: 500;
}

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 700;
    border: 1px solid transparent;
    white-space: nowrap;
}

.badge.green {
    color: var(--green);
    background: var(--green-bg);
    border-color: #bbf7d0
}

.badge.orange {
    color: var(--orange);
    background: var(--orange-bg);
    border-color: #fed7aa
}

.badge.slate {
    color: #475569;
    background: var(--soft);
    border-color: var(--line)
}

.resizer {
    position: relative;
    cursor: col-resize;
    background: transparent;
}

.resizer::before {
    content: "";
    position: absolute;
    inset: 0;
    left: 50%;
    width: 1px;
    transform: translateX(-50%);
    background: var(--line);
    transition: .2s;
}

.resizer::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 6px;
    height: 48px;
    border-radius: 999px;
    background: #cbd5e1;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: .2s;
}

.resizer:hover::before {
    background: #94a3b8
}

.resizer:hover::after {
    opacity: 1
}

.preview {
    background: rgba(255, 255, 255, .92);
    overflow: hidden;
    backdrop-filter: blur(20px);
}

.preview-inner {
    height: 100%;
    display: flex;
    flex-direction: column
}

.preview-head {
    padding: 20px;
    border-bottom: 1px solid var(--line);
}

.preview-head-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px
}

.preview h2 {
    font-size: 20px;
    line-height: 1.2;
    margin: 0;
    font-weight: 700;
    letter-spacing: 0
}

.preview-date {
    font-size: 12px;
    color: var(--muted);
    margin-top: 7px
}

.tag-list {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
    margin-top: 13px
}

.preview-body {
    flex: 1;
    overflow: auto;
    padding: 20px;
}

.prompt-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 9px;
}

pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    background: #0f172a;
    color: #f8fafc;
    border-radius: 18px;
    padding: 17px;
    font-size: 13px;
    line-height: 1.65;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06);
}

.notes {
    margin-top: 18px;
    background: var(--soft);
    border-radius: 18px;
    padding: 15px;
    color: #475569;
    font-size: 13px;
    line-height: 1.55;
}

.notes-title {
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px
}

.preview-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
    padding: 14px;
    border-top: 1px solid var(--line);
}

.modal-layer {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    place-items: center;
    background: rgba(15, 23, 42, .42);
    backdrop-filter: blur(14px);
    padding: 20px;
}

.modal-layer.show {
    display: grid;
    animation: fadeIn .18s ease
}

.modal {
    width: min(760px, 100%);
    max-height: 92vh;
    overflow: auto;
    background: rgba(255, 255, 255, .94);
    border: 1px solid rgba(255, 255, 255, .6);
    border-radius: 24px;
    padding: 24px;
    box-shadow: var(--shadow);
    animation: pop .2s ease;
}

.modal-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px
}

.modal-title {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 0
}

.modal-sub {
    font-size: 13px;
    color: var(--muted);
    margin-top: 3px
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px
}

label {
    display: block
}

.label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: #475569;
    margin-bottom: 7px
}

.full {
    grid-column: 1/-1
}

.tag-editor {
    display: flex;
    gap: 9px
}

.tag-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px
}

.tag-chip {
    border: 0;
    border-radius: 999px;
    background: var(--soft);
    color: #475569;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px
}

.toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 200;
    background: #0f172a;
    color: white;
    border-radius: 16px;
    padding: 12px 15px;
    display: flex;
    align-items: center;
    gap: 9px;
    box-shadow: var(--shadow);
    transform: translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: .22s ease;
    font-size: 13px;
    font-weight: 600;
}

.toast.show {
    transform: translateY(0);
    opacity: 1
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(8px)
    }

    to {
        opacity: 1;
        transform: translateY(0)
    }
}

@keyframes fadeIn {
    from {
        opacity: 0
    }

    to {
        opacity: 1
    }
}

@keyframes pop {
    from {
        opacity: 0;
        transform: translateY(18px) scale(.98)
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1)
    }
}

@media(max-width:1000px) {
    .layout {
        grid-template-columns: 220px 1fr
    }

    .resizer,
    .preview {
        display: none
    }

    .filters {
        grid-template-columns: 1fr
    }

    .pill {
        display: none
    }
}
