@font-face {
  font-family: "Vazirmatn";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("./assets/fonts/Vazirmatn-Regular.woff2") format("woff2");
}

@font-face {
  font-family: "Vazirmatn";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("./assets/fonts/Vazirmatn-Bold.woff2") format("woff2");
}

:root {
  color-scheme: light;
  --background: #eef2f1;
  --surface: #ffffff;
  --surface-muted: #f6f8f8;
  --surface-strong: #e7edec;
  --foreground: #16211f;
  --muted: #667470;
  --border: #d6dfdd;
  --border-strong: #b9c8c5;
  --primary: #0f766e;
  --primary-hover: #0b625c;
  --primary-soft: #e0f2ef;
  --accent: #db6644;
  --accent-soft: #fff0eb;
  --danger: #b83d45;
  --danger-soft: #fbeaec;
  --success: #18794e;
  --success-soft: #e4f4eb;
  --warning: #946410;
  --warning-soft: #fff7dd;
  --shadow: 0 22px 56px rgb(25 45 42 / 13%);
  --font: Vazirmatn, IRANSansX, "Segoe UI Variable Text", "Segoe UI", Tahoma, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  min-width: 320px;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font);
  font-size: 14px;
  letter-spacing: 0;
}

body.modal-open {
  overflow: hidden;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

svg {
  display: block;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

[hidden] {
  display: none !important;
}

.icon-sprite {
  position: fixed;
  width: 0;
  height: 0;
  overflow: hidden;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background: var(--background);
}

.login-shell {
  display: grid;
  width: min(940px, 100%);
  min-height: 590px;
  grid-template-columns: minmax(0, 0.92fr) minmax(340px, 1.08fr);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.brand-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 64px 48px;
  color: #f8fffd;
  background: #155b55;
}

.brand-mark,
.compact-mark {
  display: grid;
  place-items: center;
  color: #ffffff;
  background: var(--accent);
}

.brand-mark {
  width: 58px;
  height: 58px;
  margin-bottom: 30px;
  border-radius: 8px;
}

.brand-mark svg {
  width: 31px;
  height: 31px;
}

.brand-kicker,
.eyebrow {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 750;
}

.brand-kicker {
  color: #9cdfd7;
  direction: ltr;
  text-align: start;
}

.brand-panel h1 {
  margin: 0;
  font-size: clamp(29px, 4vw, 41px);
  line-height: 1.35;
}

.brand-copy {
  max-width: 315px;
  margin: 14px 0 0;
  color: #d0e8e4;
  line-height: 2;
}

.server-preview {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: auto;
  color: #d9efec;
  font-size: 12px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6bd6a0;
  box-shadow: 0 0 0 5px rgb(107 214 160 / 14%);
}

.login-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 58px 64px;
}

.panel-heading,
.modal-header,
.page-heading,
.app-header,
.table-toolbar,
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.panel-heading {
  margin-bottom: 30px;
}

.panel-heading h2,
.page-heading h1,
.page-heading h2,
.modal-header h2 {
  margin: 0;
  font-size: 21px;
}

.panel-heading p {
  margin: 8px 0 0;
  color: var(--muted);
}

.icon-button {
  position: relative;
  display: inline-grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--muted);
  transition:
    border-color 160ms ease,
    color 160ms ease,
    background 160ms ease,
    transform 160ms ease,
    opacity 160ms ease;
}

.icon-button:hover:not(:disabled),
.icon-button:focus-visible {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.icon-button:active:not(:disabled) {
  transform: translateY(1px);
}

.icon-button.action-danger:hover:not(:disabled) {
  border-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
}

.icon-button.action-success:hover:not(:disabled) {
  border-color: var(--success);
  background: var(--success-soft);
  color: var(--success);
}

.icon-button[data-tooltip]::after,
.field[data-tooltip]::after,
.search-box[data-tooltip]::after {
  position: absolute;
  z-index: 220;
  top: calc(100% + 8px);
  right: 50%;
  width: max-content;
  max-width: 190px;
  padding: 6px 9px;
  border-radius: 5px;
  background: #17201f;
  color: #ffffff;
  content: attr(data-tooltip);
  font-size: 11px;
  opacity: 0;
  pointer-events: none;
  transform: translate(50%, -4px);
  transition:
    opacity 140ms ease,
    transform 140ms ease;
}

.icon-button[data-tooltip]:hover::after,
.icon-button[data-tooltip]:focus-visible::after,
.field[data-tooltip]:hover::after,
.field[data-tooltip]:focus-within::after,
.search-box[data-tooltip]:hover::after,
.search-box[data-tooltip]:focus-within::after {
  opacity: 1;
  transform: translate(50%, 0);
}

.login-form,
.ticket-form {
  display: flex;
  flex-direction: column;
}

.login-form {
  gap: 17px;
}

.field {
  position: relative;
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 7px;
}

.field > span:first-child:not(.input-with-action) {
  color: #44504e;
  font-size: 12px;
  font-weight: 750;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  outline: none;
  background: var(--surface);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.field input,
.field select {
  height: 44px;
  padding: 0 13px;
}

.field textarea {
  min-height: 86px;
  resize: vertical;
  padding: 12px 13px;
  line-height: 1.8;
}

.field input:hover,
.field select:hover,
.field textarea:hover {
  border-color: #8fa4a0;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgb(15 118 110 / 13%);
}

.field input[readonly] {
  background: var(--surface-muted);
  color: var(--muted);
}

.field-ltr input,
.field-ltr select {
  direction: ltr;
  text-align: left;
}

.input-with-action {
  position: relative;
  display: block;
}

.input-with-action input {
  padding-inline-end: 44px;
}

.field-action {
  position: absolute;
  top: 50%;
  inset-inline-end: 5px;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--muted);
  transform: translateY(-50%);
}

.field-action:hover {
  color: var(--primary);
}

.primary-button,
.secondary-button,
.danger-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: 6px;
  padding: 0 18px;
  font-weight: 750;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    transform 160ms ease,
    opacity 160ms ease;
}

.primary-button {
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #ffffff;
}

.primary-button:hover:not(:disabled) {
  border-color: var(--primary-hover);
  background: var(--primary-hover);
}

.secondary-button {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--foreground);
}

.secondary-button:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}

.danger-button {
  border: 1px solid var(--danger);
  background: var(--danger);
  color: #ffffff;
}

.danger-button:hover:not(:disabled) {
  background: #9f3037;
}

.primary-button:active:not(:disabled),
.secondary-button:active:not(:disabled),
.danger-button:active:not(:disabled) {
  transform: translateY(1px);
}

.primary-button.compact {
  min-height: 40px;
}

.primary-button svg {
  width: 18px;
  height: 18px;
}

.button-loader {
  display: none;
  width: 17px;
  height: 17px;
  border: 2px solid rgb(255 255 255 / 35%);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.is-loading .button-loader {
  display: inline-block;
}

.icon-button.is-loading > svg {
  display: none;
}

.form-message {
  min-height: 18px;
  color: var(--danger);
  font-size: 12px;
  line-height: 1.8;
  white-space: pre-line;
}

.config-state {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 22px;
  color: var(--muted);
  font-size: 11px;
}

.config-state svg {
  width: 15px;
  height: 15px;
}

.workspace-view {
  min-height: 100vh;
}

.app-header {
  position: sticky;
  z-index: 20;
  top: 0;
  height: 66px;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  background: rgb(255 255 255 / 94%);
  backdrop-filter: blur(12px);
}

.app-brand,
.header-actions,
.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.compact-mark {
  width: 36px;
  height: 36px;
  border-radius: 7px;
}

.compact-mark svg {
  width: 21px;
  height: 21px;
}

.app-brand > div:last-child {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.app-brand span:last-child {
  color: var(--muted);
  font-size: 10px;
}

.workspace-content {
  width: min(1540px, 100%);
  margin: 0 auto;
  padding: 7px 28px 36px;
}

.page-heading {
  margin-bottom: 7px;
}

.sender-notices {
  display: flex;
  flex-direction: column;
  grid-template-columns: minmax(210px, 0.32fr) minmax(0, 1fr);
  gap: 22px;
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid #a9d5ce;
  border-right: 4px solid var(--primary);
  border-radius: 7px;
  background: #f5fbfa;
}

.notice-heading {
  display: flex;
  align-items: flex-start;
  gap: 11px;
}

.notice-heading h2,
.notice-heading h3,
.notice-heading p,
.notice-lines p {
  margin: 0;
}

.notice-heading h2,
.notice-heading h3 {
  font-size: 14px;
}

.notice-heading p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}

.notice-icon {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border-radius: 6px;
  background: var(--primary-soft);
  color: var(--primary);
}

.notice-lines {
  display: grid;
  gap: 8px;
}

.notice-lines p {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  color: #354542;
  font-size: 14px;
  line-height: 1.8;
}

.notice-lines p > span:first-child {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  background: var(--surface);
  color: var(--primary);
  font-size: 10px;
  font-weight: 800;
}

.records-panel {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  box-shadow: 0 10px 30px rgb(31 52 48 / 5%);
}

.table-toolbar {
  min-height: 66px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.search-box {
  position: relative;
  display: block;
  width: min(360px, 100%);
}

.search-box svg {
  position: absolute;
  top: 50%;
  right: 13px;
  width: 17px;
  height: 17px;
  color: var(--muted);
  transform: translateY(-50%);
}

.search-box input {
  width: 100%;
  height: 39px;
  padding: 0 40px 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  outline: none;
  background: var(--surface);
}

.search-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgb(15 118 110 / 12%);
}

.toolbar-separator {
  width: 1px;
  height: 25px;
  margin: 0 3px;
  background: var(--border);
}

.count-badge,
.boolean-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 750;
}

.count-badge {
  min-height: 30px;
  padding: 0 11px;
  background: var(--surface-muted);
  color: var(--muted);
}

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

table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 15px;
  border-bottom: 1px solid var(--border);
  text-align: right;
  white-space: nowrap;
}

th {
  background: var(--surface-muted);
  color: #44504e;
  font-size: 12px;
  font-weight: 800;
}

td {
  max-width: 360px;
  overflow: hidden;
  color: #2d3836;
  text-overflow: ellipsis;
}

.selection-column {
  width: 48px;
  min-width: 48px;
  padding-right: 17px;
  padding-left: 8px;
}

.selection-column input {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--primary);
}

tbody tr {
  cursor: pointer;
  outline: none;
  transition:
    background 140ms ease,
    box-shadow 140ms ease;
}

tbody tr:hover,
tbody tr:focus-visible {
  background: #f5faf9;
}

tbody tr.is-selected {
  background: var(--primary-soft);
  box-shadow: inset -3px 0 0 var(--primary);
}

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

.boolean-badge {
  min-width: 42px;
  padding: 4px 8px;
}

.boolean-badge.is-true {
  background: var(--success-soft);
  color: var(--success);
}

.boolean-badge.is-false {
  background: var(--surface-strong);
  color: var(--muted);
}

.empty-value {
  color: #9aa5a2;
}

.table-skeleton {
  display: grid;
  gap: 1px;
  background: var(--border);
}

.table-skeleton span {
  display: block;
  height: 54px;
  background: #edf1f0;
  overflow: hidden;
}

.table-skeleton span::after {
  display: block;
  width: 42%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgb(255 255 255 / 72%), transparent);
  content: "";
  animation: shimmer 1.35s ease-in-out infinite;
}

.empty-state {
  display: flex;
  min-height: 260px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
}

.empty-state svg {
  width: 34px;
  height: 34px;
  color: var(--border-strong);
}

.icon-button.is-spinning svg {
  animation: spin 850ms linear infinite;
}

.modal-layer {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgb(14 24 23 / 64%);
  backdrop-filter: blur(4px);
  animation: fade-in 180ms ease-out both;
}

.modal-dialog {
  position: relative;
  display: flex;
  width: min(790px, 100%);
  max-height: calc(100vh - 44px);
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 30px 90px rgb(6 20 18 / 35%);
  animation: modal-enter 220ms ease-out both;
}

.modal-dialog.modal-small {
  width: min(520px, 100%);
}

.ticket-notice-layer {
  z-index: 120;
}

.ticket-notice-message {
  margin: 0;
  padding: 22px;
  overflow-y: auto;
  overflow-wrap: anywhere;
  line-height: 2;
  white-space: pre-line;
}

.modal-header {
  flex: 0 0 auto;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}

.ticket-form {
  min-height: 0;
  overflow-y: auto;
  padding: 22px;
}

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

.form-grid.single-column {
  grid-template-columns: 1fr;
}

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

.file-picker {
  display: grid;
  min-height: 72px;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border: 1px dashed var(--border-strong);
  border-radius: 6px;
  background: var(--surface-muted);
  cursor: pointer;
  transition:
    border-color 160ms ease,
    background 160ms ease;
}

.file-picker:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.file-picker-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 6px;
  background: var(--surface);
  color: var(--primary);
}

.file-picker > span:nth-child(2) {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
}

.file-picker small {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-button {
  min-height: 36px;
  pointer-events: none;
}

.field-hint {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}

.modal-footer {
  margin: 4px -22px -22px;
  justify-content: flex-start;
  padding: 16px 22px;
  border-top: 1px solid var(--border);
  background: var(--surface-muted);
}

.modal-footer.detached-footer {
  margin: 0;
}

.confirm-icon {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 8px;
}

.confirm-icon svg {
  width: 25px;
  height: 25px;
}

.confirm-content {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 26px 22px 18px;
}

.confirm-content p {
  margin: 7px 0 0;
  color: var(--muted);
}

.confirm-icon {
  flex: 0 0 52px;
  background: var(--danger-soft);
  color: var(--danger);
}

.modal-message {
  padding: 0 22px;
}

.danger-text {
  color: var(--danger);
}

.toast-region {
  position: fixed;
  z-index: 240;
  bottom: 22px;
  left: 22px;
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.toast {
  min-width: 280px;
  max-width: min(430px, calc(100vw - 44px));
  padding: 13px 15px;
  border: 1px solid #9fceb9;
  border-radius: 6px;
  background: #f1fbf7;
  color: #1d6849;
  box-shadow: var(--shadow);
  line-height: 1.8;
  white-space: pre-line;
  animation: toast-enter 180ms ease-out both;
}

.toast.is-error {
  border-color: #e2adb2;
  background: #fff4f5;
  color: var(--danger);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes shimmer {
  from {
    transform: translateX(140%);
  }
  to {
    transform: translateX(-250%);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes modal-enter {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.985);
  }
}

@keyframes toast-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@media (max-width: 820px) {
  .sender-notices {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .login-view {
    padding: 16px;
  }
  .login-shell {
    grid-template-columns: 1fr;
  }
  .brand-panel {
    min-height: 215px;
    padding: 28px;
  }
  .brand-mark {
    width: 44px;
    height: 44px;
    margin-bottom: 18px;
  }
  .brand-copy {
    margin-top: 8px;
  }
  .server-preview {
    margin-top: 24px;
  }
  .login-panel {
    padding: 32px 28px;
  }
  .app-header,
  .workspace-content {
    padding-right: 16px;
    padding-left: 16px;
  }
  .table-toolbar {
    align-items: stretch;
    flex-direction: column;
  }
  .search-box {
    width: 100%;
  }
  .toolbar-actions {
    flex-wrap: wrap;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .field-full {
    grid-column: auto;
  }
}

@media (max-width: 480px) {
  .login-panel {
    padding: 28px 20px;
  }
  .page-heading {
    align-items: flex-start;
    flex-direction: column;
  }
  .page-heading .primary-button {
    width: 100%;
  }
  .app-brand > div:last-child span {
    display: none;
  }
  .modal-layer {
    padding: 8px;
  }
  .modal-dialog {
    max-height: calc(100vh - 16px);
  }
  .file-picker {
    grid-template-columns: 38px minmax(0, 1fr);
  }
  .file-button {
    display: none;
  }
  .toast-region {
    right: 12px;
    bottom: 12px;
    left: 12px;
  }
  .toast {
    min-width: 0;
    max-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
