/**
 * ==========================================================
 * ABSENSIKU v1.0 — Web UI Final
 * Master Reference: navy sidebar + clean navbar + card content
 * Loaded LAST to harmonize existing modules without changing logic.
 * ==========================================================
 */

:root {
    --sidebar-width: 280px;
    --navbar-height: 76px;

    --abs-navy-950: #07162f;
    --abs-navy-900: #0a1c3a;
    --abs-navy-850: #0d2348;
    --abs-blue: #2563eb;
    --abs-blue-strong: #1d4ed8;
    --abs-blue-soft: #eaf2ff;

    --color-background: #f7f9fc;
    --color-surface: #ffffff;
    --color-surface-soft: #f8fafc;
    --color-text: #0f172a;
    --color-text-soft: #64748b;
    --color-border: #e6ebf2;
    --color-primary: #2563eb;
    --color-primary-soft: #eaf2ff;

    --radius-small: 10px;
    --radius-medium: 14px;
    --radius-large: 18px;

    --shadow-small: 0 1px 2px rgba(15, 23, 42, .03);
    --shadow-medium:
        0 14px 38px rgba(15, 23, 42, .055),
        0 2px 8px rgba(15, 23, 42, .025);
}

html,
body {
    background: var(--color-background);
}

body {
    overflow-x: hidden;
    color: var(--color-text);
}

.app-shell {
    min-height: 100vh;
    display: block;
}

.app-main {
    min-width: 0;
    min-height: 100vh;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    background: var(--color-background);
}

/* SIDEBAR */
.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 100;
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: #dbe7fb;
    background:
        radial-gradient(circle at 25% 0%, rgba(37, 99, 235, .18), transparent 30%),
        linear-gradient(180deg, var(--abs-navy-900) 0%, var(--abs-navy-950) 100%);
    border-right: 1px solid rgba(255, 255, 255, .045);
    box-shadow: 16px 0 42px rgba(15, 23, 42, .055);
}

.sidebar-brand {
    min-height: var(--navbar-height);
    flex: 0 0 var(--navbar-height);
    display: flex;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
}

.sidebar-brand__link {
    width: 100%;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 13px;
}

.sidebar-brand__mark {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    position: relative;
    display: grid;
    place-items: center;
    border-radius: 13px;
    background: linear-gradient(145deg, #3b82f6, #2563eb);
    box-shadow:
        0 9px 22px rgba(37, 99, 235, .28),
        inset 0 1px 0 rgba(255, 255, 255, .22);
}

.sidebar-brand__roof {
    position: absolute;
    width: 22px;
    height: 22px;
    border-left: 3px solid #fff;
    border-top: 3px solid #fff;
    border-radius: 2px;
    transform: rotate(45deg) translate(3px, 3px);
}

.sidebar-brand__base {
    position: absolute;
    left: 17px;
    right: 17px;
    bottom: 11px;
    height: 3px;
    border-radius: 999px;
    background: #fff;
}

.sidebar-brand__text {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.sidebar-brand__text strong {
    overflow: hidden;
    color: #fff;
    font-size: 18px;
    line-height: 1.15;
    font-weight: 850;
    letter-spacing: .015em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-brand__text small {
    margin-top: 4px;
    overflow: hidden;
    color: #9fb0cd;
    font-size: 10.5px;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-navigation {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px 14px 20px;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, .22) transparent;
}

.sidebar-navigation::-webkit-scrollbar {
    width: 4px;
}

.sidebar-navigation::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(148, 163, 184, .22);
}

.sidebar-group + .sidebar-group {
    margin-top: 16px;
}

.sidebar-navigation__title {
    display: block;
    margin: 0 10px 7px;
    color: #8193b1;
    font-size: 9.5px;
    line-height: 1.2;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.sidebar-menu {
    margin: 0;
    padding: 0;
    display: grid;
    gap: 2px;
    list-style: none;
}

.sidebar-menu__link {
    min-height: 39px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border: 1px solid transparent;
    border-radius: 9px;
    color: #d4def0;
    transition:
        color .16s ease,
        background-color .16s ease,
        border-color .16s ease,
        transform .16s ease;
}

.sidebar-menu__link:hover {
    color: #fff;
    background: rgba(255, 255, 255, .055);
    border-color: rgba(255, 255, 255, .035);
    transform: translateX(1px);
}

.sidebar-menu__link.is-active {
    color: #fff;
    background: linear-gradient(135deg, #2f6feb, #2563eb);
    border-color: rgba(147, 197, 253, .16);
    box-shadow:
        0 7px 18px rgba(20, 76, 190, .22),
        inset 0 1px 0 rgba(255, 255, 255, .11);
}

.sidebar-menu__icon {
    width: 25px;
    height: 25px;
    flex: 0 0 25px;
    display: grid;
    place-items: center;
    border-radius: 7px;
    color: #9db3d8;
    background: rgba(111, 143, 198, .08);
}

.sidebar-menu__icon svg {
    width: 17px;
    height: 17px;
}

.sidebar-menu__link:hover .sidebar-menu__icon,
.sidebar-menu__link.is-active .sidebar-menu__icon {
    color: #fff;
    background: rgba(255, 255, 255, .10);
}

.sidebar-menu__label {
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
    color: inherit;
    font-size: 12.5px;
    line-height: 1.25;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-menu__chevron {
    width: 18px;
    flex: 0 0 18px;
    color: #8094b8;
    font-size: 18px;
    line-height: 1;
    text-align: center;
}

.sidebar-menu__link.is-active .sidebar-menu__chevron {
    color: #fff;
}

.sidebar-footer {
    flex: 0 0 auto;
    padding: 11px 15px 12px;
    border-top: 1px solid rgba(255, 255, 255, .07);
    background: rgba(4, 12, 28, .12);
}

.sidebar-user {
    min-height: 56px;
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) 31px;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border: 1px solid rgba(148, 163, 184, .08);
    border-radius: 12px;
    background: rgba(255, 255, 255, .045);
}

.sidebar-user__avatar {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    color: #fff;
    background: linear-gradient(145deg, #3b82f6, #2f5de0);
    font-size: 13px;
    font-weight: 850;
}

.sidebar-user__identity {
    min-width: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
}

.sidebar-user__identity strong {
    overflow: hidden;
    color: #f5f8ff;
    font-size: 11.5px;
    line-height: 1.35;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-user__identity span {
    margin-top: 2px;
    overflow: hidden;
    color: #8395b2;
    font-size: 9.5px;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-user form {
    margin: 0;
}

.sidebar-logout {
    width: 31px;
    height: 31px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid rgba(148, 163, 184, .13);
    border-radius: 9px;
    color: #94a5c1;
    background: rgba(255, 255, 255, .035);
}

.sidebar-logout:hover {
    color: #fff;
    background: rgba(239, 68, 68, .13);
    border-color: rgba(248, 113, 113, .18);
}

.sidebar-logout svg {
    width: 16px;
    height: 16px;
}

.sidebar-version {
    margin-top: 9px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: #647695;
    font-size: 8.5px;
    line-height: 1.2;
}

/* NAVBAR */
.app-navbar {
    position: sticky;
    top: 0;
    z-index: 60;
    min-height: var(--navbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 11px clamp(22px, 2.6vw, 38px);
    background: rgba(255, 255, 255, .96);
    border-bottom: 1px solid var(--color-border);
    box-shadow: 0 1px 0 rgba(15, 23, 42, .015);
    backdrop-filter: blur(18px);
}

.app-navbar__left,
.app-navbar__right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.navbar-menu-button {
    width: 38px;
    height: 38px;
    display: none;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 10px;
    color: #172033;
    background: transparent;
}

.navbar-menu-button:hover {
    background: #f1f5f9;
}

.navbar-menu-button svg {
    width: 21px;
    height: 21px;
}

.navbar-context {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.navbar-context__title {
    overflow: hidden;
    color: #111827;
    font-size: 13px;
    line-height: 1.3;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.navbar-context__subtitle {
    margin-top: 2px;
    color: #8a97aa;
    font-size: 9.5px;
    line-height: 1.2;
}

.navbar-user {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.navbar-user__avatar {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: linear-gradient(145deg, #38bdf8, #2563eb);
    font-size: 12px;
    font-weight: 850;
    box-shadow: none;
}

.navbar-user__identity {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.navbar-user__identity strong {
    max-width: 210px;
    overflow: hidden;
    color: #111827;
    font-size: 11.5px;
    line-height: 1.35;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.navbar-user__identity small {
    margin-top: 1px;
    color: #718096;
    font-size: 9.5px;
    line-height: 1.25;
    text-transform: none;
}

.navbar-user__chevron {
    width: 18px;
    height: 18px;
    display: grid;
    place-items: center;
    color: #94a3b8;
}

.navbar-user__chevron svg {
    width: 16px;
    height: 16px;
}

/* MAIN CONTENT */
.app-content {
    flex: 1 0 auto;
    min-width: 0;
    padding:
        clamp(24px, 2.7vw, 38px)
        clamp(22px, 3vw, 42px)
        42px;
    background:
        radial-gradient(circle at 95% 0%, rgba(37, 99, 235, .025), transparent 24%),
        var(--color-background);
}

.page-container {
    width: min(100%, 1500px);
    margin: 0 auto;
}

.page-header {
    margin-bottom: 22px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
}

.page-title {
    margin: 0;
    color: #0f172a;
    font-size: clamp(1.65rem, 2vw, 2.1rem);
    line-height: 1.15;
    font-weight: 820;
    letter-spacing: -.035em;
}

.page-subtitle {
    max-width: 760px;
    margin: 7px 0 0;
    color: #64748b;
    font-size: .9rem;
    line-height: 1.6;
}

.page-content {
    min-width: 0;
}

/* Global surfaces: harmonize existing modules */
.card,
.master-user-panel,
.master-user-hero,
.attendance-dashboard__hero,
.attendance-dashboard__section,
[class*="__panel"],
[class*="__card"] {
    border-color: var(--color-border);
}

.card {
    padding: 24px;
    border: 1px solid var(--color-border);
    border-radius: 16px;
    background: #fff;
    box-shadow: var(--shadow-small);
}

/* Keep module-specific layouts, but remove accidental giant top gaps. */
.page-content > :first-child {
    margin-top: 0 !important;
}

.attendance-dashboard {
    width: 100%;
    margin: 0;
}

.attendance-dashboard__hero {
    border-radius: 18px;
}

/* Forms and tables */
input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
    border-color: #dce3ec;
}

input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus,
textarea:focus {
    border-color: #93b4fb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .08);
    outline: none;
}

table {
    border-collapse: separate;
    border-spacing: 0;
}

/* FOOTER */
.app-footer {
    flex: 0 0 auto;
    border-top: 1px solid var(--color-border);
    background: #fff;
}

.app-footer__content {
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 14px clamp(22px, 3vw, 42px);
    color: #8793a6;
    font-size: 10px;
}

.app-footer__tagline {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.app-footer__tagline span {
    color: #38a7ee;
}

/* OVERLAY + RESPONSIVE */
.app-overlay {
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(15, 23, 42, .42);
    backdrop-filter: blur(2px);
}

@media (max-width: 1180px) {
    :root {
        --sidebar-width: 258px;
    }

    .sidebar-menu__label {
        font-size: 12px;
    }
}

@media (max-width: 1024px) {
    :root {
        --sidebar-width: 280px;
    }

    .app-main {
        margin-left: 0;
    }

    .app-sidebar {
        transform: translateX(-100%);
        transition: transform .22s ease;
        box-shadow: 20px 0 55px rgba(15, 23, 42, .18);
    }

    .app-sidebar.is-open {
        transform: translateX(0);
    }

    .navbar-menu-button {
        display: grid;
    }
}

@media (max-width: 720px) {
    :root {
        --navbar-height: 68px;
    }

    .app-navbar {
        padding-inline: 16px;
    }

    .navbar-context__subtitle,
    .navbar-user__identity,
    .navbar-user__chevron {
        display: none;
    }

    .app-content {
        padding: 20px 16px 30px;
    }

    .page-header {
        align-items: stretch;
        flex-direction: column;
        gap: 14px;
    }

    .page-actions {
        width: 100%;
    }

    .app-footer__content {
        align-items: flex-start;
        flex-direction: column;
        gap: 5px;
        padding: 14px 16px;
    }
}

@media (max-height: 780px) and (min-width: 1025px) {
    .sidebar-brand {
        min-height: 68px;
        flex-basis: 68px;
        padding-block: 10px;
    }

    .sidebar-brand__mark {
        width: 42px;
        height: 42px;
        flex-basis: 42px;
    }

    .sidebar-navigation {
        padding-top: 10px;
        padding-bottom: 12px;
    }

    .sidebar-group + .sidebar-group {
        margin-top: 11px;
    }

    .sidebar-menu__link {
        min-height: 35px;
        padding-block: 5px;
    }

    .sidebar-footer {
        padding-top: 8px;
        padding-bottom: 8px;
    }

    .sidebar-version {
        margin-top: 6px;
    }
}
