:root {
    --ic-sidebar-w: 240px;
    --ic-sidebar-bg: #1f2933;
    --ic-sidebar-fg: #cbd5e0;
    --ic-sidebar-active: #2d3a48;
    --ic-accent: #3b82f6;
}

html, body { height: 100%; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #f4f6f8;
}

.ic-shell {
    display: flex;
    min-height: 100vh;
}

.ic-sidebar {
    width: var(--ic-sidebar-w);
    background: var(--ic-sidebar-bg);
    color: var(--ic-sidebar-fg);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.ic-sidebar .brand {
    padding: 18px 18px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    font-weight: 600;
    font-size: 1.1rem;
    color: #fff;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.ic-sidebar .brand .brand-logo {
    max-height: 40px;
    max-width: 100%;
    width: auto;
    display: inline-block;
    object-fit: contain;
}
.ic-sidebar .brand .brand-fallback { display: none; }
.ic-sidebar .brand .brand-text { font-weight: 600; }

/* Bootstrap tab panes: works even when wrapped in a form (no .tab-content direct-child) */
.tab-pane { display: none !important; }
.tab-pane.show.active,
.tab-pane.active.show,
.tab-pane.active { display: block !important; }

/* Password show/hide toggle */
.pwd-wrap { position: relative; }
.pwd-wrap .pwd-toggle {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}
.pwd-wrap .pwd-toggle i { font-size: 1rem; line-height: 1; }

.ic-sidebar nav { padding: 8px 0; }
.ic-sidebar nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    color: var(--ic-sidebar-fg);
    text-decoration: none;
    font-size: 0.95rem;
    border-left: 3px solid transparent;
}
.ic-sidebar nav a:hover { background: rgba(255,255,255,0.04); color: #fff; }
.ic-sidebar nav a.active {
    background: var(--ic-sidebar-active);
    color: #fff;
    border-left-color: var(--ic-accent);
}
.ic-sidebar nav .section {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.35);
    padding: 14px 18px 6px;
}

.ic-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.ic-topbar {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.ic-topbar h1 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 600;
    color: #1f2933;
}
.ic-topbar .user {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: #4b5563;
}

.ic-content { padding: 24px; flex: 1; }

.ic-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 18px;
}

.ic-stat {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 18px;
}
.ic-stat .label { color: #6b7280; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.5px; }
.ic-stat .value { font-size: 1.85rem; font-weight: 600; color: #111827; margin-top: 6px; }
.ic-stat .hint { font-size: 0.8rem; color: #6b7280; margin-top: 4px; }

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}
.gallery a {
    display: block;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 8px;
    background: #e5e7eb;
    position: relative;
}
.gallery img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.15s ease-out;
}
.gallery a:hover img { transform: scale(1.04); }
.gallery .meta {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    padding: 6px 8px;
    background: linear-gradient(transparent, rgba(0,0,0,0.55));
    color: #fff;
    font-size: 0.75rem;
    pointer-events: none;
}
.gallery-item {
    position: relative;
    aspect-ratio: 1 / 1;
}
.gallery-item > a {
    aspect-ratio: 1 / 1;
    width: 100%;
    height: 100%;
}
.gallery-item .photo-del {
    position: absolute;
    top: 6px;
    right: 6px;
    margin: 0;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.15s ease-out;
}
.gallery-item:hover .photo-del { opacity: 1; }

.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1f2933 0%, #3b4a5a 100%);
}
.login-card {
    background: #fff;
    border-radius: 14px;
    padding: 32px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.25);
}
.login-card h1 {
    margin: 0 0 18px;
    font-size: 1.35rem;
    color: #1f2933;
}

.muted { color: #6b7280; }
.text-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.badge-status-0 { background: #dbeafe; color: #1e40af; }
.badge-status-1 { background: #fef3c7; color: #92400e; }
.badge-status-2 { background: #d1fae5; color: #065f46; }

/* ===== Dark mode ===== */
html[data-bs-theme="dark"] body { background: #0f1419; color: #e5e7eb; }
html[data-bs-theme="dark"] .ic-topbar {
    background: #1a202c;
    border-bottom-color: #2d3748;
}
html[data-bs-theme="dark"] .ic-topbar h1 { color: #e5e7eb; }
html[data-bs-theme="dark"] .ic-topbar .user { color: #cbd5e0; }
html[data-bs-theme="dark"] .ic-card,
html[data-bs-theme="dark"] .ic-stat {
    background: #1a202c;
    border-color: #2d3748;
    color: #e5e7eb;
}
html[data-bs-theme="dark"] .ic-stat .label { color: #9ca3af; }
html[data-bs-theme="dark"] .ic-stat .value { color: #f3f4f6; }
html[data-bs-theme="dark"] .ic-stat .hint { color: #9ca3af; }
html[data-bs-theme="dark"] .muted { color: #9ca3af; }
html[data-bs-theme="dark"] .table > :not(caption) > * > * { color: inherit; }
html[data-bs-theme="dark"] .table-light > :not(caption) > * > * {
    background-color: #2d3748;
    color: #e5e7eb;
}
html[data-bs-theme="dark"] .form-text { color: #9ca3af; }
html[data-bs-theme="dark"] .bg-light { background-color: #2d3748 !important; color: #e5e7eb; }
html[data-bs-theme="dark"] .border { border-color: #4a5568 !important; }
html[data-bs-theme="dark"] .alert-info {
    background-color: #1e3a5f; color: #bfdbfe; border-color: #1e40af;
}
html[data-bs-theme="dark"] .login-shell {
    background: linear-gradient(135deg, #0f1419 0%, #1a202c 100%);
}
html[data-bs-theme="dark"] .login-card {
    background: #1a202c; color: #e5e7eb;
    box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}
html[data-bs-theme="dark"] .login-card h1 { color: #f3f4f6; }
html[data-bs-theme="dark"] .gallery a { background: #2d3748; }

/* ===== Hub / Module launcher ===== */
.hub-header h2 { font-weight: 600; color: #1f2933; }
.ic-module-card {
    display: block;
    text-decoration: none;
    color: inherit;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 28px 24px;
    height: 100%;
    transition: transform 0.15s ease-out, box-shadow 0.15s ease-out, border-color 0.15s;
}
.ic-module-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(0,0,0,0.08);
    text-decoration: none;
    color: inherit;
    border-color: var(--ic-accent);
}
.ic-module-card .icon {
    font-size: 2.5rem;
    color: var(--ic-accent);
    line-height: 1;
    margin-bottom: 14px;
}
.ic-module-card h4 { margin: 0 0 6px; font-weight: 600; color: #1f2933; }
.ic-module-card p {
    margin: 0 0 14px;
    color: #6b7280;
    font-size: 0.92rem;
    min-height: 2.6em;
}
.ic-module-card.disabled-ish { opacity: 0.92; }

/* Sub-item in sidebar (e.g. Work orders under TransferPhotos) */
.ic-sidebar nav a.ic-subitem {
    padding-left: 40px;
    font-size: 0.88rem;
}
.ic-sidebar nav a.ic-subitem i { font-size: 0.85rem; }

/* Small badge inside sidebar (e.g. "Coming soon") */
.ic-sidebar nav a .ic-nav-badge {
    margin-left: auto;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 8px;
    background: rgba(245, 158, 11, 0.18);
    color: #fbbf24;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* Dark mode for hub */
html[data-bs-theme="dark"] .hub-header h2 { color: #f3f4f6; }
html[data-bs-theme="dark"] .ic-module-card {
    background: #1a202c;
    border-color: #2d3748;
}
html[data-bs-theme="dark"] .ic-module-card h4 { color: #f3f4f6; }
html[data-bs-theme="dark"] .ic-module-card p { color: #9ca3af; }
html[data-bs-theme="dark"] .ic-module-card:hover { border-color: var(--ic-accent); }
