/* LawFMS — Iraqi law office UI, RTL */
:root {
  --bg: #f3efe6;
  --bg-deep: #e7dfd0;
  --ink: #1c2420;
  --muted: #5c675f;
  --line: #cfc6b4;
  --card: #fffdf8;
  --accent: #1f5c45;
  --accent-2: #c45c26;
  --danger: #9b2c2c;
  --ok: #1f5c45;
  --shadow: 0 10px 30px rgba(28, 36, 32, 0.08);
  --radius: 14px;
  --font: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  --display: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 100% -10%, #d9e7df 0%, transparent 55%),
    radial-gradient(900px 400px at -10% 20%, #f0e0d2 0%, transparent 50%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
  min-height: 100vh;
  line-height: 1.65;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { width: min(1100px, 92%); margin-inline: auto; }

/* Landing */
.hero {
  min-height: 100vh;
  display: grid;
  align-items: center;
  padding: 2rem 0 3rem;
}
.brand {
  font-family: var(--display);
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 .4rem;
  color: var(--accent);
}
.hero h1 {
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  font-weight: 600;
  margin: 0 0 .75rem;
  max-width: 28ch;
}
.hero p.lead {
  color: var(--muted);
  max-width: 42ch;
  margin: 0 0 1.5rem;
}
.cta-row { display: flex; flex-wrap: wrap; gap: .75rem; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  border: 0;
  border-radius: 999px;
  padding: .7rem 1.25rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 20px rgba(31, 92, 69, .25);
}
.btn-primary:hover { background: #174836; text-decoration: none; }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn-ghost:hover { background: rgba(255,255,255,.5); text-decoration: none; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: .4rem .85rem; font-size: .9rem; }

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 2.5rem;
}
.feature {
  padding: 1rem 1.1rem;
  border-top: 2px solid var(--accent);
}
.feature h3 { margin: 0 0 .35rem; font-size: 1.05rem; }
.feature p { margin: 0; color: var(--muted); font-size: .95rem; }

/* App shell */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: rgba(243, 239, 230, .88);
  border-bottom: 1px solid var(--line);
}
.app-header .inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .75rem 0;
}
.logo {
  font-weight: 700;
  color: var(--accent);
  font-size: 1.15rem;
}
.logo:hover { text-decoration: none; }
.nav {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem .75rem;
  align-items: center;
}
.nav a {
  color: var(--muted);
  font-weight: 500;
  padding: .25rem .15rem;
}
.nav a.active, .nav a:hover { color: var(--accent); text-decoration: none; }

.main { padding: 1.5rem 0 3rem; }
.page-title {
  margin: 0 0 1rem;
  font-size: 1.55rem;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.15rem 1.25rem;
}
.card + .card { margin-top: 1rem; }

.grid-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: .85rem;
  margin-bottom: 1.25rem;
}
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
}
.stat .n {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.1;
}
.stat .l { color: var(--muted); font-size: .9rem; }

.form-grid {
  display: grid;
  gap: .85rem;
}
.form-grid.two {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
label {
  display: block;
  font-size: .9rem;
  font-weight: 600;
  margin-bottom: .3rem;
}
input, select, textarea {
  width: 100%;
  font: inherit;
  padding: .65rem .75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(31, 92, 69, .35);
  border-color: var(--accent);
}
textarea { min-height: 100px; resize: vertical; }

.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: .95rem;
}
th, td {
  text-align: right;
  padding: .65rem .5rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th { color: var(--muted); font-weight: 600; font-size: .85rem; }
.actions { display: flex; flex-wrap: wrap; gap: .4rem; }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .45rem .85rem;
  background: #fff;
  cursor: pointer;
  user-select: none;
}
.chip input { width: auto; margin: 0; }
.chip:has(input:checked) {
  border-color: var(--accent);
  background: #e8f2ed;
  color: var(--accent);
}

.alert {
  padding: .75rem 1rem;
  border-radius: 10px;
  margin-bottom: 1rem;
  display: none;
}
.alert.show { display: block; }
.alert-error { background: #fde8e8; color: var(--danger); border: 1px solid #f0bcbc; }
.alert-ok { background: #e8f2ed; color: var(--ok); border: 1px solid #b7d4c6; }

.auth-box {
  width: min(420px, 92%);
  margin: 3rem auto;
}
.muted { color: var(--muted); }
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.empty {
  text-align: center;
  color: var(--muted);
  padding: 2rem 1rem;
}
.footer-note {
  margin-top: 2rem;
  font-size: .85rem;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 720px) {
  .app-header .inner { flex-direction: column; align-items: flex-start; }
  .nav { width: 100%; }
}
