:root {
    --bg-main: #f4f6f9;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-muted: #64748b;
    --accent: #4f46e5;
    --accent-light: rgba(79, 70, 229, 0.06);
    --border: #e2e8f0;
    --danger: #ef4444;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-main: #0f172a;
        --card-bg: #1e293b;
        --text-primary: #f8fafc;
        --text-muted: #94a3b8;
        --border: #334155;
        --accent: #6366f1;
        --accent-light: rgba(99, 102, 241, 0.08);
        --shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* App Containers and Layout Structures */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
}

.app-header {
    height: 56px;
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0.375rem;
    position: sticky;
    top: 0;
    z-index: 10;
}

.app-header h1 {
    font-size: 1.25rem;
    font-weight: 700;
}

.view-content-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0.25rem calc(76px + var(--safe-bottom)) 0.25rem;
}

/* Sticky Bottom Navigation Bar Styles */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(60px + var(--safe-bottom));
    background-color: var(--card-bg);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding-bottom: var(--safe-bottom);
    z-index: 100;
}

.nav-item {
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    width: 25%;
    height: 100%;
    justify-content: center;
    cursor: pointer;
    transition: color 0.15s ease;
}

.nav-item.active {
    color: var(--accent);
    font-weight: 600;
}

.nav-icon {
    font-size: 1.4rem;
    margin-bottom: 2px;
}

/* Panel Hiding Logic Layouts */
.nav-view-panel {
    display: none;
}
.nav-view-panel.active {
    display: block;
}
.visual-hidden {
    display: none !important;
}

/* Cards & UI Elements */
.editor-card, .panel-box, .memory-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.75rem 0.5rem;
    margin-bottom: 0.75rem;
    box-shadow: var(--shadow);
}

.section-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    margin: 1.25rem 0.25rem 0.5rem 0.25rem;
}

/* Form Inputs styling structures */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.input-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

textarea, input[type="text"], input[type="password"], input[type="url"] {
    width: 100%;
    padding: 0.65rem 0.5rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    resize: none;
}

textarea {
    min-height: 120px;
}

/* Buttons Design Archetypes */
button {
    background-color: var(--accent);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 0.75rem 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: opacity 0.1s ease;
}
button:active {
    opacity: 0.85;
}

.secondary-btn {
    background-color: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
}

.danger-btn {
    background-color: var(--danger);
    color: white;
}

.icon-btn {
    background: none;
    width: auto;
    padding: 0.5rem;
    font-size: 1.25rem;
}

.text-link-btn {
    background: none;
    color: var(--accent);
    width: auto;
    padding: 0;
    font-size: 0.9rem;
}

/* FAB Floating Action Button Styling */
.fab-btn {
    position: fixed;
    bottom: calc(72px + var(--safe-bottom));
    right: 0.5rem;
    width: 52px;
    height: 52px;
    border-radius: 26px;
    font-size: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4);
    z-index: 90;
}

/* Custom Row layout elements */
.back-bar {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    align-items: center;
    padding: 0 0.25rem;
}

.config-actions-row {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.batch-action-banner {
    background: var(--accent-light);
    border: 1px dashed var(--accent);
    border-radius: 10px;
    padding: 0.75rem 0.5rem;
    margin-bottom: 0.75rem;
}

.batch-action-banner p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0.25rem 0 0.75rem 0;
}

/* Agent Custom Insight Area row card item variables */
.agent-row-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.75rem 0.5rem;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.agent-row-title {
    font-weight: 600;
}

.agent-insight-edit-box {
    min-height: 80px;
    margin-top: 0.5rem;
    background-color: var(--card-bg);
    border-color: var(--border);
}

/* Modals Overlay Configurations */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0;
}

.modal-content {
    background-color: var(--card-bg);
    border-radius: 12px;
    padding: 0.75rem 0.4rem;
    width: 100%;
    max-width: 600px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

.modal-content h2 {
    margin-bottom: 0.4rem;
    font-size: 1.25rem;
}

.modal-content p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.memory-card-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.memory-text {
    font-size: 1rem;
    line-height: 1.45;
    white-space: pre-wrap;
}

.status-msg {
    font-size: 0.85rem;
    font-style: italic;
    margin-top: 0.5rem;
    color: var(--accent);
}

.backup-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}
