/* ============================================================
   CHECKSAFETY ERP - INSTITUTIONAL CLEAN WHITE DESIGN SYSTEM
   Inspired by Mitti / SafetyCulture & Apple Launchpad
   ============================================================ */

:root {
    /* Institutional White & Crisp Light Palette */
    --bg-main: #ffffff;
    --bg-surface: #f8fafc;
    --bg-card: #ffffff;
    --bg-input: #ffffff;
    --border-color: #e2e8f0;
    --border-subtle: #f1f5f9;
    
    /* Text Typography */
    --text-main: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    
    /* Brand Green */
    --verde-marca: #00AE09;
    --verde-hover: #008f07;
    --verde-light: #e6f7e7;
    --verde-border: #bbf7d0;
    --verde-glow: rgba(0, 174, 9, 0.25);
    
    /* Semantic Colors */
    --critico: #ef4444;
    --critico-light: #fef2f2;
    --critico-border: #fecaca;
    --alerta: #f59e0b;
    --alerta-light: #fffbeb;
    --alerta-border: #fde68a;
    --info: #3b82f6;
    --info-light: #eff6ff;
    --info-border: #bfdbfe;
    --purple: #8b5cf6;
    --purple-light: #f5f3ff;
    --purple-border: #ddd6fe;
    --teal: #0d9488;
    --teal-light: #f0fdfa;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.07), 0 1px 2px -1px rgba(0, 0, 0, 0.07);
    --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    --shadow-launcher: 0 12px 24px -4px rgba(0, 0, 0, 0.12);
}

/* Dark Mode Fallback */
body.dark-mode {
    --bg-main: #0f172a;
    --bg-surface: #1e293b;
    --bg-card: #1e293b;
    --bg-input: #0f172a;
    --border-color: #334155;
    --border-subtle: #1e293b;
    --text-main: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --verde-light: rgba(0, 174, 9, 0.15);
    --verde-border: rgba(0, 174, 9, 0.4);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', 'Roboto', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color 0.2s ease, color 0.2s ease;
}

/* Clean background subtle pattern */
.bg-clean-canvas {
    background-color: var(--bg-main);
    background-image: 
        radial-gradient(#e2e8f0 1px, transparent 1px);
    background-size: 24px 24px;
}

body.dark-mode .bg-clean-canvas {
    background-color: var(--bg-main);
    background-image: 
        radial-gradient(#334155 1px, transparent 1px);
}

/* Submenu Horizontal Tabs (Reference Style) */
.submodule-tabs-bar {
    display: flex;
    align-items: center;
    gap: 1.75rem;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 1.5rem;
    overflow-x: auto;
    scrollbar-width: none;
}
.submodule-tabs-bar::-webkit-scrollbar {
    display: none;
}

.submodule-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 0.75rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: #64748b;
    border-bottom: 2px solid transparent;
    transition: all 0.15s ease;
    white-space: nowrap;
    background: transparent;
    border-top: none;
    border-left: none;
    border-right: none;
    cursor: pointer;
}

.submodule-tab-btn svg {
    width: 1rem;
    height: 1rem;
    stroke-width: 2px;
}

.submodule-tab-btn:hover {
    color: #1e293b;
}

.submodule-tab-btn.active {
    color: #e11d48;
    font-weight: 700;
    border-bottom-color: #e11d48;
}

body.dark-mode .submodule-tabs-bar {
    border-bottom-color: #334155;
}

body.dark-mode .submodule-tab-btn {
    color: #94a3b8;
}

body.dark-mode .submodule-tab-btn.active {
    color: #f43f5e;
    border-bottom-color: #f43f5e;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--verde-marca);
}

/* Institutional Header */
.institutional-header {
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.04);
}

body.dark-mode .institutional-header {
    background: #1e293b;
    border-bottom-color: #334155;
}

/* Institutional Sidebar (Mitti Style) */
.institutional-sidebar {
    background: #ffffff;
    border-right: 1px solid var(--border-color);
    width: 250px;
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s ease;
}

body.dark-mode .institutional-sidebar {
    background: #1e293b;
    border-right-color: #334155;
}

.institutional-sidebar.collapsed {
    width: 70px;
}

.institutional-sidebar.collapsed .sidebar-text,
.institutional-sidebar.collapsed .sidebar-heading,
.institutional-sidebar.collapsed .sidebar-badge {
    display: none !important;
}

.institutional-sidebar.collapsed .sidebar-item-btn {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

/* Institutional Cards */
.institutional-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-card);
    transition: all 0.2s ease;
}

body.dark-mode .institutional-card {
    background: #1e293b;
    border-color: #334155;
}

.institutional-card:hover {
    box-shadow: var(--shadow-hover);
}

/* ============================================================
   APPLE-STYLE LAUNCHPAD GRID (EXACT REFERENCE SPECIFICATION)
   ============================================================ */

.launchpad-container {
    max-width: 980px;
    margin: 0 auto;
    padding: 36px 20px 60px 20px;
    text-align: center;
}

.launchpad-subtitle {
    font-size: 0.92rem;
    color: #64748b;
    font-weight: 400;
    letter-spacing: -0.1px;
}

.launchpad-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    column-gap: 24px;
    row-gap: 30px;
    margin-top: 36px;
    justify-items: center;
}

@media (min-width: 480px) {
    .launchpad-grid {
        grid-template-columns: repeat(3, 1fr);
        column-gap: 28px;
        row-gap: 32px;
    }
}

@media (min-width: 768px) {
    .launchpad-grid {
        grid-template-columns: repeat(4, 1fr);
        column-gap: 36px;
        row-gap: 36px;
    }
}

@media (min-width: 1024px) {
    .launchpad-grid {
        grid-template-columns: repeat(6, 1fr);
        column-gap: 44px;
        row-gap: 36px;
    }
}

.app-icon-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    background: transparent;
    border: none;
    outline: none;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    padding: 0;
    width: 96px;
}

.app-icon-card:hover {
    transform: translateY(-5px);
}

.app-icon-card:active {
    transform: translateY(-1px) scale(0.97);
}

/* Exact Reference Squircle Icon Container (66px x 66px, r: 17px) */
.app-squircle {
    width: 66px;
    height: 66px;
    border-radius: 17px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.04);
    position: relative;
    transition: all 0.2s ease;
    overflow: hidden;
}

.app-icon-card:hover .app-squircle {
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.14);
}

.app-squircle svg {
    width: 28px;
    height: 28px;
    stroke-width: 2.2px;
}

.app-icon-title {
    font-size: 0.8rem;
    font-weight: 500;
    color: #334155;
    margin-top: 8px;
    letter-spacing: -0.15px;
    line-height: 1.25;
    max-width: 96px;
    text-align: center;
    transition: color 0.15s ease;
}

.app-icon-card:hover .app-icon-title {
    color: var(--verde-marca);
}

.app-badge-alert {
    position: absolute;
    top: -3px;
    right: 10px;
    background: #ef4444;
    color: #ffffff;
    font-size: 0.68rem;
    font-weight: 700;
    min-width: 19px;
    height: 19px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    box-shadow: 0 2px 5px rgba(239, 68, 68, 0.35);
    border: 2px solid #ffffff;
    z-index: 10;
}

/* Exact Reference Solid Matte Color Palettes */
.bg-app-teal { background-color: #1e8c81; }
.bg-app-blue { background-color: #2e75dc; }
.bg-app-green { background-color: #419c4d; }
.bg-app-terracotta { background-color: #cb513e; }
.bg-app-navy { background-color: #2c3a4d; }
.bg-app-slate { background-color: #364152; }
.bg-app-mustard { background-color: #e59b18; }
.bg-app-emerald { background-color: #2da868; }
.bg-app-crimson { background-color: #d34141; }
.bg-app-cyan { background-color: #229b93; }
.bg-app-purple { background-color: #894879; }
.bg-app-amber { background-color: #e49a15; }
.bg-app-pink { background-color: #c94277; }
.bg-app-indigo { background-color: #4352b3; }
.bg-app-darkteal { background-color: #196d66; }
.bg-app-cobalt { background-color: #1d5cb8; }

/* ============================================================
   MITTI / SAFETYCULTURE STYLE DATA TABLES & TABS
   ============================================================ */

.custom-table-container {
    width: 100%;
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: #ffffff;
}

body.dark-mode .custom-table-container {
    background: #1e293b;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.86rem;
}

.custom-table th {
    background: #f8fafc;
    color: #475569;
    padding: 12px 16px;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
}

body.dark-mode .custom-table th {
    background: #0f172a;
    color: #94a3b8;
}

.custom-table td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
}

.custom-table tr:hover td {
    background: #f8fafc;
}

body.dark-mode .custom-table tr:hover td {
    background: rgba(255, 255, 255, 0.03);
}

/* Status Badges */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 9999px;
    font-size: 0.74rem;
    font-weight: 600;
    text-transform: capitalize;
}

.badge-success { background: var(--verde-light); color: var(--verde-hover); border: 1px solid var(--verde-border); }
.badge-warning { background: var(--alerta-light); color: #b45309; border: 1px solid var(--alerta-border); }
.badge-danger { background: var(--critico-light); color: #b91c1c; border: 1px solid var(--critico-border); }
.badge-info { background: var(--info-light); color: #1d4ed8; border: 1px solid var(--info-border); }

/* Buttons */
.btn-primary {
    background: var(--verde-marca);
    color: #ffffff;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.88rem;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 174, 9, 0.2);
}

.btn-primary:hover {
    background: var(--verde-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 174, 9, 0.3);
}

.btn-secondary {
    background: #ffffff;
    color: var(--text-secondary);
    font-weight: 500;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.88rem;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.form-input-custom {
    width: 100%;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 9px 13px;
    color: var(--text-main);
    font-size: 0.88rem;
    outline: none;
    transition: all 0.2s ease;
}

body.dark-mode .form-input-custom {
    background: #0f172a;
    border-color: #334155;
    color: #ffffff;
}

.form-input-custom:focus {
    border-color: var(--verde-marca);
    box-shadow: 0 0 0 3px var(--verde-light);
}

/* Digital Signature Canvas */
.signature-container {
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
    position: relative;
    width: 100%;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: crosshair;
}

body.dark-mode .signature-container {
    background: #0f172a;
    border-color: #334155;
}

.signature-canvas {
    width: 100%;
    height: 100%;
    touch-action: none;
}

.animate-slide-up {
    animation: slideUp 0.25s ease-out;
}

@keyframes slideUp {
    0% { transform: translateY(12px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

.animate-pop-in {
    animation: popIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
    0% { transform: scale(0.95); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}
