* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    padding-top: 92px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    padding: 0.5rem 2rem 2rem 2rem;
}

.navbar .container {
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    padding: 0 20px;
}

[data-theme="light"] .navbar {
    background: #f5f3ff;
    border-bottom: 1px solid #e9d5ff;
}

[data-theme="light"] .navbar .nav-menu a {
    color: #1f2937;
}

[data-theme="light"] .navbar .nav-menu a:hover {
    color: #6d28d9;
}

[data-theme="light"] .navbar .nav-theme-toggle {
    border-color: #e9d5ff;
    color: #1f2937;
}

.header {
    text-align: center;
    margin-bottom: 0 !important;
    margin-top: 0 !important;
    padding-bottom: 10px !important;
    padding-top: 20px !important;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
}

[data-theme="light"] .header {
    background: #e6e0ff !important;
}

[data-theme="light"] .header h1 {
    color: #1f1b3a !important;
}

[data-theme="light"] .header .subtitle {
    color: #3b3566 !important;
}

.header::before,
.header::after {
    content: none !important;
    display: none !important;
}

.header * {
    background: transparent !important;
    box-shadow: none !important;
}

.header h1 {
    color: #0f172a;
    margin-bottom: 0 !important;
    margin-top: 0 !important;
    font-size: 1.9rem !important;
    line-height: 1.2 !important;
    padding: 0 !important;
    letter-spacing: 0.02em;
}

.header .subtitle {
    color: #334155;
    font-size: 0.85rem !important;
    margin-top: 0.25rem !important;
    margin-bottom: 0 !important;
    padding: 0 !important;
    line-height: 1.3 !important;
}

.main-layout {
    display: grid;
    grid-template-columns: 310px 1fr;
    gap: 1.5rem;
}

.sidebar {
    background: #f9fafb;
    border-radius: 12px;
    padding: 1.25rem;
    border: 1px solid #9ca3af;
    height: fit-content;
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.content-area {
    min-width: 0;
}

.type-tabs-panel {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #dbe3ef;
    border-radius: 14px;
    padding: 1rem 1rem 0.9rem;
    margin-bottom: 1rem;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.05);
}

.type-tabs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.8rem;
}

.type-tabs-header h3 {
    font-size: 1rem;
    margin: 0;
    color: #0f172a;
}

.quick-type-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.type-tab {
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #334155;
    border-radius: 999px;
    padding: 0.42rem 0.8rem;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s ease;
}

.type-tab:hover {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #1d4ed8;
}

.type-tab.active {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: #ffffff;
    box-shadow: 0 8px 18px rgba(29, 78, 216, 0.22);
}

.type-tab.zero {
    opacity: 0.6;
}

.type-tab-count {
    opacity: 0.8;
    margin-left: 0.25rem;
}

.upload-section {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    border: 2px dashed #6366f1;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
}

.upload-section:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(139, 92, 246, 0.15) 100%);
}

.upload-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.upload-buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 1rem;
    flex-wrap: wrap;
}

/* ========================
   BUTTONS
======================== */
.btn {
    padding: 0.65rem 1.25rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.btn-secondary {
    background: white;
    color: #6366f1;
    border: 1.5px solid #6366f1;
}

.btn-secondary:hover {
    background: #6366f1;
    color: white;
}

.btn-small {
    padding: 0.4rem 0.85rem;
    font-size: 0.8rem;
}

.btn-export {
    background: linear-gradient(135deg, #6366f1, #7c3aed);
    color: white;
    border: none;
}

.btn-export:hover {
    background: linear-gradient(135deg, #4f46e5, #6d28d9);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.btn-download {
    background: #10b981;
    color: white;
}

.btn-download:hover {
    background: #059669;
}

.btn-like {
    background: #f3f4f6;
    color: #6b7280;
}

.btn-like:hover,
.btn-like.liked {
    background: #fee2e2;
    color: #dc2626;
}

.btn-json-manager {
    background: #8b5cf6;
    color: white;
}

.btn-json-manager:hover {
    background: #7c3aed;
}

/* ========================
   FILTERS
======================== */
.filter-section {
    margin-bottom: 1rem;
}

.filter-section h3 {
    font-size: 1rem;
    color: #1f2937;
    margin-bottom: 0.75rem;
    font-weight: 700;
}

.filter-group {
    margin-bottom: 0.75rem;
}

.filter-group label {
    display: block;
    font-size: 0.8rem;
    color: #6b7280;
    margin-bottom: 0.3rem;
    font-weight: 500;
}

.filter-group select,
.filter-group input {
    width: 100%;
    padding: 0.4rem 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.8rem;
}

.quick-tag-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    max-height: 160px;
    overflow: auto;
    padding: 0.2rem 0;
}

.quick-tag-empty {
    font-size: 0.78rem;
    color: #6b7280;
}

/* ========================
   CARDS GRID
======================== */
.shared-items {
    display: grid;
    gap: 1.25rem;
}

/* ========================
   CARD BASE
======================== */
.shared-item {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 1.25rem 1.4rem;
    transition: all 0.22s ease;
    user-select: text;
    position: relative;
    overflow: hidden;
}

.shared-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #6366f1, #a855f7);
    opacity: 0;
    transition: opacity 0.22s ease;
    border-radius: 14px 14px 0 0;
}

.shared-item:hover {
    border-color: #818cf8;
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.12);
    transform: translateY(-1px);
}

.shared-item:hover::before {
    opacity: 1;
}

/* ========================
   CARD HEADER
======================== */
.item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.9rem;
    gap: 0.75rem;
}

.item-header-left {
    flex: 1;
    min-width: 0;
}

.item-title {
    font-size: 1rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 0.2rem;
    line-height: 1.3;
    word-break: break-word;
}

.item-author {
    font-size: 0.78rem;
    color: #9ca3af;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.item-author-name {
    color: #6b7280;
    font-weight: 500;
}

.item-badges {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.badge {
    padding: 0.22rem 0.65rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.badge-strategy {
    background: #dbeafe;
    color: #1e40af;
}

.badge-expression {
    background: #fce7f3;
    color: #9f1239;
}

.badge-idea {
    background: #fef3c7;
    color: #92400e;
}

.badge-stats {
    background: #d1fae5;
    color: #065f46;
}

/* ========================
   CARD CONTENT — EXPRESSION
======================== */
.expr-info-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.expr-info-row {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    font-size: 0.865rem;
    line-height: 1.5;
}

.expr-info-label {
    flex-shrink: 0;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.18rem 0.55rem;
    border-radius: 20px;
    min-width: 72px;
    text-align: center;
    margin-top: 0.1rem;
}

.expr-info-label.lbl-desc {
    background: #eff6ff;
    color: #1d4ed8;
}

.expr-info-label.lbl-logic {
    background: #f5f3ff;
    color: #6d28d9;
}

.expr-info-label.lbl-math {
    background: #fdf4ff;
    color: #86198f;
}

.expr-info-label.lbl-use {
    background: #ecfdf5;
    color: #065f46;
}

.expr-info-label.lbl-app {
    background: #fff7ed;
    color: #9a3412;
}

.expr-info-label.lbl-verify {
    background: #fff0f3;
    color: #9f1239;
}

.expr-info-label.lbl-abc {
    background: #f0fdf4;
    color: #14532d;
}

.expr-info-label.lbl-trend {
    background: #fefce8;
    color: #713f12;
}

.expr-info-label.lbl-left {
    background: #f8fafc;
    color: #475569;
}

.expr-info-label.lbl-op {
    background: #f8fafc;
    color: #475569;
}

.expr-info-label.lbl-right {
    background: #f8fafc;
    color: #475569;
}

.expr-info-text {
    color: #374151;
    flex: 1;
    word-break: break-word;
}

/* ========================
   CARD CONTENT — STRATEGY / OTHER
======================== */
.item-description {
    color: #4b5563;
    font-size: 0.875rem;
    max-width: 72ch;
    margin-bottom: 0.85rem;
    line-height: 1.65;
    user-select: text;
}

.desc-preview {
    color: #4b5563;
    line-height: 1.55;
    margin-bottom: 0.2rem;
}

.desc-full {
    color: #374151;
    line-height: 1.65;
}

.item-description-toggle {
    margin-top: -0.3rem;
    margin-bottom: 0.8rem;
}

/* ========================
   EXECUTION DATA / SNAPSHOT
======================== */
.execution-data-section {
    background: #f0f9ff;
    border-left: 3px solid #3b82f6;
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
}

.execution-stat {
    margin-bottom: 0.4rem;
    color: #1e40af;
}

.execution-snapshot {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
}

.snapshot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.snapshot-header h4 {
    font-size: 0.85rem;
    color: #1f2937;
    margin: 0;
    font-weight: 600;
}

.snapshot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.45rem;
}

.snapshot-item {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 7px;
    padding: 0.45rem 0.6rem;
}

.snapshot-label {
    display: block;
    font-size: 0.68rem;
    color: #64748b;
    margin-bottom: 0.1rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.snapshot-value {
    font-size: 0.85rem;
    color: #111827;
    font-weight: 600;
}

/* ========================
   QUICK META / STATS TEXT
======================== */
.item-extra {
    margin-bottom: 0.85rem;
    padding: 0.6rem 0.75rem;
    background: #f9fafb;
    border-radius: 7px;
    font-size: 0.82rem;
}

.item-quick-meta {
    font-size: 0.78rem;
    color: #475569;
}

.item-stats-text {
    background: #f9fafb;
    padding: 0.4rem 0.65rem;
    border-radius: 6px;
    font-size: 0.82rem;
    color: #4b5563;
    margin-bottom: 0.65rem;
}

/* ========================
   TAGS
======================== */
.item-tags {
    margin-bottom: 0.85rem;
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.tag {
    background: #f3f4f6;
    color: #6b7280;
    padding: 0.2rem 0.65rem;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 500;
}

.tag-button {
    border: 1px solid #e5e7eb;
    cursor: pointer;
}

.tag-button:hover {
    background: #e0e7ff;
    color: #3730a3;
    border-color: #a5b4fc;
}

.quick-left-type-filters {
    max-height: 220px;
}

.tag-left-type {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.tag-left-type.active {
    background: #dbeafe;
    color: #1d4ed8;
    border-color: #60a5fa;
}

.tag-left-type.disabled {
    opacity: 0.55;
}

.tag-count {
    font-size: 0.68rem;
    opacity: 0.8;
}

/* ========================
   CARD FOOTER
======================== */
.item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 0.9rem;
    border-top: 1px solid #f1f5f9;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.item-stats {
    display: flex;
    gap: 1.1rem;
    font-size: 0.82rem;
    align-items: center;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: #9ca3af;
    font-weight: 500;
}

.stat-icon {
    font-size: 0.95rem;
}

.item-actions {
    display: flex;
    gap: 0.45rem;
    align-items: center;
    flex-wrap: wrap;
}

.vote-section {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.vote-label {
    font-size: 0.78rem;
    color: #9ca3af;
}

.star-rating {
    display: flex;
    gap: 0.15rem;
    cursor: pointer;
}

.star {
    font-size: 1.1rem;
    color: #e5e7eb;
    transition: all 0.15s ease;
    line-height: 1;
}

.star:hover {
    color: #fbbf24;
    transform: scale(1.2);
}

.star.active {
    color: #fbbf24;
}

.vote-count {
    font-size: 0.72rem;
    color: #d1d5db;
}

/* ========================
   PACK CARDS
======================== */
.pack-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1rem 1.2rem;
    transition: all 0.2s ease;
}

.pack-card:hover {
    border-color: #818cf8;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.1);
}

.pack-card h4 {
    margin: 0 0 0.35rem 0;
    font-size: 1rem;
    color: #0f172a;
    font-weight: 700;
}

.pack-meta {
    color: #475569;
    font-size: 0.82rem;
    margin-bottom: 0.5rem;
}

.pack-glossary {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.5rem 0.65rem;
    font-size: 0.82rem;
    color: #334155;
    margin-bottom: 0.5rem;
}

.pack-expr-list {
    font-size: 0.82rem;
    color: #334155;
    line-height: 1.5;
    margin-bottom: 0.65rem;
}

/* ========================
   EMPTY STATE
======================== */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: #9ca3af;
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* ========================
   MODALS
======================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: #1a1a2e;
    border-radius: 16px;
    padding: 1.25rem;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid #3a3a5e;
}

.modal-content,
.modal-header,
.modal-header h2,
.modal-header p,
.form-group label,
.form-group input,
.form-group textarea,
.form-group select,
.close-btn {
    transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.modal-header h2 {
    color: #e5e7eb;
    font-size: 1.2rem;
}

.modal-header p {
    color: #9ca3af;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #9ca3af;
}

.close-btn:hover {
    color: #e5e7eb;
}

/* Snapshot / Details modals */
.snapshot-modal {
    max-width: 720px;
}

.details-modal {
    width: min(96vw, 1320px);
    max-width: 1320px;
}

.details-modal-body {
    padding: 0.4rem 0.4rem 1rem;
    color: inherit;
    font-size: 1rem;
}

.details-section {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 0.75rem 0.9rem;
    margin-bottom: 0.75rem;
    background: #f9fafb;
    user-select: text;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 0.6rem;
}

.details-grid-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.details-item {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 0.6rem 0.7rem;
    min-width: 0;
    align-self: start;
}

.details-item .snapshot-label {
    font-size: 0.72rem;
}

.details-item .snapshot-value {
    font-size: 1.02rem;
    display: block;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.35;
    min-width: 0;
}

.details-item .snapshot-value code {
    display: block;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.35;
    max-width: 100%;
}

.details-sketch pre {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    line-height: 1.45;
}

.channel-sketch-compact {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
    gap: 0.85rem;
    align-items: start;
}

.channel-sketch-lines,
.channel-sketch-meta {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 0.8rem 0.9rem;
}

.channel-line-row {
    display: grid;
    grid-template-columns: minmax(180px, 220px) 1fr minmax(180px, 220px);
    gap: 0.6rem;
    align-items: center;
}

.channel-line-label,
.channel-line-note,
.channel-gap-note,
.channel-sketch-meta {
    font-size: 0.93rem;
    line-height: 1.45;
}

.channel-line-label {
    font-weight: 600;
}

.channel-line-bar {
    height: 3px;
    border-radius: 999px;
    background: linear-gradient(90deg, #64748b, #334155);
}

.channel-gap-note {
    margin: 0.45rem 0 0.7rem;
    padding-left: 0.1rem;
    color: #475569;
}

.channel-sketch-meta {
    display: grid;
    gap: 0.5rem;
}

.details-bottom-download {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.details-bottom-download .btn {
    min-width: 180px;
}

@media (max-width: 900px) {
    .details-grid-summary {
        grid-template-columns: 1fr;
    }

    .channel-sketch-compact {
        grid-template-columns: 1fr;
    }

    .channel-line-row {
        grid-template-columns: 1fr;
        gap: 0.35rem;
    }
}

.details-report {
    margin-top: 0.5rem;
    background: #0b1020;
    color: #e5e7eb;
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 0.95rem;
    overflow: auto;
    max-height: 420px;
    border: 1px solid #1f2937;
    user-select: text;
}

.details-report-frame {
    width: 100%;
    height: min(70vh, 820px);
    min-height: 420px;
    border: 0;
    border-radius: 6px;
    background: #0b1020;
}

.details-modal-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
    margin-right: 0.5rem;
}

.details-guide-block {
    border: 1px solid rgba(99, 102, 241, 0.14);
}

.details-guide-intro {
    margin: 0 0 0.75rem 0;
    color: #475569;
    line-height: 1.55;
}

.details-guide-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
}

.details-guide-card {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 0.9rem 1rem;
}

.details-guide-label {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 0.55rem;
}

.details-guide-list {
    margin: 0;
    padding-left: 1rem;
    color: #0f172a;
    line-height: 1.5;
}

.details-guide-list li + li {
    margin-top: 0.35rem;
}

.details-guide-foot {
    margin-top: 0.8rem;
    padding-top: 0.8rem;
    border-top: 1px dashed rgba(148, 163, 184, 0.35);
    color: #334155;
}

.snapshot-modal-body {
    padding: 0.5rem 0.25rem 1rem;
}

.snapshot-modal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
}

.snapshot-modal-item {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 0.75rem;
}

.snapshot-modal-item .snapshot-label {
    font-size: 0.75rem;
}

.snapshot-modal-item .snapshot-value {
    font-size: 0.95rem;
}

/* Form groups */
.form-group {
    margin-bottom: 0.875rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: #e5e7eb;
    margin-bottom: 0.375rem;
    font-size: 0.875rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.625rem;
    border: 1px solid #3a3a5e;
    border-radius: 8px;
    font-size: 0.875rem;
    font-family: inherit;
    background: #0f0f1e;
    color: #e5e7eb;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #6366f1;
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

.file-upload-area {
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.file-upload-area:hover {
    border-color: #6366f1;
    background: #f9fafb;
}

input[type="file"] {
    display: none;
}

/* Validation */
.validation-body {
    padding: 1.5rem;
}

.validation-summary {
    margin-bottom: 1rem;
    color: inherit;
}

.validation-status {
    font-weight: 600;
    margin-left: 0.25rem;
}

.validation-block {
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
}

.validation-block ul {
    margin: 0.5rem 0 0 1.5rem;
}

.validation-errors {
    background: #fee2e2;
    border-color: #fecaca;
    color: #991b1b;
}

.validation-errors strong {
    color: #dc2626;
}

.validation-warnings {
    background: #fef3c7;
    border-color: #fde68a;
    color: #92400e;
}

.validation-warnings strong {
    color: #d97706;
}

.validation-checks {
    background: #d1fae5;
    border-color: #a7f3d0;
    color: #047857;
}

.validation-checks strong {
    color: #059669;
}

.validation-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.validation-actions .btn {
    flex: 1;
}

.validation-actions .btn[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Messages */
.message {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    display: none;
}

.message.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #ef4444;
}

.message.success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #10b981;
}

.message.show {
    display: block;
}

@media (max-width: 1024px) {
    .main-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        max-height: none;
        overflow: visible;
    }
}

/* ====================================
   DARK THEME
==================================== */
[data-theme="dark"] body {
    background: radial-gradient(circle at top, #0f172a 0%, #05070f 55%, #03050b 100%);
    color: #e5e7eb;
}

[data-theme="dark"] .navbar {
    background: #0b1220;
    border-bottom: 1px solid #1f2937;
}

[data-theme="dark"] .navbar .nav-menu a {
    color: #cbd5f5;
}

[data-theme="dark"] .navbar .nav-menu a:hover {
    color: #60a5fa;
}

[data-theme="dark"] .navbar .nav-theme-toggle {
    border-color: #1f2937;
    color: #cbd5f5;
}

[data-theme="dark"] .container {
    background: #0b1220;
    box-shadow: 0 20px 30px rgba(2, 6, 23, 0.6);
    border: 1px solid #0f172a;
}

[data-theme="dark"] .header {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
}

[data-theme="dark"] .header h1 {
    color: #e5e7eb !important;
    background: none !important;
    -webkit-text-fill-color: #e5e7eb !important;
}

[data-theme="dark"] .header .subtitle {
    color: #94a3b8;
    background: transparent !important;
}

[data-theme="dark"] .sidebar {
    background: #0a0f1f;
    border-color: #1f2937;
    color: #e2e8f0;
}

[data-theme="dark"] .filter-section h3 {
    color: #e5e7eb;
}

[data-theme="dark"] .filter-group label {
    color: #94a3b8;
}

[data-theme="dark"] .filter-group select,
[data-theme="dark"] .filter-group input {
    background: #0b1220;
    border-color: #1f2937;
    color: #e5e7eb;
}

/* Dark card */
[data-theme="dark"] .shared-item {
    background: #0f172a;
    border-color: #1e293b;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .shared-item:hover {
    border-color: #38bdf8;
    box-shadow: 0 6px 24px rgba(56, 189, 248, 0.12);
}

[data-theme="dark"] .shared-item::before {
    background: linear-gradient(90deg, #38bdf8, #818cf8);
}

[data-theme="dark"] .item-title {
    color: #f1f5f9;
}

[data-theme="dark"] .item-author {
    color: #64748b;
}

[data-theme="dark"] .item-author-name {
    color: #94a3b8;
}

/* Dark expr info rows */
[data-theme="dark"] .expr-info-label.lbl-desc {
    background: #1e3a5f;
    color: #93c5fd;
}

[data-theme="dark"] .expr-info-label.lbl-logic {
    background: #2d1f5e;
    color: #c4b5fd;
}

[data-theme="dark"] .expr-info-label.lbl-math {
    background: #341a47;
    color: #e879f9;
}

[data-theme="dark"] .expr-info-label.lbl-use {
    background: #0f2e22;
    color: #6ee7b7;
}

[data-theme="dark"] .expr-info-label.lbl-app {
    background: #2d1a0f;
    color: #fdba74;
}

[data-theme="dark"] .expr-info-label.lbl-verify {
    background: #2b1025;
    color: #fda4af;
}

[data-theme="dark"] .expr-info-label.lbl-abc {
    background: #0f2a16;
    color: #86efac;
}

[data-theme="dark"] .expr-info-label.lbl-trend {
    background: #2c2506;
    color: #fde68a;
}

[data-theme="dark"] .expr-info-label.lbl-left,
[data-theme="dark"] .expr-info-label.lbl-op,
[data-theme="dark"] .expr-info-label.lbl-right {
    background: #1e2d40;
    color: #94a3b8;
}

[data-theme="dark"] .expr-info-text {
    color: #cbd5e1;
}

[data-theme="dark"] .item-description {
    color: #cbd5f5;
}

[data-theme="dark"] .item-extra {
    background: #0b1220;
    color: #cbd5f5;
}

[data-theme="dark"] .item-quick-meta {
    color: #94a3b8;
}

[data-theme="dark"] .item-stats-text {
    background: #0b1220;
    color: #cbd5f5;
}

[data-theme="dark"] .tag {
    background: #0b1220;
    color: #94a3b8;
    border: 1px solid #1f2937;
}

[data-theme="dark"] .tag-button:hover {
    background: #1e3a8a;
    color: #93c5fd;
    border-color: #3b82f6;
}

[data-theme="dark"] .tag-left-type.active {
    background: #1e3a8a;
    color: #bfdbfe;
    border-color: #60a5fa;
}

[data-theme="dark"] .type-tabs-panel {
    background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
    border-color: #243041;
    box-shadow: none;
}

[data-theme="dark"] .type-tabs-header h3 {
    color: #e5e7eb;
}

[data-theme="dark"] .type-tab {
    background: #0b1220;
    border-color: #334155;
    color: #cbd5e1;
}

[data-theme="dark"] .type-tab:hover {
    background: #1e3a8a;
    border-color: #60a5fa;
    color: #dbeafe;
}

[data-theme="dark"] .type-tab.active {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}

[data-theme="dark"] .type-tab.zero {
    opacity: 0.55;
}

[data-theme="dark"] .item-footer {
    border-top-color: #1e293b;
}

[data-theme="dark"] .stat-item {
    color: #64748b;
}

[data-theme="dark"] .vote-label {
    color: #64748b;
}

[data-theme="dark"] .vote-count {
    color: #475569;
}

[data-theme="dark"] .star {
    color: #374151;
}

[data-theme="dark"] .execution-data-section {
    background: #0b1220;
    border-left-color: #38bdf8;
}

[data-theme="dark"] .execution-stat {
    color: #7dd3fc;
}

[data-theme="dark"] .execution-snapshot {
    background: #0b1220;
    border-color: #1f2937;
}

[data-theme="dark"] .snapshot-header h4 {
    color: #e5e7eb;
}

[data-theme="dark"] .snapshot-item {
    background: #0f172a;
    border-color: #1f2937;
}

[data-theme="dark"] .snapshot-label {
    color: #64748b;
}

[data-theme="dark"] .snapshot-value {
    color: #e5e7eb;
}

[data-theme="dark"] .snapshot-modal-item {
    background: #0f172a;
    border-color: #1f2937;
}

[data-theme="dark"] .pack-card {
    background: #0f172a;
    border-color: #1e293b;
}

[data-theme="dark"] .pack-card h4 {
    color: #e5e7eb;
}

[data-theme="dark"] .pack-meta {
    color: #94a3b8;
}

[data-theme="dark"] .pack-glossary {
    background: #0b1220;
    border-color: #1f2937;
    color: #94a3b8;
}

[data-theme="dark"] .pack-expr-list {
    color: #94a3b8;
}

[data-theme="dark"] .details-section {
    background: #0f172a;
    border-color: #1f2937;
}

[data-theme="dark"] .details-item {
    background: #0b1220;
    border-color: #1f2937;
}

[data-theme="dark"] .details-report {
    background: #060b14;
    border-color: #1f2937;
}

[data-theme="dark"] .details-report-frame {
    background: #060b14;
}

[data-theme="dark"] .details-item .snapshot-label {
    color: #64748b;
}

[data-theme="dark"] .details-item .snapshot-value {
    color: #e5e7eb;
}

/* Modal dark */
[data-theme="dark"] .modal {
    background: rgba(0, 0, 0, 0.65);
}

[data-theme="dark"] .validation-modal-content {
    background: #0f172a;
    border-color: #1f2937;
    color: #e5e7eb;
}

[data-theme="dark"] .details-guide-intro {
    color: #cbd5e1;
}

[data-theme="dark"] .details-guide-card {
    background: rgba(15, 23, 42, 0.72);
    border-color: rgba(148, 163, 184, 0.2);
}

[data-theme="dark"] .details-guide-label {
    color: #94a3b8;
}

[data-theme="dark"] .details-guide-list,
[data-theme="dark"] .details-guide-foot {
    color: #e2e8f0;
}

[data-theme="dark"] .validation-summary {
    color: #e5e7eb;
}

[data-theme="dark"] .status-valid {
    color: #34d399;
}

[data-theme="dark"] .status-invalid {
    color: #f87171;
}

[data-theme="dark"] .validation-errors {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.35);
    color: #fecaca;
}

[data-theme="dark"] .validation-errors strong {
    color: #fca5a5;
}

[data-theme="dark"] .validation-warnings {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.35);
    color: #fde68a;
}

[data-theme="dark"] .validation-warnings strong {
    color: #fbbf24;
}

[data-theme="dark"] .validation-checks {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.35);
    color: #a7f3d0;
}

[data-theme="dark"] .validation-checks strong {
    color: #34d399;
}

/* light modal overrides */
[data-theme="light"] .modal {
    background: rgba(15, 23, 42, 0.35);
}

[data-theme="light"] .modal-content {
    background: #ffffff;
    border-color: #e5e7eb;
    box-shadow: 0 18px 30px rgba(15, 23, 42, 0.2);
    color: #111827;
}

[data-theme="light"] .modal-header h2 {
    color: #111827;
}

[data-theme="light"] .modal-header p {
    color: #6b7280;
}

[data-theme="light"] .close-btn {
    color: #6b7280;
}

[data-theme="light"] .close-btn:hover {
    color: #111827;
}

@media (max-width: 900px) {
    .details-guide-grid {
        grid-template-columns: 1fr;
    }
}

[data-theme="light"] .form-group label {
    color: #111827;
}

[data-theme="light"] .form-group input,
[data-theme="light"] .form-group textarea,
[data-theme="light"] .form-group select {
    background: #f9fafb;
    border-color: #e5e7eb;
    color: #111827;
}

[data-theme="light"] .details-section {
    background: #f9fafb;
    border-color: #e5e7eb;
}

[data-theme="light"] .details-report {
    background: #f8fafc;
    color: #111827;
    border-color: #e5e7eb;
}
