:root {
    --brand-primary: #1E40AF;
    --brand-secondary: #0F172A;
    --brand-success: #059669;
    --bg-main: #F1F5F9;
    --panel-bg: #FFFFFF;
    --font-main: 'Sarabun', 'Inter', sans-serif;
    --font-display: 'Noto Sans Thai', 'Inter', sans-serif;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-main);
    color: #1E293B;
    font-size: 20px;
    /* Increased from 19px for maximum readability */
    line-height: 1.7;
    /* Increased line-height for better spacing */
    letter-spacing: normal;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-display);
}

.dashboard-header {
    background: var(--brand-secondary);
    border-bottom: 2px solid #1E293B;
}

.command-card {
    background: var(--panel-bg);
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    transition: transform 0.2s, box-shadow 0.2s;
}

.command-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.section-header {
    border-bottom: 1px solid #F1F5F9;
}

.checkbox-custom {
    appearance: none;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid #CBD5E1;
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
    background: white;
}

.checkbox-custom:checked {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
}

.checkbox-custom:checked::after {
    content: '✓';
    color: white;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.875rem;
    font-weight: bold;
}

.score-gauge {
    background: conic-gradient(var(--brand-primary) var(--percentage), #E2E8F0 0);
    border-radius: 50%;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.score-gauge::after {
    content: '';
    background: var(--brand-secondary);
    width: 52px;
    height: 52px;
    border-radius: 50%;
    position: absolute;
}

.score-value {
    position: relative;
    z-index: 10;
    font-family: var(--font-display);
    font-weight: 800;
    color: #FFFFFF;
}

.history-pill {
    background: #334155;
    color: #94A3B8;
    font-size: 13px;
    /* Increased from 11px */
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 100px;
    transition: all 0.2s;
    cursor: pointer;
    border: 1px solid #475569;
}

.history-pill:hover {
    background: #475569;
    color: #F8FAFC;
    border-color: #64748B;
}

#debug-manager {
    display: none;
    background: #020617;
    color: #4ADE80;
    font-family: 'Inter', monospace;
    font-size: 13px;
    /* Increased from 11px */
    border-top: 1px solid #1E293B;
}

.btn-action {
    background: #334155;
    border: 1px solid #475569;
    color: #F1F5F9;
    transition: all 0.2s;
}

.btn-action:hover {
    background: #475569;
    border-color: #64748B;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn-primary {
    background: var(--brand-primary);
    color: white;
    transition: all 0.2s;
}

.btn-primary:hover {
    background: #1D4ED8;
    transform: translateY(-1px);
}

.input-dark {
    background: #1E293B;
    border: 1px solid #334155;
    color: #F1F5F9;
    transition: all 0.2s;
}

.input-dark:focus {
    border-color: var(--brand-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.3);
}

.item-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.2s;
    opacity: 0;
}

.item-card.expanded .item-details {
    max-height: 400px;
    /* user req: scroll if too long */
    overflow-y: auto;
    opacity: 1;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed #E2E8F0;
    padding-right: 8px;
    /* Space for scrollbar */
}

/* Custom Scrollbar for Details */
.item-details::-webkit-scrollbar {
    width: 6px;
}

.item-details::-webkit-scrollbar-track {
    background: #F1F5F9;
    border-radius: 10px;
}

.item-details::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 10px;
}

.item-details::-webkit-scrollbar-thumb:hover {
    background: #94A3B8;
}

.tool-link {
    color: var(--brand-primary);
    font-weight: 600;
    text-decoration: underline;
    transition: color 0.2s;
}

.tool-link:hover {
    color: #1D4ED8;
}

.nav-item {
    font-family: var(--font-display);
    font-size: 13px;
    /* Increased from 11px */
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748B;
    transition: all 0.2s;
    position: relative;
    padding: 8px 0;
}

.nav-item:hover {
    color: #CBD5E1;
}

.nav-item.active {
    color: #FFFFFF;
}

.nav-item.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--brand-primary);
    border-radius: 100px;
}

.no-scrollbar::-webkit-scrollbar {
    display: none;
}

.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.btn-fix {
    background: #EFF6FF;
    /* blue-50 */
    color: #2563EB;
    /* blue-600 */
    border: 1px solid #DBEAFE;
    /* blue-100 */
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    /* Reduced from 13px */
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    display: inline-flex;
    align-items: center;
    transition: all 0.2s;
    cursor: pointer;
}

.btn-fix:hover {
    background: #2563EB;
    color: white;
    border-color: #2563EB;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.15);
    transform: translateY(-1px);
}

.btn-fix:hover svg {
    transform: rotate(30deg);
}

.filter-btn {
    color: #64748B;
    /* slate-500 */
    background: white;
    font-weight: 600;
    padding: 8px 18px;
    /* Increased from 6px 16px */
    border-radius: 999px;
    transition: all 0.2s;
    border: 1px solid #E2E8F0;
    font-size: 15px;
    /* Increased size */
    margin-right: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.filter-btn:hover {
    color: #334155;
    /* slate-700 */
    background: #F8FAFC;
    /* slate-50 */
    border-color: #CBD5E1;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.filter-btn.active {
    background: #2563EB;
    /* blue-600 */
    color: white;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

/* --- DEFAULT GRID LAYOUT (Formerly Focus Mode) --- */
.checklist-container {
    display: grid !important;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 1.5rem !important;
    max-height: 600px;
    /* added scroll limit */
    overflow-y: auto;
}

/* Custom Scrollbar for Checklist Container */
.checklist-container::-webkit-scrollbar {
    width: 6px;
}

.checklist-container::-webkit-scrollbar-track {
    background: #F1F5F9;
    border-radius: 10px;
}

.checklist-container::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 10px;
}

.checklist-container::-webkit-scrollbar-thumb:hover {
    background: #94A3B8;
}

@media (min-width: 768px) {
    .checklist-container {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1536px) {
    .checklist-container {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* --- FOCUS MODE (Zen Mode / Maximize) --- */
.command-card.focus-mode {
    grid-column: 1 / -1 !important;
    /* Force full width */
    z-index: 50;
    border-color: #3B82F6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2), 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    transform: scale(1.01);
    transition: all 0.3s ease;
}

.btn-focus-toggle {
    display: inline-flex;
    align-items: center;
    background: #F1F5F9;
    color: #475569;
    border: 1px solid #E2E8F0;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: all 0.2s ease;
    cursor: pointer;
}

.btn-focus-toggle:hover {
    background: #E2E8F0;
    color: #1E293B;
    transform: translateY(-1px);
}

.focus-mode .btn-focus-toggle {
    background: #2563EB;
    color: #FFFFFF !important;
    border-color: #2563EB;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

/* --- ITEM LIST CONTAINER (FLEX VS GRID) --- */
.item-list-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    /* space-y-3 equivalent */
}

/* When the parent section is in focus mode, turn the list into a responsive grid */
.focus-mode .item-list-container {
    display: grid !important;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 1.5rem !important;
}

@media (min-width: 768px) {
    .focus-mode .item-list-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1280px) {
    .focus-mode .item-list-container {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* --- PREMIUM GOLD BUTTON --- */
.btn-premium-gold {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 50%, #FF8C00 100%);
    background-size: 200% auto;
    color: #431407 !important;
    border: none !important;
    box-shadow: 0 4px 15px rgba(255, 165, 0, 0.3);
    transition: all 0.3s ease;
}

.btn-premium-gold:hover {
    background-position: right center;
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(255, 165, 0, 0.4);
    color: #000 !important;
}

.btn-premium-gold:active {
    transform: translateY(0) scale(1);
}

/* --- PERSONAL NOTES --- */
.note-textarea {
    width: 100%;
    min-height: 80px;
    padding: 12px;
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    font-family: var(--font-main);
    font-size: 14px;
    color: #334155;
    resize: vertical;
    transition: all 0.2s;
    margin-bottom: 12px;
}

.note-textarea:focus {
    background: #FFFFFF;
    border-color: var(--brand-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

.note-textarea::placeholder {
    color: #94A3B8;
    font-style: italic;
}