/* =====================================================
   OMS - Office Management System
   Shared stylesheet
   ===================================================== */

:root {
    --brand-1: #4f46e5;     /* indigo  */
    --brand-2: #06b6d4;     /* cyan    */
    --brand-3: #8b5cf6;     /* violet  */
    --ink:     #0f172a;
    --muted:   #64748b;
    --bg:      #f1f5f9;
    --card-bg: #ffffff;
    --shadow:  0 10px 30px rgba(15, 23, 42, .08);
    --shadow-hover: 0 18px 40px rgba(79, 70, 229, .25);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    color: var(--ink);
    background: var(--bg);
}

a { color: var(--brand-1); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===================== LOGIN PAGE ===================== */
.login-wrapper {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(1200px 600px at 10% -10%, rgba(79,70,229,.22), transparent 60%),
        radial-gradient(900px 500px at 110% 10%, rgba(6,182,212,.22), transparent 60%),
        linear-gradient(135deg, #eef2ff 0%, #ecfeff 50%, #f5f3ff 100%);
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--card-bg);
    border-radius: 20px;
    box-shadow: var(--shadow);
    padding: 36px 32px 32px;
    animation: pop .35s ease;
}

@keyframes pop {
    from { opacity: 0; transform: translateY(8px) scale(.98); }
    to   { opacity: 1; transform: none; }
}

.brand {
    text-align: center;
    margin-bottom: 26px;
}

.brand-logo {
    /* Default (no image uploaded): gradient square with Font Awesome icon */
    width: 64px; height: 64px;
    margin: 0 auto 22px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
    display: grid; place-items: center;
    color: #fff; font-size: 28px;
    box-shadow: 0 8px 18px rgba(79,70,229,.35);
    overflow: hidden;
    flex-shrink: 0;
}
/* When an image is uploaded, drop the square box and just show the image
   at its natural aspect ratio so tall/wide logos look right. */
.brand-logo:has(.logo-img) {
    width: auto;
    height: 92px;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    overflow: visible;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.brand-logo .logo-img,
.brand-logo img {
    height: 100%;
    width: auto;
    max-width: 200px;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

.brand-office {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: .2px;
    margin: 0;
}

.brand-system {
    font-size: 13px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 4px;
}

.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: #334155;
}
.form-group input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    font-size: 15px;
    transition: border-color .15s, background .15s, box-shadow .15s;
}
.form-group input:focus {
    outline: none;
    background: #fff;
    border-color: var(--brand-1);
    box-shadow: 0 0 0 4px rgba(79,70,229,.15);
}

.btn {
    display: inline-block;
    width: 100%;
    padding: 12px 16px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: transform .08s, box-shadow .15s, opacity .15s;
}
.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
    box-shadow: 0 8px 18px rgba(79,70,229,.35);
}
.btn-primary:hover { transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-ghost {
    background: #f1f5f9;
    color: #334155;
}
.btn-ghost:hover { background: #e2e8f0; }

.alert {
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 14px;
    margin-bottom: 14px;
}
.alert-error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

.muted-note {
    font-size: 12px;
    color: var(--muted);
    text-align: center;
    margin-top: 18px;
}

/* ===================== TOP BAR ===================== */
.topbar {
    position: sticky;
    top: 0;
    z-index: 10050;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    overflow: visible;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}
.topbar-titles {
    min-width: 0;
}
.topbar-titles h1 {
    font-size: 18px;
    margin: 0;
    line-height: 1.2;
}
.topbar-titles span { font-size: 12px; color: var(--muted); letter-spacing: 1px; text-transform: uppercase; }

.topbar-logo {
    width: 42px; height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
    color: #fff;
    display: grid; place-items: center;
    font-size: 18px;
    overflow: hidden;
    flex-shrink: 0;
}
/* Image mode: ditch the square box, show logo at natural aspect ratio. */
.topbar-logo:has(.logo-img) {
    width: auto;
    height: 42px;
    background: transparent;
    border: none;
    padding: 0;
    overflow: visible;
    border-radius: 0;
    display: flex;
    align-items: center;
}
.topbar-logo .logo-img,
.topbar-logo img {
    height: 100%;
    width: auto;
    max-width: 80px;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

.topbar-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

.user-chip {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 12px 6px 6px;
    border-radius: 999px;
    background: #f1f5f9;
    font-size: 14px;
}
.user-chip .avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-3), var(--brand-1));
    color: #fff;
    display: grid; place-items: center;
    font-size: 13px; font-weight: 700;
}

.icon-btn {
    width: 38px; height: 38px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #fff;
    cursor: pointer;
    display: grid; place-items: center;
    color: #334155;
    transition: background .15s, color .15s;
    text-decoration: none;
}
.icon-btn:hover { background: #f8fafc; color: var(--brand-1); text-decoration: none; }

/* ===================== DASHBOARD ===================== */
.dash-wrap { max-width: 1280px; margin: 0 auto; padding: 28px; }

.welcome {
    background: linear-gradient(135deg, rgba(79,70,229,.12), rgba(6,182,212,.10));
    border: 1px solid rgba(79,70,229,.18);
    border-radius: 18px;
    padding: 22px 26px;
    margin-bottom: 26px;
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    flex-wrap: wrap;
}
.welcome h2 { margin: 0 0 4px; font-size: 22px; }
.welcome p  { margin: 0; color: var(--muted); }

.section-title {
    font-size: 13px; font-weight: 700; color: var(--muted);
    letter-spacing: 2px; text-transform: uppercase;
    margin: 0;
}

.dash-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin: 0 0 14px;
}
.dash-admin-tools {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.btn-dash-arrange,
.btn-dash-arrange-save,
.btn-dash-arrange-cancel {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #475569;
    transition: background .15s, border-color .15s, color .15s;
}
.btn-dash-arrange:hover,
.btn-dash-arrange-cancel:hover {
    background: #f8fafc;
    color: var(--brand-1);
    border-color: rgba(79, 70, 229, .25);
}
.btn-dash-arrange-save {
    background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
    color: #fff;
    border: none;
}
.btn-dash-arrange-save:hover {
    opacity: .95;
    color: #fff;
}
.dash-arrange-actions[hidden] { display: none !important; }

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.module-card {
    position: relative;
    background: var(--card-bg);
    border-radius: 18px;
    padding: 22px;
    text-decoration: none;
    color: var(--ink);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform .18s, box-shadow .18s;
    display: flex; flex-direction: column; gap: 14px;
    min-height: 180px;
    border: 1px solid #eef2f7;
}

.module-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 5px;
    background: linear-gradient(90deg, var(--c1, var(--brand-1)), var(--c2, var(--brand-2)));
}

.module-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    text-decoration: none;
}
.module-card:hover .card-icon { transform: scale(1.08) rotate(-3deg); }

.card-icon {
    width: 56px; height: 56px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--c1, var(--brand-1)), var(--c2, var(--brand-2)));
    color: #fff;
    display: grid; place-items: center;
    font-size: 24px;
    box-shadow: 0 8px 16px rgba(15, 23, 42, .12);
    transition: transform .25s;
}

.card-title { font-size: 17px; font-weight: 700; margin: 0; }
.card-desc  { font-size: 13px; color: var(--muted); margin: 0; line-height: 1.5; flex: 1; }

.card-cta {
    font-size: 13px; font-weight: 600;
    color: var(--brand-1);
    display: inline-flex; align-items: center; gap: 6px;
}

.module-card.disabled {
    pointer-events: none;
    opacity: .55;
    filter: grayscale(.4);
}
.module-card.disabled::after {
    content: "Coming soon";
    position: absolute;
    top: 14px; right: 14px;
    font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1.5px;
    background: #fbbf24; color: #78350f;
    padding: 4px 8px; border-radius: 999px;
}

/* Dashboard: admin gear + module popover (no top toolbar bar) */
.dash-card-item {
    position: relative;
    display: block;
}
.dash-card-wrap {
    position: relative;
    display: block;
}
.dash-card-drag-handle {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 7;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    border: 1px dashed rgba(79, 70, 229, .35);
    background: rgba(255, 255, 255, .95);
    color: var(--brand-1);
    cursor: grab;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .08);
}
.dash-card-drag-handle[hidden] { display: none !important; }
.dash-card-drag-handle:active { cursor: grabbing; }
.cards-grid--reorder .dash-card-item {
    outline: 2px dashed rgba(79, 70, 229, .28);
    outline-offset: 4px;
    border-radius: 20px;
}
.cards-grid--reorder .dash-card-item--dragging {
    opacity: .55;
}
.cards-grid--reorder .dash-card-item--drop-target {
    outline-color: var(--brand-1);
    outline-width: 2px;
}
.cards-grid--reorder .module-card {
    pointer-events: none;
}
.cards-grid--reorder .dash-card-admin-ui {
    pointer-events: none;
    opacity: .45;
}
.dash-card-ribbon {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 2;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 5px 10px;
    border-radius: 999px;
    line-height: 1.2;
}
.dash-card-ribbon-unavailable {
    background: #fff7ed;
    color: #c2410c;
    border: 1px solid #fed7aa;
}
.dash-card-ribbon-no-perm {
    background: #fffbeb;
    color: #b45309;
    border: 1px solid #fde68a;
}
.dash-card-ribbon-inactive-admin {
    background: #fff7ed;
    color: #c2410c;
    border: 1px solid #fdba74;
}
.dash-card-item:has(.dash-card-admin-ui) .dash-card-ribbon {
    right: 52px;
}
.dash-blocked-hint {
    font-size: 13px;
    font-weight: 600;
    color: var(--brand-1);
    opacity: .85;
}
.dash-card-admin-ui {
    position: absolute;
    top: 10px;
    right: 14px;
    left: auto;
    z-index: 6;
}
.dash-card-menu-trigger {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    border: 1px solid rgba(15, 23, 42, .1);
    background: rgba(255, 255, 255, .94);
    color: #64748b;
    cursor: pointer;
    transition: box-shadow .15s, color .15s, background .15s;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .08);
}
.dash-card-menu-trigger:hover {
    color: var(--brand-1);
    background: #fff;
    box-shadow: 0 4px 12px rgba(15, 23, 42, .1);
}
.dash-card-menu-trigger[aria-expanded="true"] {
    color: var(--brand-1);
    border-color: rgba(79, 70, 229, .35);
}
.dash-module-popover {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    left: auto;
    min-width: 232px;
    padding: 14px;
    border-radius: 14px;
    background: #fff;
    border: 1px solid #e8ecf2;
    box-shadow: 0 16px 40px rgba(15, 23, 42, .14), 0 2px 6px rgba(15, 23, 42, .06);
    z-index: 25;
}
.dash-module-popover[hidden] { display: none !important; }
.dash-popover-title {
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.1px;
    color: var(--muted);
    margin-bottom: 10px;
}
.dash-popover-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
    color: var(--ink);
}
.dash-popover-row > span:first-child {
    color: var(--muted);
    font-weight: 500;
}
.btn-dash-popover-action {
    width: 100%;
    margin-top: 12px;
    justify-content: center;
    display: flex;
}

.dash-status-label {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.6px;
    text-transform: uppercase;
}
.dash-status-label.is-on  { color: #047857; }
.dash-status-label.is-off { color: #c2410c; }
.btn-dash-toggle {
    font-size: 12px;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
    background: #fff;
    color: var(--brand-1);
    border-color: rgba(79,70,229,.35);
}
.btn-dash-toggle:hover {
    background: rgba(79,70,229,.08);
}
.module-card.module-card-inactive-dashboard {
    opacity: .88;
    filter: grayscale(0.15);
    box-shadow: 0 0 0 1px rgba(234, 88, 12, .25), var(--shadow);
}

/* Suspended module: visible, colourful, but clearly not openable */
button.module-card {
    width: 100%;
    text-align: left;
    font: inherit;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}
.module-card.module-card-suspended {
    opacity: 1;
    filter: none;
    border: 1px solid #e2e8f0;
    background:
        linear-gradient(180deg, rgba(255,255,255,.98) 0%, rgba(248,250,252,.92) 100%);
    box-shadow: var(--shadow);
}
.module-card.module-card-suspended .card-icon {
    opacity: 1;
    filter: none;
}
.module-card.module-card-suspended .card-title {
    color: var(--ink);
}
.module-card.module-card-suspended .card-desc {
    opacity: 1;
    color: var(--muted);
}
.module-card.module-card-suspended-clickable {
    cursor: pointer;
}
.module-card.module-card-suspended-clickable:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
    border-color: rgba(79, 70, 229, .22);
}
.module-card.module-card-suspended-clickable:hover .card-icon {
    transform: scale(1.06);
}
.module-card.module-card-no-hover:hover {
    transform: none;
    box-shadow: var(--shadow);
}
.module-card.module-card-no-hover:hover .card-icon { transform: none; }
.dash-unavailable-cta {
    font-size: 13px;
    font-weight: 700;
    color: #94a3b8;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}
.card-cta.dash-cta-solo-muted { justify-content: center; flex-wrap: nowrap; }
.dash-no-permission-cta {
    font-size: 13px;
    font-weight: 700;
    color: #b45309;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    opacity: .85;
}

/* Dashboard double-confirm modal */
.dash-modal[hidden] { display: none !important; }
.dash-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.dash-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .45);
    backdrop-filter: blur(2px);
}
.dash-modal-panel {
    position: relative;
    max-width: 420px;
    width: 100%;
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 24px 48px rgba(15,23,42,.18);
}
.dash-modal-title {
    margin: 0 0 10px;
    font-size: 18px;
    font-weight: 800;
    color: var(--ink);
}
.dash-modal-body {
    margin: 0 0 22px;
    font-size: 14px;
    line-height: 1.55;
    color: #475569;
}
.dash-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}
.btn-dash-secondary {
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #fff;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    color: #475569;
}
.btn-dash-secondary:hover {
    background: #f8fafc;
}
.btn-dash-primary {
    padding: 10px 16px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(79,70,229,.35);
}
.btn-dash-primary:hover { opacity: .95; }
.btn-dash-primary:disabled { opacity: .55; cursor: not-allowed; }

/* Per-card color variants */
.c-mail      { --c1:#f97316; --c2:#fb7185; }
.c-archive   { --c1:#0ea5e9; --c2:#22d3ee; }
.c-leave     { --c1:#10b981; --c2:#34d399; }
.c-stores    { --c1:#8b5cf6; --c2:#a78bfa; }
.c-vehicle   { --c1:#ef4444; --c2:#f97316; }
.c-event     { --c1:#ec4899; --c2:#f472b6; }
.c-admin     { --c1:#1e293b; --c2:#475569; }
.c-files     { --c1:#0891b2; --c2:#06b6d4; }
.c-pending   { --c1:#94a3b8; --c2:#cbd5e1; }

/* ===================== Generic page ===================== */
.page-wrap { max-width: 720px; margin: 0 auto; padding: 28px; }
.page-card {
    background: #fff;
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: 28px;
}
.page-card h2 { margin: 0 0 18px; }

.role-pill {
    display: inline-block;
    padding: 2px 9px;
    background: rgba(79,70,229,.10);
    color: #4338ca;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .5px;
    text-transform: uppercase;
    margin-right: auto;
}
.module-card .card-cta { display: flex; align-items: center; gap: 8px; }

/* ===================== Admin Control ===================== */
.admin-shell { display: grid; grid-template-columns: 240px 1fr; min-height: calc(100vh - 65px); }

.admin-side {
    background: #0f172a;
    color: #cbd5e1;
    padding: 24px 16px;
}
.admin-side h4 {
    color: #94a3b8;
    font-size: 11px;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin: 8px 12px 14px;
}
.admin-side a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    color: #e2e8f0;
    border-radius: 10px;
    text-decoration: none;
    margin-bottom: 4px;
    transition: background .15s, color .15s;
    font-size: 14px;
}
.admin-side a i { width: 18px; text-align: center; opacity: .85; }
.admin-side a:hover { background: rgba(255,255,255,.06); text-decoration: none; }
.admin-side a.active {
    background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
    color: #fff;
    box-shadow: 0 6px 14px rgba(79,70,229,.35);
}

.admin-main { padding: 28px 32px; }
.admin-main h2 { margin: 0 0 4px; }
.admin-main .lead { color: var(--muted); margin: 0 0 22px; }

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 18px;
    margin-top: 14px;
}
.feature-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 22px;
    text-decoration: none;
    color: var(--ink);
    transition: transform .15s, box-shadow .15s;
    display: flex; flex-direction: column; gap: 10px;
    border: 1px solid #eef2f7;
}
.feature-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
    text-decoration: none;
}
.feature-card .ic {
    width: 48px; height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
    color: #fff;
    display: grid; place-items: center;
    font-size: 20px;
}
.feature-card.users    .ic { background: linear-gradient(135deg,#0ea5e9,#22d3ee); }
.feature-card.branding .ic { background: linear-gradient(135deg,#f97316,#fb7185); }
.feature-card.backup   .ic { background: linear-gradient(135deg,#10b981,#34d399); }
.feature-card h4 { margin: 0; font-size: 16px; }
.feature-card p  { margin: 0; font-size: 13px; color: var(--muted); }

/* Tables — readable layout: full width, text wraps naturally */
.tbl {
    width: 100%;
    max-width: 100%;
    table-layout: auto;
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: var(--shadow);
    border-collapse: collapse;
    font-size: 14px;
}
.tbl th, .tbl td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid #eef2f7;
    vertical-align: top;
    white-space: normal;
    word-break: normal;
    overflow-wrap: break-word;
    line-height: 1.45;
    hyphens: none;
}
.tbl thead th {
    background: #f8fafc;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #475569;
    white-space: normal;
}
.tbl tbody tr:hover { background: #f8fafc; }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr.tbl-group-row:hover { background: #eef2ff; }
.tbl tbody tr.tbl-group-row td {
    background: #eef2ff;
    color: #3730a3;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .6px;
    text-transform: uppercase;
    padding-top: 10px;
    padding-bottom: 10px;
}
.tbl tbody tr.is-inactive { opacity: .78; }
.tbl tbody tr.is-inactive:hover { background: #f8fafc; }

/*
 * Module data tables (Tailwind pages): wrap at word boundaries.
 * overflow-wrap:anywhere was squeezing "Update" into one letter per line.
 * Tables in .overflow-x-auto may be wider than the screen (sideways scroll).
 */
.overflow-x-auto > table,
table.min-w-full,
table.w-full:not(.audit-print-table):not([class*="print"]) {
    width: 100%;
    table-layout: auto;
}
.overflow-x-auto > table {
    min-width: 52rem;
    max-width: none;
    width: max(100%, 52rem);
}
.overflow-x-auto > table th,
.overflow-x-auto > table td,
table.min-w-full th,
table.min-w-full td,
table.w-full:not(.audit-print-table):not([class*="print"]) th,
table.w-full:not(.audit-print-table):not([class*="print"]) td,
table.ar-datatable th,
table.ar-datatable td {
    vertical-align: top;
    white-space: normal;
    word-break: normal;
    overflow-wrap: break-word;
    line-height: 1.45;
    hyphens: none;
    max-width: none !important;
}
/* Short columns (dates, refs, actions): keep compact on one line when possible */
.oms-td-compact,
td.oms-td-compact,
th.oms-td-compact {
    white-space: nowrap !important;
    width: 1%;
    word-break: normal;
    overflow-wrap: normal;
}
/* Text-heavy columns: minimum readable width before wrapping */
.oms-td-wrap,
td.oms-td-wrap,
th.oms-td-wrap {
    white-space: normal !important;
    min-width: 10rem;
    max-width: 22rem;
    word-break: normal;
    overflow-wrap: break-word;
    line-height: 1.45;
}
@media (min-width: 1280px) {
    .oms-td-wrap,
    td.oms-td-wrap,
    th.oms-td-wrap {
        max-width: 26rem;
    }
}

.oms-row-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap !important;
    flex-shrink: 0;
    word-break: normal !important;
    overflow-wrap: normal !important;
}
.oms-row-actions {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.4rem;
}
@media (max-width: 640px) {
    .oms-row-btn-label {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }
    .oms-row-btn i {
        margin-right: 0 !important;
    }
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .5px;
    text-transform: uppercase;
}
.badge-admin   { background: #ede9fe; color: #5b21b6; }
.badge-super   { background: #fee2e2; color: #991b1b; }
.badge-active  { background: #dcfce7; color: #166534; }
.badge-inactive{ background: #f1f5f9; color: #64748b; }
.badge-role    { background: #e0f2fe; color: #075985; margin-right: 4px; }

.row-actions { display: flex; gap: 6px; }
.row-actions a, .row-actions button {
    width: 32px; height: 32px;
    border-radius: 8px;
    display: grid; place-items: center;
    text-decoration: none;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #334155;
    cursor: pointer;
}
.row-actions a:hover    { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }
.row-actions .delete    { color: #b91c1c; }
.row-actions .delete:hover { background: #fef2f2; color: #7f1d1d; border-color: #fecaca; }
.row-actions .deactivate { color: #b45309; }
.row-actions .deactivate:hover { background: #fffbeb; color: #92400e; border-color: #fde68a; }

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    gap: 10px;
    flex-wrap: wrap;
}
.btn-inline { width: auto; padding: 10px 16px; }

/* Forms inside admin */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
}
.form-row-full { grid-column: 1 / -1; }
.form-help { font-size: 12px; color: var(--muted); margin-top: 4px; }

.module-roles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
    margin-top: 8px;
}
.role-row {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.role-row .ic {
    width: 38px; height: 38px;
    border-radius: 10px;
    color: #fff;
    display: grid; place-items: center;
    font-size: 16px;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--c1, var(--brand-1)), var(--c2, var(--brand-2)));
}
.role-row .meta { flex: 1; min-width: 0; }
.role-row .meta b { font-size: 14px; display: block; }
.role-row .meta span { font-size: 11px; color: var(--muted); }
.role-row select {
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #fff;
    font-size: 13px;
    min-width: 140px;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px;
    background: linear-gradient(135deg, rgba(79,70,229,.06), rgba(6,182,212,.06));
    border: 1px solid rgba(79,70,229,.15);
    border-radius: 12px;
}
.checkbox-row input { width: 18px; height: 18px; }
.checkbox-row label { font-weight: 600; cursor: pointer; }
.checkbox-row small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; }

.flash {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 18px;
    font-size: 14px;
}
.flash-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.flash-error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.flash-info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

@media (max-width: 880px) {
    .admin-shell { grid-template-columns: 1fr; }
    .admin-side {
        display: flex;
        overflow-x: auto;
        padding: 12px;
        gap: 6px;
    }
    .admin-side h4 { display: none; }
    .admin-side a { white-space: nowrap; margin: 0; }
}

@media (max-width: 640px) {
    .topbar {
        padding: 8px 10px;
        gap: 6px;
    }
    .topbar-left {
        flex: 1;
        gap: 8px;
    }
    .topbar-logo {
        width: 34px;
        height: 34px;
        border-radius: 10px;
        font-size: 15px;
    }
    .topbar-logo:has(.logo-img) {
        height: 32px;
    }
    .topbar-logo .logo-img,
    .topbar-logo img {
        max-width: 48px;
    }
    .topbar-titles h1 {
        font-size: 13px;
        font-weight: 700;
        line-height: 1.27;
        max-height: 2.54em;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        overflow: hidden;
        overflow-wrap: anywhere;
        word-break: break-word;
    }
    .topbar-titles span {
        display: block;
        font-size: 9px;
        letter-spacing: 0.4px;
        line-height: 1.25;
        margin-top: 1px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .topbar-right {
        gap: 5px;
    }
    .user-chip {
        padding: 3px;
        font-size: 0;
        max-width: none;
    }
    .user-chip span {
        display: none;
    }
    .user-chip .avatar {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    .icon-btn {
        width: 34px;
        height: 34px;
        border-radius: 9px;
        font-size: 14px;
    }
}

@media (max-width: 540px) {
    .dash-wrap { padding: 18px; }
    .welcome { padding: 18px; }
}

@media (max-width: 360px) {
    .topbar-titles span {
        display: none;
    }
}

/* Admin sub-tabs (e.g. Branding + Mail binding) */
.admin-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 1px solid #e2e8f0;
    flex-wrap: wrap;
}
.admin-tabs a {
    padding: 10px 16px;
    color: var(--muted);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    font-weight: 600;
    font-size: 14px;
}
.admin-tabs a:hover { color: var(--brand-1); }
.admin-tabs a.active {
    color: var(--brand-1);
    border-bottom-color: var(--brand-1);
}

/* Page footer — quick links to module pages */
.oms-page-footer {
    margin-top: 28px;
    padding: 16px 0 8px;
    border-top: 1px solid #e2e8f0;
}
.oms-page-footer-title {
    margin: 0 0 10px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted, #64748b);
}
.oms-page-footer-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    align-items: center;
}
.oms-page-footer-link {
    font-size: 13px;
    font-weight: 600;
    color: var(--brand-1, #4f46e5);
    text-decoration: none;
}
.oms-page-footer-link:hover {
    text-decoration: underline;
    color: var(--brand-2, #4338ca);
}
.oms-page-footer-link.is-active {
    color: #0f172a;
    text-decoration: underline;
}
.oms-page-footer-copy {
    margin: 12px 0 0;
    font-size: 11px;
    color: #94a3b8;
}
html[data-theme="dark"] .oms-page-footer {
    border-top-color: #334155;
}
html[data-theme="dark"] .oms-page-footer-link.is-active {
    color: #f1f5f9;
}