/* ============================================================
   Robeeta Cloud — Custom theme layer (Tabler base)
   ============================================================ */

:root {
    --app-sidebar-width: 236px;
    --app-sidebar-bg: #111a27;
    --app-sidebar-border: #253143;
    --app-blue: #206bc4;
    --app-heading-text: #1f2d3d;
    --app-muted-text: #6c7b95;
    --app-icon-muted: #8a99ad;
    --app-surface-bg: #f2f5f9;
    --app-card-bg: #ffffff;
    --app-border: #e3eaf3;
}

html[data-bs-theme="dark"] {
    --app-sidebar-bg: #0d1420;
    --app-sidebar-border: #1c2a3a;
    --app-heading-text: #e2e8f0;
    --app-muted-text: #8fa3bb;
    --app-icon-muted: #6b849e;
    --app-surface-bg: #111827;
    --app-card-bg: #1a2332;
    --app-border: #253143;
}

/* ── Global ─────────────────────────────────────────────── */

html, body {
    min-height: 100%;
}

body {
    color: #1f2d3d;
    background-color: var(--app-surface-bg);
    font-family: var(--tblr-font-sans-serif, Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
}

a { color: var(--app-blue); }

/* ── App shell ───────────────────────────────────────────── */

.app-layout {
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--app-surface-bg);
}

/* ── Sidebar ─────────────────────────────────────────────── */

.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    width: var(--app-sidebar-width);
    min-height: 100vh;
    color: #d7e0ed;
    background: var(--app-sidebar-bg);
    border-right: 1px solid var(--app-sidebar-border);
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.03);
}

.app-sidebar-inner {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 100%;
    padding: 12px;
}

.app-sidebar-toggle {
    display: none;
    width: 36px;
    height: 36px;
    color: #d7e0ed;
    background: transparent;
    border: 1px solid #2c394b;
    border-radius: 4px;
    place-items: center;
}

.app-brand {
    width: 100%;
    padding: 2px 4px 14px;
    margin: 0;
    font-size: 0.92rem;
    font-weight: 800;
    line-height: 1;
}

.app-brand a {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 34px;
    color: #ffffff !important;
    text-decoration: none;
}

.brand-mark {
    display: inline-grid;
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    color: #ffffff;
    background: var(--app-blue);
    border-radius: 4px;
    place-items: center;
    box-shadow: 0 8px 18px rgba(32, 107, 196, 0.28);
}

.app-sidebar-menu { width: 100%; }

.app-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    padding: 0;
    margin: 0;
    list-style: none;
}

.nav-section-title {
    padding: 8px 6px 5px;
    margin: 4px 0 2px;
    font-size: 0.62rem;
    font-weight: 800;
    line-height: 1;
    color: #8794a6;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.sidebar-dark-nav .nav-item { width: 100%; }

.sidebar-dark-nav .nav-link {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 38px;
    padding: 0 12px;
    color: #d4dfed !important;
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.2;
    border-radius: 4px;
    text-decoration: none;
    transition: background 0.12s, color 0.12s;
}

.sidebar-dark-nav .nav-link-icon {
    display: grid;
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
    margin-right: 10px;
    color: inherit !important;
    font-size: 1rem;
    opacity: 0.9;
    place-items: center;
}

.sidebar-dark-nav .nav-link-title {
    min-width: 0;
    overflow: hidden;
    color: inherit !important;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-dark-nav .nav-link:hover,
.sidebar-dark-nav .nav-item.active .nav-link {
    color: #ffffff !important;
    background: var(--app-blue) !important;
}

/* ── Main area ───────────────────────────────────────────── */

.app-main {
    min-height: 100vh;
    min-height: 100dvh;
    width: calc(100% - var(--app-sidebar-width));
    margin-left: var(--app-sidebar-width) !important;
    display: flex;
    flex-direction: column;
    background: var(--app-surface-bg);
}

.app-content {
    flex: 1 0 auto;
    padding: 16px 16px 24px;
}

/* ── Topbar ──────────────────────────────────────────────── */

.app-topbar {
    min-height: 56px;
    background: var(--app-card-bg);
    border-bottom: 1px solid var(--app-border);
    box-shadow: 0 1px 0 rgba(22, 34, 51, 0.03);
}

.app-topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 56px;
    padding: 0 24px;
}

.app-page-title {
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--app-heading-text);
}

.app-topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.app-topbar-icon-btn {
    display: inline-grid;
    width: 34px;
    height: 34px;
    color: #33465d;
    background: var(--app-card-bg);
    border: 1px solid #d8e2ee;
    border-radius: 4px;
    place-items: center;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
}

.app-topbar-icon-btn:hover,
.app-topbar-icon-btn:focus {
    color: var(--app-heading-text);
    background: #f6f9fd;
    border-color: #c6d5e7;
}

.app-topbar-icon-btn i { font-size: 1rem; }

.app-topbar-dropdown .dropdown-menu {
    min-width: 12rem;
    margin-top: 0.45rem;
    border-color: #dde6f1;
    box-shadow: 0 12px 28px rgba(22, 34, 51, 0.08);
}

.app-topbar-dropdown .dropdown-item {
    font-size: 0.82rem;
    font-weight: 600;
    color: #31455c;
}

.app-topbar-dropdown .dropdown-item i {
    width: 1.1rem;
    margin-right: 0.4rem;
    color: #6c7f95;
}

.app-topbar-divider {
    width: 1px;
    height: 26px;
    margin: 0 0.15rem;
    background: #e2e9f2;
}

.app-user-menu {
    display: flex !important;
    align-items: center;
    padding: 0.2rem 0.35rem 0.2rem 0.2rem !important;
    color: #27364a !important;
    font-size: 0.78rem;
    font-weight: 600;
    border: 1px solid #d8e2ee;
    border-radius: 4px;
    text-decoration: none;
    background: var(--app-card-bg);
    transition: background 0.12s, border-color 0.12s;
}

.app-user-menu:hover,
.app-user-menu:focus {
    background: #f6f9fd;
    border-color: #c6d5e7;
}

.app-topbar .avatar {
    width: 26px;
    height: 26px;
    font-size: 0.74rem;
    background: var(--app-blue) !important;
}

.app-user-name { line-height: 1; }

/* ── Footer ──────────────────────────────────────────────── */

.app-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    margin: 0;
    margin-top: auto;
    padding: 0.65rem 0.95rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.35;
    color: #5f7288;
    text-align: center;
    background: linear-gradient(180deg, var(--app-card-bg) 0%, #f7faff 100%);
    border: 1px solid #dce6f2;
    border-radius: 4px;
    box-shadow: 0 6px 16px rgba(22, 34, 51, 0.04);
}

.app-footer-version {
    display: inline-flex;
    align-items: center;
    padding: 0.12rem 0.42rem;
    color: #355274;
    font-size: 0.7rem;
    font-weight: 700;
    background: #eaf2fb;
    border: 1px solid #cfdff1;
    border-radius: 4px;
}

/* ── Dashboard shell ─────────────────────────────────────── */

.dashboard-shell {
    max-width: none;
    padding: 0;
}

.dashboard-shell .card {
    overflow: hidden;
    background: var(--app-card-bg);
    border: 1px solid var(--app-border);
    border-radius: 4px;
    box-shadow: 0 8px 18px rgba(22, 34, 51, 0.05);
}

.dashboard-shell .card-header {
    min-height: 48px;
    padding: 0.85rem 1rem;
    border-bottom-color: #edf1f6;
}

.dashboard-shell .card-title {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--app-heading-text);
}

/* ── Welcome panel ───────────────────────────────────────── */

.welcome-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.2rem 1.25rem;
    color: #ffffff;
    background: linear-gradient(125deg, #0f4d88 0%, #266db8 54%, #5a8fc9 100%);
    border-radius: 4px;
    box-shadow: 0 10px 22px rgba(21, 49, 80, 0.18);
}

.welcome-panel h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
}

.welcome-panel p {
    margin: 0.3rem 0 0;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.87);
}

.welcome-action {
    display: inline-grid;
    width: 38px;
    height: 38px;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.42);
    border-radius: 4px;
    place-items: center;
    text-decoration: none;
    flex-shrink: 0;
}

/* ── Module / service cards ──────────────────────────────── */

.module-card .module-icon {
    display: inline-grid;
    width: 42px;
    height: 42px;
    border-radius: 4px;
    place-items: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.module-card .module-copy {
    flex: 1 1 0;
    min-width: 0;
}

.module-card .module-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--app-muted-text, #6c7b95);
}

.module-card .module-value {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--app-heading-text, #1f2d3d);
    line-height: 1.25;
}

.module-card .module-meta {
    font-size: 0.73rem;
    font-weight: 700;
}

.module-card .module-arrow {
    margin-left: auto;
    flex-shrink: 0;
    color: var(--app-icon-muted, #8a99ad);
}

/* Compact card-body for module widget cards */
.module-card .card-body {
    padding: 0.875rem 1rem;
}

/* Widget grid: tight gutters, no row-cards override */
.module-grid {
    --bs-gutter-x: 0.5rem;
    --bs-gutter-y: 0.5rem;
    margin-bottom: 0.25rem !important;
}

/* Chart card body */
.chart-wrap { padding-top: 0.5rem; }

/* Dark-mode overrides for metric card text */
html[data-bs-theme="dark"] .module-card .module-title { color: var(--app-muted-text, #8fa3bb); }
html[data-bs-theme="dark"] .module-card .module-value { color: var(--app-heading-text, #e2e8f0); }

/* Module tone colors */
.module-tone-msg4  { background: #e9f5ff; color: #206bc4; }
.module-tone-veri5 { background: #f4ecff; color: #7c3aed; }
.module-tone-vm    { background: #f0f7ea; color: #2f9e44; }
.module-tone-dhsm  { background: #e9fbfa; color: #0f766e; }

/* ── Service widget cards (small-box style) ─────────────────── */

.service-widget {
    border: none;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.14);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.service-widget:hover { transform: translateY(-3px); box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22); }

.service-widget-name {
    font-size: 1.25rem;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.2;
    margin-bottom: 0.2rem;
}

.service-widget-desc {
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
}

.service-widget-icon {
    font-size: 3.5rem;
    color: rgba(255, 255, 255, 0.35);
}

.service-widget-footer {
    display: flex;
    align-items: center;
    padding: 0.55rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.88);
    background: rgba(0, 0, 0, 0.14);
    border-top: 1px solid rgba(255, 255, 255, 0.18);
    transition: background 0.12s;
}

.service-widget:hover .service-widget-footer { background: rgba(0, 0, 0, 0.22); }

/* Widget color backgrounds — matching reference project's Success/Warning/Danger/Info */
.widget-bg-success { background: linear-gradient(135deg, #27943e 0%, #2fb84e 100%); }
.widget-bg-warning { background: linear-gradient(135deg, #c96a00 0%, #f59f00 100%); }
.widget-bg-danger  { background: linear-gradient(135deg, #b81c1c 0%, #e03535 100%); }
.widget-bg-info    { background: linear-gradient(135deg, #0e56a8 0%, #206bc4 100%); }

/* ── Modules hero (Index page) ───────────────────────────── */

.modules-hero {
    position: relative;
    overflow: hidden;
    padding: 1.3rem 1.35rem;
    color: #ffffff;
    background: linear-gradient(132deg, #0b4e89 0%, #236cb9 52%, #4c85c5 100%);
    border-radius: 4px;
}

.modules-hero::before {
    content: "";
    position: absolute;
    top: -110px;
    right: -70px;
    width: 260px;
    height: 260px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.24) 0%, rgba(255, 255, 255, 0) 72%);
    pointer-events: none;
}

.modules-hero h2 { margin: 0; font-size: 1.06rem; font-weight: 800; }
.modules-hero p { margin: 0.35rem 0 0; max-width: 720px; font-size: 0.8rem; line-height: 1.45; color: rgba(255, 255, 255, 0.89); }

.module-launch-card {
    display: block;
    color: inherit;
    text-decoration: none;
}

.module-launch-card:hover,
.module-launch-card:focus,
.module-launch-card:active,
.module-launch-card:visited { color: inherit; text-decoration: none; }

.module-launch-card .card {
    border: 1px solid var(--app-border);
    border-radius: 4px;
    box-shadow: 0 8px 16px rgba(26, 38, 57, 0.04);
    transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.module-launch-card:hover .card {
    border-color: #c8d7e8;
    box-shadow: 0 12px 24px rgba(26, 38, 57, 0.09);
    transform: translateY(-2px);
}

.module-launch-body {
    display: flex;
    align-items: center;
    min-height: 100px;
    padding: 1rem;
    gap: 0.8rem;
}

.module-launch-icon {
    display: inline-grid;
    flex: 0 0 46px;
    width: 46px;
    height: 46px;
    font-size: 1.24rem;
    border-radius: 4px;
    place-items: center;
}

.module-launch-title { margin: 0; font-size: 0.89rem; font-weight: 800; color: #22364f; }
.module-launch-copy { margin-top: 0.22rem; font-size: 0.76rem; font-weight: 600; color: #607389; }
.module-launch-arrow { margin-left: auto; color: #9fb0c4; font-size: 1rem; }

.module-tone-task    { background: #e9f5ff; color: #206bc4; }
.module-tone-veri5   { background: #f4ecff; color: #7c3aed; }
.module-tone-vm      { background: #f0f7ea; color: #2f9e44; }
.module-tone-dhsm    { background: #e9fbfa; color: #0f766e; }
.module-tone-admin   { background: #fff4e8; color: #d97706; }
.module-tone-support { background: #ffeef2; color: #be185d; }

/* ── Form styles ─────────────────────────────────────────── */

.required-marker {
    position: relative;
    top: -0.45em;
    margin-left: 0.18rem;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
    color: #d63939;
}

.employee-form-wrap .form-control.input-validation-error,
.employee-form-wrap .form-select.input-validation-error,
.employee-form-wrap textarea.form-control.input-validation-error {
    border-color: #dc3545 !important;
    box-shadow: inset 0 0 0 1px rgba(220, 53, 69, 0.25);
}

.employee-form-wrap .form-control.input-validation-error:focus,
.employee-form-wrap .form-select.input-validation-error:focus {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.2) !important;
}

/* ── Record count badge ──────────────────────────────────── */

.record-count-badge {
    background: #eaf2fb;
    color: #355274;
    border: 1px solid #cfdff1;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
}

/* ── Entry layout (login/OTP pages) ─────────────────────── */

.entry-page-bg {
    background: linear-gradient(135deg, #0e3a6e 0%, #1a5fb4 50%, #3b82c4 100%);
    min-height: 100vh;
}

.entry-layout {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem 1rem;
}

.entry-card {
    width: 100%;
    max-width: 420px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(10, 30, 60, 0.22);
    padding: 2rem 2.25rem;
}

.entry-brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 1.75rem;
    justify-content: center;
}

.entry-brand-name {
    font-size: 1.1rem;
    font-weight: 800;
    color: #1a2d42;
}

.entry-footer {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #e5ebf3;
    text-align: center;
    font-size: 0.74rem;
    color: #7a8fa6;
}

/* ── Service page iframe wrapper ─────────────────────────── */

.service-frame-wrap {
    position: relative;
    background: var(--app-card-bg);
    border: 1px solid var(--app-border);
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 8px 18px rgba(22, 34, 51, 0.05);
}

.service-frame-header {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--app-border);
    background: var(--app-card-bg);
}

.service-frame-icon {
    display: inline-grid;
    width: 36px;
    height: 36px;
    border-radius: 4px;
    place-items: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.service-frame-title { font-size: 0.9rem; font-weight: 800; color: var(--app-heading-text); }
.service-frame-desc  { font-size: 0.76rem; color: var(--app-muted-text); }

.service-open-btn {
    margin-left: auto;
}

/* ── Sidebar collapse for desktop ───────────────────────── */

@media (min-width: 992px) {
    .app-sidebar-menu.collapse {
        display: block !important;
        height: auto !important;
        visibility: visible !important;
    }
}

/* ── Responsive ──────────────────────────────────────────── */

@media (max-width: 991.98px) {
    .app-sidebar {
        position: sticky;
        top: 0;
        width: 100%;
        min-height: auto;
    }

    .app-sidebar-inner { min-height: auto; }

    .app-sidebar-toggle {
        display: grid;
        position: absolute;
        top: 11px;
        right: 12px;
    }

    .app-brand { width: calc(100% - 48px); padding-bottom: 4px; }

    .app-sidebar-menu { margin-top: 10px; }

    .app-main { width: 100%; margin-left: 0 !important; }

    .app-topbar-inner { padding: 0 16px; }

    .app-content { padding: 12px 12px 16px; }

    .welcome-panel { padding: 1rem; }
    .modules-hero  { padding: 1rem; }

    .module-launch-body { min-height: 92px; padding: 0.85rem; }

    .app-footer { flex-direction: column; gap: 0.35rem; padding: 0.6rem 0.75rem; }
}

/* ── Agreement modal ─────────────────────────────────────── */

.agreement-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1050;
    background: rgba(15, 25, 40, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.agreement-modal-box {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(10, 30, 60, 0.22);
    width: 100%;
    max-width: 640px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.agreement-modal-header {
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid #e5ebf3;
    font-size: 0.95rem;
    font-weight: 800;
    color: #1a2d42;
}

.agreement-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    font-size: 0.82rem;
    line-height: 1.6;
    color: #3a4f63;
}

.agreement-modal-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid #e5ebf3;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* ── Delete confirm row ──────────────────────────────────── */

.event-log-col-date { min-width: 13.5rem; white-space: nowrap; }
.post-by-col-updated-on { min-width: 13.5rem; white-space: nowrap; }
.attachments-col-download { width: 6rem; white-space: nowrap; }
