@font-face {
  font-family: ArabicUI;
  src: local("Tahoma");
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: #f5f7f4;
  color: #223a32;
  font:
    15px/1.7 ArabicUI,
    Tahoma,
    Arial,
    sans-serif;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select,
textarea {
  outline-offset: 4px;
}
a {
  color: #17674f;
  text-decoration: none;
}
button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid #d9e3dc;
  border-radius: 9px;
  padding: 9px 17px;
  background: white;
  color: #294b3f;
  cursor: pointer;
  font-weight: 600;
}
button:hover,
.button:hover {
  background: #edf4ee;
}
button:disabled {
  opacity: 0.55;
  cursor: wait;
}
.primary {
  background: #1a604c;
  color: white;
  border-color: #1a604c;
}
.primary:hover {
  background: #124b3b;
}
.danger {
  color: #a13936;
  border-color: #e5c8c4;
}
.muted {
  color: #75837b;
  font-size: 13px;
}
.shell {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  background: #123e33;
  color: #d5e9df;
  padding: 35px 23px;
  display: flex;
  flex-direction: column;
  gap: 25px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  font-size: 33px;
  color: white;
  font-weight: bold;
  letter-spacing: -1px;
}
.brand small {
  font-size: 11px;
  display: block;
  font-weight: normal;
  letter-spacing: 1px;
  color: #a8c8b7;
}
.brand-icon {
  border: 1px solid #6d9e87;
  border-radius: 12px;
  padding: 0 10px;
  margin-left: 8px;
  font-size: 25px;
}
.nav {
  display: grid;
  gap: 7px;
}
.nav a {
  color: #c4dacf;
  border-radius: 9px;
  padding: 10px 14px;
}
.nav a:hover,
.nav a.active {
  background: #2b594a;
  color: white;
}
.sidebar-foot {
  margin-top: auto;
  border-top: 1px solid #406456;
  padding-top: 20px;
  font-size: 12px;
}
.user-avatar {
  background: #dae9df;
  color: #244e3c;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: bold;
}
.workspace {
  min-width: 0;
}
.topbar {
  height: 78px;
  background: #fff;
  border-bottom: 1px solid #e4e9e3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 42px;
  gap: 14px;
}
.profile {
  display: flex;
  gap: 10px;
  align-items: center;
}
.content {
  max-width: 1450px;
  margin: auto;
  padding: 35px 42px 65px;
}
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}
.eyebrow {
  font-size: 12px;
  color: #6f8375;
  letter-spacing: 1px;
}
h1 {
  font-size: 28px;
  line-height: 1.5;
  margin: 4px 0 7px;
}
h2 {
  font-size: 19px;
  margin: 0 0 15px;
}
h3 {
  font-size: 16px;
  margin: 0 0 10px;
}
p {
  margin: 6px 0 12px;
}
.card {
  background: white;
  border: 1px solid #e0e7df;
  border-radius: 13px;
  padding: 23px;
  margin-bottom: 20px;
  box-shadow: 0 3px 12px #163c2103;
}
.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 17px;
  margin: 23px 0;
}
.stat {
  padding: 23px;
  border: 1px solid #dfe6dc;
  background: white;
  border-radius: 12px;
}
.stat .num {
  font-size: 34px;
  line-height: 1.5;
  font-weight: 700;
  color: #255b43;
}
.stat .unit {
  font-size: 13px;
  font-weight: normal;
}
.accent {
  background: #eaf2e9;
  border-color: #cadbc9;
}
.attention {
  border-right: 4px solid #b58b40;
  background: #faf8f0;
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 17px;
}
.section-head h2 {
  margin: 0;
}
.tag {
  display: inline-block;
  font-size: 12px;
  padding: 3px 11px;
  border-radius: 6px;
  background: #f0f2ee;
  white-space: nowrap;
  color: #5a6b61;
}
.tag.complete {
  background: #e4f2e9;
  color: #246440;
}
.tag.incomplete {
  background: #fff0d3;
  color: #906715;
}
.tag.draft {
  background: #edf0f4;
  color: #607084;
}
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.wide {
  grid-column: 1/-1;
}
label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}
input,
select,
textarea {
  background: #fff;
  border: 1px solid #d4dfd4;
  border-radius: 8px;
  padding: 10px 12px;
  width: 100%;
  color: #283c31;
  min-height: 44px;
}
input:focus,
select:focus,
textarea:focus {
  border-color: #4d8a69;
  outline: 2px solid #dcece1;
}
textarea {
  resize: vertical;
  min-height: 95px;
}
input[type="checkbox"] {
  width: 18px;
  min-height: auto;
  accent-color: #236345;
}
input[type="file"] {
  font-size: 13px;
}
input[type="number"],
input[type="date"],
input[type="email"],
.ltr {
  direction: ltr;
  unicode-bidi: isolate;
}
.actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.quick-search {
  display: flex;
  gap: 10px;
}
.quick-search input {
  max-width: 580px;
}
.table-wrap {
  overflow: auto;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14px;
}
th {
  color: #718075;
  font-size: 12px;
  background: #f7f9f5;
  font-weight: normal;
}
th,
td {
  text-align: right;
  padding: 13px 11px;
  border-bottom: 1px solid #e9ede6;
  vertical-align: middle;
}
td b {
  font-weight: 600;
}
tbody tr:hover {
  background: #fafcf8;
}
.mini {
  width: 38px;
  height: 45px;
  object-fit: cover;
  border: 1px solid #dee6dd;
  border-radius: 5px;
  vertical-align: middle;
}
.doc-icon {
  display: inline-grid;
  place-items: center;
  background: #edf2ec;
  border: 1px solid #d6e3d4;
  border-radius: 7px;
  width: 38px;
  height: 45px;
  color: #669175;
  font-size: 10px;
}
.empty {
  text-align: center;
  padding: 45px 20px;
  color: #6c7c6f;
}
.empty strong {
  display: block;
  font-size: 19px;
  color: #42604b;
  margin: 8px;
}
.empty-symbol {
  font-size: 40px;
  color: #8ca893;
}
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 19px;
}
.editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 1fr);
  gap: 22px;
  align-items: start;
}
.savebar {
  position: sticky;
  bottom: 0;
  z-index: 4;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: #fff;
  border: 1px solid #d7e2d6;
  padding: 14px 19px;
  border-radius: 12px;
  box-shadow: 0 -4px 20px #183b2310;
}
.save-state {
  font-size: 13px;
  color: #6b7b6b;
}
.save-state.error {
  color: #ae3737;
}
.save-state.ok {
  color: #277647;
}
.missing {
  background: #fff8e8;
  color: #8b671d;
  border: 1px solid #edddb7;
  border-radius: 8px;
  padding: 13px 17px;
  margin-bottom: 17px;
}
.upload-box {
  border: 2px dashed #c5d6c7;
  border-radius: 11px;
  background: #f6faf4;
  padding: 24px;
  text-align: center;
}
.attachments {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
  margin-top: 17px;
}
.attachment {
  border: 1px solid #dee5dc;
  border-radius: 10px;
  padding: 11px;
  overflow: hidden;
}
.attachment img,
.attachment iframe {
  width: 100%;
  height: 190px;
  object-fit: contain;
  border: 0;
  background: #f5f6f2;
}
.attachment .filename {
  direction: ltr;
  text-align: right;
  overflow-wrap: anywhere;
  font-size: 12px;
  margin: 8px 0;
}
.attachment .actions {
  gap: 5px;
}
.attachment button,
.attachment .button {
  padding: 4px 8px;
  font-size: 12px;
}
.kv {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 11px;
  border-bottom: 1px solid #edf0e9;
  padding: 10px 0;
}
.kv dt {
  color: #718070;
}
.kv dd {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.audit {
  border-right: 2px solid #d9e5d8;
  padding: 0 17px;
  margin: 17px 0;
  font-size: 13px;
}
.audit summary {
  cursor: pointer;
}
.auth {
  max-width: 465px;
  margin: 8vh auto;
  padding: 0 20px;
}
.auth-brand {
  text-align: center;
  font-size: 39px;
  font-weight: bold;
  color: #1b5d47;
  margin-bottom: 25px;
}
.auth .card {
  padding: 32px;
}
.auth label {
  margin-top: 15px;
}
.auth button {
  width: 100%;
  margin-top: 24px;
}
.errorbox {
  background: #ffeded;
  color: #a33030;
  padding: 12px;
  border-radius: 8px;
  margin: 12px 0;
}
.successbox {
  background: #e8f5eb;
  color: #246439;
  padding: 12px;
  border-radius: 8px;
}
.loading {
  text-align: center;
  padding: 15vh 30px;
  color: #66826c;
}
.row-name {
  min-width: 150px;
}
.row-name small {
  display: block;
  color: #7f897d;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
dialog {
  border: 1px solid #cedacf;
  border-radius: 14px;
  padding: 27px;
  width: min(500px, 95vw);
  color: #254431;
}
dialog::backdrop {
  background: #12392e60;
}
#toast {
  position: fixed;
  bottom: 24px;
  left: 25px;
  background: #244e3d;
  color: #fff;
  max-width: 440px;
  border-radius: 10px;
  z-index: 20;
  padding: 0;
  box-shadow: 0 8px 35px #12352625;
}
#toast:not(:empty) {
  padding: 15px 22px;
}
progress {
  width: 100%;
  accent-color: #216a4d;
}
.check-label {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}
.print-page {
  max-width: 1000px;
  margin: 25px auto;
  background: white;
  padding: 30px;
}
.print-heading {
  border-bottom: 2px solid #285d46;
  padding-bottom: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.print-image {
  width: 100%;
  height: auto;
  max-height: 250mm;
  object-fit: contain;
  display: block;
  margin: 20px auto;
}
.print-attachment {
  break-before: page;
}
.print-options {
  margin: 20px auto;
  max-width: 1000px;
}
.notes {
  white-space: pre-wrap;
}
.mobile-only {
  display: none;
}
@media (max-width: 1100px) {
  .shell {
    grid-template-columns: 190px minmax(0, 1fr);
  }
  .sidebar {
    padding: 25px 15px;
  }
  .content {
    padding: 26px;
  }
  .topbar {
    padding: 0 26px;
  }
  .editor-layout {
    grid-template-columns: 1fr;
  }
  .filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 700px) {
  body {
    font-size: 14px;
  }
  .shell {
    display: block;
  }
  .sidebar {
    height: auto;
    position: static;
    padding: 15px 18px;
    gap: 12px;
  }
  .brand {
    font-size: 25px;
  }
  .brand small,
  .sidebar-foot {
    display: none;
  }
  .nav {
    display: flex;
    overflow: auto;
    gap: 3px;
  }
  .nav a {
    white-space: nowrap;
    font-size: 12px;
    padding: 7px 10px;
  }
  .topbar {
    height: 61px;
    padding: 0 18px;
  }
  .content {
    padding: 22px 16px 40px;
  }
  h1 {
    font-size: 23px;
  }
  .page-head {
    align-items: flex-start;
    gap: 12px;
  }
  .stats {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .stat {
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .stat .num {
    font-size: 26px;
  }
  .card {
    padding: 17px;
  }
  .grid,
  .filters {
    grid-template-columns: 1fr 1fr;
  }
  .invoice-table thead {
    display: none;
  }
  .invoice-table tr {
    display: grid;
    grid-template-columns: 35px 1fr 1fr;
    padding: 12px 0;
    border-bottom: 1px solid #dfe6da;
  }
  .invoice-table td {
    border: 0;
    padding: 6px;
  }
  .invoice-table td:first-child {
    grid-row: 1/4;
  }
  .invoice-table .row-name {
    grid-column: 2/4;
  }
  .invoice-table td[data-label]:before {
    content: attr(data-label);
    display: block;
    color: #82917f;
    font-size: 11px;
  }
  .invoice-table td.thumb-cell {
    display: none;
  }
  .page-head .primary {
    padding: 8px 12px;
    font-size: 13px;
  }
  .section-head {
    align-items: flex-start;
  }
  .kv {
    grid-template-columns: 105px 1fr;
  }
  .attachments {
    grid-template-columns: 1fr 1fr;
  }
  .attachment img,
  .attachment iframe {
    height: 140px;
  }
  .print-page {
    margin: 0;
    padding: 15px;
  }
  .savebar {
    padding: 12px;
  }
  .savebar .actions {
    gap: 6px;
  }
  .savebar button {
    padding: 8px 10px;
  }
  .quick-search {
    flex-wrap: wrap;
  }
  .pagination {
    font-size: 12px;
  }
}
@page {
  size: A4;
  margin: 15mm;
}
@media print {
  body {
    background: white;
    color: black;
    font-size: 11pt;
  }
  .no-print,
  .sidebar,
  .topbar,
  #toast,
  dialog,
  .print-options {
    display: none !important;
  }
  .print-page {
    max-width: none;
    padding: 0;
    margin: 0;
  }
  .print-page table {
    font-size: 9pt;
    table-layout: fixed;
  }
  .print-page th,
  .print-page td {
    padding: 7px 5px;
    overflow-wrap: anywhere;
  }
  thead {
    display: table-header-group;
  }
  tr,
  .kv {
    break-inside: avoid;
  }
  .print-heading {
    margin-bottom: 20px;
  }
  .print-image {
    max-height: 245mm;
  }
  .hide-print {
    display: none !important;
  }
  a {
    color: black;
  }
  .tag {
    border: 1px solid #aaa;
  }
  h1,
  h2,
  h3 {
    break-after: avoid;
  }
  .notes {
    overflow-wrap: anywhere;
  }
  footer {
    margin-top: 20px;
  }
}

.original .print-attachment:first-child {
  break-before: auto;
}
@media (max-width: 700px) {
  .nav {
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar {
    display: none;
  }
}
