* { box-sizing: border-box; }

:root {
  --accent: #0e7c66;
  --accent-2: #c9a24b;
  --text: #1c2b33;
  --muted: #6b7a82;
  --danger: #b3261e;
  --glass: rgba(255, 255, 255, 0.55);
  --glass-border: rgba(255, 255, 255, 0.8);
}

body {
  margin: 0;
  font-family: "Segoe UI", "Tahoma", "Arial", sans-serif;
  color: var(--text);
  background: linear-gradient(135deg, #dff3ec 0%, #f7efe0 50%, #d6e8f5 100%);
  min-height: 100vh;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--danger); min-height: 1.2em; }

.glass {
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

/* ---------- تسجيل الدخول ---------- */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { width: 360px; padding: 32px; display: flex; flex-direction: column; gap: 12px; text-align: center; }
.login-card h1 { margin: 4px 0 0; color: var(--accent); }
.login-card label { display: flex; flex-direction: column; text-align: right; gap: 6px; font-size: 14px; }
.logo { width: 90px; height: 90px; object-fit: contain; margin: 0 auto; }

/* ---------- الهيكل ---------- */
.app { display: flex; min-height: 100vh; padding: 12px; gap: 12px; }
.sidebar { width: 230px; padding: 18px; display: flex; flex-direction: column; gap: 16px; position: sticky; top: 12px; height: calc(100vh - 24px); }
.brand { display: flex; align-items: center; gap: 10px; font-size: 18px; color: var(--accent); }
.brand img { width: 44px; height: 44px; object-fit: contain; }
#nav { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.nav-btn {
  background: transparent; border: none; text-align: right; padding: 10px 12px;
  border-radius: 10px; cursor: pointer; font-size: 15px; color: var(--text);
}
.nav-btn:hover, .nav-btn.active { background: rgba(14, 124, 102, 0.12); color: var(--accent); }
.user-box { display: flex; align-items: center; justify-content: space-between; font-size: 14px; }

.content { flex: 1; padding: 8px 12px; min-width: 0; }
.content h2 { margin: 6px 0 16px; color: var(--accent); }

/* ---------- عناصر عامة ---------- */
.btn {
  border: none; border-radius: 10px; padding: 9px 16px; cursor: pointer; font-size: 14px;
  font-family: inherit;
}
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: rgba(255, 255, 255, 0.6); color: var(--text); }
.btn.small { padding: 5px 10px; font-size: 13px; }

input, select, textarea {
  font-family: inherit; font-size: 14px; padding: 8px 10px;
  border: 1px solid #c9d6dc; border-radius: 10px; background: rgba(255, 255, 255, 0.85);
  width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(14, 124, 102, 0.35); }

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar input { max-width: 300px; }

.grid-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { padding: 18px; }
.stat .label { color: var(--muted); font-size: 14px; }
.stat .value { font-size: 22px; font-weight: 700; margin-top: 6px; }

.panel { padding: 18px; margin-bottom: 18px; }
.panel h3 { margin: 0 0 12px; font-size: 16px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 8px; border-bottom: 1px solid rgba(0, 0, 0, 0.06); text-align: right; }
th { color: var(--muted); font-weight: 600; }
.table-wrap { overflow-x: auto; }

.badge { padding: 3px 10px; border-radius: 999px; font-size: 12px; background: #e9eef1; }
.badge.CONFIRMED, .badge.PAID { background: #d4f0e6; color: #0b5c4c; }
.badge.DRAFT, .badge.UNPAID, .badge.PARTIAL { background: #fdf0d2; color: #7a5a10; }
.badge.CANCELLED { background: #f6dcd9; color: var(--danger); }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.form-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.form-actions { display: flex; gap: 10px; margin-top: 14px; }

.items-table input { padding: 6px 8px; }

.modal-back {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.25);
  display: flex; align-items: center; justify-content: center; z-index: 10;
}
.modal { width: min(560px, 92vw); padding: 22px; max-height: 90vh; overflow-y: auto; }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: #1c2b33; color: #fff; padding: 12px 20px; border-radius: 12px; z-index: 20;
  font-size: 14px; max-width: 90vw;
}
.toast.error { background: var(--danger); }

@media (max-width: 1100px) {
  .sidebar { width: 180px; }
}

.modal.wide { width: min(900px, 95vw); }


/* mobile menu */
.menu-btn, .backdrop { display: none; }
@media (max-width: 768px) {
  .menu-btn { display: flex; position: fixed; top: 10px; right: 10px; z-index: 60; width: 44px; height: 44px; align-items: center; justify-content: center; border: 0; border-radius: 12px; background: #357a68; color: #fff; font-size: 24px; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
  .sidebar { position: fixed !important; top: 0; right: 0; bottom: 0; width: 260px !important; max-width: 80vw; z-index: 55; overflow-y: auto; transform: translateX(105%); transition: transform .25s ease; background: rgba(250,248,242,.98) !important; }
  body.menu-open .sidebar { transform: none; }
  body.menu-open .backdrop { display: block; position: fixed; top: 0; right: 0; bottom: 0; left: 0; background: rgba(0,0,0,.35); z-index: 50; }
  .content { width: 100% !important; margin: 0 !important; padding-top: 64px !important; }
}
