:root {
    --navy: #16425b;
    --teal: #2c6e7f;
    --steel: #cfe0e8;
    --gold: #f6e2b3;
    --cream: #fffdf4;
    --zebra: #f3f8fa;
    --paper: #ffffff;
    --line: #d7e4e9;
    --ink: #132f3f;
    --muted: #6b7f88;
    --danger: #b42318;
    --success: #067647;
    --warning: #b54708;
}

* { box-sizing: border-box; }

html { direction: rtl; font-family: Tajawal, system-ui, sans-serif; }
body { margin: 0; background: #eef3f5; color: var(--ink); letter-spacing: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
table { border-collapse: collapse; }

.app-header,
body > header {
    position: sticky;
    top: 0;
    z-index: 30;
    border-bottom: 1px solid #d3e1e7;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 10px 30px rgba(22, 66, 91, .06);
}

.app-header-inner {
    max-width: 1500px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-logo {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--navy);
    color: #fff;
    font-weight: 900;
}

.app-brand-title {
    display: block;
    color: var(--navy);
    font-size: 20px;
    font-weight: 900;
    line-height: 1.1;
}

.app-brand-subtitle {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

body > main {
    max-width: 1500px;
    margin: 0 auto;
    padding: 20px;
}

.app-nav { display: flex; gap: 8px; align-items: center; font-size: 14px; font-weight: 800; color: var(--teal); }
.app-nav a { border-radius: 8px; padding: 10px 12px; }
.app-nav a:hover { background: #edf5f7; color: var(--navy); }

.hero {
    overflow: hidden;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--navy), #0f3348);
    color: #fff;
    box-shadow: 0 20px 45px rgba(22, 66, 91, .16);
}
.hero-inner { display: flex; justify-content: space-between; gap: 24px; align-items: end; padding: 24px; flex-wrap: wrap; }
.hero h1 { margin: 6px 0 8px; font-size: clamp(28px, 4vw, 44px); line-height: 1.1; font-weight: 900; }
.hero p { margin: 0; color: #d8e8ee; line-height: 1.8; max-width: 760px; }
.eyebrow { color: var(--steel); font-size: 13px; font-weight: 900; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-wide { grid-template-columns: 1.08fr .92fr; }

/* Fallbacks for the utility classes still present in Blade. */
.mb-5 { margin-bottom: 20px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.p-4 { padding: 16px; }
.p-5 { padding: 20px; }
.px-3 { padding-left: 12px; padding-right: 12px; }
.px-4 { padding-left: 16px; padding-right: 16px; }
.py-1 { padding-top: 4px; padding-bottom: 4px; }
.py-2 { padding-top: 8px; padding-bottom: 8px; }
.py-3 { padding-top: 12px; padding-bottom: 12px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.flex { display: flex; }
.grid { display: grid; }
.hidden { display: none; }
.block { display: block; }
.inline-flex { display: inline-flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.overflow-hidden { overflow: hidden; }
.overflow-x-auto { overflow-x: auto; }
.rounded-md { border-radius: 8px; }
.rounded-lg { border-radius: 10px; }
.rounded-xl { border-radius: 16px; }
.rounded-full { border-radius: 999px; }
.font-bold { font-weight: 700; }
.font-extrabold,
.font-black { font-weight: 900; }
.text-xs { font-size: 12px; }
.text-sm { font-size: 14px; }
.text-xl { font-size: 20px; }
.text-2xl { font-size: 24px; }
.text-3xl { font-size: 30px; }
.text-4xl { font-size: 36px; }
.min-h-screen { min-height: 100vh; }
.w-full { width: 100%; }
.min-w-\[640px\] { min-width: 640px; }
.min-w-\[680px\] { min-width: 680px; }
.min-w-\[760px\] { min-width: 760px; }
.min-w-\[860px\] { min-width: 860px; }
.min-w-\[900px\] { min-width: 900px; }
.divide-y > * + * { border-top: 1px solid #e8f0f3; }
.shadow-lg { box-shadow: 0 20px 45px rgba(22, 66, 91, .16); }
.bg-white { background: #fff; }
.text-white { color: #fff; }
.text-\[\#16425B\] { color: var(--navy); }
.text-\[\#2C6E7F\] { color: var(--teal); }
.text-\[\#6b7f88\] { color: var(--muted); }
.text-\[\#87979f\] { color: #87979f; }
.bg-\[\#16425B\] { background: var(--navy); }
.bg-\[\#F6E2B3\] { background: var(--gold); }
.bg-\[\#f3f8fa\] { background: var(--zebra); }
.bg-\[\#fffdf4\] { background: var(--cream); }
.bg-white\/10 { background: rgba(255,255,255,.1); }
.text-emerald-800 { color: #065f46; }
.bg-emerald-100 { background: #d1fae5; }
.text-red-800 { color: #991b1b; }
.bg-red-100 { background: #fee2e2; }
.text-amber-800 { color: #92400e; }
.bg-amber-100 { background: #fef3c7; }
.ring-1 { box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.antialiased { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

.workbook-panel,
.panel {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--paper);
    box-shadow: 0 10px 30px rgba(22, 66, 91, .06);
    overflow: hidden;
}
.panel-pad { padding: 16px; }
.section-band { background: var(--teal); color: #fff; padding: 12px 16px; font-weight: 900; }
.steel-head { background: var(--steel); color: var(--navy); padding: 12px 16px; font-weight: 900; }
.total-row { background: var(--gold); color: #5a3e12; font-weight: 900; }
.input-cell { background: var(--cream); }

.metric { padding: 16px; }
.metric-label { color: var(--muted); font-size: 12px; font-weight: 900; }
.metric-value { margin-top: 8px; color: var(--navy); font-size: 30px; line-height: 1.1; font-weight: 900; }
.metric-sub { margin-top: 4px; color: #87979f; font-size: 12px; font-weight: 700; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 16px 0; flex-wrap: wrap; }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 10px 14px;
    background: #fff;
    color: var(--navy);
    cursor: pointer;
    font-weight: 900;
}
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: #0f3348; }
.btn-gold { background: var(--gold); color: var(--navy); }
.btn-danger { background: #fff1f0; color: var(--danger); border-color: #fecdca; }
.btn-muted { border-color: var(--line); color: var(--teal); }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; min-width: 760px; text-align: right; font-size: 14px; }
.data-table th { background: var(--zebra); color: var(--navy); padding: 12px; font-weight: 900; white-space: nowrap; }
.data-table td { border-top: 1px solid #e8f0f3; padding: 10px 12px; vertical-align: middle; }
.data-table tbody tr:hover { background: #fbfdfe; }

.status-pill {
    display: inline-flex;
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 900;
}
.status-ok { background: #dcfae6; color: var(--success); }
.status-bad { background: #fee4e2; color: var(--danger); }
.status-warn { background: #fef0c7; color: var(--warning); }

.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.field { display: grid; gap: 6px; }
.field label { color: var(--muted); font-size: 12px; font-weight: 900; }
.field input, .field select, .field textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--cream);
    color: var(--ink);
    padding: 10px 12px;
    outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(44, 110, 127, .12);
}
.field textarea { min-height: 88px; resize: vertical; }
.form-section { margin-top: 16px; }
.form-table { width: 100%; min-width: 860px; font-size: 13px; }
.form-table th { padding: 10px; background: var(--steel); color: var(--navy); text-align: right; }
.form-table td { border-top: 1px solid #e8f0f3; padding: 8px; }
.form-table input, .form-table select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 9px 10px;
}
.error-box {
    margin: 16px 0;
    border: 1px solid #fecdca;
    border-radius: 12px;
    background: #fff1f0;
    color: var(--danger);
    padding: 12px 16px;
    font-weight: 800;
}
.notice {
    margin: 12px 0;
    border: 1px solid #abefc6;
    border-radius: 12px;
    background: #ecfdf3;
    color: var(--success);
    padding: 12px 16px;
    font-weight: 900;
}

@media (max-width: 1100px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-3, .grid-wide { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
    body > main { padding: 14px; }
    .hero-inner { padding: 18px; }
    .grid-2, .grid-4, .form-grid { grid-template-columns: 1fr; }
    .metric-value { font-size: 24px; }
}
