@import url("/design-system.css");

.prototype-ribbon { display: none; }

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 82% 14%, #e3f0eb, transparent 34%),
    radial-gradient(circle at 15% 86%, #fbefe2, transparent 31%),
    var(--page);
}
.login-card {
  width: min(410px, 100%);
  padding: 32px;
  text-align: center;
  background: rgba(255, 255, 255, .96);
  border: 1px solid var(--line);
  border-radius: 19px;
  box-shadow: var(--shadow);
}
.login-card .brand-mark { margin: 0 auto; }
.login-card h1 { margin: 14px 0 4px; font-size: 26px; }
.login-card > p { margin: 0 0 24px; color: var(--muted); font-size: 12px; }
.stack { display: grid; gap: 14px; text-align: right; }
.stack label,
.toolbar label {
  display: grid;
  gap: 6px;
  color: #5f6d67;
  font-size: 10px;
  font-weight: 700;
}
.stack input,
.toolbar input,
.toolbar select {
  width: 100%;
  min-height: 41px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fbfcfa;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: 0;
}
.stack input:focus,
.toolbar input:focus,
.toolbar select:focus {
  border-color: #9bc0b2;
  box-shadow: 0 0 0 3px rgba(20, 114, 95, .07);
}
.form-error { min-height: 18px; color: var(--red); font-size: 10px; }
.login-card .button { width: 100%; margin-top: 2px; }

.primary,
.secondary,
.danger,
.ghost {
  min-height: 39px;
  padding: 8px 13px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 700;
}
.primary { color: #fff; background: var(--teal); border-color: var(--teal); }
.secondary { color: var(--teal-dark); background: var(--teal-soft); }
.danger { color: var(--red); background: var(--red-soft); }
.ghost { color: #56645e; background: var(--surface); border-color: var(--line); }

.notice {
  position: fixed;
  left: 24px;
  bottom: 24px;
  z-index: 70;
  max-width: min(420px, calc(100% - 30px));
  padding: 12px 14px;
  color: #fff;
  background: #263d35;
  border-radius: 11px;
  box-shadow: 0 14px 34px rgba(23, 47, 38, .2);
  font-size: 11px;
}

.notification-shell { position: relative; }
.notification-badge {
  min-width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  position: absolute;
  top: -5px;
  right: -5px;
  padding: 0 4px;
  color: #fff;
  background: var(--red);
  border: 2px solid var(--page);
  border-radius: 9px;
  font-size: 7px;
  font-weight: 800;
  font-style: normal;
}
.notification-panel {
  width: min(390px, calc(100vw - 28px));
  max-height: min(560px, calc(100vh - 100px));
  position: absolute;
  top: calc(100% + 9px);
  left: 0;
  z-index: 65;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: 0 18px 45px rgba(24, 48, 39, .16);
}
.notification-panel > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 15px; border-bottom: 1px solid var(--line); }
.notification-panel > header span strong,
.notification-panel > header span small { display: block; }
.notification-panel > header span strong { font-size: 12px; }
.notification-panel > header span small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.notification-list { max-height: 475px; overflow-y: auto; padding: 7px; }
.notification-list .empty { padding: 34px 15px; border: 0; }
.notification-item {
  width: 100%;
  display: grid;
  grid-template-columns: 37px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 9px;
  padding: 10px 8px;
  color: var(--ink);
  text-align: right;
  background: transparent;
  border: 0;
  border-bottom: 1px solid #edf1ee;
  border-radius: 9px;
}
.notification-item:last-child { border-bottom: 0; }
.notification-item:hover { background: #f7faf8; }
.notification-item > span:nth-child(2) { min-width: 0; }
.notification-item strong,
.notification-item small { display: block; }
.notification-item strong { font-size: 10px; }
.notification-item small { margin-top: 4px; color: var(--muted); font-size: 8px; line-height: 1.7; }
.notification-item > span:last-child { color: #9aa49f; }
.notification-item-icon { width: 37px; height: 37px; display: grid; place-items: center; color: var(--blue); background: var(--blue-soft); border-radius: 9px; }
.notification-item-icon.receipt,
.notification-item-icon.overdue { color: var(--orange); background: var(--orange-soft); }
.notification-item-icon.attendance { color: var(--red); background: var(--red-soft); }
.notification-item.high strong { color: #3b4541; }

.loading-state {
  min-height: 180px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 15px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.metric {
  min-width: 0;
  position: relative;
  padding: 17px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.metric::before {
  content: "";
  position: absolute;
  top: 16px;
  right: 0;
  width: 3px;
  height: 26px;
  background: var(--teal);
  border-radius: 3px 0 0 3px;
}
.metric span { display: block; color: var(--muted); font-size: 10px; }
.metric strong { display: block; margin-top: 9px; font-size: 24px; }
.metric strong.money { font-size: 18px; }
.metric-card strong.money { font-size: 18px; }

.panel h2 { margin: 0; font-size: 15px; }
.panel p { color: var(--muted); font-size: 10px; line-height: 1.8; }
.toolbar { display: flex; align-items: end; gap: 9px; flex-wrap: wrap; }
.toolbar label { min-width: 190px; }
.toolbar .grow { flex: 1; }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 13px;
}
.table-wrap table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  background: var(--surface);
}
.table-wrap th,
.table-wrap td {
  padding: 12px 13px;
  text-align: right;
  white-space: nowrap;
  border-bottom: 1px solid #edf1ee;
  font-size: 10px;
}
.table-wrap th { color: #7c8883; background: #fafbf9; font-weight: 700; }
.table-wrap tr:last-child td { border-bottom: 0; }
.table-wrap tbody tr:hover { background: #fbfcfa; }

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 3px 7px;
  color: var(--teal-dark);
  background: var(--teal-soft);
  border-radius: 7px;
  font-size: 8px;
  font-weight: 700;
}
.pill.warn { color: #99601e; background: var(--orange-soft); }
.pill.bad { color: #954643; background: var(--red-soft); }
.empty {
  padding: 48px 18px;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
}
.empty strong { display: block; margin-bottom: 6px; color: var(--ink); }
.empty span { display: block; font-size: 10px; line-height: 1.8; }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.card {
  padding: 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 13px;
}
.card h3 { margin: 0 0 6px; font-size: 12px; }
.card p { margin: 0; color: var(--muted); font-size: 9px; }
.card-meta { display: flex; gap: 12px; margin-top: 12px; color: var(--muted); font-size: 9px; }
.roster-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.roster-card-head h3 { margin: 0; }
.class-link-control { min-width: 390px; display: grid; gap: 9px; }
.class-link-current { display: flex; flex-wrap: wrap; gap: 7px; }
.class-link-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 9px 6px 5px; border: 1px solid #d9e6e1; border-radius: 10px; background: #f6faf8; }
.class-link-chip span { display: grid; gap: 1px; }
.class-link-chip strong { font-size: .8rem; font-weight: 700; }
.class-link-chip small, .muted-line { color: var(--muted); font-size: .72rem; }
.class-link-chip .icon-btn { width: 25px; height: 25px; min-height: 25px; border-radius: 7px; color: #a34747; }
.class-link-add { display: grid; grid-template-columns: minmax(220px, 1fr) auto; align-items: center; gap: 7px; }
.class-link-add .compact-select { width: 100%; }
.loading-state.compact { min-height: 110px; margin-top: 14px; }
.student-link-detail { margin-top: 14px; border-color: #c7ddd4; scroll-margin-top: 18px; }
.student-link-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(310px,.8fr); gap: 14px; }
.student-link-grid h4 { margin: 0 0 9px; font-size: 10px; }
.student-link-list { display: grid; gap: 7px; }
.student-link-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 10px; background: #f8faf8; }
.student-link-row span { min-width: 0; }
.student-link-row strong, .student-link-row small { display: block; }
.student-link-row strong { font-size: 9px; }
.student-link-row small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.student-link-form { display: grid; align-content: start; gap: 9px; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: #fafbf9; }
.student-link-form label { display: grid; gap: 5px; color: var(--muted); font-size: 8px; }
.student-link-form > small { color: var(--muted); font-size: 8px; line-height: 1.8; }
.student-link-form .button { justify-self: start; }
.table-wrap td > strong,
.table-wrap td > small { display: block; }
.table-wrap td > small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.small-btn {
  min-height: 29px;
  padding: 5px 9px;
  color: var(--teal-dark);
  background: var(--teal-soft);
  border: 0;
  border-radius: 7px;
  font-size: 9px;
  font-weight: 700;
}
.small-btn:hover { background: #d8ebe4; }
.compact-select {
  min-height: 31px;
  padding: 5px 8px;
  color: var(--ink);
  background: #fbfcfa;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 9px;
  outline: 0;
}
.compact-select:focus { border-color: #9bc0b2; box-shadow: 0 0 0 3px rgba(20, 114, 95, .07); }
.role-overview { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.nav-item[aria-disabled="true"] { opacity: .55; }
.nav-item[aria-disabled="true"]::after {
  content: "به‌زودی";
  margin-right: auto;
  color: #8d9893;
  font-size: 8px;
  font-weight: 400;
}

.sync-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--teal);
  font-size: 9px;
}
.sync-status::before {
  content: "";
  width: 6px;
  height: 6px;
  background: #2e9d75;
  border-radius: 50%;
}

.connection-state {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  color: #52605a;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 11px;
}
.connection-state > span:last-child { display: grid; gap: 1px; }
.connection-state strong { font-size: 9px; }
.connection-state small { color: var(--muted); font-size: 7px; white-space: nowrap; }
.connection-dot { width: 7px; height: 7px; flex: 0 0 auto; background: #2e9d75; border-radius: 50%; }
.connection-state.offline { color: #8b4b47; background: #fff8f7; border-color: #edcfcc; }
.connection-state.offline .connection-dot { background: var(--red); }
.connection-state.syncing { color: #885d25; background: #fffaf3; border-color: #edd9b9; }
.connection-state.syncing .connection-dot { background: var(--orange); animation: syncPulse 1s ease-in-out infinite alternate; }
@keyframes syncPulse { to { opacity: .35; transform: scale(.75); } }
@media (prefers-reduced-motion: reduce) { .connection-state.syncing .connection-dot { animation: none; } }

.button:disabled,
.primary:disabled,
.secondary:disabled {
  cursor: not-allowed;
  opacity: .48;
}

.setup-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px;
  color: #eef8f4;
  background: linear-gradient(125deg, #173e34, #1d5a4a);
  border-radius: 17px;
  box-shadow: 0 12px 30px rgba(20, 68, 54, .12);
}
.setup-hero h2 { margin: 5px 0 6px; color: #fff; font-size: 20px; }
.setup-hero p { max-width: 650px; margin: 0; color: #c8ddd5; font-size: 11px; line-height: 1.9; }
.setup-kicker { color: #91c8b7; font-size: 9px; font-weight: 800; }
.setup-hero .status { flex: 0 0 auto; background: rgba(255,255,255,.12); }

.setup-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.setup-step {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 72px;
  padding: 13px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 13px;
}
.setup-step > span {
  width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #74817c;
  background: #f0f3f1;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 800;
}
.setup-step div { min-width: 0; }
.setup-step strong,
.setup-step small { display: block; }
.setup-step strong { font-size: 11px; }
.setup-step small { margin-top: 4px; color: var(--muted); font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.setup-step.done { border-color: #c7e1d7; background: #f8fcfa; }
.setup-step.done > span { color: #fff; background: var(--teal); }
.setup-step.current { border-color: #ddb986; background: #fffaf3; }
.setup-step.current > span { color: #8f591d; background: #f6e5c8; }

.setup-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr); gap: 12px; }
.panel-icon {
  width: 35px;
  height: 35px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--teal);
  background: var(--teal-soft);
  border-radius: 10px;
}
.setup-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.setup-form label,
.mapping-form label,
.upload-form > label:not(.file-picker) {
  display: grid;
  gap: 6px;
  color: #5f6d67;
  font-size: 9px;
  font-weight: 700;
}
.setup-form .wide { grid-column: 1 / -1; }
.setup-form input,
.setup-form textarea,
.mapping-form select,
.upload-form select {
  width: 100%;
  min-height: 41px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fbfcfa;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: 0;
}
.setup-form textarea { min-height: 76px; resize: vertical; line-height: 1.8; }
.setup-form input:focus,
.setup-form textarea:focus,
.mapping-form select:focus,
.upload-form select:focus { border-color: #9bc0b2; box-shadow: 0 0 0 3px rgba(20,114,95,.07); }
.setup-form input:disabled,
.setup-form textarea:disabled,
.mapping-form select:disabled { color: #77837e; background: #f3f5f3; cursor: not-allowed; }
.form-actions { display: flex; align-items: center; justify-content: flex-start; gap: 8px; }
.year-form { padding-bottom: 15px; border-bottom: 1px solid var(--line); }
.year-list { display: grid; gap: 7px; margin-top: 13px; }
.year-list > div:not(.empty) { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 11px; background: #fafbf9; border: 1px solid #edf0ed; border-radius: 10px; }
.year-list span strong,
.year-list span small { display: block; }
.year-list span strong { font-size: 10px; }
.year-list span small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.year-list .empty { padding: 26px 12px; }

.sida-upload-panel { overflow: hidden; }
.upload-form { display: grid; grid-template-columns: minmax(300px, 1fr) minmax(190px, .42fr) auto; align-items: end; gap: 10px; }
.file-picker {
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 11px;
  position: relative;
  padding: 12px 14px;
  color: var(--teal-dark);
  background: #f7fbf9;
  border: 1px dashed #9fc7b8;
  border-radius: 12px;
  cursor: pointer;
}
.file-picker > svg { flex: 0 0 auto; }
.file-picker span strong,
.file-picker span small { display: block; }
.file-picker span strong { font-size: 10px; }
.file-picker span small { margin-top: 4px; color: var(--muted); font-size: 8px; }
.file-picker input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.security-notes { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 13px; padding-top: 12px; color: #60706a; border-top: 1px solid #edf1ee; font-size: 9px; }
.security-notes span { display: inline-flex; align-items: center; gap: 5px; }
.security-notes svg { color: var(--teal); }
.roster-summary { display: flex; align-items: baseline; gap: 8px; padding: 18px; background: var(--teal-soft); border-radius: 12px; }
.roster-summary strong { color: var(--teal-dark); font-size: 24px; }
.roster-summary span { color: #5d6d67; font-size: 10px; }

.import-review { scroll-margin-top: 20px; }
.import-summary { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; margin-bottom: 18px; }
.import-summary > div { padding: 12px; background: #f8faf8; border: 1px solid #edf1ee; border-radius: 10px; }
.import-summary span,
.import-summary strong { display: block; }
.import-summary span { color: var(--muted); font-size: 8px; }
.import-summary strong { margin-top: 5px; font-size: 17px; }
.import-summary .has-error { color: var(--red); background: var(--red-soft); border-color: #f0cfcc; }
.setup-section-title { display: flex; align-items: center; gap: 8px; margin-bottom: 11px; }
.setup-section-title > svg { color: var(--teal); }
.setup-section-title span strong,
.setup-section-title span small { display: block; }
.setup-section-title span strong { font-size: 11px; }
.setup-section-title span small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.mapping-form { padding: 15px; background: #fafbf9; border: 1px solid var(--line); border-radius: 12px; }
.mapping-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; }
.mapping-grid label { position: relative; }
.mapping-grid label em { margin-right: 4px; color: #a35d1f; font-size: 7px; font-style: normal; }
.mapping-form .form-actions { margin-top: 13px; padding-top: 12px; border-top: 1px solid var(--line); }
.preview-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 17px 0 9px; }
.preview-head strong { font-size: 11px; }
.preview-head span { color: var(--muted); font-size: 8px; }
.success-message { display: flex; align-items: center; gap: 7px; padding: 13px; color: var(--teal-dark); background: var(--teal-soft); border: 1px solid #cce2da; border-radius: 11px; font-size: 10px; font-weight: 700; }

.metric-grid.compact { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dashboard-grid.single { grid-template-columns: 1fr; }
.finance-lead { align-items: center; }
.tuition-summary .metric-card small { min-height: 16px; line-height: 1.6; }
.tuition-plan-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr); gap: 12px; align-items: start; }
.tuition-form { display: grid; gap: 13px; }
.tuition-form > label,
.tuition-form-grid label,
.installment-row label,
.payment-form label {
  display: grid;
  gap: 6px;
  color: #5f6d67;
  font-size: 9px;
  font-weight: 700;
}
.tuition-form input,
.tuition-form select,
.tuition-form textarea,
.payment-form input,
.payment-form select {
  width: 100%;
  min-height: 41px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fbfcfa;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: 0;
}
.tuition-form textarea { min-height: 76px; resize: vertical; line-height: 1.8; }
.tuition-form input:focus,
.tuition-form select:focus,
.tuition-form textarea:focus,
.payment-form input:focus,
.payment-form select:focus { border-color: #9bc0b2; box-shadow: 0 0 0 3px rgba(20,114,95,.07); }
.tuition-form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.tuition-form-grid .wide { grid-column: 1 / -1; }
.installment-builder-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 4px; border-top: 1px solid var(--line); }
.installment-builder-head span strong,
.installment-builder-head span small { display: block; }
.installment-builder-head span strong { font-size: 10px; }
.installment-builder-head span small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.installment-builder { display: grid; gap: 8px; }
.installment-row { display: grid; grid-template-columns: auto minmax(115px,.8fr) minmax(140px,1fr) minmax(130px,.8fr) auto; align-items: end; gap: 8px; padding: 10px; background: #f8faf8; border: 1px solid #e8eeea; border-radius: 11px; }
.installment-number { align-self: center; color: var(--teal-dark); font-size: 9px; font-weight: 800; white-space: nowrap; }
.installment-total { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 4px 12px; padding: 11px 12px; color: #53635d; background: var(--teal-soft); border-radius: 10px; }
.installment-total span { font-size: 9px; }
.installment-total strong { font-size: 13px; }
.installment-total small { grid-column: 1 / -1; color: #946027; font-size: 8px; }
.installment-total small.matched { color: var(--teal); }
.student-list-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: #5f6d67; font-size: 9px; font-weight: 700; }
.student-list-head label { display: inline-flex; align-items: center; gap: 5px; font-size: 8px; }
.student-list-head input,
.student-choice-row input { width: 15px; min-height: 15px; accent-color: var(--teal); }
.student-check-list { max-height: 325px; overflow-y: auto; display: grid; border: 1px solid var(--line); border-radius: 11px; }
.student-choice-row { display: grid; grid-template-columns: 17px minmax(0,1fr); align-items: center; gap: 8px; padding: 9px 10px; border-bottom: 1px solid #edf1ee; cursor: pointer; }
.student-choice-row:last-child { border-bottom: 0; }
.student-choice-row:hover { background: #f8faf8; }
.student-choice-row span strong,
.student-choice-row span small { display: block; }
.student-choice-row span strong { font-size: 9px; }
.student-choice-row span small { margin-top: 2px; color: var(--muted); font-size: 8px; }
.account-detail { border-color: #c7ddd4; scroll-margin-top: 18px; }
.payment-form { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); align-items: end; gap: 10px; margin-top: 14px; padding: 14px; background: #f7faf8; border: 1px solid var(--line); border-radius: 12px; }
.payment-form-head { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.payment-form-head > span:first-child { width: 34px; height: 34px; display: grid; place-items: center; color: var(--teal); background: var(--teal-soft); border-radius: 9px; }
.payment-form-head strong,
.payment-form-head small { display: block; }
.payment-form-head strong { font-size: 10px; }
.payment-form-head small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.payment-form label.wide { grid-column: 1 / -1; }
.payment-form label.optional::after { content: "اختیاری"; color: var(--muted); font-size: 7px; }
.payment-actions { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; }
.table-wrap td small { color: var(--muted); font-size: 8px; }

.workspace-grid { display: grid; grid-template-columns: minmax(0,1.55fr) minmax(330px,.75fr); gap: 14px; align-items: start; }
.form-panel { position: sticky; top: 18px; }
.operation-form { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 11px; }
.operation-form label { display: grid; gap: 6px; color: #5f6d67; font-size: 9px; font-weight: 700; }
.operation-form label.wide { grid-column: 1 / -1; }
.operation-form input,
.operation-form select,
.operation-form textarea {
  width: 100%;
  min-height: 41px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fbfcfa;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: 0;
}
.operation-form textarea { min-height: 92px; resize: vertical; line-height: 1.8; }
.operation-form input:focus,
.operation-form select:focus,
.operation-form textarea:focus { border-color: #9bc0b2; box-shadow: 0 0 0 3px rgba(20,114,95,.07); }
.operation-form > .button { grid-column: 1 / -1; justify-self: start; }
.sensitive-note { max-width: 360px; overflow: hidden; white-space: pre-wrap !important; text-overflow: ellipsis; line-height: 1.75; }
.danger-action { color: var(--red); background: var(--red-soft); }
.server-time { color: var(--muted); font-size: 9px; white-space: nowrap; }
.readiness-grid { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 9px; }
.readiness-card { min-width: 0; display: grid; grid-template-columns: 31px minmax(0,1fr); align-items: center; gap: 8px; position: relative; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.readiness-card > span:first-child { width: 31px; height: 31px; display: grid; place-items: center; color: var(--teal); background: var(--teal-soft); border-radius: 8px; }
.readiness-card > span:nth-child(2) { min-width: 0; }
.readiness-card strong,.readiness-card small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.readiness-card strong { font-size: 9px; }
.readiness-card small { margin-top: 3px; color: var(--muted); font-size: 7px; }
.readiness-card b { grid-column: 1 / -1; color: var(--teal); font-size: 8px; font-weight: 700; }
.readiness-card.blocked { border-color: #efd7d4; background: #fffafa; }
.readiness-card.blocked > span:first-child { color: var(--red); background: var(--red-soft); }
.readiness-card.blocked b { color: var(--red); }
.rule-banner.warning { background: #fffaf3; border-color: #edd9b9; }
.rule-banner.warning > span:first-child { color: var(--orange); background: var(--orange-soft); }
.rule-banner.danger { background: #fff8f7; border-color: #edcfcc; }
.rule-banner.danger > span:first-child { color: var(--red); background: var(--red-soft); }

@media (max-width: 1180px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .setup-grid { grid-template-columns: 1fr; }
  .tuition-plan-grid { grid-template-columns: 1fr; }
  .payment-form { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .upload-form { grid-template-columns: 1fr 1fr; }
  .upload-form .file-picker { grid-column: 1 / -1; }
  .connection-state small { display: none; }
  .workspace-grid { grid-template-columns: 1fr; }
  .form-panel { position: static; }
  .readiness-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media (max-width: 820px) {
  .notice { right: 15px; left: 15px; bottom: 15px; }
  .finance-lead { align-items: flex-start; flex-direction: column; }
  .metric-grid.compact { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .installment-row { grid-template-columns: auto 1fr 1fr; }
  .installment-row label:nth-of-type(3) { grid-column: 2 / -1; }
  .setup-steps { grid-template-columns: 1fr; }
  .mapping-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .role-overview { grid-template-columns: 1fr; }
  .student-link-grid { grid-template-columns: 1fr; }
  .connection-state { display: none; }
  .readiness-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 560px) {
  .login-card { padding: 26px 20px; }
  .toolbar { display: grid; }
  .toolbar label { min-width: 0; }
  .cards { grid-template-columns: 1fr; }
  .setup-hero { align-items: flex-start; flex-direction: column; padding: 18px; }
  .setup-form,
  .tuition-form-grid,
  .payment-form,
  .mapping-grid,
  .upload-form { grid-template-columns: 1fr; }
  .metric-grid.compact { grid-template-columns: 1fr 1fr; }
  .installment-builder-head { align-items: flex-start; }
  .installment-row { grid-template-columns: 1fr 1fr; }
  .installment-number { grid-column: 1 / -1; }
  .installment-row label:nth-of-type(3) { grid-column: auto; }
  .installment-row .remove-installment { grid-column: 1 / -1; justify-self: start; }
  .payment-form-head,
  .payment-form label.wide,
  .payment-actions { grid-column: auto; }
  .payment-actions .button { flex: 1; }
  .upload-form .file-picker { grid-column: auto; }
  .import-summary { grid-template-columns: 1fr 1fr; }
  .mapping-form .form-actions { align-items: stretch; flex-direction: column; }
  .mapping-form .form-actions .button { width: 100%; }
  .preview-head { align-items: flex-start; flex-direction: column; }
  .notification-panel { position: fixed; top: 72px; right: 12px; left: 12px; width: auto; max-height: calc(100vh - 88px); }
  .notification-list { max-height: calc(100vh - 155px); }
  .operation-form { grid-template-columns: 1fr; }
  .operation-form label.wide,
  .operation-form > .button { grid-column: auto; }
  .operation-form > .button { width: 100%; }
  .readiness-grid { grid-template-columns: 1fr; }
}
@media (max-width: 390px) {
  .metrics { grid-template-columns: 1fr; }
}

@media print {
  .sidebar,.topbar,.notice,.page-actions,.notification-panel { display: none !important; }
  .main-content { margin: 0; padding: 0; }
  .view { max-width: none; }
  .panel,.rule-banner { box-shadow: none; break-inside: avoid; }
  .table-wrap { overflow: visible; }
  .table-wrap table { min-width: 0; }
}
