/* DevoEnv Project Cash Flow — Arabic RTL UI. Teal & gold theme. No build step required. */
:root {
  --teal-900: #102a33;
  --teal-800: #16323d;
  --teal-700: #1f4351;
  --teal-600: #2b5a6b;
  --teal-500: #3d7286;
  --teal-100: #e4edf0;
  --teal-50: #f1f6f7;
  --gold: #f4c025;
  --gold-dark: #d9a50c;
  --gold-soft: #fdf3d2;

  --bg: #f2f5f6;
  --surface: #ffffff;
  --surface-2: #f6f9fa;
  --border: #dfe7ea;
  --text: #1b2b33;
  --muted: #637884;
  --primary: var(--teal-700);
  --primary-soft: var(--teal-100);
  --link: #1d6a80;
  --success: #16834a;
  --success-soft: #e5f5ec;
  --danger: #c0392b;
  --danger-soft: #fcebe9;
  --warning: #9a6b00;
  --warning-soft: var(--gold-soft);
  --info: #1d6a80;
  --info-soft: #e1f0f4;
  --dark: var(--teal-800);
  --dark-soft: #e3eaed;
  --sidebar: var(--teal-800);
  --sidebar-text: #b7cad1;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 42, 51, .06), 0 2px 6px rgba(16, 42, 51, .05);
  font-family: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.6; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.3; color: var(--teal-800); }
h1 { font-size: 1.45rem; }
h2 { font-size: 1.12rem; }
h3 { font-size: 1rem; }
code { background: var(--teal-50); padding: 0 .3rem; border-radius: 4px; direction: ltr; unicode-bidi: isolate; }
.num, .money { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; display: inline-block; white-space: nowrap; }
.pos { color: var(--success); }
.neg { color: var(--danger); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* Layout */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 250px; background: linear-gradient(180deg, var(--teal-800), var(--teal-900)); color: var(--sidebar-text); flex-shrink: 0; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: block; margin: .9rem; padding: .8rem .9rem .7rem; background: #fff; border-radius: 12px; text-decoration: none; box-shadow: 0 4px 14px rgba(0,0,0,.18); }
.brand:hover { text-decoration: none; }
.brand-logo { display: block; width: 100%; max-width: 190px; height: auto; margin: 0 auto; }
.brand small { display: block; text-align: center; color: var(--teal-700); font-weight: 600; font-size: .74rem; margin-top: .2rem; border-top: 2px solid var(--gold); padding-top: .35rem; }
.nav { list-style: none; margin: 0; padding: .3rem .7rem 1rem; }
.nav a { display: flex; align-items: center; gap: .65rem; padding: .55rem .8rem; color: var(--sidebar-text); border-radius: 8px; font-size: .93rem; border-inline-start: 3px solid transparent; margin-bottom: 2px; }
.nav a span { width: 1.1rem; text-align: center; color: #7fa2ae; }
.nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.nav a.active { background: rgba(244, 192, 37, .12); color: #fff; border-inline-start-color: var(--gold); font-weight: 600; }
.nav a.active span { color: var(--gold); }
.nav .sep { margin: .9rem .8rem .3rem; font-size: .72rem; color: #7f9ba5; letter-spacing: .02em; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: inset 0 -3px 0 var(--gold); padding: .7rem 1.5rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.topbar .who { font-size: .9rem; color: var(--teal-800); }
.content { padding: 1.5rem; max-width: 1400px; width: 100%; }
.menu-toggle { display: none; }

/* Page header — gold accent bar echoes the brand */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.3rem; }
.page-head h1 { position: relative; padding-bottom: .45rem; }
.page-head h1::after { content: ""; position: absolute; bottom: 0; inset-inline-start: 0; width: 44px; height: 3px; background: var(--gold); border-radius: 2px; }
.page-head h1::before { content: ""; position: absolute; bottom: 0; inset-inline-start: 50px; width: 26px; height: 3px; background: repeating-linear-gradient(to left, var(--gold) 0 5px, transparent 5px 9px); }
.page-head .sub { color: var(--muted); font-size: .9rem; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 1.2rem; }
.card-head { padding: .85rem 1.1rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }
.card-body { padding: 1.1rem; }
a.card:hover { border-color: var(--gold); text-decoration: none; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(195px, 1fr)); gap: .9rem; margin-bottom: 1.2rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem 1rem; box-shadow: var(--shadow); }
.stat .label { color: var(--muted); font-size: .82rem; }
.stat .value { font-size: 1.25rem; font-weight: 700; margin-top: .2rem; }
.stat .hint { font-size: .76rem; color: var(--muted); margin-top: .15rem; }
.stat.primary { background: linear-gradient(135deg, var(--teal-700), var(--teal-800)); border-color: var(--teal-800); color: #fff; }
.stat.primary .label, .stat.primary .hint { color: #b9d0d7; }
.stat.primary .value .money { color: #fff; }
.stat.primary .value .money.neg { color: #ffb4a9; }
.stat.success { border-top: 3px solid var(--success); }
.stat.danger { border-top: 3px solid var(--danger); }
.stat.warning { border-top: 3px solid var(--gold); }
.stat.dark { border-top: 3px solid var(--teal-700); }
.balance-box { border-radius: var(--radius); padding: 1rem 1.2rem; background: linear-gradient(135deg, var(--teal-700), var(--teal-800)); color: #fff; box-shadow: var(--shadow); }
.balance-box .label { font-weight: 600; color: var(--gold); }
.balance-box .value { font-size: 1.7rem; font-weight: 700; }
.balance-box .value .money, .balance-box .value .money.pos { color: #fff; }
.balance-box .value .money.neg { color: #ffb4a9; }
.balance-box .muted { color: #b9d0d7; }
.balance-box.final { background: linear-gradient(135deg, var(--teal-900), #0b1f26); border: 1px solid var(--gold); }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: .6rem .75rem; text-align: start; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { background: var(--teal-50); color: var(--teal-700); font-weight: 600; font-size: .8rem; white-space: nowrap; }
tbody tr:hover { background: #fafcfc; }
tfoot td { font-weight: 700; background: var(--gold-soft); }
td.amount, th.amount { text-align: end; }
tr.is-void td { color: #9aabb2; text-decoration: line-through; }
tr.is-void td .badge { text-decoration: none; }

/* Badges */
.badge { display: inline-block; padding: .12rem .55rem; border-radius: 999px; font-size: .76rem; font-weight: 600; white-space: nowrap; }
.badge.success { background: var(--success-soft); color: var(--success); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.warning { background: var(--gold-soft); color: var(--warning); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.dark { background: var(--teal-800); color: #fff; }
.badge.muted { background: #edf1f3; color: var(--muted); }
.badge.primary { background: var(--gold); color: var(--teal-900); }

/* Alerts */
.alert { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid transparent; border-inline-start-width: 4px; }
.alert ul { margin: .3rem 0 0; padding-inline-start: 1.2rem; }
.alert.success { background: var(--success-soft); color: var(--success); border-color: #bfe3cd; }
.alert.error { background: var(--danger-soft); color: var(--danger); border-color: #f2c1bb; }
.alert.warning { background: var(--gold-soft); color: var(--warning); border-color: #f1d77d; }
.alert.info { background: var(--info-soft); color: var(--info); border-color: #b5dbe5; }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.2rem; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-weight: 600; font-size: .86rem; margin-bottom: .3rem; color: var(--teal-800); }
.field .req { color: var(--danger); }
.field .help { font-size: .78rem; color: var(--muted); margin-top: .25rem; }
.field .error { font-size: .8rem; color: var(--danger); margin-top: .25rem; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=month], input[type=number], input[type=search], input[type=file], select, textarea {
  width: 100%; padding: .5rem .7rem; border: 1px solid #c9d6db; border-radius: 8px; font: inherit; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(244, 192, 37, .35); border-color: var(--gold-dark); }
input.is-invalid, select.is-invalid, textarea.is-invalid { border-color: var(--danger); }
input.ltr { direction: ltr; text-align: left; }
textarea { min-height: 80px; resize: vertical; }
.checkbox { display: flex; gap: .45rem; align-items: center; font-weight: 500; }
input[type=checkbox] { accent-color: var(--teal-700); width: 1rem; height: 1rem; }
.form-actions { display: flex; gap: .6rem; margin-top: 1.2rem; flex-wrap: wrap; }
.filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: flex-end; }
.filters .field { min-width: 150px; }
.filters .field label { font-size: .78rem; color: var(--muted); }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: .35rem; padding: .48rem 1rem; border-radius: 6px; border: 1px solid transparent; font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; background: var(--teal-700); color: #fff; white-space: nowrap; transition: background .15s, filter .15s; }
.btn:hover { background: var(--teal-800); text-decoration: none; }
.btn.gold { background: var(--gold); color: var(--teal-900); }
.btn.gold:hover { background: var(--gold-dark); }
.btn.secondary { background: #fff; color: var(--teal-800); border-color: #c9d6db; }
.btn.secondary:hover { border-color: var(--teal-700); background: var(--teal-50); }
.btn.danger { background: var(--danger); }
.btn.danger:hover { filter: brightness(.92); background: var(--danger); }
.btn.success { background: var(--success); }
.btn.success:hover { filter: brightness(.92); background: var(--success); }
.btn.warning { background: var(--gold); color: var(--teal-900); }
.btn.warning:hover { background: var(--gold-dark); }
.btn.sm { padding: .28rem .65rem; font-size: .8rem; }
.btn:disabled { opacity: .6; cursor: progress; }
.inline { display: inline; }

/* Misc */
.empty { text-align: center; padding: 2.2rem 1rem; color: var(--muted); }
.empty .icon { font-size: 2rem; color: var(--gold-dark); }
.dl { display: grid; grid-template-columns: 170px 1fr; gap: .45rem 1rem; margin: 0; }
.dl dt { color: var(--muted); font-size: .86rem; }
.dl dd { margin: 0; }
.month-tabs { display: flex; gap: .35rem; flex-wrap: wrap; }
.month-tabs a { padding: .3rem .75rem; border: 1px solid var(--border); border-radius: 999px; font-size: .82rem; background: #fff; color: var(--teal-800); }
.month-tabs a:hover { border-color: var(--teal-500); text-decoration: none; }
.month-tabs a.active { background: var(--teal-700); color: #fff; border-color: var(--teal-700); }
.month-tabs a .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); margin-inline-start: .35rem; }
.month-tabs a .dot.closed { background: var(--teal-500); }
.month-tabs a.active .dot.closed { background: #9fc3cf; }
.progress { height: 8px; background: #e8eef0; border-radius: 999px; overflow: hidden; min-width: 80px; }
.progress span { display: block; height: 100%; background: var(--teal-600); }
.progress span.warning { background: var(--gold); }
.progress span.exceeded { background: var(--danger); }
details.box { border: 1px solid var(--border); border-radius: 8px; padding: .6rem .9rem; margin-top: .6rem; background: var(--surface-2); }
details.box summary { cursor: pointer; font-weight: 600; color: var(--teal-800); }
pre.json { direction: ltr; text-align: left; background: var(--teal-900); color: #e2ecef; padding: .8rem; border-radius: 8px; overflow-x: auto; font-size: .8rem; }
.pagination { display: flex; gap: .3rem; list-style: none; padding: 0; margin: 1rem 0 0; flex-wrap: wrap; }
.pagination a, .pagination span { display: inline-block; padding: .3rem .7rem; border: 1px solid var(--border); border-radius: 6px; background: #fff; font-size: .85rem; color: var(--teal-800); }
.pagination .active span { background: var(--teal-700); color: #fff; border-color: var(--teal-700); }
.pagination .disabled span { color: #a3b3b9; }

/* Auth / login — split screen with illustrated brand panel */
.auth-split { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); background: #fff; }
.auth-visual { position: relative; overflow: hidden; color: #fff; padding: 3rem 3.2rem; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(circle at 15% 85%, rgba(244,192,37,.10), transparent 40%), linear-gradient(150deg, var(--teal-700) 0%, var(--teal-800) 55%, var(--teal-900) 100%); }
.auth-visual.has-photo { background: linear-gradient(150deg, rgba(31,67,81,.92), rgba(16,42,51,.94)), var(--login-photo) center / cover no-repeat; }
.auth-visual .illustration { position: absolute; inset-inline-end: 0; bottom: 0; width: 80%; max-width: 600px; opacity: .95; pointer-events: none; }
.auth-visual .tagline { position: relative; z-index: 1; max-width: 430px; }
.auth-visual .eyebrow { color: var(--gold); font-weight: 600; font-size: .9rem; letter-spacing: .03em; }
.auth-visual h2 { color: #fff; font-size: 2rem; margin: .4rem 0 .6rem; line-height: 1.35; }
.auth-visual p { color: #c6d8de; margin: 0; }
.gold-rule { display: flex; align-items: center; gap: 5px; margin: 1.1rem 0; }
.gold-rule::before { content: ""; width: 44px; height: 3px; background: var(--gold); border-radius: 2px; }
.gold-rule span { width: 5px; height: 3px; background: var(--gold); border-radius: 2px; }
.auth-features { list-style: none; padding: 0; margin: 1.2rem 0 0; display: grid; gap: .55rem; position: relative; z-index: 1; }
.auth-features li { display: flex; gap: .55rem; align-items: center; color: #e2ecef; font-size: .93rem; }
.auth-features li::before { content: "✓"; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--gold); color: var(--teal-900); font-size: .75rem; font-weight: 700; flex-shrink: 0; }
.auth-visual .foot { position: relative; z-index: 1; font-size: .8rem; color: #9fbac3; }
.auth-form-side { display: flex; align-items: center; justify-content: center; padding: 2rem 1.2rem; background: #fff; box-shadow: inset 4px 0 0 var(--gold); }
.auth-form { width: 100%; max-width: 380px; }
.auth-form h1 { font-size: 1.5rem; }
.auth-form .field { margin-bottom: 1rem; }
.auth-form .btn { width: 100%; justify-content: center; padding: .65rem 1rem; font-size: 1rem; }
.auth-logo { display: block; width: 210px; max-width: 70%; height: auto; margin: 0 auto 1.4rem; }
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; background: linear-gradient(150deg, var(--teal-700), var(--teal-900)); }
.auth-card { width: 100%; max-width: 420px; background: #fff; border-radius: 14px; padding: 2rem; box-shadow: 0 20px 50px rgba(0,0,0,.25); border-top: 4px solid var(--gold); }

@media (max-width: 960px) {
  .sidebar { position: fixed; inset-inline-start: -270px; z-index: 50; transition: inset-inline-start .2s; }
  body.nav-open .sidebar { inset-inline-start: 0; box-shadow: 0 0 30px rgba(0,0,0,.3); }
  .menu-toggle { display: inline-flex; }
  .grid-2, .grid-3, .form-grid { grid-template-columns: 1fr; }
  .content { padding: 1rem; }
  .dl { grid-template-columns: 1fr; }
  .auth-split { grid-template-columns: 1fr; }
  .auth-visual { min-height: 300px; padding: 2rem 1.4rem; }
  .auth-visual h2 { font-size: 1.5rem; }
  .auth-visual .illustration { width: 70%; opacity: .35; }
  .auth-features { display: none; }
  .auth-form-side { box-shadow: inset 0 4px 0 var(--gold); }
}
@media print {
  .sidebar, .topbar, .no-print, .filters, form { display: none !important; }
  .content { padding: 0; }
  .card { box-shadow: none; }
}

/* Only signed figures (net movement, balances) are colored; totals stay neutral. */
.stat.success .value .money, .stat.danger .value .money, .stat.warning .value .money { color: var(--teal-800); }

/* Language switch + left-to-right (English) adjustments */
.lang-switch { font-weight: 700; min-width: 4.2rem; justify-content: center; }
.auth-lang { display: flex; justify-content: flex-end; margin-bottom: .6rem; }
[dir="ltr"] .auth-form-side { box-shadow: inset -4px 0 0 var(--gold); }
[dir="ltr"] .page-head h1::before { background: repeating-linear-gradient(to right, var(--gold) 0 5px, transparent 5px 9px); }
[dir="ltr"] body, [dir="ltr"] { font-family: "IBM Plex Sans Arabic", "Segoe UI", system-ui, sans-serif; }
@media (max-width: 960px) {
  [dir="ltr"] .auth-form-side { box-shadow: inset 0 4px 0 var(--gold); }
}
