@import url("https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;600;700;800&display=swap");

:root {
  --ink: #142421;
  --muted: #6e7b78;
  --canvas: #f4f1e9;
  --paper: #fffdf8;
  --line: #e4e0d6;
  --brand: #173f3a;
  --brand-2: #1e5b52;
  --accent: #d8a446;
  --accent-soft: #f5e8ca;
  --success: #22755d;
  --danger: #b84d45;
  --warning: #9b6b1d;
  --sidebar-width: 258px;
  --shadow: 0 18px 55px rgba(25, 45, 40, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  font-family: "Tajawal", system-ui, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

body {
  margin: 0;
  min-height: 100vh;
}

button,
input,
select,
textarea {
  font: inherit;
}

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

.app-shell {
  background:
    radial-gradient(circle at 75% -20%, rgba(216, 164, 70, 0.13), transparent 35%),
    var(--canvas);
}

.sidebar {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 30;
  width: var(--sidebar-width);
  min-height: 100vh;
  padding: 28px 18px 20px;
  display: flex;
  flex-direction: column;
  color: #f9f7ef;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.035), transparent 45%),
    var(--brand);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 10px 28px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: var(--brand);
  background: var(--accent);
  font-size: 22px;
  font-weight: 800;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.18);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 19px;
}

.brand small {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.62);
}

.main-nav {
  padding-top: 24px;
  display: grid;
  gap: 7px;
}

.main-nav a {
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 46px;
  padding: 0 14px;
  border-radius: 13px;
  color: rgba(255, 255, 255, 0.7);
  transition: 0.2s ease;
}

.main-nav a:hover,
.main-nav a.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  transform: translateX(-3px);
}

.main-nav a.active {
  box-shadow: inset -3px 0 var(--accent);
}

.nav-icon {
  width: 25px;
  text-align: center;
  font-size: 20px;
  color: var(--accent);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--brand);
  background: var(--accent-soft);
  font-weight: 800;
}

.user-card strong,
.user-card small {
  display: block;
}

.user-card small {
  color: rgba(255, 255, 255, 0.55);
  font-size: 12px;
}

.link-button {
  width: 100%;
  padding: 9px;
  border: 0;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.65);
  background: transparent;
  cursor: pointer;
  text-align: right;
}

.link-button:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.main-content {
  min-height: 100vh;
  margin-right: var(--sidebar-width);
}

.topbar {
  min-height: 108px;
  padding: 25px clamp(22px, 4vw, 55px);
  display: flex;
  align-items: center;
  gap: 18px;
  border-bottom: 1px solid rgba(23, 63, 58, 0.08);
  background: rgba(244, 241, 233, 0.86);
  backdrop-filter: blur(18px);
}

.topbar h1 {
  margin: 2px 0 0;
  font-size: clamp(24px, 3vw, 32px);
  line-height: 1.2;
}

.eyebrow {
  color: var(--muted);
  font-size: 13px;
}

.topbar-actions {
  margin-right: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.today {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.menu-button {
  display: none;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 12px;
  background: var(--paper);
  box-shadow: var(--shadow);
  cursor: pointer;
}

.page-content {
  padding: 30px clamp(22px, 4vw, 55px) 55px;
}

.button {
  min-height: 42px;
  padding: 10px 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s ease;
}

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

.button-primary {
  color: #fff;
  background: var(--brand);
  box-shadow: 0 9px 22px rgba(23, 63, 58, 0.18);
}

.button-secondary {
  color: var(--brand);
  border-color: var(--line);
  background: var(--paper);
}

.button-danger {
  color: var(--danger);
  border-color: rgba(184, 77, 69, 0.2);
  background: #fff8f6;
}

.button-small {
  min-height: 34px;
  padding: 6px 11px;
  border-radius: 9px;
  font-size: 13px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  position: relative;
  min-height: 144px;
  padding: 22px;
  overflow: hidden;
  border: 1px solid rgba(23, 63, 58, 0.08);
  border-radius: 22px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.stat-card::after {
  content: "";
  position: absolute;
  width: 70px;
  height: 70px;
  left: -20px;
  top: -20px;
  border-radius: 50%;
  background: var(--accent-soft);
  opacity: 0.75;
}

.stat-card.featured {
  color: #fff;
  background: var(--brand);
}

.stat-card.featured::after {
  background: rgba(216, 164, 70, 0.22);
}

.stat-label {
  color: var(--muted);
  font-size: 14px;
}

.featured .stat-label {
  color: rgba(255, 255, 255, 0.62);
}

.stat-value {
  display: block;
  margin-top: 15px;
  font-size: clamp(23px, 3vw, 31px);
  line-height: 1;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.stat-meta {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.featured .stat-meta {
  color: rgba(255, 255, 255, 0.55);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(290px, 0.8fr);
  gap: 18px;
}

.panel {
  border: 1px solid rgba(23, 63, 58, 0.08);
  border-radius: 22px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.panel-header {
  padding: 20px 22px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  border-bottom: 1px solid var(--line);
}

.panel-header h2,
.panel-header h3 {
  margin: 0;
  font-size: 18px;
}

.panel-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.panel-body {
  padding: 22px;
}

.chart-bars {
  min-height: 235px;
  display: flex;
  align-items: end;
  gap: 12px;
}

.chart-column {
  min-width: 0;
  flex: 1;
  text-align: center;
}

.chart-track {
  height: 180px;
  display: flex;
  align-items: end;
  border-radius: 10px;
  background: linear-gradient(to top, rgba(23, 63, 58, 0.05), transparent);
}

.chart-bar {
  width: 100%;
  min-height: 3px;
  border-radius: 10px 10px 4px 4px;
  background: linear-gradient(180deg, var(--accent), #b87f25);
  box-shadow: 0 9px 20px rgba(216, 164, 70, 0.2);
}

.chart-column strong {
  display: block;
  margin-top: 8px;
  font-size: 12px;
}

.chart-column span {
  color: var(--muted);
  font-size: 11px;
}

.attention-list,
.clean-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.attention-list li {
  display: flex;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.attention-list li:last-child {
  border-bottom: 0;
}

.attention-dot {
  width: 10px;
  height: 10px;
  margin-top: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 0 5px rgba(184, 77, 69, 0.1);
}

.attention-list strong,
.attention-list span {
  display: block;
}

.attention-list span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.table-toolbar {
  margin-bottom: 17px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.search-input,
.select-input {
  min-height: 42px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--ink);
  background: var(--paper);
  outline: none;
}

.search-input {
  min-width: min(320px, 60vw);
}

.search-input:focus,
.select-input:focus,
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(216, 164, 70, 0.13);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

.data-table th,
.data-table td {
  padding: 15px 16px;
  text-align: right;
  border-bottom: 1px solid var(--line);
}

.data-table th {
  color: var(--muted);
  background: #faf8f2;
  font-size: 13px;
  font-weight: 700;
}

.data-table tbody tr:hover {
  background: #fbfaf6;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.entity-name {
  display: block;
  font-weight: 700;
}

.entity-subtitle {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.badge {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--brand);
  background: #e8f0ee;
  font-size: 12px;
  font-weight: 700;
}

.badge-completed {
  color: var(--success);
  background: #e7f4ef;
}

.badge-paused,
.badge-planned {
  color: var(--warning);
  background: #fbefd7;
}

.badge-cancelled {
  color: var(--danger);
  background: #fae8e5;
}

.progress {
  width: 100%;
  min-width: 110px;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9e5db;
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--success);
}

.actions {
  display: flex;
  gap: 7px;
}

.form-panel {
  max-width: 1020px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.field {
  display: grid;
  gap: 7px;
}

.field-full {
  grid-column: 1 / -1;
}

.field label {
  font-size: 14px;
  font-weight: 700;
}

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

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

.field textarea {
  min-height: 105px;
  resize: vertical;
}

.form-section {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.form-section:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: 0;
}

.form-section h3 {
  margin: 0 0 16px;
}

.conversion-preview {
  min-height: 82px;
  padding: 16px;
  border: 1px dashed rgba(23, 63, 58, 0.25);
  border-radius: 14px;
  background: #f4f7f5;
}

.conversion-preview span,
.conversion-preview strong {
  display: block;
}

.conversion-preview span {
  color: var(--muted);
  font-size: 13px;
}

.conversion-preview strong {
  margin-top: 6px;
  color: var(--brand);
  font-size: 24px;
}

.form-actions {
  margin-top: 24px;
  display: flex;
  gap: 10px;
}

.alert {
  margin-bottom: 16px;
  padding: 13px 16px;
  border-radius: 12px;
  font-weight: 600;
}

.alert-success {
  color: #155b46;
  border: 1px solid #cbe7dc;
  background: #e9f6f1;
}

.alert-error {
  color: #913a34;
  border: 1px solid #f0cfcb;
  background: #fff0ee;
}

.empty-state {
  padding: 42px 20px;
  color: var(--muted);
  text-align: center;
}

.auth-shell {
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(115deg, rgba(23, 63, 58, 0.96), rgba(23, 63, 58, 0.82)),
    radial-gradient(circle at 20% 20%, var(--accent), transparent 45%);
}

.auth-main {
  width: min(1040px, 100%);
}

.auth-card {
  min-height: 610px;
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  overflow: hidden;
  border-radius: 30px;
  background: var(--paper);
  box-shadow: 0 35px 95px rgba(0, 0, 0, 0.24);
}

.auth-intro {
  padding: 50px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #fff;
  background:
    radial-gradient(circle at 20% 10%, rgba(216, 164, 70, 0.32), transparent 34%),
    var(--brand);
}

.auth-intro h1 {
  margin: 28px 0 12px;
  font-size: 42px;
  line-height: 1.15;
}

.auth-intro p {
  max-width: 390px;
  color: rgba(255, 255, 255, 0.68);
  line-height: 1.8;
}

.auth-points {
  display: grid;
  gap: 10px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 14px;
}

.auth-form-wrap {
  padding: 55px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-form-wrap h2 {
  margin: 0 0 8px;
  font-size: 30px;
}

.auth-form-wrap > p {
  margin: 0 0 28px;
  color: var(--muted);
}

.auth-form {
  display: grid;
  gap: 17px;
}

.auth-form .button {
  width: 100%;
  margin-top: 6px;
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.summary-list {
  display: grid;
  gap: 12px;
}

.summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.summary-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.summary-row span {
  color: var(--muted);
}

.sidebar-backdrop {
  display: none;
}

@media (max-width: 1100px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid,
  .report-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .sidebar {
    transform: translateX(105%);
    transition: transform 0.24s ease;
  }

  .sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 20;
    background: rgba(8, 20, 18, 0.48);
  }

  .sidebar-open .sidebar-backdrop {
    display: block;
  }

  .main-content {
    margin-right: 0;
  }

  .menu-button {
    display: grid;
    place-items: center;
  }

  .today {
    display: none;
  }

  .topbar {
    min-height: 92px;
  }

  .topbar-actions .button {
    padding-inline: 12px;
  }

  .auth-card {
    grid-template-columns: 1fr;
  }

  .auth-intro {
    min-height: 260px;
    padding: 35px;
  }

  .auth-intro h1 {
    font-size: 31px;
  }

  .auth-points {
    display: none;
  }

  .auth-form-wrap {
    padding: 35px;
  }
}

@media (max-width: 590px) {
  .stats-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .field-full {
    grid-column: auto;
  }

  .page-content {
    padding-inline: 15px;
  }

  .topbar {
    padding-inline: 15px;
  }

  .eyebrow {
    display: none;
  }

  .topbar h1 {
    font-size: 22px;
  }

  .topbar-actions .button {
    width: 42px;
    overflow: hidden;
    white-space: nowrap;
    color: transparent;
  }

  .topbar-actions .button::first-letter {
    color: #fff;
  }

  .table-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .search-input {
    min-width: 100%;
  }
}
