/* ==========================================================================
   PILLARS SYSTEM STYLE SHEET - MATTE LIGHT PROTOCOL CREATOR
   Theme: In the Clouds (Cheerful, Airy, Clean Light Aesthetic)
   Inspired by Apple Design Guidelines (Optimized for Readability & Performance)
   ========================================================================== */

:root {
    /* Color Palette (Warm alabaster and sky grays) */
    --bg-dark: #f3f5f8;
    --bg-card: rgba(255, 255, 255, 0.75);
    --bg-card-hover: rgba(255, 255, 255, 0.9);
    --border-color: rgba(245, 158, 11, 0.12);
    --border-color-hover: rgba(245, 158, 11, 0.3);
    
    /* System Accents (Sunset Amber & Warm Solar Colors) */
    --accent-primary: #0f172a;
    --accent-secondary: #475569;
    --accent-success: #ea580c;   /* Solar Sunset Orange */
    --accent-danger: #ef4444;    /* Crimson Red */
    --accent-warn: #f59e0b;      /* Warm Amber */
    
    /* Typography Grays (Slate tones - Enhanced Contrast) */
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #5e6b7e;
    --text-dark: #000000;
    
    /* Fonts: Clean sans-serif everywhere to reduce cognitive load */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    
    /* Grid Intensity (Light theme cells) */
    --lvl-0: #e2e8f0;
    --lvl-1: #fed7aa;
    --lvl-2: #fdba74;
    --lvl-3: #f97316;
}

/* ==========================================================================
   GLOBAL RESET & DEFAULTS
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    position: relative; /* Anchor absolute children like side pillars to the body! */
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.98rem;
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    
    /* Muted Twilight Sky Gradient (Comfort mode - Lower Glare) */
    background-image: 
        linear-gradient(180deg, #93c5fd 0%, #fda4af 50%, #94a3b8 100%);
    background-size: 100% 100%;
    background-attachment: fixed;
}

/* CRITICAL BUTTON STYLE RESET */
button {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font: inherit;
    color: inherit;
    cursor: pointer;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

/* Base Layout Container */
.container {
    max-width: 800px; /* Narrower centered single column (symmetrical fit between columns) */
    margin: 0 auto;
    padding: 3rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2.2rem;
}

/* System tags and markers */
.system-tag {
    font-size: 0.65rem;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Glass panel styled as a flat, clean card with subtle border (Optimized: Removed backdrop-filter to prevent slow scroll) */
.glass-panel {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.03), 0 1px 3px rgba(15, 23, 42, 0.01), inset 0 1px 0 rgba(255, 255, 255, 0.8);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.glass-panel:hover {
    border-color: var(--border-color-hover);
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.05), 0 2px 12px rgba(15, 23, 42, 0.01);
}

/* ==========================================================================
   HEADER & ILLUSTRATION
   ========================================================================== */
header {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: 2.2rem;
    border-bottom: 1px solid var(--border-color);
    gap: 1.5rem;
    width: 100%;
    position: relative;
    z-index: 2; /* float on top of absolute clouds background */
    margin-top: 150px; /* sit cleanly down below the clouds banner */
}

.logo-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
    gap: 0.8rem;
}

.top-cloud-banner {
    width: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    position: absolute; /* sit behind the header text */
    top: 0;
    left: 0;
    right: 0;
    z-index: 1; /* in front of columns (z-index 0) but behind header text (z-index 2) */
    pointer-events: none;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    height: 240px;
    
    /* Smooth clouds banner fade into the sky gradient background */
    -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 75%, rgba(0,0,0,0) 100%);
    mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 75%, rgba(0,0,0,0) 100%);
}

.hero-graphic-wrapper {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
}

.header-illustration {
    width: 100%;
    height: auto;
    max-height: 180px;
    min-width: 1000px;
}

/* ==========================================================================
   VIEWPORT SIDE PILLARS (MAJESTIC & TALL DYNAMIC STRUCTURE)
   ========================================================================== */
.side-pillar {
    position: absolute;
    bottom: 0;
    top: 140px; /* start exactly behind the soft lower mist layer */
    width: 160px; /* Majestic wider columns */
    z-index: 0; /* Sits behind clouds banner (z-index 1) and content cards */
    display: flex;
    flex-direction: column;
    pointer-events: none;
    opacity: 0.98;
    transition: opacity 0.3s ease;
    filter: drop-shadow(0 10px 25px rgba(15, 23, 42, 0.05));
}

.left-pillar {
    left: 0.5rem; /* closer to screen edges */
}

.right-pillar {
    right: 0.5rem; /* closer to screen edges */
}

.pillar-cap {
    width: 100%;
    height: 80px;
    flex-shrink: 0;
}

.pillar-shaft {
    width: 100%;
    flex-grow: 1; /* stretches vertically to fill page height */
}

.pillar-base {
    width: 100%;
    height: 120px;
    flex-shrink: 0;
}

@media (max-width: 1150px) {
    .side-pillar {
        display: none; /* Hide on smaller tablet/mobile viewports to prevent layout overlap */
    }
}

.logo-text-group h1 {
    font-size: 2.8rem;
    font-weight: 700;
    letter-spacing: -0.04em;
    color: #1e293b;
    text-align: center;
    margin-bottom: 0.15rem;
}

.logo-text-group .subtitle {
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    text-align: center;
    margin-top: 0.3rem;
}

.header-meta {
    display: flex;
    gap: 3rem;
    justify-content: center;
    width: 100%;
}

.meta-item {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.meta-item .label {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.meta-item .value {
    font-size: 0.8rem;
    font-weight: 500;
    margin-top: 0.2rem;
    color: var(--text-secondary);
}

.status-active {
    color: var(--text-primary);
    position: relative;
    padding-right: 12px;
}

.status-active::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    background-color: var(--accent-success);
    border-radius: 50%;
}

.profile-mode {
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 1px dotted var(--text-muted);
    transition: color 0.2s ease, border-color 0.2s ease;
}

.profile-mode:hover {
    color: var(--text-primary);
    border-bottom-color: var(--text-secondary);
}

/* ==========================================================================
   2-COLUMN DASHBOARD GRID
   ========================================================================== */
.dashboard-layout {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    align-items: stretch;
}

.directives-column {
    display: flex;
    flex-direction: column;
}

.sidebar-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-width: 420px; /* Centered compact layout below directives list */
    width: 100%;
    margin: 0 auto;
}

/* ==========================================================================
   CONSOLIDATED SIDEBAR PERFORMANCE WIDGET
   ========================================================================== */
.stats-card-panel {
    padding: 1.4rem;
}

.stats-card-panel .panel-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    padding-bottom: 0.8rem;
    margin-bottom: 1.2rem;
}

.stats-card-panel h3 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-top: 0.15rem;
    color: var(--text-secondary);
}

.stats-card-content {
    display: flex;
    flex-direction: column;
    gap: 1.4rem;
}

/* Gauge Circle */
.stats-top-row {
    display: grid;
    grid-template-columns: 85px 1fr;
    gap: 1.5rem;
    align-items: center;
}

.gauge-wrapper {
    position: relative;
    width: 85px;
    height: 85px;
}

.gauge-svg {
    transform: rotate(-90deg);
}

.gauge-bg {
    fill: none;
    stroke: rgba(0, 0, 0, 0.03);
    stroke-width: 4;
}

.gauge-fill {
    fill: none;
    stroke: var(--text-muted);
    stroke-width: 4;
    stroke-linecap: round;
    stroke-dasharray: 263.89; /* 2 * pi * 42 */
    stroke-dashoffset: 263.89;
    transition: stroke-dashoffset 0.6s cubic-bezier(0.4, 0, 0.2, 1), stroke 0.4s ease;
}

.gauge-fill.completed {
    stroke: var(--accent-success);
    filter: drop-shadow(0 0 3px rgba(234, 88, 12, 0.2));
}

.gauge-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    display: flex;
    flex-direction: column;
}

.gauge-text .number {
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1;
    color: var(--text-primary);
}

.gauge-text .subtext {
    font-size: 0.55rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.stat-numbers-block {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.stat-numbers-block .metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    padding-bottom: 2px;
}

.stat-numbers-block .number {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1;
}

.stat-numbers-block .label {
    font-size: 0.65rem;
    color: var(--text-secondary);
}

/* 30-Day Grid */
.stats-grid-row {
    border-top: 1px solid rgba(0, 0, 0, 0.03);
    padding: 0.8rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    background: rgba(15, 23, 42, 0.02); /* darker underlay container */
    border-radius: 10px;
    margin-top: 0.5rem;
}

.grid-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.grid-title {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.sync-status-badge {
    background: rgba(234, 88, 12, 0.03);
    border: 1px solid rgba(234, 88, 12, 0.12);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.55rem;
    color: var(--accent-success);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.sync-status-badge:hover {
    background: rgba(234, 88, 12, 0.08);
    border-color: rgba(234, 88, 12, 0.2);
}

.streak-grid {
    display: grid;
    grid-template-columns: repeat(10, 26px);
    grid-template-rows: repeat(3, 26px);
    gap: 6px;
    justify-content: center; /* keep grid cells centered inside the card */
}

.grid-cell {
    aspect-ratio: 1;
    background-color: var(--lvl-0);
    border-radius: 3px;
    cursor: pointer;
    position: relative;
    border: 1px solid rgba(0, 0, 0, 0.01);
    transition: background-color 0.15s ease, transform 0.15s ease;
}

.grid-cell:hover {
    transform: scale(1.18);
    z-index: 2;
}

.grid-cell::before {
    content: attr(data-date);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%) translateY(3px);
    background: #ffffff;
    color: var(--text-secondary);
    font-size: 0.6rem;
    padding: 3px 6px;
    border-radius: 3px;
    border: 1px solid rgba(0,0,0,0.06);
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.grid-cell:hover::before {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.grid-cell.lvl-0 { background-color: var(--lvl-0); }
.grid-cell.lvl-1 { background-color: var(--lvl-1); }
.grid-cell.lvl-2 { background-color: var(--lvl-2); }
.grid-cell.lvl-3 { 
    background-color: var(--lvl-3); 
    box-shadow: 0 0 5px rgba(234, 88, 12, 0.2);
}

.grid-cell.future {
    opacity: 0.15;
    cursor: not-allowed;
    pointer-events: none;
}

.grid-legend {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
    font-size: 0.6rem;
    color: var(--text-muted);
}

.legend-cell {
    width: 8px;
    height: 8px;
    border-radius: 1px;
}

/* ==========================================================================
   LIFE RULES CREATOR (LEFT COLUMN LIST)
   ========================================================================== */
.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.filter-header h2 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
}

.btn-create-rule {
    background: linear-gradient(135deg, #fbbf24 0%, #ea580c 100%);
    color: #ffffff;
    border: none;
    font-size: 0.76rem;
    font-weight: 600;
    padding: 8px 18px;
    border-radius: 20px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(234, 88, 12, 0.2);
    transition: all 0.22s ease;
}

.btn-create-rule:hover {
    background: linear-gradient(135deg, #fcd34d 0%, #f97316 100%);
    box-shadow: 0 6px 16px rgba(234, 88, 12, 0.35);
    transform: translateY(-1px);
}

.btn-manage-tags-toggle {
    background: #ffffff;
    border: 1px solid rgba(245, 158, 11, 0.2);
    color: #ea580c;
    font-size: 0.76rem;
    font-weight: 600;
    padding: 8px 18px;
    border-radius: 20px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
    transition: all 0.22s ease;
}

.btn-manage-tags-toggle:hover {
    background: #ffffff;
    border-color: rgba(245, 158, 11, 0.4);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
}

/* Sliding rule panel */
.create-rule-panel {
    padding: 1.8rem;
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    background: linear-gradient(135deg, #ffffff 0%, #f0f9ff 100%);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: 20px;
    box-shadow: 0 15px 40px rgba(15, 23, 42, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.create-rule-panel h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    padding-bottom: 0.5rem;
}

#create-rule-form {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

/* Dynamic Global Tags Manager Panel */
.tag-manager-panel {
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.panel-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    padding-bottom: 0.5rem;
}

.panel-header-row h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.close-panel-btn {
    font-size: 1.5rem;
    font-weight: 300;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
}

.close-panel-btn:hover {
    color: var(--text-primary);
}

.tag-creator-subform {
    display: flex;
    gap: 0.5rem;
}

.tag-creator-subform input {
    flex: 1;
}

.global-tags-editor-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    max-height: 250px;
    overflow-y: auto;
    padding-right: 0.3rem;
}

/* Renaming tags rows */
.tag-editor-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: 8px;
    transition: border-color 0.2s;
}

.tag-editor-row:hover {
    border-color: var(--border-color-hover);
}

.tag-editor-row .tag-color-blob {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.tag-editor-row input {
    flex: 1;
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
    font-family: var(--font-sans);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-primary);
    box-shadow: none !important;
    outline: none;
}

.btn-tag-delete {
    color: var(--text-muted);
    font-size: 0.8rem;
    transition: color 0.15s;
    background: none;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.btn-tag-delete:hover {
    color: var(--accent-danger);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-group label {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Creator Form Input Text Fields */
#create-rule-form input {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    padding: 0.6rem 0.8rem;
    border-radius: 6px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    outline: none;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.01);
    transition: all 0.2s ease;
    width: 100%;
}

#create-rule-form input:focus {
    border-color: rgba(234, 88, 12, 0.3);
    box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.06);
}

/* Dynamic Tags Selector Styling */
.tag-input-wrapper {
    display: flex;
    gap: 0.5rem;
}

.btn-secondary-action {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.06);
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 500;
    padding: 0 1.2rem;
    border-radius: 6px;
    transition: all 0.2s;
}

.btn-secondary-action:hover {
    background: #fafafa;
    border-color: rgba(0, 0, 0, 0.12);
    color: var(--text-primary);
}

.form-active-tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.2rem;
    min-height: 10px;
}

/* Dynamic Tags Badges inside form */
.tag-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.68rem;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.03);
}

.tag-badge .btn-remove-tag {
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1;
    color: inherit;
    opacity: 0.6;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 2px;
}

.tag-badge .btn-remove-tag:hover {
    opacity: 1;
}

/* Clickable Existing Tags Pills container */
.form-existing-tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.1rem;
}

.existing-tag-pill {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.05);
    color: var(--text-secondary);
    font-size: 0.7rem;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    user-select: none;
}

.existing-tag-pill:hover {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.1);
    color: var(--text-primary);
}

.existing-tag-pill.selected {
    background: var(--tag-bg);
    border-color: var(--tag-border);
    color: var(--tag-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* ==========================================================================
   SLEEK SUNSET GRADIENT ACTION BUTTONS
   ========================================================================== */
.form-actions {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-top: 0.4rem;
}

/* Sunset Gradient Save button */
.glow-btn {
    background: linear-gradient(135deg, #fbbf24 0%, #ea580c 100%);
    color: #ffffff;
    border: none;
    padding: 0.65rem 1.6rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(234, 88, 12, 0.2);
}

.glow-btn:hover {
    background: linear-gradient(135deg, #fcd34d 0%, #f97316 100%);
    box-shadow: 0 0 15px rgba(234, 88, 12, 0.35);
    transform: translateY(-1px);
}

.glow-btn:active {
    transform: translateY(0);
}

/* Clean Cancel button */
.cancel-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.65rem 1.6rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.22s ease;
}

.cancel-btn:hover {
    color: #ea580c;
    border-color: rgba(234, 88, 12, 0.2);
    background-color: rgba(234, 88, 12, 0.02);
}

/* Filters row */
.list-filters {
    margin-bottom: 0.8rem;
}

.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    background: rgba(15, 23, 42, 0.045); /* darker underlay track */
    border: 1px solid rgba(15, 23, 42, 0.06);
    padding: 3px;
    border-radius: 8px;
    width: fit-content;
    gap: 2px;
}

.filter-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease;
}

.filter-btn:hover {
    color: var(--text-secondary);
}

.filter-btn.active {
    background: #ffffff;
    color: var(--text-primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.pillars-grid {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

/* Rule Card (Minimal floating tab design) */
.rule-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.05rem 1.4rem;
    display: flex;
    flex-direction: column;
    gap: 0;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.01);
    transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.rule-card:hover {
    border-color: var(--border-color-hover);
    background-color: var(--bg-card-hover);
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.04);
}

/* COMPLIANT GLOW-BORDER (NO STRIKETHROUGH TEXT, AMBERProgress) */
.rule-card.compliant {
    border-color: rgba(234, 88, 12, 0.35);
    background-color: rgba(234, 88, 12, 0.015);
    box-shadow: 0 4px 15px rgba(234, 88, 12, 0.02);
}

.rule-card.compliant:hover {
    border-color: rgba(234, 88, 12, 0.45);
    background-color: rgba(234, 88, 12, 0.03);
}

.card-header-layout {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 1rem;
}

.card-num {
    font-size: 0.85rem;
    color: var(--text-muted);
    width: 18px;
    flex-shrink: 0;
}

/* Dynamic Card Tags List */
.card-tags-list {
    display: flex;
    flex-direction: column; /* stack tags vertically "down each other" */
    align-items: flex-start;
    gap: 0.25rem;
    width: 120px; /* fixed column width to align all titles vertically! */
    flex-shrink: 0;
}

.card-tag-pill {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 6px;
    border: none !important;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: fit-content;
}

.card-tag-pill::before {
    display: none; /* hide dot, background and text color only */
}

.rule-card h3 {
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--text-primary);
    flex-grow: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity 0.2s ease;
    margin-right: 1.5rem;
}

/* Dims but leaves text fully intact and clean (Optimistic) */
.rule-card.compliant h3 {
    opacity: 0.55;
}

/* Chevron arrow */
.btn-details {
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    width: 20px;
    height: 20px;
    transition: color 0.15s ease, transform 0.25s ease;
    flex-shrink: 0;
}

.rule-card:hover .btn-details {
    color: var(--text-secondary);
}

.rule-card.expanded .btn-details {
    transform: rotate(180deg);
    color: var(--text-primary);
}

/* Trash delete button */
.btn-delete {
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    width: 22px;
    height: 22px;
    opacity: 0;
    transition: opacity 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
}

.rule-card:hover .btn-delete {
    opacity: 1;
}

.btn-delete:hover {
    color: var(--accent-danger);
}

/* Circular Checkbox (Spring Fill animation, Solar checked state) */
.minimal-checkbox {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1.5px solid var(--text-muted);
    position: relative;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.2);
    flex-shrink: 0;
}

.rule-card:hover .minimal-checkbox {
    border-color: var(--text-secondary);
}

.rule-card.compliant .minimal-checkbox {
    border-color: var(--accent-success);
    background: linear-gradient(135deg, #fbbf24 0%, #f97316 100%);
    transform: scale(1.05);
    box-shadow: 0 0 10px rgba(234, 88, 12, 0.25);
}

.minimal-checkbox::after {
    content: '';
    position: absolute;
    left: 7px;
    top: 3px;
    width: 4px;
    height: 8px;
    border: solid #ffffff;
    border-width: 0 1.5px 1.5px 0;
    transform: rotate(45deg) scale(0);
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.2);
}

.rule-card.compliant .minimal-checkbox::after {
    transform: rotate(45deg) scale(1);
}

/* Expanded Card Description */
.expandable-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), margin-top 0.35s ease;
}

.rule-card.expanded .expandable-details {
    max-height: 150px;
    margin-top: 1.1rem;
    padding-top: 1.1rem;
    border-top: 1px solid rgba(0, 0, 0, 0.03);
}

.detail-block {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.detail-block .title {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.detail-block .content {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    background: rgba(15, 23, 42, 0.03); /* soft dark underlay box */
    padding: 0.8rem 1rem;
    border-radius: 8px;
    margin-top: 0.4rem;
}

/* ==========================================================================
   AUTHENTICATION MODAL
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.modal-card {
    width: 90%;
    max-width: 360px;
    padding: 2.2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: relative;
    border: 1px solid rgba(0, 0, 0, 0.06);
    background-color: #ffffff;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.12);
}

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

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    transition: color 0.15s ease;
}

.close-btn:hover {
    color: var(--text-primary);
}

#auth-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.auth-tabs {
    display: flex;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    margin-bottom: 0.25rem;
}

.tab-btn {
    flex: 1;
    padding: 8px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.15s;
}

.tab-btn:hover {
    color: var(--text-secondary);
}

.tab-btn.active {
    color: var(--text-primary);
    border-bottom-color: var(--text-primary);
}

#auth-form {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

#auth-form input {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    padding: 0.65rem 0.85rem;
    border-radius: 6px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s ease;
    width: 100%;
}

#auth-form input:focus {
    border-color: rgba(234, 88, 12, 0.3);
}

/* Animations */
.animate-zoom {
    animation: zoomIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ==========================================================================
   FOOTER & NOTIFICATION TOAST
   ========================================================================== */
footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    margin-top: 5rem;
    padding: 3rem 0;
    border-top: 1px solid rgba(0, 0, 0, 0.03);
    width: 100%;
}

.footer-logo {
    font-family: var(--font-sans);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 0.1rem;
}

.footer-credits {
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #94a3b8;
    text-align: center;
    line-height: 1.4;
}

.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 6px;
    padding: 0.6rem 1.2rem;
    box-shadow: 0 8px 30px rgba(15, 23, 42, 0.08);
    color: var(--text-primary);
    font-size: 0.72rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    z-index: 9999;
    opacity: 0;
    transform: translateY(6px);
    transition: all 0.25s ease;
}

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

.toast::before {
    content: "•";
    color: var(--text-secondary);
    font-weight: bold;
}

.hidden {
    display: none !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
/* ==========================================================================
   DYNAMIC ADD-RULE CARD PLACEHOLDER
   ========================================================================== */
.add-rule-card-placeholder {
    border: 2px dashed rgba(234, 88, 12, 0.25) !important;
    background: rgba(255, 255, 255, 0.4) !important;
    box-shadow: none !important;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    border-radius: 12px;
    padding: 1.2rem !important;
    transition: all 0.2s ease !important;
}

.add-rule-card-placeholder:hover {
    background: rgba(255, 255, 255, 0.8) !important;
    border-color: rgba(234, 88, 12, 0.5) !important;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(234, 88, 12, 0.05) !important;
}

.add-rule-placeholder-content {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.add-rule-placeholder-text {
    font-size: 0.98rem;
    font-weight: 600;
    color: #ea580c;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.add-rule-placeholder-text svg {
    margin-top: -1px;
}
