:root {
  --bg: #f3f6f8;
  --surface: #ffffff;
  --surface-alt: #eef2f5;
  --text: #1f2937;
  --muted: #667085;
  --line: #e5e7eb;
  --primary: #4f8cff;
  --primary-strong: #356fe3;
  --success: #7cc9a6;
  --warning: #f4b183;
  --danger: #ee8f8f;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: radial-gradient(circle at 10% 0%, #ffffff 0%, var(--bg) 55%);
  color: var(--text);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

a { color: inherit; text-decoration: none; }

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.sidebar {
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border-inline-end: 1px solid var(--line);
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.brand h1 { margin: 0; font-size: 1.4rem; }
.brand p { margin: 0.35rem 0 0; color: var(--muted); font-size: 0.9rem; }

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.sidebar nav a {
  padding: 0.6rem 0.7rem;
  border-radius: 10px;
  transition: background-color 0.2s ease;
}

.sidebar nav a:hover { background-color: var(--surface-alt); }

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding-top: 0.8rem;
}

.sidebar-footer span,
.sidebar-footer small {
  display: block;
}

.sidebar-footer small { color: var(--muted); }

.content { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
}

.topbar .locale-switcher,
.topbar .topbar-actions {
  display: flex;
  gap: 0.5rem;
}

.page {
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.hero {
  background: linear-gradient(145deg, #ffffff 0%, #edf3ff 100%);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.25rem;
}

.hero h2 {
  margin: 0;
  font-size: 1.5rem;
}

.hero p { color: var(--muted); max-width: 760px; }

.hero-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }

.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.card h3,
.card h2,
.page h2 {
  margin: 0;
}

.meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.9rem;
}

.metric {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--primary-strong);
}

.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.55rem 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.btn:hover { transform: translateY(-1px); }

.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-strong); }

.btn.ghost {
  border-color: var(--line);
  background: #fff;
}

.btn.danger { background: var(--danger); color: #fff; }

.alert {
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  border: 1px solid;
}

.alert.success {
  border-color: #a6d9c2;
  background: #edf9f3;
}

.alert.danger {
  border-color: #efb4b4;
  background: #fff4f4;
}

.form-grid,
.form-card {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-weight: 600;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.6rem 0.7rem;
  background: #fff;
  font: inherit;
}

.checkbox {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

.checkbox input {
  width: 18px;
  height: 18px;
}

.auth-wrap {
  max-width: 500px;
  width: 100%;
}

.auth-links {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.actions-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.pagination-wrap nav {
  display: flex;
  justify-content: center;
}

.mobile-only { display: none; }

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    z-index: 30;
    width: 270px;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
  }

  [dir="rtl"] .sidebar {
    transform: translateX(105%);
  }

  .sidebar.show { transform: translateX(0); }

  .mobile-only { display: inline-flex; }

  .topbar {
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 10;
  }
}
