:root {
  --bg: #faf9f6;
  --card: #ffffff;
  --text: #07111f;
  --muted: #6d7280;
  --line: #e8dfcf;
  --line-strong: #dccfb9;
  --gold: #c99a16;
  --gold-soft: #fff8e8;
  --black: #171717;
  --black-soft: #282828;
  --danger: #b42318;
  --success: #137333;
  --info: #1d4ed8;
  --shadow: 0 20px 42px rgba(31, 25, 13, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  direction: rtl;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: Tahoma, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.8;
  letter-spacing: 0;
  direction: rtl;
  text-align: right;
}

a {
  color: inherit;
}

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

.public-page {
  background:
    linear-gradient(112deg, #fbfaf8 0%, #ffffff 56%, #fbf3df 100%);
}

.site-header {
  min-height: 104px;
  border-top: 1px solid #dedbd5;
  border-bottom: 1px solid #e7decd;
  background: rgba(255, 255, 255, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px 20px;
}

.site-brand {
  width: min(1180px, 100%);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 18px;
  direction: rtl;
  text-align: right;
}

.site-brand h1 {
  margin: 0;
  font-size: clamp(25px, 3vw, 39px);
  font-weight: 800;
  line-height: 1.2;
}

.site-brand img {
  width: 70px;
  height: 70px;
  object-fit: contain;
  flex: 0 0 auto;
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 36px auto 72px;
}

.card,
.admin-card,
.auth-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.intro-card {
  padding: 28px 28px;
}

.eyebrow,
.auth-kicker {
  color: #9b7208;
  font-weight: 800;
  font-size: 13px;
}

.intro-card h2 {
  margin: 4px 0 6px;
  font-size: clamp(28px, 3.2vw, 42px);
  line-height: 1.35;
}

.intro-card p,
.section-heading p,
.confirm-card p,
.admin-card-head p,
.muted {
  color: var(--muted);
  margin: 0;
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 28px;
}

.step {
  min-height: 96px;
  border: 1px solid #f0d99f;
  border-radius: 17px;
  padding: 18px 16px;
  background: #fffdf8;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}

.step.active {
  background: var(--gold-soft);
}

.step strong {
  color: #8a6506;
  font-size: 26px;
  line-height: 1;
}

.step span {
  font-weight: 800;
}

.registration-form {
  margin-top: 24px;
}

.form-section {
  padding: 28px;
  margin-top: 24px;
}

.form-section.compact {
  padding-top: 24px;
  padding-bottom: 24px;
}

.section-heading {
  margin-bottom: 24px;
}

.section-heading span {
  display: block;
  width: 92px;
  height: 4px;
  margin-right: 0;
  margin-left: auto;
  margin-bottom: 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold), #fff2bf);
}

.section-heading h2,
.confirm-card h2,
.admin-card h1 {
  margin: 0 0 8px;
  font-size: 26px;
  line-height: 1.35;
}

.field-grid {
  display: grid;
  gap: 16px;
}

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

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

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

.field span {
  font-weight: 800;
}

.field b {
  color: #d70d00;
}

input,
select,
textarea {
  width: 100%;
  min-height: 49px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line-strong);
  border-radius: 15px;
  outline: none;
  padding: 11px 15px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

textarea {
  min-height: 98px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(201, 154, 22, 0.13);
  background: #ffffff;
}

.field-error input,
.field-error select,
.field-error textarea,
.field-error .file-control {
  border-color: var(--danger);
  box-shadow: 0 0 0 4px rgba(180, 35, 24, 0.1);
}

::placeholder {
  color: #707682;
  opacity: 1;
}

.file-field {
  max-width: 554px;
  margin-right: 0;
  margin-left: auto;
  text-align: right;
}

input[type="file"] {
  padding: 9px;
  border-style: dashed;
  border-color: #efca67;
  background: #fffefd;
}

input[type="file"]::file-selector-button {
  border: 0;
  border-radius: 12px;
  background: var(--black);
  color: #fff;
  padding: 9px 15px;
  margin-left: 12px;
  cursor: pointer;
  font-weight: 800;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.file-control {
  min-height: 58px;
  border: 1px dashed #efca67;
  border-radius: 15px;
  background: #fffefd;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 9px 12px;
  direction: rtl;
  cursor: pointer;
}

.file-button {
  min-height: 38px;
  border-radius: 12px;
  background: var(--black);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 15px;
  font-weight: 800;
  white-space: nowrap;
}

.file-label {
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-input:focus + .file-control {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(201, 154, 22, 0.13);
}

.field small {
  color: var(--muted);
  line-height: 1.5;
  text-align: right;
}

.file-name {
  display: block;
  margin-top: -8px;
  color: #8a6506;
  font-weight: 700;
}

.file-name.is-error {
  color: var(--danger);
}

.file-label.is-error {
  color: var(--danger);
  font-weight: 800;
}

.confirm-card {
  margin-top: 18px;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 1fr 160px;
  gap: 20px;
  align-items: center;
}

.form-actions {
  display: grid;
  gap: 8px;
}

.btn {
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  cursor: pointer;
  text-decoration: none;
  font-weight: 800;
  white-space: nowrap;
}

.btn-primary {
  background: var(--black);
  color: #ffffff;
}

.btn-primary:hover {
  background: #050505;
}

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

.alert {
  width: min(1180px, 100%);
  margin: 0 auto 14px;
  border-radius: 15px;
  padding: 12px 16px;
  border: 1px solid transparent;
  background: #fff;
  font-weight: 700;
}

.alert a {
  color: #8a6506;
  font-weight: 900;
}

.alert-success {
  color: #0a5c2b;
  background: #ecfdf3;
  border-color: #b7e3c2;
}

.alert-error {
  color: #9f1d16;
  background: #fff1f0;
  border-color: #fac5c1;
}

.alert-warning {
  color: #7a5600;
  background: #fff7df;
  border-color: #eed084;
}

.auth-page,
.install-page {
  min-height: 100vh;
  background: linear-gradient(112deg, #fbfaf8 0%, #ffffff 58%, #fbf3df 100%);
}

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 16px;
}

.auth-card {
  width: min(560px, 100%);
  padding: 34px;
  text-align: center;
}

.auth-card h1 {
  margin: 4px 0 22px;
  font-size: clamp(30px, 4vw, 42px);
  line-height: 1.25;
}

.login-form {
  text-align: right;
}

.login-form .btn {
  width: 100%;
  font-size: 18px;
}

.login-form input {
  background: #e9f1ff;
}

.install-card {
  text-align: right;
}

.install-card h1 {
  text-align: right;
}

.install-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.setup-note {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
  display: grid;
  gap: 4px;
  color: var(--muted);
}

.admin-page {
  min-height: 100vh;
  background: #f8f7f4;
}

.admin-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: 280px;
  height: 100vh;
  background: var(--black);
  color: #ffffff;
  padding: 22px;
  z-index: 10;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.sidebar-brand img {
  width: 66px;
  height: 66px;
  object-fit: contain;
  flex: 0 0 auto;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(8, 8, 8, 0.48);
}

.modal-backdrop.is-open {
  display: flex;
}

.success-modal {
  position: relative;
  width: min(460px, 100%);
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #ffffff;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.18);
  padding: 28px;
  text-align: center;
}

.success-modal img {
  width: 74px;
  height: 74px;
  object-fit: contain;
  margin-bottom: 10px;
}

.success-modal h2 {
  margin: 10px 0 6px;
  font-size: 26px;
  line-height: 1.35;
}

.success-modal p {
  margin: 0;
  color: var(--muted);
}

.success-modal strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 12px 0 20px;
  border: 1px solid #f0d99f;
  border-radius: 14px;
  background: var(--gold-soft);
  color: #8a6506;
  padding: 7px 14px;
  font-size: 18px;
}

.success-modal .btn {
  width: min(180px, 100%);
}

.success-mark {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  margin: 0 auto;
  display: grid;
  place-items: center;
  background: #eaf8ef;
  color: var(--success);
  font-size: 30px;
  font-weight: 900;
}

.modal-close {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.sidebar-brand strong {
  color: var(--gold);
  display: block;
  line-height: 1;
}

.sidebar-brand span {
  display: block;
  font-size: 25px;
  font-weight: 900;
  line-height: 1.3;
}

.sidebar-nav {
  display: grid;
  gap: 10px;
}

.sidebar-nav a {
  min-height: 48px;
  border-radius: 14px;
  background: var(--black-soft);
  color: #ffffff;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 17px;
}

.sidebar-nav a.active {
  background: #343434;
}

.admin-main {
  margin-right: 280px;
  padding: 26px 24px 64px;
}

.stats-grid,
.admin-card {
  width: min(1180px, 100%);
  margin-right: auto;
  margin-left: auto;
}

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

.stat-card {
  min-height: 102px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 18px;
  display: grid;
  align-content: center;
  gap: 6px;
}

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

.stat-card strong {
  font-size: 32px;
  line-height: 1;
}

.admin-card {
  padding: 28px;
  margin-bottom: 24px;
}

.admin-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 26px;
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

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

.data-table th {
  background: #fafafa;
  color: #5f6572;
  font-size: 14px;
}

.empty-row {
  text-align: center;
  color: var(--muted);
}

.table-link {
  color: #8a6506;
  font-weight: 900;
  text-decoration: none;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.status-badge.info {
  color: #1d4ed8;
  background: #e9f1ff;
}

.status-badge.warning {
  color: #8a6506;
  background: #fff3cf;
}

.status-badge.success {
  color: #137333;
  background: #eaf8ef;
}

.status-badge.danger {
  color: #b42318;
  background: #fff0ef;
}

.status-badge.muted {
  color: #59606d;
  background: #f0f2f5;
}

.filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 220px 120px;
  gap: 10px;
  margin-bottom: 18px;
}

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

.details-grid article {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  background: #fffdf9;
}

.details-grid h2 {
  margin: 0 0 12px;
  font-size: 21px;
}

dl {
  margin: 0;
  display: grid;
  gap: 10px;
}

dt {
  color: var(--muted);
  font-weight: 800;
}

dd {
  margin: -8px 0 0;
  font-weight: 700;
}

.attachment-link {
  display: block;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  margin-top: 8px;
  text-decoration: none;
  font-weight: 800;
  color: #8a6506;
  background: #fff;
}

.status-form {
  display: grid;
  grid-template-columns: 260px minmax(260px, 1fr) 150px;
  gap: 12px;
  align-items: end;
}

.status-form .field {
  margin-bottom: 0;
}

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

  .stats-grid .stat-card:first-child {
    grid-column: span 2;
  }
}

@media (max-width: 860px) {
  .site-header {
    min-height: auto;
  }

  .site-brand {
    flex-direction: column;
    text-align: center;
    justify-content: center;
    gap: 8px;
  }

  .steps,
  .field-grid.two,
  .field-grid.three,
  .details-grid,
  .confirm-card,
  .filters,
  .status-form {
    grid-template-columns: 1fr;
  }

  .file-field {
    max-width: none;
  }

  .admin-sidebar {
    position: static;
    width: 100%;
    height: auto;
  }

  .admin-main {
    margin-right: 0;
    padding: 18px 14px 42px;
  }

  .sidebar-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .sidebar-nav a {
    font-size: 14px;
    min-height: 44px;
  }

  .admin-card-head {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 14px;
  }

  .page-shell {
    width: min(100% - 20px, 1180px);
    margin-top: 18px;
  }

  .intro-card,
  .form-section,
  .admin-card,
  .auth-card {
    border-radius: 18px;
    padding: 20px;
  }

  .intro-card h2,
  .auth-card h1 {
    font-size: 28px;
  }

  .section-heading h2,
  .confirm-card h2,
  .admin-card h1 {
    font-size: 22px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid .stat-card:first-child {
    grid-column: auto;
  }

  .install-actions {
    display: grid;
  }
}
