html {
  font-size: 14px;
  --green-900: #155c51;
  --green-800: #1d7668;
  --green-700: #259684;
  --green-600: #33b6a3;
  --green-100: #dff5f1;
  --green-50: #f2fbf9;
  --sidebar-width: 210px;
  --sidebar-collapsed-width: 68px;
  --topbar-height: 40px;
  --ink: #263b38;
  --muted: #5d817b;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem var(--green-600);
}

html {
  position: relative;
  min-height: 100%;
}

body {
    min-height: 100vh;
    margin-bottom: 60px;
    color: var(--ink);
    background: #eef6f6;
    font-family: "Cairo", serif;
    font-optical-sizing: auto;
    font-weight: 400;
    font-style: normal;
    font-variation-settings: "slnt";
}

.app-topbar {
    position: fixed;
    top: 0;
    right: var(--sidebar-width);
    left: 0;
    z-index: 1020;
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0 12px;
    background: #fff;
    border-bottom: 1px solid #d7e3e3;
    transition: right .2s ease;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: .35rem;
}

.app-icon-button {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: #263b38;
    border: 0;
    border-radius: 6px;
    background: transparent;
    font-size: 1.2rem;
}

.app-icon-button:hover,
.app-icon-button:focus {
    color: var(--green-900);
    background: var(--green-50);
}

.app-login-menu {
    flex-direction: row;
    align-items: center;
    gap: .4rem;
}

.app-login-menu .nav-link,
.app-login-menu .btn-link {
    color: var(--green-900);
    font-weight: 700;
    padding: .35rem .55rem;
}

.app-side-menu {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 1030;
    width: var(--sidebar-width);
    height: 100vh;
    display: flex;
    flex-direction: column;
    color: var(--green-900);
    background: #dcefed;
    border-left: 1px solid rgba(37, 150, 132, .14);
    box-shadow: -10px 0 26px rgba(21, 92, 81, .06);
    transition: width .2s ease, transform .2s ease;
}

.side-profile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .55rem;
    min-height: 132px;
    padding: 28px 14px 14px;
    text-align: center;
    font-size: .78rem;
}

.side-avatar {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(145deg, #8b4527, #2f1c18);
    border-radius: 50%;
    font-size: 1.7rem;
    box-shadow: 0 10px 20px rgba(47, 28, 24, .16);
}

.side-nav {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: .35rem;
    padding: 0 10px;
}

.side-link {
    width: 100%;
    min-height: 34px;
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .45rem .7rem;
    color: #4d6663;
    text-decoration: none;
    border: 0;
    border-radius: 7px;
    background: transparent;
    font-weight: 700;
    text-align: right;
}

.side-link i:first-child {
    width: 20px;
    color: #6f8581;
    text-align: center;
    font-size: 1rem;
}

.side-link:hover,
.side-link:focus,
.side-link.active {
    color: var(--green-700);
    background: #fff;
}

.side-link:hover i:first-child,
.side-link:focus i:first-child,
.side-link.active i:first-child {
    color: var(--green-600);
}

.side-collapse-toggle {
    cursor: pointer;
}

.side-chevron {
    margin-right: auto;
    font-size: .75rem;
    transition: transform .18s ease;
}

.side-collapse-toggle[aria-expanded="true"] .side-chevron {
    transform: rotate(180deg);
}

.side-submenu {
    margin: .15rem 12px .45rem 0;
    padding: .4rem .45rem;
    background: rgba(255, 255, 255, .58);
    border-radius: 8px;
}

.side-submenu a {
    min-height: 27px;
    display: flex;
    align-items: center;
    padding: .25rem .55rem;
    color: #526d68;
    text-decoration: none;
    border-radius: 6px;
    font-size: .82rem;
    font-weight: 700;
}

.side-submenu a:hover,
.side-submenu a:focus {
    color: var(--green-700);
    background: #fff;
}

.side-logout {
    padding: 12px 10px 22px;
}

.side-logout form {
    margin: 0;
}

.app-page {
    padding-top: calc(var(--topbar-height) + 40px);
}

.home-dashboard {
    padding: 12px 0 34px;
}

.department-dashboard {
    min-height: calc(100vh - 150px);
    display: grid;
    align-items: center;
    padding: 34px 0 52px;
}

.quality-card-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(210px, 1fr));
    gap: 20px 28px;
}

.quality-card {
    position: relative;
    min-height: 154px;
    padding: 28px 20px 18px;
    overflow: hidden;
    text-align: center;
    background: #ddf4ef;
    border: 2px solid #b7e6dc;
    border-radius: 12px;
    box-shadow: 0 2px 6px rgba(21, 92, 81, .08);
}

.quality-card .corner {
    position: absolute;
    width: 14px;
    height: 14px;
    pointer-events: none;
}

.quality-card .corner::before,
.quality-card .corner::after {
    position: absolute;
    content: "";
    background: rgba(255, 255, 255, .9);
    border-radius: 999px;
}

.quality-card .corner::before {
    width: 14px;
    height: 2px;
}

.quality-card .corner::after {
    width: 2px;
    height: 14px;
}

.corner-top {
    top: 10px;
    left: 10px;
}

.corner-top::before,
.corner-top::after {
    top: 0;
    left: 0;
}

.corner-bottom {
    right: 10px;
    bottom: 10px;
}

.corner-bottom::before,
.corner-bottom::after {
    right: 0;
    bottom: 0;
}

.quality-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.05;
    color: var(--green-600);
}

.quality-brand strong {
    font-size: 1.4rem;
    font-weight: 900;
}

.quality-brand span {
    margin-top: 3px;
    font-size: .78rem;
    font-weight: 600;
}

.quality-card h2 {
    min-height: 42px;
    margin: 14px 0 12px;
    display: grid;
    place-items: center;
    color: #2e4a46;
    font-size: clamp(1rem, 1.8vw, 1.08rem);
    font-weight: 600;
    line-height: 1.45;
}

.quality-card-button {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    width: 100%;
    color: #123d38;
    text-decoration: none;
    font-weight: 600;
    background: var(--green-600);
    border-radius: 5px;
    transition: background-color .18s ease, color .18s ease, transform .18s ease;
}

.quality-card-button:hover,
.quality-card-button:focus {
    color: #fff;
    background: var(--green-800);
    transform: translateY(-1px);
}

.department-card-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 262px));
    justify-content: center;
    align-items: start;
    gap: 20px;
}

.department-card {
    min-height: 174px;
    padding: 28px 22px 22px;
    background: #fff;
}

.department-card-featured {
    grid-column: auto;
    justify-self: center;
}

.department-card h2 {
    margin-top: 18px;
    margin-bottom: 18px;
    color: #161616;
    font-weight: 800;
}

.department-card-button {
    min-height: 32px;
    color: #263b38;
    background: #d6f1ec;
}

.projects-dashboard {
    min-height: calc(100vh - 150px);
    display: grid;
    place-items: center;
    padding: 50px 0;
}

.projects-card-grid {
    width: min(820px, 100%);
    display: grid;
    grid-template-columns: repeat(2, minmax(240px, 1fr));
    gap: 28px;
    padding: 24px;
    background: #fff;
}

.systems-dashboard {
    min-height: calc(100vh - 150px);
    display: grid;
    place-items: center;
    padding: 50px 0;
}

.systems-card-grid {
    width: min(900px, 100%);
    display: grid;
    grid-template-columns: repeat(3, minmax(220px, 1fr));
    gap: 22px;
    padding: 14px;
    background: #fff;
}

.systems-card {
    min-height: 174px;
    border-color: #afe4db;
    border-radius: 14px;
}

.project-card {
    min-height: 220px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.project-brand strong {
    font-size: 2rem;
}

.management-page {
    padding: 32px 0 54px;
}

.management-panel {
    width: min(1160px, 100%);
    margin: 0 auto;
    padding: 18px 22px 26px;
    background: #fff;
}

.wide-panel {
    width: min(1360px, 100%);
}

.management-header {
    display: grid;
    gap: 18px;
}

.management-panel h1,
.management-header h1 {
    margin: 0 0 16px;
    color: #bf2936;
    font-size: 1rem;
    font-weight: 800;
    text-align: right;
}

.management-action {
    min-height: 28px;
    color: #263b38;
    background: #d6f1ec;
}

.project-form {
    display: grid;
    gap: 12px;
}

.form-grid {
    display: grid;
    grid-template-columns: minmax(180px, 260px) 1fr;
    border: 1px solid #c7d0d0;
}

.dense-form-grid {
    grid-template-columns: minmax(190px, 260px) minmax(220px, 1fr);
}

.form-grid label {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-height: 42px;
    margin: 0;
    padding: 8px 12px;
    border-bottom: 1px solid #c7d0d0;
    border-left: 1px solid #c7d0d0;
    color: #263b38;
    font-weight: 700;
}

.form-grid input,
.form-grid select,
.form-grid textarea {
    min-height: 42px;
    border: 0;
    border-bottom: 1px solid #dce4e4;
    border-radius: 0;
}

.form-grid label:last-of-type,
.form-grid input:last-child {
    border-bottom: 0;
}

.form-submit,
.form-cancel {
    min-height: 30px;
}

.form-cancel {
    color: #263b38;
    background: #d6f1ec;
}

.proposal-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.proposal-form-field {
    display: grid;
    gap: 8px;
}

.proposal-form-field-wide {
    grid-column: 1 / -1;
}

.proposal-form-field label {
    margin: 0;
    color: #263b38;
    font-weight: 800;
}

.proposal-form-field textarea {
    min-height: 126px;
    resize: vertical;
    border: 1px solid #c7d0d0;
    border-radius: 8px;
    padding: 12px;
    line-height: 1.8;
}

.proposal-form-field-wide textarea {
    min-height: 92px;
}

.project-data-table {
    width: 100% !important;
    color: #161616;
    font-size: .88rem;
}

.project-data-table thead th {
    background: #e3f4f0;
    text-align: center;
    vertical-align: middle;
}

.project-data-table tbody td {
    text-align: center;
    vertical-align: middle;
}

.table-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.table-actions form {
    margin: 0;
}

.table-action-button {
    color: #123d38;
    background: var(--green-600);
    border: 0;
}

.mandate-panel {
    width: min(920px, 100%);
}

.mandate-card {
    display: grid;
    gap: 16px;
    padding: 22px;
    border: 1px solid #c7d0d0;
    background: #f8fdfc;
}

.mandate-upload-form {
    display: grid;
    gap: 14px;
}

.mandate-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(140px, 1fr));
    gap: 12px;
}

.quality-card-button:disabled {
    opacity: .55;
    cursor: not-allowed;
    transform: none;
}

.report-filter-row {
    width: min(360px, 100%);
    display: grid;
    grid-template-columns: 88px 1fr;
    align-items: center;
    gap: 8px;
    margin: 0 0 16px auto;
}

.report-filter-row label {
    margin: 0;
    color: #263b38;
    font-weight: 800;
}

.dt-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.dt-button {
    color: #123d38 !important;
    background: #d6f1ec !important;
    border: 0 !important;
    border-radius: 5px !important;
}

.lookup-inline-form,
.lookup-row-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: center;
}

.lookup-inline-form {
    margin-bottom: 18px;
}

.lookup-submit {
    min-width: 120px;
    min-height: 38px;
}

.details-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.project-summary-grid {
    display: grid;
    grid-template-columns: minmax(150px, 220px) 1fr minmax(150px, 220px) 1fr;
    margin-bottom: 24px;
    border: 1px solid #c7d0d0;
}

.project-summary-grid span,
.project-summary-grid strong {
    min-height: 38px;
    padding: 8px 12px;
    border-bottom: 1px solid #dce4e4;
}

.project-summary-grid span {
    color: #263b38;
    background: #f2fbf9;
    border-left: 1px solid #c7d0d0;
}

.details-file-link {
    color: var(--green-800);
    font-weight: 800;
    text-decoration: none;
}

.details-file-link:hover,
.details-file-link:focus {
    color: var(--green-900);
    text-decoration: underline;
}

.organization-levels-wrapper {
    margin-bottom: 28px;
}

.organization-levels-table {
    width: 100%;
    min-width: 850px;
    table-layout: fixed;
    direction: rtl;
    color: #111;
    background: #fff;
    border-collapse: collapse;
    font-size: 1.15rem;
}

.organization-levels-table th,
.organization-levels-table td {
    padding: 10px 12px;
    border: 1px solid #333;
    text-align: center;
    vertical-align: middle;
    line-height: 1.6;
}

.organization-levels-table th {
    background: #e9e9e9;
    font-weight: 700;
    white-space: nowrap;
}

.organization-level-column {
    width: 20%;
}

.organization-systems-column {
    width: 26%;
}

.organization-specialty-column {
    width: 15%;
}

.organization-malware-column {
    width: 24%;
}

.awareness-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 18px;
}

.awareness-gallery-card {
    overflow: hidden;
    background: #fff;
    border: 1px solid #c7d0d0;
    border-radius: 8px;
}

.awareness-gallery-media {
    aspect-ratio: 4 / 3;
    display: grid;
    place-items: center;
    background: #f2fbf9;
}

.awareness-gallery-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.awareness-gallery-body {
    display: grid;
    gap: 10px;
    padding: 12px;
}

.awareness-gallery-body h2 {
    margin: 0;
    color: #263b38;
    font-size: .95rem;
    font-weight: 800;
}

.section-title {
    margin-top: 18px !important;
}

@media (min-width: 992px) {
    body {
        padding-right: var(--sidebar-width);
        transition: padding-right .2s ease;
    }

    body.sidebar-collapsed {
        padding-right: var(--sidebar-collapsed-width);
    }

    body.sidebar-collapsed .app-topbar {
        right: var(--sidebar-collapsed-width);
    }

    body.sidebar-collapsed .app-side-menu {
        width: var(--sidebar-collapsed-width);
    }

    body.sidebar-collapsed .side-profile strong,
    body.sidebar-collapsed .side-link span,
    body.sidebar-collapsed .side-chevron,
    body.sidebar-collapsed .side-submenu {
        display: none;
    }

    body.sidebar-collapsed .side-avatar {
        width: 42px;
        height: 42px;
        font-size: 1.25rem;
    }

    body.sidebar-collapsed .side-profile {
        min-height: 84px;
        padding: 20px 8px 10px;
    }

    body.sidebar-collapsed .side-link {
        justify-content: center;
        padding-inline: 0;
    }

    body.sidebar-collapsed .side-link i:first-child {
        width: auto;
        font-size: 1.12rem;
    }
}

@media (max-width: 991.98px) {
    body {
        padding-right: 0;
    }

    .app-topbar {
        right: 0;
    }

    .app-side-menu {
        width: var(--sidebar-width);
        transform: translateX(100%);
    }

    body.sidebar-open .app-side-menu {
        transform: translateX(0);
    }

    .quality-card-grid {
        grid-template-columns: repeat(2, minmax(170px, 1fr));
        gap: 16px;
    }

    .department-card-grid {
        grid-template-columns: repeat(2, minmax(180px, 1fr));
        gap: 22px;
    }

    .department-card-featured {
        grid-column: auto;
    }

    .projects-card-grid {
        grid-template-columns: 1fr;
    }

    .systems-card-grid {
        grid-template-columns: 1fr;
    }

    .proposal-form-grid {
        grid-template-columns: 1fr;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .project-summary-grid {
        grid-template-columns: 1fr;
    }

    .form-grid label {
        border-left: 0;
        background: #f2fbf9;
    }
}

@media (max-width: 575.98px) {
    .quality-card-grid,
    .department-card-grid {
        grid-template-columns: 1fr;
    }

    .quality-card {
        min-height: 148px;
    }
}

@keyframes fadeIn {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounceIn {
    0% {
        transform: scale(0);
    }

    60% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

.page-bg {
    background-image: url('/images/bg.png');
    background-size: cover; /* Fill screen */
    background-repeat: no-repeat;
    background-position: center;
    min-height: 100vh; /* Full height */
}
