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

:root {
  --bg: #10171a;
  --surface: #1a2327;
  --surface-2: #212c31;
  --surface-3: #283539;
  --border: #2e3a3f;
  --text: #ede7da;
  --text-muted: #93a3a6;
  --text-faint: #647175;
  --gold: #c9a227;
  --gold-soft: rgba(201, 162, 39, 0.14);
  --income: #4e9f6e;
  --income-soft: rgba(78, 159, 110, 0.14);
  --expense: #c1573d;
  --expense-soft: rgba(193, 87, 61, 0.14);
  --danger: #c1573d;
  --radius: 10px;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  --font-display: 'Tajawal', sans-serif;
  --font-body: 'IBM Plex Sans Arabic', 'Tajawal', sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  background-image:
    linear-gradient(var(--bg), var(--bg)),
    repeating-linear-gradient(
      to bottom,
      rgba(237, 231, 218, 0.028) 0px,
      rgba(237, 231, 218, 0.028) 1px,
      transparent 1px,
      transparent 34px
    );
}

button, input, select, textarea {
  font-family: inherit;
  color: inherit;
}

a { color: inherit; }

.tabular { font-variant-numeric: tabular-nums; }

::selection { background: var(--gold-soft); color: var(--text); }

/* Focus visibility for accessibility */
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* ---------------- Stamp / brand mark ---------------- */
.stamp {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  position: relative;
  flex-shrink: 0;
}
.stamp::before {
  content: '';
  position: absolute;
  inset: 5px;
  border: 1px dashed rgba(201, 162, 39, 0.5);
  border-radius: 50%;
}

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  padding: 11px 18px;
  border-radius: var(--radius);
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { background: var(--surface-3); border-color: var(--text-faint); }
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: var(--gold);
  border-color: var(--gold);
  color: #1a1405;
}
.btn-primary:hover { background: #d9b13a; }
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger {
  background: transparent;
  border-color: var(--border);
  color: var(--expense);
}
.btn-danger:hover { background: var(--expense-soft); border-color: var(--expense); }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ---------------- Form fields ---------------- */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 600;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 11px 13px;
  font-size: 14.5px;
  transition: border-color 0.15s ease;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--gold);
  outline: none;
}
.field textarea { resize: vertical; min-height: 70px; }

.type-toggle {
  display: flex;
  gap: 8px;
}
.type-toggle button {
  flex: 1;
  padding: 11px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  font-weight: 700;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s ease;
}
.type-toggle button.active[data-type="income"] {
  background: var(--income-soft);
  border-color: var(--income);
  color: var(--income);
}
.type-toggle button.active[data-type="expense"] {
  background: var(--expense-soft);
  border-color: var(--expense);
  color: var(--expense);
}

.error-msg {
  background: var(--expense-soft);
  border: 1px solid var(--expense);
  color: #f0a58f;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  margin-bottom: 16px;
  display: none;
}
.error-msg.show { display: block; }

/* ---------------- Pills ---------------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 700;
}
.pill-income { background: var(--income-soft); color: var(--income); }
.pill-expense { background: var(--expense-soft); color: var(--expense); }

/* ---------------- Scrollbar ---------------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 6px; }
