:root {
  --bg-1: #3a2e04;
  --bg-2: #8a7309;
  --bg-3: #b89b14;
  --glass: rgba(255, 245, 180, 0.15);
  --glass-strong: rgba(255, 245, 180, 0.25);
  --stroke: rgba(255, 235, 150, 0.3);
  --text: #fffdf5;
  --muted: #ffecb3;
  --accent: #ffb300;
  --accent-2: #ffca28;
  --danger: #ff5252;
  --shadow: 0 14px 35px rgba(0, 0, 0, 0.35);
  --shadow-soft: 0 8px 20px rgba(0, 0, 0, 0.25);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: "Cairo", sans-serif;
  background:
    radial-gradient(circle at top right, rgba(255, 213, 79, 0.35), transparent 24%),
    radial-gradient(circle at bottom left, rgba(255, 193, 7, 0.25), transparent 20%),
    linear-gradient(145deg, var(--bg-1), var(--bg-2) 45%, var(--bg-3));
  color: var(--text);
}

body {
  padding: 18px 14px 110px;
}

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

.app-shell {
  width: min(1200px, 100%);
  margin: 0 auto;
}

.glass-card,
.glass-nav,
.modal-box {
  background: linear-gradient(180deg, rgba(255,245,180,0.18), rgba(255,245,180,0.05));
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow), inset 0 2px 6px rgba(255,255,255,0.25), inset 0 -2px 6px rgba(0,0,0,0.2);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.topbar {
  border-radius: var(--radius-xl);
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.topbar h1,
.hero h2,
.section-head h2,
.sub-section h3,
.report-card h3,
.settings-card h2 {
  margin: 0;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.mini-label {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
}

.topbar-icon,
.stat-card i,
.feature-card i {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, rgba(255,245,180,0.25), rgba(255,245,180,0.05));
  box-shadow: inset 0 2px 4px rgba(255,255,255,0.4), 0 8px 18px rgba(0,0,0,0.3);
  font-size: 24px;
}

.content-area {
  display: block;
}

.tab-page {
  display: none;
}

.tab-page.active {
  display: block;
}

.hero {
  border-radius: var(--radius-xl);
  padding: 22px;
  display: grid;
  gap: 20px;
  grid-template-columns: 1.25fr 0.9fr;
  margin-bottom: 18px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.18);
  color: var(--text);
  font-size: 13px;
  margin-bottom: 12px;
  box-shadow: inset 0 1px 2px rgba(255,255,255,0.3), 0 2px 5px rgba(0,0,0,0.2);
}

.hero p,
.feature-card p,
.settings-card p {
  line-height: 1.8;
  color: var(--muted);
}

.hero-stats,
.cards-grid,
.reports-grid {
  display: grid;
  gap: 14px;
}

.hero-stats {
  grid-template-columns: repeat(1, 1fr);
}

.cards-grid {
  grid-template-columns: repeat(3, 1fr);
}

.reports-grid {
  grid-template-columns: repeat(2, 1fr);
}

.soft,
.feature-card,
.report-card,
.settings-card,
.list-wrap,
.contract-form {
  border-radius: var(--radius-lg);
}

.stat-card,
.feature-card,
.report-card,
.settings-card {
  padding: 18px;
}

.stat-card strong {
  display: block;
  font-size: 30px;
  margin-top: 12px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.stat-card span {
  color: var(--muted);
}

.feature-card {
  min-height: 190px;
}

.feature-card i {
  margin-bottom: 12px;
}

.contract-form,
.list-wrap {
  padding: 20px;
}

.section-head,
.records-head,
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.action-inline,
.settings-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.edit-badge {
  background: rgba(255, 196, 0, 0.25);
  color: #ffe8a4;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 196, 0, 0.4);
  font-size: 13px;
  box-shadow: inset 0 1px 2px rgba(255,255,255,0.3);
}

.hidden {
  display: none !important;
}

.sub-section {
  margin-top: 18px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255,255,255,0.15);
  box-shadow: inset 0 2px 5px rgba(0,0,0,0.1);
}

.sub-section h3 {
  margin-bottom: 14px;
}

.form-grid {
  display: grid;
  gap: 14px;
}

.two-col {
  grid-template-columns: repeat(2, 1fr);
}

.three-col {
  grid-template-columns: repeat(3, 1fr);
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-group label {
  font-size: 14px;
  color: var(--muted);
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.field-group input,
.field-group textarea,
.search-box input {
  width: 100%;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(0,0,0,0.15);
  color: var(--text);
  border-radius: 16px;
  padding: 13px 14px;
  outline: none;
  box-shadow: inset 0 2px 5px rgba(0,0,0,0.3), 0 1px 0 rgba(255,255,255,0.1);
}

.field-group input::placeholder,
.field-group textarea::placeholder,
.search-box input::placeholder {
  color: rgba(255,253,245,0.5);
}

.field-group textarea {
  resize: vertical;
}

.full-width {
  width: 100%;
}

.form-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.btn,
.nav-btn,
.icon-btn,
.record-btn {
  border: 0;
  cursor: pointer;
  transition: 0.25s ease;
}

.btn,
.record-btn,
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 16px;
  padding: 13px 16px;
  box-shadow: 0 8px 16px rgba(0,0,0,0.3), inset 0 2px 4px rgba(255,255,255,0.3), inset 0 -2px 4px rgba(0,0,0,0.2);
}

.primary-btn { background: linear-gradient(145deg, #ffca28, #ff8f00); color: #2a2004; font-weight: bold; }
.secondary-btn { background: linear-gradient(145deg, #ffd54f, #ffb300); color: #2a2004; font-weight: bold; }
.dark-btn { background: linear-gradient(145deg, #615008, #3a2e04); color: white; }
.danger-btn { background: linear-gradient(145deg, #ff5252, #d50000); color: white; }

.btn:hover,
.record-btn:hover,
.nav-btn:hover,
.icon-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 20px rgba(0,0,0,0.4), inset 0 2px 4px rgba(255,255,255,0.4), inset 0 -2px 4px rgba(0,0,0,0.2);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: min(100%, 280px);
  padding: 0 14px;
  border-radius: 16px;
  background: rgba(0,0,0,0.15);
  border: 1px solid rgba(255,255,255,0.15);
  box-shadow: inset 0 2px 5px rgba(0,0,0,0.2), 0 1px 0 rgba(255,255,255,0.1);
}

.search-box input {
  background: transparent;
  border: 0;
  padding-inline: 0;
  box-shadow: none;
}

.records-container {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.record-item {
  padding: 18px;
  border-radius: 20px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  box-shadow: var(--shadow-soft), inset 0 2px 5px rgba(255,255,255,0.1);
}

.record-top,
.record-meta,
.record-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.record-top {
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.record-title {
  margin: 0;
  font-size: 19px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.record-meta {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 14px;
}

.record-values {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, 1fr);
}

.value-box {
  padding: 12px;
  border-radius: 16px;
  background: rgba(0,0,0,0.15);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.2), 0 1px 0 rgba(255,255,255,0.1);
}

.value-box span {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 4px;
}

.record-actions {
  margin-top: 14px;
}

.record-btn.edit { background: linear-gradient(145deg, #ffca28, #ff8f00); color: #222; font-weight: bold; }
.record-btn.delete { background: linear-gradient(145deg, #ff5252, #d50000); color: white; }
.record-btn.view { background: linear-gradient(145deg, #8a7309, #615008); color: white; }
.record-btn.print { background: linear-gradient(145deg, #e6b800, #b38f00); color: white; }

.report-list,
.alerts-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.report-list li,
.alert-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(255,255,255,0.15);
}

.report-list li:last-child,
.alert-item:last-child {
  border-bottom: 0;
}

.alert-item p {
  margin: 0;
  color: var(--muted);
}

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

.bottom-nav {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: min(900px, calc(100% - 20px));
  border-radius: 28px;
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  z-index: 20;
}

.nav-btn {
  background: transparent;
  color: var(--muted);
  border-radius: 20px;
  padding: 12px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.nav-btn i {
  font-size: 18px;
}

.nav-btn.active {
  color: #2a2004;
  font-weight: bold;
  background: linear-gradient(145deg, #ffca28, #ff8f00);
  box-shadow: 0 8px 14px rgba(0,0,0,0.3), inset 0 2px 4px rgba(255,255,255,0.4), inset 0 -2px 4px rgba(0,0,0,0.2);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: grid;
  place-items: center;
  padding: 14px;
  z-index: 40;
}

.modal-box {
  width: min(900px, 100%);
  max-height: 90vh;
  overflow: auto;
  border-radius: 28px;
  padding: 20px;
}

.icon-btn {
  width: 44px;
  height: 44px;
  padding: 0;
  background: linear-gradient(145deg, #8a7309, #615008);
  color: white;
}

.preview-content {
  margin-top: 16px;
  line-height: 1.9;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.preview-block {
  padding: 14px;
  border-radius: 18px;
  background: rgba(0,0,0,0.15);
  box-shadow: inset 0 2px 5px rgba(0,0,0,0.1), 0 1px 0 rgba(255,255,255,0.1);
}

.preview-block h4 {
  margin: 0 0 10px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.preview-block p {
  margin: 6px 0;
  color: var(--muted);
}

.preview-full {
  margin-top: 14px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(0,0,0,0.15);
  box-shadow: inset 0 2px 5px rgba(0,0,0,0.1), 0 1px 0 rgba(255,255,255,0.1);
}

@media (max-width: 992px) {
  .hero,
  .cards-grid,
  .reports-grid,
  .three-col,
  .record-values,
  .preview-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 700px) {
  body {
    padding: 12px 10px 98px;
  }

  .hero,
  .cards-grid,
  .reports-grid,
  .two-col,
  .three-col,
  .record-values,
  .preview-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .section-head,
  .records-head,
  .modal-head {
    align-items: stretch;
  }

  .bottom-nav {
    gap: 4px;
    padding: 8px;
  }

  .nav-btn span {
    font-size: 11px;
  }

  .nav-btn i {
    font-size: 17px;
  }
}

.print-only {
  display: none;
}

@media print {
  body {
    background: white !important;
    padding: 0 !important;
    margin: 0 !important;
    color: black !important;
    font-family: "Cairo", sans-serif !important;
  }
  .app-shell, .modal, .bottom-nav {
    display: none !important;
  }
  .print-only {
    display: block !important;
    width: 100%;
    direction: rtl;
    padding: 15px;
    box-sizing: border-box;
  }
  @page {
    size: A4 portrait;
    margin: 1cm;
  }
}
