@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;800&display=swap');

:root {
    --bg: #eef3f6;
    --surface: #ffffff;
    --line: #d9e2e9;
    --ink: #132331;
    --muted: #697985;
    --sidebar: #0e1d27;
    --sidebar-2: #183040;
    --gold: #b88636;
    --red: #cf4c55;
    --blue: #236f8e;
    --green: #2f8a64;
    --shadow: 0 12px 32px rgba(19, 35, 49, .07);
    --soft-shadow: 0 4px 16px rgba(19, 35, 49, .055);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: linear-gradient(180deg, #f8fafb 0, var(--bg) 310px);
    color: var(--ink);
    font-family: Tajawal, Tahoma, Arial, sans-serif;
    font-size: 14px;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

.app {
    display: grid;
    grid-template-columns: 250px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: linear-gradient(180deg, #0d1b24 0%, #132836 64%, #0f202b 100%);
    color: #fff;
    height: 100vh;
    overflow-y: auto;
    position: sticky;
    top: 0;
    border-left: 1px solid rgba(255, 255, 255, .08);
}

.brand,
.company {
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand strong {
    display: block;
    font-size: 16px;
    letter-spacing: 0;
}

.brand span,
.company span,
.user span,
.page-head p,
.project-row span,
.alert-row span {
    color: var(--muted);
    display: block;
    font-size: 12px;
    margin-top: 3px;
}

.brand span,
.company span {
    color: #9fb0bd;
}

.brand-mark {
    align-items: center;
    background: transparent;
    border-radius: 0;
    color: #fff;
    display: grid;
    height: 56px;
    justify-items: center;
    padding: 0;
    width: 56px;
}

.brand-mark img {
    border-radius: 0;
    height: 54px;
    object-fit: contain;
    width: 54px;
}

.company strong {
    display: block;
    font-size: 13px;
}

.nav {
    padding: 10px 8px 24px;
}

.nav-group {
    color: #8ea2af;
    font-size: 11px;
    margin: 16px 12px 6px;
}

.nav-item {
    align-items: center;
    border-radius: 7px;
    color: #eef6fb;
    display: flex;
    gap: 9px;
    min-height: 36px;
    padding: 8px 12px;
    transition: background .16s ease, color .16s ease, transform .16s ease;
}

.nav-item:hover,
.nav-item.active {
    background: var(--sidebar-2);
    color: #fff;
}

.nav-item:hover {
    transform: translateX(-2px);
}

.nav-item.active {
    box-shadow: inset -3px 0 0 var(--gold);
}

.nav-icon {
    color: #b5c3cc;
    display: inline-grid;
    flex: 0 0 auto;
    height: 20px;
    justify-items: center;
    opacity: .92;
    width: 20px;
}

.ui-icon {
    display: block;
    height: 20px;
    width: 20px;
}

.main {
    min-width: 0;
}

.topbar {
    align-items: center;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 20px;
    justify-content: space-between;
    min-height: 58px;
    padding: 10px 22px;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 18px rgba(15, 32, 48, .04);
}

.user {
    align-items: center;
    display: flex;
    gap: 10px;
}

.avatar {
    align-items: center;
    background: #102030;
    border-radius: 9px;
    color: #fff;
    display: grid;
    font-weight: 700;
    height: 34px;
    justify-items: center;
    width: 34px;
}

.search {
    flex: 1;
    max-width: 430px;
}

.top-actions {
    display: flex;
    gap: 8px;
}

.top-actions a {
    align-items: center;
    background: #f7f7f4;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: #405563;
    display: grid;
    height: 34px;
    justify-items: center;
    width: 34px;
}

.top-actions .ui-icon,
.brand-mark .ui-icon {
    height: 18px;
    width: 18px;
}

.top-actions a:hover {
    background: #fff;
    border-color: #c9c8bf;
    color: var(--ink);
}

.search input,
.filter input,
input,
select,
textarea {
    background: #fbfcfd;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    outline: 0;
    padding: 10px 12px;
    width: 100%;
}

.search input:focus,
.filter input:focus,
input:focus,
select:focus,
textarea:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(198, 135, 47, .14);
}

.content {
    margin: 0 auto;
    max-width: 1360px;
    padding: 24px 22px 42px;
}

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

.crumb {
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 6px;
}

h1 {
    font-size: 30px;
    line-height: 1.2;
    margin: 0;
}

h2 {
    font-size: 18px;
    margin: 0;
}

.actions,
.row-actions,
.form-actions,
.toolbar,
.filter {
    align-items: center;
    display: flex;
    gap: 8px;
}

.btn {
    align-items: center;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    display: inline-flex;
    font-weight: 600;
    min-height: 36px;
    padding: 8px 13px;
    transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
    gap: 7px;
}

.btn .ui-icon {
    height: 17px;
    width: 17px;
}

.btn.primary {
    background: #102638;
    border-color: #102638;
    color: #fff;
}

.btn.danger {
    background: var(--red);
    border-color: var(--red);
    color: #fff;
}

.btn:hover {
    border-color: #c5c3b9;
    box-shadow: var(--soft-shadow);
    transform: translateY(-1px);
}

.actions form,
.project-card-actions form {
    margin: 0;
}

.notice {
    background: #eaf5ef;
    border: 1px solid #b7ddca;
    border-radius: 8px;
    color: #246147;
    margin-bottom: 14px;
    padding: 12px 14px;
}

.notice.error {
    background: #fff0f0;
    border-color: #f1c4c6;
    color: #a9353a;
}

.form-errors {
    margin-bottom: 16px;
}

.form-errors strong {
    display: block;
    margin-bottom: 6px;
}

.form-errors ul {
    margin: 0;
    padding-right: 20px;
}

.field-error {
    color: #a9353a;
    display: block;
    font-size: 12px;
    margin-top: 6px;
}

.stats {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 16px;
}

.module-summary {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 16px;
}

.module-summary div {
    background: linear-gradient(135deg, rgba(198, 135, 47, .10), rgba(47, 111, 135, .06)), #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--soft-shadow);
    padding: 15px 16px;
}

.module-summary span {
    color: var(--muted);
    display: block;
    font-size: 12px;
    margin-bottom: 8px;
}

.module-summary strong {
    font-size: 18px;
    font-weight: 600;
}

.stat,
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.stat {
    overflow: hidden;
    padding: 18px;
    position: relative;
    transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.stat:hover,
.panel:hover {
    border-color: #d3d1c7;
    box-shadow: 0 16px 42px rgba(15, 32, 48, .10);
}

.stat::before {
    background: rgba(15, 32, 48, .09);
    border-radius: 999px;
    content: "";
    height: 56px;
    left: -18px;
    position: absolute;
    top: -18px;
    width: 56px;
}

.stat span {
    color: var(--muted);
    display: block;
    font-size: 12px;
    margin-bottom: 12px;
}

.stat strong {
    display: block;
    font-size: 21px;
    font-weight: 500;
    position: relative;
}

.stat.gold strong {
    color: var(--gold);
}

.stat.red strong {
    color: var(--red);
}

.stat.blue strong {
    color: var(--blue);
}

.stat.green strong {
    color: var(--green);
}

.text-green {
    color: var(--green);
}

.text-red {
    color: var(--red);
}

.finance-head {
    background: linear-gradient(135deg, rgba(35, 111, 142, .08), rgba(47, 138, 100, .05)), #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--soft-shadow);
    padding: 18px;
}

.dashboard-head {
    background: linear-gradient(135deg, rgba(35, 111, 142, .08), rgba(184, 134, 54, .06)), #fff;
}

.finance-stats .stat {
    min-height: 118px;
}

.finance-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: 1.1fr .9fr;
    margin-bottom: 16px;
}

.dashboard-grid {
    grid-template-columns: 1.15fr .85fr;
}

.ratio-list {
    display: grid;
    gap: 14px;
    padding: 16px;
}

.ratio-row {
    display: grid;
    gap: 9px;
}

.ratio-row > div:first-child {
    align-items: center;
    display: flex;
    justify-content: space-between;
}

.ratio-row strong {
    font-size: 13px;
}

.ratio-row span {
    color: var(--blue);
    font-weight: 700;
}

.ratio-bar {
    background: #edf0ef;
    border-radius: 999px;
    height: 10px;
    overflow: hidden;
}

.ratio-bar span {
    background: linear-gradient(90deg, var(--gold), var(--green));
    display: block;
    height: 100%;
}

.finance-summary {
    display: grid;
    gap: 10px;
    grid-template-columns: 1fr 1fr;
    padding: 16px;
}

.finance-summary div {
    background: #fbfbf8;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 13px;
}

.finance-summary span,
.account-balance span {
    color: var(--muted);
    display: block;
    font-size: 12px;
    margin-top: 4px;
}

.finance-summary strong {
    display: block;
    font-size: 17px;
    margin-top: 8px;
}

.dashboard-summary div {
    min-height: 86px;
}

.dashboard-workbench {
    display: grid;
    gap: 16px;
    grid-template-columns: 1.45fr .85fr;
    margin-bottom: 16px;
}

.project-focus-list {
    display: grid;
}

.project-focus-row {
    align-items: center;
    border-bottom: 1px solid var(--line);
    display: grid;
    gap: 14px;
    grid-template-columns: minmax(230px, 1fr) 150px 180px 86px;
    padding: 15px 16px;
}

a.project-focus-row {
    color: inherit;
}

.project-focus-row:hover {
    background: #fffdf7;
}

.project-main strong,
.timeline-item strong {
    display: block;
}

.project-main span,
.project-money span,
.timeline-item span,
.timeline-item small {
    color: var(--muted);
    display: block;
    font-size: 12px;
    margin-top: 4px;
}

.project-money strong {
    display: block;
    font-size: 13px;
    margin-top: 5px;
}

.progress-wrap {
    align-items: center;
    display: grid;
    gap: 9px;
    grid-template-columns: 1fr 44px;
}

.progress-wrap b {
    color: var(--green);
    font-size: 13px;
    text-align: left;
}

.dashboard-side {
    min-height: 100%;
}

.alert-timeline {
    display: grid;
    padding: 8px 0;
}

.timeline-item {
    margin: 0 16px;
    padding: 12px 0 12px 20px;
    position: relative;
}

.timeline-item + .timeline-item {
    border-top: 1px solid var(--line);
}

.timeline-item::before {
    background: var(--gold);
    border: 3px solid #f5ead9;
    border-radius: 999px;
    content: "";
    height: 11px;
    left: 0;
    position: absolute;
    top: 17px;
    width: 11px;
}

.dashboard-lower {
    grid-template-columns: 1.35fr .95fr;
}

.certificate-list .account-balance {
    min-height: 68px;
}

.operation-strip {
    margin-bottom: 16px;
}

.operation-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    padding: 16px;
}

.operation-grid a {
    background: linear-gradient(135deg, rgba(47, 111, 135, .07), rgba(198, 135, 47, .08)), #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.operation-grid a:hover {
    border-color: #d1b98f;
    box-shadow: var(--soft-shadow);
    transform: translateY(-1px);
}

.operation-grid span {
    color: var(--muted);
    display: block;
    font-size: 12px;
    margin-bottom: 8px;
}

.operation-grid strong {
    display: block;
    font-size: 17px;
}

.project-summary-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.project-toolbar {
    margin-bottom: 16px;
}

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

.project-card,
.project-hero,
.quick-add-panel,
.project-tabs {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.project-card {
    display: grid;
    gap: 16px;
    padding: 18px;
    transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.project-card-main {
    display: grid;
    gap: 16px;
}

.project-card:hover {
    border-color: #d0aa69;
    box-shadow: 0 18px 45px rgba(15, 32, 48, .11);
    transform: translateY(-2px);
}

.project-card-head,
.project-hero {
    align-items: flex-start;
    display: flex;
    gap: 14px;
    justify-content: space-between;
}

.project-card-head strong {
    display: block;
    font-size: 17px;
}

.project-card-head span,
.project-card-money span,
.project-card-progress span,
.project-hero p,
.quick-add-panel .panel-head span,
.project-section .panel-head span,
.cost-breakdown span,
.document-list span {
    color: var(--muted);
    font-size: 12px;
}

.project-card-money,
.cost-breakdown {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.project-card-money div,
.cost-breakdown div {
    background: #fbfbf8;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
}

.project-card-money b,
.cost-breakdown strong {
    display: block;
    font-size: 15px;
    margin-top: 7px;
}

.project-card-progress {
    display: grid;
    gap: 8px;
}

.project-card-actions {
    border-top: 1px solid var(--line);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 12px;
}

.empty-state {
    align-items: center;
    color: var(--muted);
    display: grid;
    gap: 8px;
    justify-items: center;
    padding: 36px;
    text-align: center;
}

.empty-state .ui-icon {
    color: var(--gold);
    height: 34px;
    width: 34px;
}

.project-hero {
    background:
        linear-gradient(135deg, rgba(15, 32, 48, .05), rgba(198, 135, 47, .10)),
        #fff;
    margin-bottom: 16px;
    padding: 20px;
}

.project-finance-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.quick-add-panel {
    margin-bottom: 16px;
}

.quick-add-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
    padding: 16px;
}

.quick-add-grid a {
    align-items: center;
    background: #fbfcfd;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 8px;
    justify-items: center;
    min-height: 88px;
    padding: 12px 8px;
    text-align: center;
    transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.quick-add-grid a:hover {
    border-color: #d0aa69;
    box-shadow: var(--soft-shadow);
    transform: translateY(-1px);
}

.quick-add-grid .ui-icon {
    color: var(--gold);
    height: 23px;
    width: 23px;
}

.project-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    padding: 10px;
    position: sticky;
    top: 68px;
    z-index: 8;
}

.project-tabs a {
    background: #f7fafb;
    border: 1px solid var(--line);
    border-radius: 7px;
    color: #405563;
    font-weight: 600;
    padding: 9px 12px;
}

.project-section {
    margin-bottom: 16px;
}

.cost-breakdown {
    padding: 16px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.project-section-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: 1fr 1fr;
}

.compact-table table {
    min-width: 640px;
}

.document-list {
    display: grid;
    padding: 8px 0;
}

.document-list a {
    align-items: center;
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 12px;
    padding: 13px 16px;
}

.document-list .ui-icon {
    color: var(--gold);
}

.document-list strong {
    display: block;
}

.empty-inline {
    color: var(--muted);
    padding: 18px 16px;
}

.report-shortcuts {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.field-help-link {
    color: var(--blue);
    display: inline-flex;
    font-size: 12px;
    font-weight: 700;
    margin-right: 8px;
}

.field-help-link:hover {
    color: var(--ink);
}

.backup-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 16px;
}

.backup-card .panel-head .ui-icon {
    color: var(--gold);
}

.backup-card-body {
    display: grid;
    gap: 14px;
    padding: 16px;
}

.backup-card-body p {
    color: var(--muted);
    line-height: 1.8;
    margin: 0;
}

.backup-card-body label span {
    color: var(--muted);
    display: block;
    font-size: 12px;
    margin-bottom: 7px;
}

.danger-zone {
    border-color: #efc4c7;
}

.danger-zone .panel-head {
    background: linear-gradient(180deg, #fff8f8, #fff);
}

.danger-zone .panel-head .ui-icon {
    color: var(--red);
}

.accounting-cards,
.statement-type-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 16px;
}

.report-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.accounting-card,
.statement-type-grid a,
.report-card {
    background: linear-gradient(135deg, rgba(47, 111, 135, .07), rgba(198, 135, 47, .07)), #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--soft-shadow);
    display: grid;
    gap: 8px;
    min-height: 132px;
    padding: 16px;
    transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.accounting-card:hover,
.statement-type-grid a:hover,
.statement-type-grid a.active,
.report-card:hover {
    border-color: #d0aa69;
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.accounting-card .ui-icon,
.statement-type-grid .ui-icon,
.report-card > .ui-icon {
    color: var(--gold);
    height: 24px;
    width: 24px;
}

.accounting-card strong,
.statement-type-grid strong,
.report-card strong {
    font-size: 16px;
}

.accounting-card span,
.statement-type-grid span,
.report-card span {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.7;
}

.report-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.report-actions .btn {
    min-height: 34px;
    padding: 8px 10px;
}

.statement-picker {
    margin-bottom: 16px;
}

.statement-filter {
    align-items: end;
    display: grid;
    gap: 12px;
    grid-template-columns: 1fr auto;
    padding: 16px;
}

.statement-filter label span {
    color: var(--muted);
    display: block;
    font-size: 12px;
    margin-bottom: 7px;
}

.account-balance-list {
    display: grid;
}

.account-balance {
    align-items: center;
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 13px 16px;
}

.account-balance b {
    color: var(--ink);
    font-size: 14px;
}

.grid.two {
    display: grid;
    gap: 16px;
    grid-template-columns: 1.45fr .9fr;
    margin-bottom: 16px;
}

.panel {
    overflow: hidden;
}

.panel-head,
.toolbar {
    background: linear-gradient(180deg, #fff, #fbfbf8);
    border-bottom: 1px solid var(--line);
    justify-content: space-between;
    padding: 14px 16px;
}

.panel-head {
    align-items: center;
    display: flex;
}

.panel-head a,
.link {
    color: #ba7427;
}

.project-list,
.alert-list {
    display: grid;
}

.project-row,
.alert-row {
    align-items: center;
    border-bottom: 1px solid var(--line);
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(190px, 1fr) 160px 54px;
    padding: 14px 16px;
}

.alert-row {
    display: block;
}

.progress {
    background: #edf0ef;
    border-radius: 999px;
    height: 8px;
    overflow: hidden;
}

.progress span {
    background: var(--green);
    display: block;
    height: 100%;
}

.table-wrap {
    overflow-x: auto;
}

table {
    border-collapse: collapse;
    min-width: 850px;
    width: 100%;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 12px 14px;
    text-align: right;
    vertical-align: middle;
    white-space: nowrap;
}

th {
    background: #e9e9e4;
    color: #4f5962;
    font-size: 12px;
    font-weight: 600;
}

td {
    background: #fff;
}

tbody tr:hover td {
    background: #fffdf7;
}

tfoot th {
    color: var(--ink);
    font-size: 13px;
}

.badge {
    background: linear-gradient(180deg, #eef4f6, #e5edf0);
    border-radius: 7px;
    color: #315769;
    display: inline-flex;
    padding: 5px 9px;
}

.icon-btn {
    align-items: center;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 7px;
    color: var(--ink);
    display: inline-grid;
    height: 31px;
    justify-items: center;
    width: 31px;
}

.icon-btn.danger {
    border-color: #efc6c6;
    color: #c83c42;
}

.icon-btn:hover {
    background: #f7f7f4;
    border-color: #c8c5ba;
}

.row-actions form {
    margin: 0;
}

.empty {
    color: var(--muted);
    text-align: center;
}

.pagination {
    padding: 12px 16px;
}

.pagination nav > div:first-child {
    display: none;
}

.pagination a,
.pagination span {
    margin-inline: 3px;
}

.form-panel {
    padding: 20px;
}

textarea {
    line-height: 1.8;
    resize: vertical;
}

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

.form-grid label > span {
    color: #52616d;
    display: block;
    font-size: 12px;
    margin-bottom: 7px;
}

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

.form-hint {
    align-items: center;
    background: #eef8f2;
    border: 1px solid #cfe8d8;
    border-radius: 8px;
    color: #285f45;
    display: inline-flex;
    gap: 8px;
    margin-bottom: 14px;
    padding: 10px 12px;
}

.form-hint .ui-icon {
    height: 18px;
    width: 18px;
}

.date-field {
    align-items: stretch;
    display: grid;
    grid-template-columns: 1fr 42px;
}

.date-field input {
    border-bottom-left-radius: 0;
    border-top-left-radius: 0;
}

.date-field button {
    align-items: center;
    background: #eef3f6;
    border: 1px solid var(--line);
    border-right: 0;
    border-radius: 8px 0 0 8px;
    color: var(--blue);
    display: grid;
    justify-items: center;
}

.file-upload {
    align-items: center;
    background: #fbfcfd;
    border: 1px dashed #bdccd5;
    border-radius: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px;
}

.file-upload input {
    background: transparent;
    border: 0;
    padding: 0;
}

.file-link {
    align-items: center;
    color: var(--blue);
    display: inline-flex;
    font-weight: 700;
    gap: 5px;
    white-space: nowrap;
}

.file-link .ui-icon {
    height: 16px;
    width: 16px;
}

.check {
    align-items: center;
    background: #fbfbfa;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: flex;
    gap: 8px;
    min-height: 42px;
    padding: 8px 12px;
}

.check input {
    width: auto;
}

.form-actions {
    border-top: 1px solid var(--line);
    margin-top: 18px;
    padding-top: 16px;
}

.settings-layout {
    align-items: start;
    display: grid;
    gap: 16px;
    grid-template-columns: 230px 1fr;
}

.settings-tabs {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--soft-shadow);
    display: grid;
    gap: 4px;
    padding: 10px;
    position: sticky;
    top: 78px;
}

.settings-tabs a {
    border-radius: 7px;
    color: #405563;
    font-weight: 600;
    padding: 11px 12px;
}

.settings-tabs a:hover {
    background: #f4f4f1;
}

.settings-sections {
    display: grid;
    gap: 16px;
}

.settings-section .panel-head span {
    color: var(--muted);
    font-size: 12px;
}

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

.settings-grid label > span {
    color: #52616d;
    display: block;
    font-size: 12px;
    margin-bottom: 7px;
}

.settings-grid .wide {
    grid-column: 1 / -1;
}

.logo-upload {
    align-items: center;
    background: #fbfbf8;
    border: 1px dashed #c9c8bf;
    border-radius: 8px;
    display: flex;
    gap: 14px;
    padding: 14px;
}

.logo-upload img,
.logo-placeholder {
    align-items: center;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--muted);
    display: grid;
    height: 76px;
    justify-items: center;
    object-fit: contain;
    padding: 6px;
    width: 96px;
}

.settings-save {
    background: rgba(244, 244, 241, .92);
    border-top: 1px solid var(--line);
    bottom: 0;
    margin-top: 16px;
    padding: 12px 0;
    position: sticky;
    z-index: 5;
}

.statement-title {
    align-items: center;
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    padding: 14px 16px;
}

.statement-title span {
    color: var(--muted);
}

.print-body {
    background: #dfe3e5;
    color: #111827;
}

.print-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    padding: 16px;
    position: sticky;
    top: 0;
    z-index: 20;
}

.print-actions .btn {
    min-width: 142px;
    justify-content: center;
}

.print-page {
    background: #fff;
    box-shadow: 0 18px 55px rgba(0, 0, 0, .18);
    margin: 0 auto 30px;
    min-height: 1123px;
    padding: 34px;
    width: 794px;
}

.print-header {
    align-items: flex-start;
    border-bottom: 3px solid var(--ink);
    display: flex;
    justify-content: space-between;
    padding-bottom: 18px;
}

.print-company {
    align-items: center;
    display: flex;
    gap: 14px;
}

.print-logo {
    align-items: center;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    height: 72px;
    justify-items: center;
    object-fit: contain;
    padding: 6px;
    width: 86px;
}

.print-logo-fallback {
    color: var(--gold);
}

.print-company h1 {
    font-size: 23px;
}

.print-company p,
.print-meta span,
.print-footer span {
    color: #5f6c75;
    display: block;
    font-size: 12px;
    margin-top: 4px;
}

.print-meta {
    text-align: left;
}

.print-meta strong {
    display: block;
    font-size: 17px;
    margin-bottom: 8px;
}

.document-title {
    background: linear-gradient(135deg, rgba(198, 135, 47, .13), rgba(47, 111, 135, .08));
    border: 1px solid var(--line);
    border-radius: 8px;
    margin: 20px 0;
    padding: 18px;
    text-align: center;
}

.document-title h2 {
    font-size: 25px;
}

.document-title p {
    color: var(--muted);
    margin: 8px 0 0;
}

.print-cards {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(4, 1fr);
    margin-bottom: 18px;
}

.print-cards div,
.party-grid div,
.signature-grid div {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
}

.print-cards span {
    color: var(--muted);
    display: block;
    font-size: 11px;
    margin-bottom: 6px;
}

.print-section {
    margin-top: 18px;
}

.print-section h3 {
    border-bottom: 1px solid var(--line);
    font-size: 17px;
    margin: 0 0 12px;
    padding-bottom: 8px;
}

.party-grid,
.signature-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(2, 1fr);
}

.signature-grid {
    grid-template-columns: repeat(3, 1fr);
    margin-top: 28px;
}

.signature-grid div,
.signature-box {
    background: linear-gradient(180deg, #ffffff, #f8faf8);
    position: relative;
}

.signature-grid div::after,
.signature-box::after {
    background: #cfd7d2;
    bottom: 32px;
    content: "";
    height: 1px;
    left: 18px;
    position: absolute;
    right: 18px;
}

.signature-grid div {
    min-height: 92px;
}

.signature-grid span {
    color: var(--muted);
    display: block;
    margin-bottom: 38px;
}

.terms-list {
    line-height: 1.9;
    margin: 0;
    padding-right: 22px;
}

.print-table {
    border-collapse: collapse;
    min-width: 0;
    width: 100%;
}

.print-table th,
.print-table td {
    border: 1px solid #d8d8d2;
    padding: 8px 9px;
    white-space: normal;
    vertical-align: top;
}

.print-table th {
    background: #eef0ed;
}

.print-body.report-print .print-page {
    min-height: 794px;
    padding: 28px 30px;
    width: 1123px;
}

.print-body.report-print .print-header {
    padding-bottom: 14px;
}

.print-body.report-print .print-logo {
    height: 58px;
    width: 70px;
}

.print-body.report-print .print-company h1 {
    font-size: 22px;
    margin: 0;
}

.print-body.report-print .document-title {
    margin: 16px 0 14px;
    padding: 13px 16px;
}

.print-body.report-print .document-title h2 {
    font-size: 22px;
    margin: 0;
}

.print-body.report-print .document-title p {
    margin-top: 5px;
}

.print-body.report-print .print-table {
    font-size: 11px;
    table-layout: fixed;
}

.print-body.report-print .print-table th,
.print-body.report-print .print-table td {
    line-height: 1.45;
    padding: 6px 6px;
}

.print-body.report-print .print-table td:not(:first-child),
.print-body.report-print .print-table th:not(:first-child) {
    overflow-wrap: normal;
    white-space: nowrap;
}

.print-body.report-print .print-table td:first-child,
.print-body.report-print .print-table th:first-child {
    overflow-wrap: anywhere;
    white-space: normal;
}

.print-body.report-print .print-footer {
    margin-top: 20px;
}

.print-body.voucher-print .print-page {
    max-width: 840px;
}

.voucher-title {
    align-items: center;
    display: flex;
    justify-content: space-between;
    text-align: right;
}

.voucher-title > strong {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    display: inline-grid;
    font-size: 22px;
    min-width: 210px;
    padding: 16px 18px;
    place-items: center;
}

.receipt-voucher-title {
    background: linear-gradient(135deg, #edf8f1, #fbfbf8);
}

.payment-voucher-title {
    background: linear-gradient(135deg, #fff2f2, #fbfbf8);
}

.voucher-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.voucher-section {
    margin-top: 18px;
}

.voucher-table th {
    color: var(--muted);
    width: 22%;
}

.voucher-table td {
    font-weight: 700;
}

.voucher-statement p {
    background: #fbfcfd;
    border: 1px solid var(--line);
    border-radius: 8px;
    line-height: 2;
    margin: 0;
    padding: 16px;
}

.voucher-signatures {
    margin-top: 34px;
}

.print-footer {
    border-top: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    margin-top: 28px;
    padding-top: 12px;
}

@media print {
    .print-actions {
        display: none;
    }

    .print-body {
        background: #fff;
    }

    .print-page {
        box-shadow: none;
        margin: 0;
        min-height: auto;
        padding: 0;
        width: auto;
    }

    .print-body.report-print .print-page {
        page: report-page;
        padding: 0;
        width: auto;
    }

    @page {
        margin: 12mm;
        size: A4;
    }

    @page report-page {
        margin: 8mm;
        size: A4 landscape;
    }
}

@media (max-width: 1080px) {
    .stats,
    .finance-grid,
    .dashboard-workbench,
    .operation-grid,
    .project-summary-stats,
    .project-finance-stats,
    .project-card-grid,
    .quick-add-grid,
    .project-section-grid,
    .report-shortcuts,
    .backup-grid,
    .accounting-cards,
    .report-grid,
    .statement-type-grid,
    .settings-layout,
    .grid.two,
    .form-grid,
    .module-summary {
        grid-template-columns: 1fr 1fr;
    }

    .project-focus-row {
        grid-template-columns: 1fr 150px;
    }

    .cost-breakdown {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 760px) {
    .app {
        grid-template-columns: 1fr;
    }

    .sidebar {
        height: auto;
        max-height: 48vh;
        position: relative;
    }

    .topbar,
    .page-head,
    .actions,
    .toolbar,
    .filter {
        align-items: stretch;
        flex-direction: column;
    }

    .stats,
    .finance-grid,
    .finance-summary,
    .dashboard-workbench,
    .operation-grid,
    .project-summary-stats,
    .project-finance-stats,
    .project-card-grid,
    .quick-add-grid,
    .project-section-grid,
    .report-shortcuts,
    .backup-grid,
    .accounting-cards,
    .report-grid,
    .statement-type-grid,
    .settings-layout,
    .settings-grid,
    .grid.two,
    .form-grid,
    .module-summary {
        grid-template-columns: 1fr;
    }

    .project-focus-row,
    .progress-wrap {
        grid-template-columns: 1fr;
    }

    .progress-wrap b {
        text-align: right;
    }

    .statement-filter {
        grid-template-columns: 1fr;
    }

    .project-hero,
    .project-card-head {
        flex-direction: column;
    }

    .project-tabs {
        position: static;
    }

    .project-card-money,
    .cost-breakdown {
        grid-template-columns: 1fr;
    }

    .compact-table table,
    .compact-table thead,
    .compact-table tbody,
    .compact-table tr,
    .compact-table th,
    .compact-table td {
        display: block;
        min-width: 0;
        width: 100%;
    }

    .compact-table thead {
        display: none;
    }

    .compact-table tr {
        border-bottom: 1px solid var(--line);
        padding: 10px 12px;
    }

    .compact-table td {
        align-items: center;
        border: 0;
        display: flex;
        justify-content: space-between;
        padding: 7px 0;
        white-space: normal;
    }

    .compact-table td::before {
        color: var(--muted);
        content: attr(data-label);
        font-size: 12px;
        margin-left: 12px;
    }

    h1 {
        font-size: 24px;
    }

    .content {
        padding: 18px 12px 34px;
    }
}

/* Modern visual pass */
.sidebar {
    box-shadow: 10px 0 30px rgba(6, 18, 28, .10);
}

.brand {
    padding-top: 18px;
    padding-bottom: 18px;
}

.brand strong {
    font-size: 18px;
    font-weight: 800;
}

.company {
    background: rgba(255, 255, 255, .035);
}

.nav-group {
    color: #7fb0c8;
    font-weight: 700;
    letter-spacing: 0;
}

.nav-item {
    border: 1px solid transparent;
    margin-bottom: 3px;
}

.nav-item:hover,
.nav-item.active {
    background: linear-gradient(90deg, rgba(35, 111, 142, .28), rgba(184, 134, 54, .12));
    border-color: rgba(255, 255, 255, .08);
}

.topbar {
    backdrop-filter: blur(14px);
    background: rgba(255, 255, 255, .92);
}

.top-actions form {
    margin: 0;
}

.top-actions button {
    align-items: center;
    background: #f7fafb;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: #405563;
    display: grid;
    height: 34px;
    justify-items: center;
    padding: 0;
    width: 34px;
}

.top-actions button:hover {
    background: #fff;
    border-color: #c9d5dd;
    color: var(--red);
}

.content {
    max-width: 1420px;
}

.stat,
.panel,
.project-card,
.project-hero,
.quick-add-panel,
.project-tabs,
.accounting-card,
.statement-type-grid a,
.report-card {
    border-color: #d7e2e8;
    box-shadow: 0 10px 28px rgba(19, 35, 49, .065);
}

.stat {
    background: linear-gradient(180deg, #ffffff, #fbfdfe);
}

.stat::before {
    background: linear-gradient(135deg, rgba(35, 111, 142, .12), rgba(184, 134, 54, .10));
}

.project-hero,
.finance-head {
    border-color: #cfdee7;
}

.quick-add-grid a,
.operation-grid a,
.project-card-money div,
.cost-breakdown div,
.finance-summary div {
    background: linear-gradient(180deg, #ffffff, #f8fbfc);
    border-color: #dbe6ec;
}

.quick-add-grid a {
    font-weight: 700;
}

.btn.primary {
    background: linear-gradient(135deg, #102638, #236f8e);
    border-color: #102638;
}

.btn.danger {
    background: linear-gradient(135deg, #b93b45, #cf4c55);
}

.login-body {
    background:
        linear-gradient(135deg, rgba(16, 38, 56, .94), rgba(35, 111, 142, .88)),
        linear-gradient(45deg, rgba(184, 134, 54, .22), transparent 58%);
    min-height: 100vh;
}

.login-shell {
    align-items: center;
    display: grid;
    min-height: 100vh;
    padding: 24px;
}

.login-card {
    background: rgba(255, 255, 255, .96);
    border: 1px solid rgba(255, 255, 255, .55);
    border-radius: 14px;
    box-shadow: 0 24px 70px rgba(5, 18, 28, .28);
    margin: auto;
    max-width: 430px;
    padding: 28px;
    width: 100%;
}

.login-brand {
    align-items: center;
    display: flex;
    gap: 12px;
    margin-bottom: 18px;
}

.login-brand .brand-mark {
    background: #102638;
    border-radius: 12px;
}

.login-brand strong {
    display: block;
    font-size: 18px;
}

.login-brand span,
.login-card p,
.login-card label > span {
    color: var(--muted);
}

.login-card h1 {
    margin-bottom: 8px;
}

.login-card form {
    display: grid;
    gap: 13px;
    margin-top: 18px;
}

.login-check {
    justify-content: start;
}

.login-submit {
    justify-content: center;
    min-height: 44px;
}

.role-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    margin-bottom: 16px;
}

.role-card {
    background: linear-gradient(180deg, #ffffff, #f8fbfc);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--soft-shadow);
    display: grid;
    gap: 8px;
    min-height: 132px;
    padding: 15px;
}

.role-card .ui-icon {
    color: var(--blue);
}

.role-card span {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.7;
}

.permissions-panel {
    overflow: hidden;
}

.permissions-table-wrap {
    overflow-x: auto;
}

.permissions-table {
    min-width: 980px;
}

.permissions-table td:first-child {
    min-width: 290px;
}

.permissions-table td:first-child strong {
    display: block;
}

.permissions-table td:first-child span {
    color: var(--muted);
    display: block;
    font-size: 12px;
    line-height: 1.7;
    margin-top: 3px;
}

.permission-toggle {
    display: inline-grid;
    place-items: center;
}

.permission-toggle input {
    display: none;
}

.permission-toggle span {
    background: #d9e2e9;
    border-radius: 999px;
    display: block;
    height: 24px;
    position: relative;
    transition: background .18s ease;
    width: 44px;
}

.permission-toggle span::after {
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(15, 32, 48, .22);
    content: "";
    height: 18px;
    position: absolute;
    right: 3px;
    top: 3px;
    transition: transform .18s ease;
    width: 18px;
}

.permission-toggle input:checked + span {
    background: var(--green);
}

.permission-toggle input:checked + span::after {
    transform: translateX(-20px);
}

.permission-toggle input:disabled + span {
    background: var(--gold);
    opacity: .85;
}

.app {
    background:
        radial-gradient(circle at 82% 0%, rgba(23, 112, 124, .10), transparent 28%),
        radial-gradient(circle at 4% 12%, rgba(194, 123, 43, .11), transparent 28%),
        linear-gradient(180deg, #f7fbfa 0, #edf4f2 360px, #edf3f5 100%);
}

body {
    background:
        radial-gradient(circle at 84% 3%, rgba(37, 130, 141, .12), transparent 28%),
        radial-gradient(circle at 6% 14%, rgba(194, 123, 43, .10), transparent 30%),
        linear-gradient(180deg, #fbfdfc 0, #edf4f2 360px, #edf3f5 100%);
}

.sidebar {
    background: linear-gradient(180deg, #0b2026 0%, #12343a 55%, #0e252b 100%);
}

.nav-item {
    border: 1px solid transparent;
}

.nav-item:hover,
.nav-item.active {
    background: linear-gradient(135deg, rgba(255, 255, 255, .08), rgba(24, 115, 124, .22));
    border-color: rgba(255, 255, 255, .08);
}

.topbar,
.page-head,
.finance-head,
.project-hero,
.form-panel {
    background: linear-gradient(135deg, rgba(255, 255, 255, .96), rgba(248, 252, 251, .96) 58%, rgba(255, 248, 237, .9));
    border-color: #cfe0df;
}

.page-head {
    border: 1px solid #cfe0df;
    border-radius: 8px;
    padding: 18px;
}

.page-head,
.finance-head,
.project-hero,
.form-panel {
    box-shadow: 0 16px 44px rgba(17, 44, 53, .075);
}

.stat,
.panel,
.project-card,
.quick-add-panel,
.project-tabs,
.accounting-card,
.statement-type-grid a,
.report-card,
.role-card {
    background: linear-gradient(180deg, #ffffff, #f9fcfb);
    border-color: #d1e0df;
    box-shadow: 0 12px 30px rgba(17, 44, 53, .07);
}

.stat:hover,
.panel:hover,
.project-card:hover,
.accounting-card:hover,
.statement-type-grid a:hover,
.statement-type-grid a.active,
.report-card:hover {
    border-color: #bdcfcf;
    box-shadow: 0 18px 46px rgba(17, 44, 53, .11);
}

th {
    background: linear-gradient(180deg, #eef2ef, #e3ebe7);
    color: #314750;
}

tbody tr:hover {
    background: #f8fbfa;
}

.btn.primary {
    background: linear-gradient(135deg, #0c2a33, #17707c);
    border-color: #0c2a33;
}

.btn.primary:hover {
    box-shadow: 0 10px 22px rgba(23, 112, 124, .20);
}

.contract-title {
    background: linear-gradient(135deg, rgba(23, 112, 124, .10), rgba(194, 123, 43, .12));
    border-top: 4px solid #17707c;
}

.contract-cards {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.contract-cards div:nth-child(1),
.contract-cards div:nth-child(2) {
    grid-column: span 2;
}

.print-cards div,
.party-grid div,
.contract-financial-strip div {
    background: linear-gradient(180deg, #ffffff, #fbfdfc);
}

.print-cards strong {
    line-height: 1.55;
}

.contract-financial-strip {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.contract-financial-strip div {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
}

.contract-financial-strip span {
    color: var(--muted);
    display: block;
    font-size: 11px;
    margin-bottom: 7px;
}

.contract-financial-strip strong {
    display: block;
    font-size: 16px;
}

@media (max-width: 1080px) {
    .role-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .role-grid {
        grid-template-columns: 1fr;
    }
}
