/**
 * Mimir File Management System - Main Stylesheet
 */

/* ===== CSS Variables ===== */
:root {
    /* Brand colors - can be overridden by inline styles */
    --brand-primary: #1e40af;
    --brand-secondary: #475569;
    --brand-accent: #0ea5e9;
    
    /* System colors - professional palette */
    --primary-color: var(--brand-primary);
    --primary-dark: #1e3a8a;
    --primary-light: #3b82f6;
    --secondary-color: var(--brand-secondary);
    --accent-color: var(--brand-accent);
    --success-color: #059669;
    --danger-color: #dc2626;
    --warning-color: #d97706;
    --info-color: var(--brand-accent);
    
    /* Neutral palette - professional grays */
    --bg-color: #f8fafc;
    --bg-main: #ffffff;
    --bg-secondary: #f1f5f9;
    --surface-color: #ffffff;
    --text-color: #0f172a;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;
    /* Legacy / compatibility aliases used across templates */
    --text-main: var(--text-primary);
    --text-on-primary: #ffffff;
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;
    
    /* Layout */
    --sidebar-width: 250px;
    --header-height: 60px;
    /* Preview rows control */
    --table-row-height: 40px;
    --visible-rows: 15;
    

/* Compact overview mode: reduce spacing to show more rows/months */
.page-index.compact {
    font-size: 13px;
}
.page-index.compact .card h1 { font-size: 1.15rem; }
.page-index.compact .form-control { padding: 6px 8px; height: 30px; font-size: 13px; }
.page-index.compact .row-form { gap:6px; }
.page-index.compact .sheet tr { padding: 4px 0; }
.page-index.compact .sheet td, .page-index.compact .sheet th { padding: 8px 10px; }
.page-index.compact .month-header { padding: 8px 10px; }
.page-index.compact .table-responsive { max-height: none; }
.page-index.compact { --table-row-height: 30px; }
    /* Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    
    /* Shadows - subtle and professional */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 2px 4px 0 rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    
    /* Primary color with opacity for professional effects */
    --primary: var(--brand-primary);
    /* Period button tuning */
    --period-bg: rgba(255,255,255,0.92);
    --period-border: rgba(0,0,0,0.06);
    --period-text: var(--text-primary);
    --period-hover-bg: rgba(0,0,0,0.04);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-color);
    background-color: var(--bg-color);
}

a { color: var(--primary-color); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--primary-dark); }

/* ===== Layout ===== */
.app-container { display: flex; min-height: calc(100vh + 200px); }
.sidebar { width: var(--sidebar-width); background-color: var(--surface-color); border-right: 1px solid var(--border-color); box-shadow: var(--shadow-sm); position: fixed; height: 100vh; overflow-y: auto; z-index: 100; }
.main-content { flex: 1; margin-left: var(--sidebar-width); min-height: calc(100vh + 200px); display: flex; flex-direction: column; }
.header { height: var(--header-height); background-color: var(--surface-color); border-bottom: 1px solid var(--border-color); display: flex; align-items: center; justify-content: space-between; padding: 0 1.5rem; box-shadow: var(--shadow-sm); }
/* Make header a positioning context for absolute dropdowns */
.header { position: relative; }
.content { flex: 1; padding: 1.5rem; }

/* Top menu alignment: push menu items to the right and style user dropdown */
.menu-section { margin-left: auto; align-items: center; }
/* Prevent scrollbars: allow wrapping and hide horizontal overflow on narrow viewports */
.menu-section { display:flex; flex-wrap:wrap; gap:8px; max-width: calc(100% - 3rem); }
.menu-item { white-space: nowrap; }
.header { overflow-x: hidden; }
.sidebar { overflow: visible; }
.sidebar-menu { overflow: hidden; }
.menu-user { display: inline-flex; align-items: center; gap: 0.5rem; position: relative; padding: 0.35rem 0.6rem; border-radius: 6px; }
.menu-user:hover { background-color: var(--bg-color); }
.menu-user .menu-user-name { margin-left: 0.4rem; font-weight: 600; color: var(--text-secondary); }
.menu-user-dropdown { display: none; position: absolute; right: 0; top: calc(100% + 8px); background: var(--surface-color); border: 1px solid var(--border-color); box-shadow: var(--shadow-lg); border-radius: 8px; min-width: 140px; z-index: 250; overflow: hidden; }
.menu-user.open .menu-user-dropdown { display: block; }
.menu-user-dropdown .dropdown-item { display: block; padding: 0.6rem 0.9rem; color: var(--text-primary); text-decoration: none; }
.menu-user-dropdown .dropdown-item:hover { background: var(--bg-color); }
.menu-user .user-avatar { width: 32px; height: 32px; font-size: 0.95rem; }

@media (max-width: 700px) {
    .menu-user .menu-user-name { display: none; }
}

/* ==========================
   Modern colorful theme (Pi-hole-like)
   ========================== */
:root {
    --brand-primary: #ff4757;    /* coral/red */
    --brand-accent: #1dd1a1;     /* mint */
    --brand-secondary: #3742fa;  /* vivid blue */
    --bg-color: #0f1724;         /* deep navy */
    --bg-main: linear-gradient(180deg,#08101a 0%, #0f1724 100%);
    --bg-secondary: rgba(255,255,255,0.02);
    --surface-color: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
    --text-color: #e6eef8;
    --text-primary: #e6eef8;
    --text-secondary: #b8d3ff;
    --text-muted: #9fb7d6;
    --border-color: rgba(255,255,255,0.06);
}

body {
    background: var(--bg-main);
    color: var(--text-color);
}

/* Header and sidebar vibrant */
.header { background: linear-gradient(90deg, rgba(55,66,250,0.95), rgba(255,71,87,0.95)); color: white; box-shadow: 0 8px 30px rgba(8,10,20,0.6); }
.sidebar { background: linear-gradient(180deg, rgba(8,10,20,0.6), rgba(12,18,28,0.6)); border-right: 1px solid rgba(255,255,255,0.03); }
.sidebar .menu-item { color: var(--text-muted); }
.sidebar .menu-item:hover, .sidebar .menu-item.active { background: rgba(255,255,255,0.04); color: var(--text-primary); }

/* Cards: glassy, accented */
.card { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.05); box-shadow: 0 6px 24px rgba(2,6,23,0.6); }
.card h1, .card h3, .card h4 { color: var(--text-primary); }
.dashboard-cards .card { background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01)); border-left: 6px solid var(--brand-accent); }

/* Buttons */
.btn-primary { background: linear-gradient(90deg, var(--brand-secondary), var(--brand-primary)); color: white; box-shadow: 0 6px 18px rgba(55,66,250,0.18); }
.btn-secondary { background: transparent; border: 1px solid rgba(255,255,255,0.06); color: var(--text-primary); }

/* Form controls */
.form-control, .form-select, .form-textarea { background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.04); color: var(--text-primary); }
.form-control:focus { box-shadow: 0 6px 18px rgba(29,209,161,0.08); border-color: var(--brand-accent); }

/* Badges */
.badge { background: linear-gradient(90deg, var(--brand-accent), var(--brand-secondary)); color: #042026; font-weight:700; }
.badge-danger { background: linear-gradient(90deg,#ff6b81,#ff4757); color: white; }
.badge-primary { background: linear-gradient(90deg,#74b9ff,#3742fa); color: white; }

/* Table */
.sheet thead th { background: rgba(255,255,255,0.03); color: var(--text-secondary); border-bottom: 1px solid rgba(255,255,255,0.04); }
.table-responsive {
    /* Make the table area scrollable while keeping the rest of the page visible.
       The max-height subtracts header and form heights; tweak value if needed. */
    max-height: calc(100vh - var(--header-height) - 120px);
    overflow: auto;
}
/* Keep table headers visible while scrolling the table body */
.sheet thead th {
    position: sticky;
    top: 0;
    z-index: 5;
    background: rgba(255,255,255,0.03);
}

/* Index page: make the card occupy remaining viewport so only the table body scrolls
   and the column headers remain visible. Scoped to avoid affecting other pages. */
.page-index {
    display: block;
    /* allow the page to scroll normally so all months are visible */
    overflow: visible;
}
.page-index > .card {
    /* card is direct child of container in index.php */
    display: block;
    position: relative; /* positioning context for absolute header */
}
.page-index .table-responsive {
    flex: none;
    max-height: none; /* allow full height so all months show */
    overflow: visible;
}
.page-index {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--header-height));
    overflow: hidden;
}
.page-index > .card {
    /* card is direct child of container in index.php */
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative; /* positioning context for absolute header */
}
.page-index .table-responsive {
    /* ensure table area takes remaining space inside the card and is the only scrollable region */
    flex: 1 1 auto;
    overflow: auto;
}
.page-index .sheet thead th {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--surface-color);
}
.table-fixed-header { display: block !important; overflow: hidden; border-bottom: 1px solid var(--border-color); background: var(--surface-color); /* placed absolutely within the card */
    position: absolute; /* contained inside .page-index > .card */
    top: 0; left: 0; right: auto;
    z-index: 1200; /* above table rows */
    box-shadow: 0 6px 18px rgba(0,0,0,0.12);
}
/* Hide the original thead within the scrollable area to avoid duplicate headers */
.table-responsive .sheet thead { display: none; }
/* Ensure the fixed header table text is visible regardless of theme */
.table-fixed-header table.fixed-headers thead th {
    color: var(--text-primary) !important;
    background: var(--surface-color) !important;
}
/* Ensure both tables use same layout to improve alignment */
.sheet { width: 100%; table-layout: fixed; }
.sheet tr { border-bottom: 1px solid rgba(255,255,255,0.02); }

/* Sparklines - accent stroke */
svg polyline { stroke: var(--brand-accent) !important; stroke-linecap: round; stroke-linejoin: round; }

/* User menu */
.menu-user { background: rgba(255,255,255,0.02); border-radius: 10px; padding: 6px 10px; }

/* Small responsive tweaks to keep airy spacing */
@media (max-width:900px){
  .dashboard-cards { grid-template-columns: 1fr !important; }
  .sidebar { display:none; }
}

/* subtle transitions */
* { transition: all 0.12s ease-in-out; }


/* ===== Sidebar ===== */
.sidebar-header { padding: 1.5rem; border-bottom: 1px solid var(--border-color); }
.logo { font-size: 1.5rem; font-weight: 700; color: var(--primary-color); display: flex; align-items: center; gap: 0.75rem; }
.logo img { max-height: 40px; max-width: 150px; width: auto; height: auto; object-fit: contain; }
/* Visually hidden utility for screen-readers (when logo image is present we hide textual site name) */
.visually-hidden { position: absolute !important; height: 1px; width: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); white-space: nowrap; border: 0; padding: 0; margin: -1px; }
.sidebar-menu { padding: 1rem 0; }
.menu-section { margin-bottom: 1.5rem; }
.menu-section-title { padding: 0.5rem 1.5rem; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.05em; }

.header-brand { display: flex; align-items: center; gap: 0.5rem; }
.header-brand-logo { height: 32px; width: auto; }
.header-brand-text { font-weight: 600; font-size: 1rem; }

.sidebar-brand-visual { display: flex; align-items: center; gap: 0.5rem; padding: 8px 12px; }
.sidebar-brand-logo { height: 40px; width: auto; }
.sidebar-brand-text { font-weight: 700; font-size: 1.05rem; color:var(--text-color); }

/* Basic responsive behavior: when mobile-menu-open, slide sidebar over content */
body.mobile-menu-open .sidebar {
    transform: translateX(0);
}

/* Ensure sidebar header takes minimal width and profile doesn't create extra column */
.sidebar { width: 100%; height: var(--header-height); min-width: 100%; top: 0; left: 0; right: 0; border-right: none; border-bottom: 1px solid var(--border-color); box-shadow: var(--shadow-sm); display: flex; align-items: center; }
.main-content { margin-left: 0; margin-top: var(--header-height); }
.menu-section { display: flex; gap: 8px; align-items: center; padding: 0 1rem; }
.menu-item { display: inline-flex; padding: 0.5rem 0.75rem; border-radius: 6px; }
.menu-item { display: flex; align-items: center; padding: 0.75rem 1.5rem; color: var(--text-color); transition: all 0.2s; cursor: pointer; }
.menu-item:hover { background-color: var(--bg-color); color: var(--primary-color); }
.menu-item.active { background-color: var(--primary-color); color: white; font-weight: 500; }
.menu-item i { margin-right: 0.75rem; width: 20px; text-align: center; }

/* ===== Header ===== */
.header-title { font-size: 1.25rem; font-weight: 600; }
.header-actions { display: flex; align-items: center; gap: 1rem; }
.header-brand { display: flex; align-items: center; gap: 0.6rem; margin-left: 0.5rem; }
.header-brand-logo { max-height: 36px; max-width: 140px; object-fit: contain; display: inline-block; }
.header-brand-text { font-weight: 700; color: var(--primary-color); font-size: 1rem; display: inline-block; }
.user-menu { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 1rem; border-radius: var(--radius-md); cursor: pointer; transition: background-color 0.2s; }
.user-menu:hover { background-color: var(--bg-color); }
.user-avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-accent) 100%); color: white; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; box-shadow: 0 2px 8px rgba(16,24,40,0.12); }
.user-avatar svg { width: 20px; height: 20px; fill: white; display: block; }

/* User dropdown styling (used by header dropdown) */
.user-dropdown { display: none; }
.user-dropdown.show { display: block; }

/* Force topbar layout to ensure menu items are visible and not clipped */
.app-container > .sidebar { display: flex; align-items: center; padding: 0 1rem; box-shadow: none; }
.app-container > .sidebar .sidebar-menu { display: flex; align-items: center; width: 100%; overflow: visible; }
.app-container > .sidebar .menu-section { margin-left: auto; display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.app-container > .sidebar .menu-section .menu-item { padding: 0.45rem 0.85rem; }
.app-container > .sidebar .menu-section .menu-user { padding: 0.2rem 0.5rem; }

/* ===== Cards ===== */
.card { background-color: var(--surface-color); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); border: 1px solid var(--border-color); margin-bottom: 1.5rem; }
.card-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border-color); display: flex; align-items: center; justify-content: space-between; }
.card-title { font-size: 1.125rem; font-weight: 600; }
.card-body { padding: 1.5rem; }
.card-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border-color); background-color: var(--bg-color); }

/* Brandized card headers: use brand gradient and white text by default */
.card-header {
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
    color: var(--text-on-primary, #ffffff);
}
/* Dashboard-specific card tweaks */
.dashboard-cards .card { padding: 14px; display:flex; flex-direction:column; justify-content:space-between; min-height:110px; }
.dashboard-cards .card h4 { margin: 0 0 8px 0; font-size: 0.95rem; font-weight:600; color:var(--text-secondary); }
.dashboard-cards .card .muted { margin-top:6px; font-size:0.85rem; }
.dashboard-cards .card a.card-link { color: inherit; text-decoration: none; display:block; height:100%; }
.dashboard-cards .card .value { font-size:1.35rem; font-weight:700; color:var(--primary-color); }
.dashboard-cards .card .sparkline { width:120px; height:28px; display:inline-block; vertical-align:middle; }

/* Table sparkline cell */
.sheet td .sparkline { width:160px; height:32px; display:inline-block; }

/* Make cards responsive */
@media (max-width: 720px) { .dashboard-cards { grid-template-columns: 1fr !important; } }

/* Utility helpers to avoid inline styles */
.card-header--padded {
    padding: 1.5rem;
}
.card-header--flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bulk-actions-bar {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
    color: var(--text-on-primary, #ffffff);
    padding: 1rem 2rem;
    border-radius: 2rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    display: none;
    z-index: 1000;
    animation: slideUp 0.3s ease-out;
}
.bulk-actions-bar.show {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* ===== Buttons ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.625rem 1.25rem; font-size: 0.875rem; font-weight: 500; border: 1px solid transparent; border-radius: var(--radius-md); cursor: pointer; transition: all 0.2s; text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background-color: var(--primary-color); color: var(--text-on-primary); border-color: transparent; }

/* Period selector buttons (chart period) - ensure high contrast */
.period-btn {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border-color);
    background: var(--surface-color);
    color: var(--text-main);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.period-btn:hover {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: var(--text-on-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.08);
}
.period-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--text-on-primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* Ensure disk-period-btn matches period-btn styles */
.disk-period-btn {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border-color);
    background: var(--surface-color);
    color: var(--text-main);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.disk-period-btn:hover {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: var(--text-on-primary);
}
.disk-period-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--text-on-primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* Outline variant for buttons placed on dark/brand headers */
.btn-outline--on-dark {
    background: rgba(255,255,255,0.08);
    color: var(--text-on-primary);
    border-color: rgba(255,255,255,0.12);
    box-shadow: none;
}
.btn-outline--on-dark:hover {
    background: rgba(255,255,255,0.12);
    color: var(--text-on-primary);
    transform: translateY(-1px);
}

/* Unified bulk-actions-bar overrides (match admin/users.php compact branding) */
.app-container .main-content .bulk-actions-bar {
    padding: 0.5rem 1rem;
    border-radius: 999px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.18);
    gap: 0.5rem;
    font-size: 0.9rem;
    align-items: center;
    justify-content: center;
    max-width: calc(100% - 4rem);
    left: 50%;
    transform: translateX(-50%);
}

.app-container .main-content .bulk-actions-bar.show {
    display: flex !important;
}

.app-container .main-content .bulk-actions-bar .btn {
    padding: 0.45rem 0.6rem;
    font-size: 0.85rem;
    border-radius: 999px;
    min-width: 36px;
    height: 36px;
    gap: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.app-container .main-content .bulk-actions-bar .btn .btn-label {
    display: inline-block;
}

/* Icon sizing and spacing */
.app-container .main-content .bulk-actions-bar i,
.app-container .main-content .bulk-actions-bar .icon { font-size: 1.05rem; line-height: 1; }

/* Responsive: hide labels on narrow screens to become icon-only */
@media (max-width: 900px) {
    .app-container .main-content .bulk-actions-bar { padding: 0.4rem 0.6rem; gap: 0.35rem; }
    .app-container .main-content .bulk-actions-bar .btn { padding: 0.35rem 0.45rem; }
    .app-container .main-content .bulk-actions-bar .btn .btn-label { display: none; }
}

/* Slight hover lift for buttons inside the bar */
.app-container .main-content .bulk-actions-bar .btn:hover { transform: translateY(-2px); }

/* Force high-specificity admin bulk bar rules to override per-page styles */
.main-content .bulk-actions-bar,
#bulkActionsBar,
body .bulk-actions-bar {
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%) !important;
    color: var(--text-on-primary) !important;
    padding: 0.5rem 0.9rem !important;
    border-radius: 999px !important;
    box-shadow: 0 8px 30px rgba(0,0,0,0.24) !important;
    gap: 0.6rem !important;
    font-size: 0.95rem !important;
    max-width: calc(100% - 3rem) !important;
    white-space: nowrap !important;
    overflow: hidden !important;
}

/* ==========================
   Light modern theme overrides
   ========================== */
:root {
    --brand-primary: #2563eb; /* muted blue */
    --brand-secondary: #64748b; /* slate gray */
    --brand-accent: #60a5fa; /* soft accent */

    --bg-color: #f7f8fb; /* very light background */
    --bg-main: #ffffff;
    --bg-secondary: #f1f5f9;
    --surface-color: #ffffff;
    --text-color: #0f172a;
    --text-primary: #0b1220;
    --text-secondary: #475569;
    --text-muted: #6b7280;
    --border-color: #e6edf3;
    --border-light: #f3f6f9;

    --shadow-sm: 0 1px 4px rgba(16,24,40,0.04);
    --shadow-md: 0 4px 12px rgba(16,24,40,0.06);
    --shadow-lg: 0 8px 24px rgba(16,24,40,0.08);
}

body {
    background: var(--bg-color);
    color: var(--text-color);
}

/* Header & Sidebar: light surfaces, subtle shadows */
.header {
    background: var(--surface-color);
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}
.sidebar {
    background: var(--surface-color);
    border-right: 1px solid var(--border-color);
    box-shadow: none;
}
.sidebar .menu-item, .menu-item { color: var(--text-secondary); }
.sidebar .menu-item:hover, .sidebar .menu-item.active { background: var(--bg-secondary); color: var(--text-primary); }

/* Cards: white surface, soft rounded corners and subtle shadow */
.card { background-color: var(--surface-color) !important; border-radius: 10px; box-shadow: var(--shadow-sm); border: 1px solid var(--border-color); }
.card-header { background: transparent !important; color: var(--text-primary) !important; border-bottom: 1px solid var(--border-light) !important; }
.dashboard-cards .card { border-left: 4px solid transparent; }
.dashboard-cards .card .value { color: var(--text-primary); }

/* Buttons: flat, single-color, subtle shadow */
.btn-primary { background: var(--brand-primary) !important; color: var(--text-on-primary, #ffffff) !important; box-shadow: var(--shadow-sm) !important; border: 1px solid rgba(0,0,0,0.04) !important; }
.btn-secondary { background: transparent !important; border: 1px solid var(--border-color) !important; color: var(--text-primary) !important; }
.period-btn, .disk-period-btn { background: var(--surface-color); border: 1px solid var(--border-color); color: var(--text-primary); box-shadow: none; }

/* Badges: neutral, low-saturation */
.badge { background: var(--bg-secondary); color: var(--text-primary); font-weight:600; }
.badge-danger { background: rgba(220,38,38,0.12); color: var(--danger-color, #dc2626); }
.badge-primary { background: rgba(37,99,235,0.12); color: var(--brand-primary); }

/* Forms: light inputs */
.form-control, .form-select, .form-textarea { background: var(--bg-main); border: 1px solid var(--border-color); color: var(--text-primary); box-shadow: none; }
.form-control:focus { box-shadow: 0 6px 18px rgba(37,99,235,0.06); border-color: var(--brand-primary); }

/* Sparklines stroke to match muted brand */
svg polyline { stroke: var(--brand-primary) !important; }

/* User menu simplified */
.menu-user { background: transparent; padding: 0.25rem 0.5rem; border-radius: 8px; box-shadow: none; }
.menu-user:hover { background: var(--bg-secondary); }

/* Bulk actions bar: neutral background */
.bulk-actions-bar { background: var(--surface-color); color: var(--text-primary); box-shadow: var(--shadow-md); border: 1px solid var(--border-color); }

/* Reduce heavy transitions for a cleaner feel */
* { transition: all 0.12s cubic-bezier(.2,.9,.3,1); }

/* Ensure the date column in sheets stays on a single line */
.sheet th:nth-child(1), .sheet td:nth-child(1) {
    white-space: nowrap;
    width: 1%;
}

/* Ensure action buttons (editar/borrar) remain on a single line */
.sheet th:last-child, .sheet td:last-child {
    white-space: nowrap;
    width: 1%;
}
.sheet td:last-child .btn,
.sheet td:last-child .edit-entry,
.sheet td:last-child .delete-entry {
    display: inline-block;
    white-space: nowrap;
    margin-right: 6px;
    vertical-align: middle;
}
.sheet td:last-child .btn:last-child { margin-right: 0; }

/* Compact table mode to avoid horizontal overflow */
.sheet.compact { font-size: 13px; }
.sheet.compact th, .sheet.compact td { padding: 6px 8px; line-height: 1.2; }
.sheet.compact .card-body { padding: 8px; }

/* Smaller buttons inside tables */
.sheet.compact .btn { padding: 4px 8px; font-size: 0.82rem; }
.sheet.compact .btn.btn-danger { padding: 4px 7px; }

/* Fixed column widths for critical compacting (date, time columns, actions) */
.sheet.compact th:nth-child(1), .sheet.compact td:nth-child(1) { width: 95px; }
.sheet.compact th:nth-child(2), .sheet.compact td:nth-child(2),
.sheet.compact th:nth-child(3), .sheet.compact td:nth-child(3),
.sheet.compact th:nth-child(4), .sheet.compact td:nth-child(4),
.sheet.compact th:nth-child(6), .sheet.compact td:nth-child(6),
.sheet.compact th:nth-child(7), .sheet.compact td:nth-child(7),
.sheet.compact th:nth-child(9), .sheet.compact td:nth-child(9) { width: 70px; }
.sheet.compact th:nth-child(11), .sheet.compact td:nth-child(11) { width: 85px; }
.sheet.compact th:nth-child(12), .sheet.compact td:nth-child(12) { width: 140px; }

/* Make table container allow horizontal scroll but avoid unnecessary overflow */
.table-responsive { overflow-x: auto; max-width: 100%; }

@media (max-width: 900px) {
    .sheet.compact th, .sheet.compact td { padding: 5px 6px; font-size: 12px; }
    .sheet.compact th:nth-child(1), .sheet.compact td:nth-child(1) { width: 90px; }
    .sheet.compact th:nth-child(12), .sheet.compact td:nth-child(12) { width: 110px; }
    .sheet.compact .btn { padding: 3px 6px; font-size: 0.78rem; }
}

/* More aggressive compacting: fixed table layout and truncation */
.sheet.compact { table-layout: fixed; }
.sheet.compact td, .sheet.compact th { overflow: hidden; text-overflow: ellipsis; }
.sheet.compact td:nth-child(12), .sheet.compact th:nth-child(12) { white-space: nowrap; }

/* Icon buttons style */
.icon-btn { padding: 4px 6px; width: 30px; text-align: center; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; }

/* Responsive: hide less important columns on narrower screens to save space */
@media (max-width: 1100px) {
    /* hide coffee time columns */
    .sheet.compact th:nth-child(3), .sheet.compact td:nth-child(3),
    .sheet.compact th:nth-child(4), .sheet.compact td:nth-child(4) { display: none; }
}
@media (max-width: 900px) {
    /* hide coffee balance and lunch columns */
    .sheet.compact th:nth-child(5), .sheet.compact td:nth-child(5),
    .sheet.compact th:nth-child(6), .sheet.compact td:nth-child(6),
    .sheet.compact th:nth-child(7), .sheet.compact td:nth-child(7),
    .sheet.compact th:nth-child(8), .sheet.compact td:nth-child(8) { display: none; }
}
@media (max-width: 700px) {
    /* hide day balance and note to keep essential columns */
    .sheet.compact th:nth-child(11), .sheet.compact td:nth-child(11),
    .sheet.compact th:nth-child(12), .sheet.compact td:nth-child(12) { display: none; }
}

/* Prevent hiding of action/global columns for tables explicitly marked no-hide-actions */
.sheet.compact.no-hide-actions th:last-child, .sheet.compact.no-hide-actions td:last-child,
.sheet.compact.no-hide-actions th:nth-last-child(2), .sheet.compact.no-hide-actions td:nth-last-child(2) {
    display: table-cell !important;
}

/* Ensure buttons inside tables are visible and high-contrast */
.sheet .btn {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        background: transparent !important;
        border: 1px solid var(--border-color) !important;
        color: var(--text-primary) !important;
        padding: 4px 6px !important;
        min-width: 28px;
        height: 28px;
        line-height: 1;
        box-shadow: none;
}
.sheet .btn.btn-primary { background: var(--brand-primary) !important; color: #fff !important; border-color: transparent !important; }
.sheet .btn.btn-danger { background: rgba(220,38,38,0.06) !important; color: var(--danger-color) !important; border-color: rgba(220,38,38,0.12) !important; }
.sheet .icon-btn { width: 28px; padding: 0 6px; font-size: 14px; }

/* If buttons are hidden via display:none by responsive rules, ensure action column shows at least icons */
.sheet.compact td:last-child, .sheet.compact th:last-child { display: table-cell !important; }
.sheet.compact th:nth-child(13), .sheet.compact td:nth-child(13),
.sheet.compact th:nth-child(12), .sheet.compact td:nth-child(12) {
    display: table-cell !important;
    width: 80px !important;
    min-width: 60px !important;
}
.sheet.compact td:last-child .icon-btn { font-size: 14px !important; color: var(--text-primary) !important; }

/* Holiday & year action helpers (moved from inline/debug styles) */
.holiday-global { text-align: center; width: 80px; }
.holiday-actions { white-space: nowrap; text-align: right; }
.holiday-actions .btn, .yc-actions .btn { display: inline-block; }
.holiday-actions form, .yc-actions form { display: inline; margin-left: 6px; }
.yc-actions .btn-danger { padding: 4px 6px; height: 28px; }

/* Highlight edit button appearance (was applied inline during debugging) */
.highlight-edit-btn { background: linear-gradient(90deg,#ffd54d,#ffb74d); color:#1b1b1b; border: 1px solid rgba(0,0,0,0.06); box-shadow: 0 4px 10px rgba(0,0,0,0.08); }

/* Highlight row that is in inline-edit mode */
.sheet tr.editing td {
    background-color: rgba(96,165,250,0.06); /* soft blue tint */
    transition: background-color 0.15s ease-in-out;
}
.sheet tr.editing td:first-child {
    border-left: 4px solid var(--brand-accent);
}
.sheet tr.editing input.form-control {
    border-color: rgba(37,99,235,0.55) !important;
    box-shadow: 0 4px 10px rgba(37,99,235,0.06) !important;
    background: #fff !important;
    padding: 4px 6px !important;
    height: 30px !important;
}
.sheet tr.editing .btn.save-entry { background: var(--brand-primary) !important; color: #fff !important; }
.sheet tr.editing .btn.cancel-entry { background: transparent !important; border-color: var(--border-color) !important; color: var(--text-primary) !important; }

/* small popup menu for 'more' buttons */
.more-menu {
    position: absolute;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    border-radius: 6px;
    padding: 6px 4px;
    z-index: 1200;
    min-width: 120px;
}
.more-menu .more-item { display: block; padding: 6px 10px; color: var(--text-primary); text-decoration: none; cursor: pointer; }
.more-menu .more-item:hover { background: var(--bg-secondary); }

.main-content .bulk-actions-bar.show,
#bulkActionsBar.show {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.main-content .bulk-actions-bar .btn {
    padding: 0.45rem 0.6rem !important;
    font-size: 0.88rem !important;
    border-radius: 999px !important;
    min-width: 36px !important;
    height: 36px !important;
}

.main-content .bulk-actions-bar .btn .btn-label { display: inline-block !important; margin-left: 0.35rem !important; }

@media (max-width: 900px) {
    .main-content .bulk-actions-bar { padding: 0.35rem 0.5rem !important; gap: 0.4rem !important; }
    .main-content .bulk-actions-bar .btn { padding: 0.35rem 0.45rem !important; }
    .main-content .bulk-actions-bar .btn .btn-label { display: none !important; }
}

/* Ensure highly specific hover/outline variant on dark backgrounds */
.main-content .bulk-actions-bar .btn-outline--on-dark {
    background: rgba(255,255,255,0.08) !important;
    color: var(--text-on-primary) !important;
    border-color: rgba(255,255,255,0.12) !important;
}

    /* Special case: when the bulk bar is wrapped inside an outer fixed container (#floatingActions),
       the inner bar must be positioned statically to avoid nested fixed transforms and overflow. */
    #floatingActions .bulk-actions-bar,
    #floatingBar .bulk-actions-bar {
        position: static !important;
        left: auto !important;
        bottom: auto !important;
        transform: none !important;
        max-width: 100% !important;
        overflow: visible !important;
        display: flex !important;
    }

    /* Ensure labels visibility handled by responsive rules when inside floating container */
    #floatingActions .bulk-actions-bar .btn .btn-label,
    #floatingBar .bulk-actions-bar .btn .btn-label {
        display: none !important;
    }
    @media (min-width: 900px) {
        #floatingActions .bulk-actions-bar .btn .btn-label,
        #floatingBar .bulk-actions-bar .btn .btn-label { display: inline-block !important; }
    }

    /* Fix for expired_files: force single-line layout, allow left text to shrink with ellipsis,
       and ensure the button group stays inline so the bar does not occupy two lines. */
    #floatingActions .bulk-actions-bar,
    #floatingBar .bulk-actions-bar {
        display: flex !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        gap: 0.5rem !important;
    }

    #floatingActions .bulk-actions-bar > span,
    #floatingActions .bulk-actions-bar > a,
    #floatingBar .bulk-actions-bar > span,
    #floatingBar .bulk-actions-bar > a {
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        max-width: 34% !important;
        display: inline-block !important;
    }

    #floatingActions .bulk-actions-bar > div,
    #floatingBar .bulk-actions-bar > div {
        flex: 0 0 auto !important;
        display: inline-flex !important;
        gap: 0.35rem !important;
    }

    /* Hide the "select all results" link on very small screens to guarantee single-line */
    @media (max-width: 520px) {
        #floatingActions .bulk-actions-bar > a#floatingSelectAllResults,
        #floatingBar .bulk-actions-bar > a#floatingSelectAllResults { display: none !important; }
        #floatingActions .bulk-actions-bar > span,
        #floatingBar .bulk-actions-bar > span { max-width: 46% !important; }
    }

    /* ICONS ONLY: hide button labels inside the floatingActions/floatingBar to show icons only */
    #floatingActions .bulk-actions-bar .btn .btn-label,
    #floatingBar .bulk-actions-bar .btn .btn-label {
        display: none !important;
    }

    /* Slightly tighten button padding for icon-only presentation */
    #floatingActions .bulk-actions-bar .btn,
    #floatingBar .bulk-actions-bar .btn {
        padding: 0.35rem 0.45rem !important;
    }

    /* Show numeric counter, hide duplicate textual helpers (label, badge, select-all link) */
    #floatingActions .bulk-actions-bar > span#bulkSelectedCount,
    #floatingBar .bulk-actions-bar > span#bulkSelectedCount {
        display: inline-block !important;
        margin-right: 0.4rem !important;
    }

    /* Show the textual label next to the numeric counter by default (compact styling).
       JS will still hide it when 'select all results' is active. */
    #floatingActions .bulk-actions-bar > span#bulkSelectedLabel,
    #floatingBar .bulk-actions-bar > span#bulkSelectedLabel {
        display: inline-block !important;
        margin-left: 0.35rem !important;
        color: var(--text-on-primary) !important;
        opacity: 0.95 !important;
        font-weight: 500 !important;
    }

    #floatingActions .bulk-actions-bar > span#selectedAllBadge,
    #floatingActions .bulk-actions-bar > a#floatingSelectAllResults,
    #floatingBar .bulk-actions-bar > span#selectedAllBadge,
    #floatingBar .bulk-actions-bar > a#floatingSelectAllResults {
        /* keep badge and select-all link hidden to avoid duplication when JS shows the blue badge */
        display: none !important;
    }

    /* Slightly tighten overall padding when textual helpers are hidden */
    #floatingActions .bulk-actions-bar,
    #floatingBar .bulk-actions-bar {
        padding-left: 0.8rem !important;
        padding-right: 0.8rem !important;
    }

/* Ensure period selector buttons inside brand headers are readable */
.card-header .period-btn {
    padding: 0.42rem 0.9rem;
    border: 1px solid var(--period-border);
    background: var(--period-bg);
    color: var(--period-text);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.card-header .period-btn:hover {
    background: color-mix(in srgb, var(--period-bg) 88%, black 12%);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.06);
}
.card-header .period-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--text-on-primary);
}

/* Fallback for period buttons outside headers */
.period-btn {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border-color);
    background: var(--surface-color);
    color: var(--text-main);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.period-btn:hover {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: var(--text-on-primary);
}
.period-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--text-on-primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.btn-primary:hover:not(:disabled) { background-color: var(--primary-dark); }
.btn-secondary { background-color: var(--secondary-color); color: white; }
.btn-success { background-color: var(--success-color); color: white; }
.btn-danger { background-color: var(--danger-color); color: white; }
.btn-warning { background-color: var(--warning-color); color: white; }
.btn-outline { background-color: transparent; border-color: var(--border-color); color: var(--text-color); }
.btn-outline:hover { background-color: var(--bg-color); }
.btn-sm { padding: 0.375rem 0.875rem; font-size: 0.8125rem; }
.btn-lg { padding: 0.875rem 1.75rem; font-size: 1rem; }

/* ===== Forms ===== */
.form-group { margin-bottom: 1.25rem; }
.form-label { display: block; margin-bottom: 0.5rem; font-weight: 500; color: var(--text-color); }
.form-label.required::after { content: " *"; color: var(--danger-color); }
.form-control { width: 100%; padding: 0.625rem 0.875rem; font-size: 0.875rem; border: 1.5px solid rgba(0, 0, 0, 0.15); border-radius: var(--radius-md); background-color: rgba(255, 255, 255, 0.05); color: var(--text-color); transition: all 0.2s; box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05); }
.form-control:hover { border-color: rgba(0, 0, 0, 0.25); background-color: rgba(255, 255, 255, 0.08); }
.form-control:focus { outline: none; border-color: var(--primary-color); background-color: var(--surface-color); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1), inset 0 1px 2px rgba(0, 0, 0, 0.05); }
.form-control:disabled { background-color: var(--bg-color); opacity: 0.6; cursor: not-allowed; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e"); background-repeat: no-repeat; background-position: right 0.75rem center; background-size: 16px 12px; padding-right: 2.5rem; }
.form-check { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.form-check input[type="checkbox"], .form-check input[type="radio"] { width: 18px; height: 18px; cursor: pointer; }
.form-text { display: block; margin-top: 0.25rem; font-size: 0.8125rem; color: var(--text-muted); }
.form-error { color: var(--danger-color); font-size: 0.8125rem; margin-top: 0.25rem; }

/* ===== Tables ===== */
.table-responsive { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table thead th { background-color: var(--bg-color); padding: 0.875rem 1rem; text-align: left; font-weight: 600; font-size: 0.8125rem; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.05em; border-bottom: 2px solid var(--border-color); }
.table tbody td { padding: 0.875rem 1rem; border-bottom: 1px solid var(--border-color); }
.table tbody tr:hover { background-color: var(--bg-color); }
.table tbody tr.selected { background-color: rgba(37, 99, 235, 0.05); }

/* ===== Alerts ===== */
.alert { padding: 1rem 1.25rem; border-radius: var(--radius-md); border: 1px solid transparent; margin-bottom: 1rem; }
.alert-success { background-color: #d1fae5; border-color: #6ee7b7; color: #065f46; }
.alert-danger { background-color: #fee2e2; border-color: #fca5a5; color: #991b1b; }
.alert-warning { background-color: #fef3c7; border-color: #fcd34d; color: #92400e; }
.alert-info { background-color: #dbeafe; border-color: #93c5fd; color: #1e40af; }

/* ===== Badges ===== */
.badge { display: inline-flex; align-items: center; padding: 0.25rem 0.625rem; font-size: 0.75rem; font-weight: 500; border-radius: 9999px; }
.badge-primary { background-color: #dbeafe; color: #1e40af; }
.badge-success { background-color: #d1fae5; color: #065f46; }
.badge-danger { background-color: #fee2e2; color: #991b1b; }
.badge-warning { background-color: #fef3c7; color: #92400e; }
.badge-secondary { background-color: #f1f5f9; color: #475569; }

/* ===== Modals ===== */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5); z-index: 1000; align-items: center; justify-content: center; }
.modal.active { display: flex; }
.modal-dialog { background-color: var(--surface-color); border-radius: var(--radius-lg); max-width: 500px; width: 90%; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.modal-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border-color); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 1.125rem; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text-muted); line-height: 1; }
.modal-body { padding: 1.5rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border-color); display: flex; gap: 0.75rem; justify-content: flex-end; }

/* ===== Login Page ===== */
.login-container { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.login-card { background-color: var(--surface-color); border-radius: var(--radius-lg); padding: 2.5rem; width: 100%; max-width: 400px; box-shadow: var(--shadow-lg); }
.login-header { text-align: center; margin-bottom: 2rem; }
.login-header .logo { justify-content: center; margin-bottom: 1rem; }
.login-header h1 { font-size: 1.5rem; margin-bottom: 0.5rem; }
.login-header p { color: var(--text-muted); }

/* ===== Footer ===== */
.footer { padding: 1.5rem; border-top: 1px solid var(--border-color); background-color: var(--surface-color); text-align: center; }
.footer-links { display: flex; gap: 1.5rem; justify-content: center; flex-wrap: wrap; margin-bottom: 0.75rem; }
.footer-links a { color: var(--text-muted); font-size: 0.875rem; }
.footer-links a:hover { color: var(--primary-color); }
.footer-copyright { font-size: 0.8125rem; color: var(--text-muted); }

/* ===== Utilities ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success-color); }
.text-danger { color: var(--danger-color); }
.text-warning { color: var(--warning-color); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); transition: transform 0.3s; }
    .sidebar.mobile-open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .mobile-menu-toggle { display: block; }
    .table { font-size: 0.8125rem; }
    .table thead th, .table tbody td { padding: 0.5rem; }
}

@media (min-width: 769px) {
    .mobile-menu-toggle { display: none; }
}

/* ===== Loading ===== */
.spinner { border: 3px solid var(--border-color); border-top: 3px solid var(--primary-color); border-radius: 50%; width: 24px; height: 24px; animation: spin 1s linear infinite; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Font Awesome Icon Styles */
.fas, .far, .fab {
    display: inline-block;
    font-style: normal;
    font-variant: normal;
    text-rendering: auto;
    -webkit-font-smoothing: antialiased;
    -webkit-font-smoothing: antialiased;
}

.menu-item i.fas {
    width: 1.25rem;
    text-align: center;
    margin-right: 0.5rem;
}

.btn i.fas {
    margin-right: 0.25rem;
}

.stat-icon-modern i.fas {
    font-size: inherit;
}

.admin-stat-icon i.fas {
    font-size: inherit;
}

.quick-action-icon i.fas {
    font-size: inherit;
}

/* App-specific overrides to integrate Mimir with existing `.sheet` styles */
/* Keep this block at the end so it overrides upstream rules */
.main-content .container { padding: 1.5rem; max-width: 1100px; margin: 1rem auto; }

/* Make .sheet look more like the theme's tables */
.sheet { width: 100%; border-collapse: collapse; background: var(--surface-color); border: 1px solid var(--border-color); border-radius: 8px; overflow: hidden; }
.sheet thead th { background-color: var(--bg-color); padding: 0.85rem 1rem; text-align: left; font-weight: 600; font-size: 0.8125rem; text-transform: uppercase; color: var(--text-muted); border-bottom: 2px solid var(--border-color); }
.sheet tbody td { padding: 0.85rem 1rem; border-bottom: 1px solid var(--border-color); color: var(--text-primary); }
.sheet tbody tr:hover { background-color: var(--bg-secondary); }
.sheet.compact thead th, .sheet.compact tbody td { padding: 0.5rem 0.75rem; font-size: 13px; }

/* Make month rows stand out */
.sheet tr.month td { background: var(--bg-secondary); font-weight: 700; text-transform: uppercase; }

/* Form layout improvements for inline forms */
.row-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.row-form .form-group, .row-form .field { flex: 1 1 200px; min-width: 160px; }
.row-form label { display: block; font-size: 0.9rem; color: var(--text-primary); margin-bottom: 6px; }
.form-control { width: 100%; }

/* Global form styles */
.form-wrapper { background: var(--surface-color); border: 1px solid var(--border-color); padding: 16px; border-radius: 8px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.form-grid.single-column { grid-template-columns: 1fr; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-weight: 600; color: var(--text-primary); }
.form-help { font-size: 12px; color: var(--text-muted); }
.form-control, .form-select, .form-textarea { background: var(--bg-color); border: 1px solid var(--border-color); padding: 8px 10px; border-radius: 6px; color: var(--text-primary); }
.form-control:focus, .form-select:focus, .form-textarea:focus { outline: none; box-shadow: 0 6px 18px rgba(0,0,0,0.06); border-color: rgba(0,0,0,0.12); }
.form-textarea { min-height: 90px; resize: vertical; }
.form-actions { display:flex; gap:8px; align-items:center; }
.btn-primary { background: var(--primary-color); color: white; border: none; padding: 8px 12px; border-radius: 6px; cursor: pointer; }
.btn-secondary { background: transparent; border: 1px solid var(--border-color); color: var(--text-primary); padding: 8px 12px; border-radius: 6px; cursor: pointer; }
.btn:disabled, .btn[disabled] { opacity: 0.6; cursor: not-allowed; }

/* Checkbox / radio modern look */
.form-check { display:flex; align-items:center; gap:8px; }
.form-check input[type="checkbox"], .form-check input[type="radio"] { width:16px; height:16px; }

/* Inline small form compacting */
@media (max-width:900px){ .form-grid { grid-template-columns: 1fr; } }

/* Config form specific tweaks: give it a subtle card look */
.config-card { padding: 14px; border-radius: 10px; background: linear-gradient(180deg, rgba(255,255,255,0.02), transparent); border:1px solid rgba(0,0,0,0.04); }

/* Error / validation state */
.field-error { border-color: #d9534f !important; }
.form-error { color: #d9534f; font-size: 12px; margin-top: 6px; }

/* Small utility */
.muted { color: var(--text-muted); font-size: 12px; }

/* Buttons */
.actions .btn { min-width: 120px; }

/* Badges slightly larger for calendar view */
.badge { font-size: 0.78rem; padding: 0.3rem 0.6rem; }

/* Make footer subtle and aligned */
.footer { padding: 1rem 1.5rem; text-align: right; color: var(--text-muted); }

/* Small responsive tweak for narrow screens */
@media (max-width: 720px) {
    .row-form { flex-direction: column; }
    .sidebar { transform: translateX(-100%); }
    .main-content { margin-left: 0; }
}


/* Custom tweaks: compact inline entry form widths and responsive behavior */
.row-form label { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.row-form .form-label { display: inline-flex !important; align-items: center; gap: 8px; margin: 0 !important; }
.row-form label input { width: 120px; padding: 6px 8px; }
.row-form label input[type="date"] { width: 150px; }
.row-form label input[type="text"] { min-width: 220px; }
.row-form .actions { margin: 0 0 0 6px; }
.row-form { gap: 10px; }
@media (max-width: 900px) {
    .row-form { flex-direction: column; align-items: stretch; }
    .row-form label { width: 100%; justify-content: space-between; }
    .row-form label input { width: 60%; }
    .row-form label input[type="text"] { width: 100%; }
    .row-form .actions { margin-top: 8px; }
}

/* Month toggle button inside month header */
.sheet tr.month td { position: relative; }
.sheet td.month-header { cursor: pointer; }
.month-toggle {
    display: inline-block;
    width: 1.6rem;
    height: 1.6rem;
    line-height: 1.4rem;
    text-align: center;
    border: 1px solid var(--border-color);
    background: var(--surface-color);
    color: var(--text-primary);
    border-radius: 4px;
    margin-right: 8px;
    cursor: pointer;
    font-weight: 700;
}
.month-toggle, .sheet td.month-header { user-select: none; }

/* Debug indicator */
#month-debug { position: fixed; right: 12px; bottom: 12px; background: rgba(0,0,0,0.7); color: #fff; padding: 8px 10px; border-radius: 6px; font-size: 12px; z-index: 9999; box-shadow: 0 4px 12px rgba(0,0,0,0.3); }
#month-debug.hidden { display: none; }
.month-toggle:focus { outline: none; box-shadow: 0 0 0 3px rgba(0,0,0,0.06); }

/* Collapsed month: hide all rows except the header row */
tbody.month-group.collapsed tr:not(.month) { display: none; }
tbody.month-group .month-header.collapsed { opacity: 0.85; }

/* Weekend highlight */
.sheet tbody tr.weekend td {
    background-color: rgba(250, 240, 210, 0.55); /* warm subtle highlight */
}

/* Add a weekend icon in the first cell */
.sheet tbody tr.weekend td:first-child {
    position: relative;
    padding-left: 28px; /* space for icon */
}
.sheet tbody tr.weekend td:first-child::before {
    content: "🌙";
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    opacity: 0.9;
}

/* Slightly dim weekend header color to differentiate */
tbody.month-group.collapsed tr.weekend td:not(.month) { opacity: 0.95; }

/* Holiday highlight (general) */
.sheet tbody tr.holiday td {
    background-color: rgba(255, 230, 230, 0.8); /* light red/pink */
}
.sheet tbody tr.holiday td:first-child {
    position: relative;
    padding-left: 28px;
}
.sheet tbody tr.holiday td:first-child::before {
    content: "🎉";
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    opacity: 0.95;
}

/* Vacation highlight */
.sheet tbody tr.vacation td { background-color: rgba(230, 245, 255, 0.85); }
.sheet tbody tr.personal td { background-color: rgba(235, 255, 230, 0.85); }
.sheet tbody tr.illness td { background-color: rgba(255, 250, 230, 0.85); }
.sheet tbody tr.permiso td { background-color: rgba(240, 245, 255, 0.85); }


