/*
  ماژول شیت سازمانی TTT
  تمام selectorها با ttt-sheet شروع می‌شوند تا قالب فعلی سایت تغییر نکند.
  فونت از قالب اصلی سایت به ارث می‌رسد.
*/
.ttt-sheet {
  --ttt-sheet-primary: var(--ttt-navy);
  --ttt-sheet-primary-soft: color-mix(in srgb, var(--ttt-sheet-primary) 10%, transparent);
  --ttt-sheet-bg: var(--ttt-bg);
  --ttt-sheet-surface: var(--ttt-card);
  --ttt-sheet-text: var(--ttt-text);
  --ttt-sheet-muted: var(--ttt-muted);
  --ttt-sheet-border: var(--ttt-border);
  --ttt-sheet-danger: var(--ttt-danger);
  --ttt-sheet-success: var(--ttt-success);
  --ttt-sheet-radius: var(--ttt-radius);

  direction: rtl;
  color: var(--ttt-sheet-text);
  background: transparent;
  font-family: inherit;
  width: 100%;
  min-width: 0;
}

.ttt-sheet *, .ttt-sheet *::before, .ttt-sheet *::after { box-sizing: border-box; }

.ttt-sheet__header,
.ttt-sheet__toolbar,
.ttt-sheet__footer {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ttt-sheet__header {
  justify-content: space-between;
  margin-bottom: 14px;
}

.ttt-sheet__title { margin: 0; font-size: 1.25rem; font-weight: 800; }
.ttt-sheet__subtitle { margin: 4px 0 0; color: var(--ttt-sheet-muted); font-size: .86rem; }
.ttt-sheet__status { color: var(--ttt-sheet-success); font-size: .82rem; white-space: nowrap; }

.ttt-sheet__toolbar {
  flex-wrap: wrap;
  background: var(--ttt-sheet-surface);
  border: 1px solid var(--ttt-sheet-border);
  border-bottom: 0;
  border-radius: var(--ttt-sheet-radius) var(--ttt-sheet-radius) 0 0;
  padding: 10px;
}

.ttt-sheet__search { display: flex; align-items: center; gap: 8px; min-width: min(460px, 100%); flex: 1; }
.ttt-sheet__search span { color: var(--ttt-sheet-muted); font-size: .84rem; }
.ttt-sheet__search input {
  width: 100%; min-width: 160px; height: 36px;
  border: 1px solid var(--ttt-sheet-border); border-radius: 8px;
  padding: 0 11px; font: inherit; color: inherit; background: var(--ttt-sheet-surface);
}
.ttt-sheet__search input:focus { outline: 2px solid var(--ttt-sheet-primary-soft); border-color: var(--ttt-sheet-primary); }

.ttt-sheet__button {
  height: 36px; border: 1px solid var(--ttt-sheet-border); border-radius: 8px;
  background: var(--ttt-sheet-surface); color: var(--ttt-sheet-text);
  padding: 0 13px; font: inherit; cursor: pointer;
}
.ttt-sheet__button:hover { border-color: var(--ttt-sheet-primary); color: var(--ttt-sheet-primary); }
.ttt-sheet__counter { margin-inline-start: auto; color: var(--ttt-sheet-muted); font-size: .82rem; }

.ttt-sheet__notice {
  padding: 9px 12px; border: 1px solid #efb3b3; color: var(--ttt-sheet-danger);
  background: #fff5f5; font-size: .86rem;
}

.ttt-sheet__viewport {
  direction: ltr;
  overflow: auto;
  max-height: min(68vh, 760px);
  background: var(--ttt-sheet-surface);
  border: 1px solid var(--ttt-sheet-border);
  border-radius: var(--ttt-sheet-radius);
  scrollbar-gutter: stable both-edges;
  margin: 5mm;
  width: calc(100% - 10mm);
}

.ttt-sheet__grid {
  direction: rtl;
  border-collapse: separate;
  border-spacing: 0;
  width: max-content;
  min-width: 100%;
  table-layout: fixed;
  font-size: .82rem;
}

.ttt-sheet__grid th,
.ttt-sheet__grid td {
  border-inline-end: 1px solid var(--ttt-sheet-border);
  border-bottom: 1px solid var(--ttt-sheet-border);
  height: 46px;
  padding: 0;
  background: var(--ttt-sheet-surface);
  position: relative;
}

.ttt-sheet__grid th {
  position: sticky;
  top: 0;
  z-index: 4;
  height: 44px;
  padding: 7px 9px;
  background: var(--ttt-sheet-bg);
  color: var(--ttt-sheet-text);
  text-align: center;
  font-weight: 750;
  white-space: normal;
  line-height: 1.35;
}

.ttt-sheet__grid th:first-child,
.ttt-sheet__grid td:first-child {
  position: sticky;
  right: 0;
  z-index: 3;
  background: var(--ttt-sheet-bg);
}
.ttt-sheet__grid th:first-child { z-index: 6; }

.ttt-sheet__cell {
  width: 100%; height: 100%; min-height: 46px;
  border: 0; outline: 0; padding: 7px 9px;
  font: inherit; color: inherit; background: transparent;
  text-align: right;
}
.ttt-sheet__cell:focus {
  box-shadow: inset 0 0 0 2px var(--ttt-sheet-primary);
  background: var(--ttt-sheet-primary-soft);
}
.ttt-sheet__cell[readonly] { color: var(--ttt-sheet-muted); cursor: default; }
.ttt-sheet__cell--duplicate { box-shadow: inset 0 0 0 2px var(--ttt-sheet-danger); background: #fff5f5; }
.ttt-sheet__row-number { width: 52px; text-align: center; color: var(--ttt-sheet-muted); font-variant-numeric: tabular-nums; }
.ttt-sheet__empty-row td { background: color-mix(in srgb, var(--ttt-sheet-primary) 2%, var(--ttt-sheet-surface)); }
.ttt-sheet__filtered { display: none; }

.ttt-sheet__footer { flex-wrap: wrap; padding: 9px 2px; color: var(--ttt-sheet-muted); font-size: .76rem; }
.ttt-sheet__footer span + span::before { content: "•"; margin-inline-end: 12px; color: var(--ttt-sheet-border); }

@media (max-width: 720px) {
  .ttt-sheet__header { align-items: flex-start; }
  .ttt-sheet__status { white-space: normal; text-align: left; }
  .ttt-sheet__counter { width: 100%; margin: 0; }
  .ttt-sheet__viewport { max-height: 72vh; }
}

/* امکانات نسخه ۲؛ همه قواعد فقط داخل ماژول اعمال می‌شوند. */
.ttt-sheet__manager-tools{display:flex;align-items:center;gap:8px;flex-wrap:wrap;width:100%;max-width:100%;padding-inline-start:8px;border-inline-start:1px solid var(--ttt-sheet-border)}
.ttt-sheet__manager-tools label{display:inline-flex;align-items:center;gap:7px;font-size:12px;color:var(--ttt-sheet-muted)}
.ttt-sheet__manager-tools input[type="color"]{width:34px;height:30px;border:1px solid var(--ttt-sheet-border);border-radius:7px;background:transparent;padding:2px;cursor:pointer}
.ttt-sheet td.ttt-sheet__selected{outline:2px solid var(--ttt-sheet-primary);outline-offset:-2px}
.ttt-sheet__select{appearance:auto;cursor:pointer;padding-inline:6px}
.ttt-sheet__cell--formula{background:color-mix(in srgb,var(--ttt-sheet-primary) 7%,transparent);font-weight:700;cursor:not-allowed}
.ttt-sheet__cell--invalid{box-shadow:inset 0 0 0 2px var(--ttt-sheet-danger)!important;background:#fff0f0!important}
.ttt-sheet__plate{font-family:inherit;text-align:center;min-width:165px}
.ttt-sheet__jalali{text-align:center}

/* نسخه ۳: پلاک چندبخشی ایران و رنگ کامل ردیف */
.ttt-sheet__grid tbody tr td { background: var(--ttt-cell-color, var(--ttt-row-color, var(--ttt-sheet-surface))); }
.ttt-sheet__grid tbody tr.ttt-sheet__empty-row td { background: var(--ttt-cell-color, var(--ttt-row-color, color-mix(in srgb, var(--ttt-sheet-primary) 2%, var(--ttt-sheet-surface)))); }
.ttt-sheet__grid tbody tr.ttt-sheet__selected-row td { outline: 2px solid var(--ttt-sheet-primary); outline-offset: -2px; }
.ttt-sheet__row-number { cursor: pointer; user-select: none; }
.ttt-sheet__plate-editor { display:flex;align-items:center;justify-content:center;gap:4px;padding:3px 5px;direction:ltr; }
.ttt-sheet__plate-part { height:30px;border:1px solid var(--ttt-sheet-border);border-radius:5px;text-align:center;font:inherit;background:rgba(255,255,255,.75);padding:2px;outline:none; }
.ttt-sheet__plate-part:focus { border-color:var(--ttt-sheet-primary);box-shadow:0 0 0 2px var(--ttt-sheet-primary-soft); }
.ttt-sheet__plate-part--left{width:48px}.ttt-sheet__plate-part--middle{width:40px}.ttt-sheet__plate-part--letter{width:34px}.ttt-sheet__plate-part--iran{width:40px}
.ttt-sheet__plate-sep{color:var(--ttt-sheet-muted)}
.ttt-sheet__plate-iran-label{font-size:10px;color:var(--ttt-sheet-muted);margin-left:-2px}
.ttt-sheet__plate-editor.ttt-sheet__cell--invalid{box-shadow:inset 0 0 0 2px var(--ttt-sheet-danger)!important;background:#fff0f0!important}
.ttt-sheet__plate-editor.ttt-sheet__cell--duplicate{box-shadow:inset 0 0 0 2px var(--ttt-sheet-danger)!important;background:#fff5f5!important}

/* نسخه ۴: ستون پویا، فیلتر چندشرطی و شیت‌های اختصاصی */
.ttt-sheet__toolbar-select{height:36px;border:1px solid var(--ttt-sheet-border);border-radius:8px;background:var(--ttt-sheet-surface);color:inherit;font:inherit;padding:0 10px;min-width:170px}
.ttt-sheet__filter-panel{background:var(--ttt-sheet-surface);border:1px solid var(--ttt-sheet-border);padding:12px;margin:0 0 10px;border-radius:var(--ttt-sheet-radius)}
.ttt-sheet__filter-head,.ttt-sheet__filter-actions{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap}
.ttt-sheet__filter-rows{display:grid;gap:8px;margin:12px 0}
.ttt-sheet__filter-row{display:grid;grid-template-columns:minmax(150px,1fr) 130px minmax(180px,2fr) auto;gap:8px}
.ttt-sheet__filter-row select,.ttt-sheet__filter-row input{height:36px;border:1px solid var(--ttt-sheet-border);border-radius:8px;padding:0 9px;font:inherit;background:var(--ttt-sheet-surface);color:inherit}
.ttt-sheet__button--primary{background:var(--ttt-sheet-primary);border-color:var(--ttt-sheet-primary);color:#fff}
.ttt-sheet__button--primary:hover{color:#fff;filter:brightness(.96)}
.ttt-sheet__dialog{border:0;border-radius:14px;box-shadow:0 24px 80px rgba(0,0,0,.24);padding:0;min-width:min(440px,92vw);color:var(--ttt-sheet-text);font-family:inherit}
.ttt-sheet__dialog::backdrop{background:rgba(15,23,42,.45)}
.ttt-sheet__dialog form{display:grid;gap:13px;padding:20px}
.ttt-sheet__dialog h3{margin:0 0 4px}
.ttt-sheet__dialog label{display:grid;gap:6px;font-size:.84rem}
.ttt-sheet__dialog input,.ttt-sheet__dialog select,.ttt-sheet__dialog textarea{border:1px solid var(--ttt-sheet-border);border-radius:8px;padding:9px;font:inherit;color:inherit;background:#fff}
.ttt-sheet__dialog textarea{min-height:90px;resize:vertical}
.ttt-sheet__dialog-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:5px}
.ttt-sheet__saved-view-active{box-shadow:inset 0 -3px 0 var(--ttt-sheet-primary)}
@media(max-width:720px){.ttt-sheet__filter-row{grid-template-columns:1fr}.ttt-sheet__filter-row button{justify-self:start}}

/* نسخه نهایی: ردیف‌های خواناتر و سه ردیف آماده ورود */
.ttt-sheet__grid tbody td { min-height: 46px; }
.ttt-sheet__grid tbody tr { height: 46px; }
.ttt-sheet__grid tbody tr.ttt-sheet__empty-row td {
  background: var(--ttt-cell-color, var(--ttt-row-color, color-mix(in srgb, var(--ttt-sheet-primary) 3.5%, var(--ttt-sheet-surface))));
}
.ttt-sheet__grid tbody tr.ttt-sheet__empty-row .ttt-sheet__row-number {
  color: color-mix(in srgb, var(--ttt-sheet-muted) 72%, transparent);
}


/* نسخه گزارش‌گیری، چاپ و فیلتر تمیز */
.ttt-sheet__report-dialog{width:min(980px,96vw);max-height:92vh}
.ttt-sheet__report-dialog form{max-height:88vh;overflow:auto}
.ttt-sheet__report-columns{border:1px solid var(--ttt-sheet-border);border-radius:10px;padding:10px}
.ttt-sheet__report-columns>div{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:7px;margin-top:8px}
.ttt-sheet__report-columns label{display:flex!important;align-items:center;gap:7px}
.ttt-sheet__report-preview{border:1px solid var(--ttt-sheet-border);border-radius:10px;padding:12px;max-height:360px;overflow:auto;background:#fff}
.ttt-sheet__report-preview table,.ttt-sheet__report-output table{width:100%;border-collapse:collapse;font-size:.78rem}
.ttt-sheet__report-preview th,.ttt-sheet__report-preview td,.ttt-sheet__report-output th,.ttt-sheet__report-output td{border:1px solid var(--ttt-sheet-border);padding:7px;text-align:right}
.ttt-sheet__report-preview th,.ttt-sheet__report-output th{background:var(--ttt-sheet-bg)}
.ttt-sheet__report-empty{color:var(--ttt-sheet-muted);text-align:center}
@media print{
  body{background:#fff!important}
  body>*:not(#ttt-sheet-root){display:none!important}
  #ttt-sheet-root{width:100%!important}
  .ttt-sheet__header,.ttt-sheet__toolbar,.ttt-sheet__notice,.ttt-sheet__filter-panel,.ttt-sheet__footer,.ttt-sheet__dialog{display:none!important}
  .ttt-sheet__viewport{max-height:none!important;overflow:visible!important;border:0!important}
  .ttt-sheet__grid{width:100%!important;font-size:8px!important;table-layout:auto!important}
  .ttt-sheet__grid th,.ttt-sheet__grid td{position:static!important;height:auto!important;min-height:0!important;page-break-inside:avoid}
  .ttt-sheet__cell,.ttt-sheet__plate-editor{min-height:0!important;padding:3px!important}
  .ttt-sheet__filtered{display:none!important}
  @page{size:A4 landscape;margin:8mm}
}
\n\n/* نسخه ۵: همکاری هم‌زمان، تاریخچه، نسخه‌ها و داشبورد */
.ttt-sheet__presence{display:flex;align-items:center;gap:4px;margin-inline-start:auto}
.ttt-sheet__avatar{width:28px;height:28px;border-radius:50%;display:grid;place-items:center;background:var(--avatar-color);color:#fff;font-size:12px;font-weight:800;border:2px solid var(--ttt-sheet-surface);margin-inline-start:-8px}
.ttt-sheet__presence-label{font-size:12px;color:var(--ttt-sheet-muted);margin-inline-start:6px}
.ttt-sheet__row-locked td{box-shadow:inset 0 2px 0 color-mix(in srgb,var(--ttt-sheet-primary) 60%,transparent),inset 0 -2px 0 color-mix(in srgb,var(--ttt-sheet-primary) 60%,transparent)}
.ttt-sheet__wide-dialog{width:min(1100px,96vw);max-height:92vh}
.ttt-sheet__wide-dialog form{max-height:88vh;overflow:auto}
.ttt-sheet__history-tabs,.ttt-sheet__dashboard-controls{display:flex;gap:8px;align-items:end;flex-wrap:wrap}
.ttt-sheet__history-content{min-height:300px;max-height:58vh;overflow:auto;border:1px solid var(--ttt-sheet-border);border-radius:10px;padding:10px}
.ttt-sheet__history-content table{width:100%;border-collapse:collapse;font-size:12px}
.ttt-sheet__history-content th,.ttt-sheet__history-content td{border:1px solid var(--ttt-sheet-border);padding:7px;text-align:right}
.ttt-sheet__version-card{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:10px;border-bottom:1px solid var(--ttt-sheet-border)}
.ttt-sheet__version-card small{display:block;color:var(--ttt-sheet-muted);margin-top:4px}
.ttt-sheet__dashboard-controls label{display:grid;gap:5px;font-size:12px}.ttt-sheet__dashboard-controls select{min-width:160px}
.ttt-sheet__dashboard-summary{display:grid;grid-template-columns:repeat(3,minmax(120px,1fr));gap:10px;margin:16px 0}
.ttt-sheet__dashboard-summary>div{border:1px solid var(--ttt-sheet-border);border-radius:12px;padding:14px;background:var(--ttt-sheet-bg)}
.ttt-sheet__dashboard-summary strong{display:block;font-size:24px}.ttt-sheet__dashboard-summary span{color:var(--ttt-sheet-muted);font-size:12px}
.ttt-sheet__dashboard-chart{display:grid;gap:8px;border:1px solid var(--ttt-sheet-border);border-radius:12px;padding:12px;max-height:50vh;overflow:auto}
.ttt-sheet__bar-row{display:grid;grid-template-columns:minmax(130px,220px) 1fr 70px;gap:10px;align-items:center;font-size:12px}.ttt-sheet__bar-row>div{height:16px;border-radius:999px;background:var(--ttt-sheet-bg);overflow:hidden}.ttt-sheet__bar-row i{display:block;height:100%;background:var(--ttt-sheet-primary);border-radius:inherit}
@media(max-width:720px){.ttt-sheet__dashboard-summary{grid-template-columns:1fr}.ttt-sheet__bar-row{grid-template-columns:100px 1fr 50px}.ttt-sheet__presence-label{display:none}}

/* نسخه ۵ نهایی: Ribbon رنگی، منوی راست‌کلیک، فیلتر سریع و فرم‌ساز */
.ttt-sheet__ribbon{background:var(--ttt-sheet-surface);border:1px solid var(--ttt-sheet-border);border-radius:var(--ttt-sheet-radius) var(--ttt-sheet-radius) 0 0;overflow:visible;margin-bottom:0}
.ttt-sheet__ribbon-top{display:flex;align-items:center;gap:12px;padding:10px 12px;border-bottom:1px solid var(--ttt-sheet-border)}
.ttt-sheet__ribbon-tabs{display:flex;gap:2px;padding:0 8px;border-bottom:1px solid var(--ttt-sheet-border);overflow:auto}
.ttt-sheet__ribbon-tab{border:0;background:transparent;color:var(--ttt-sheet-muted);font:inherit;font-weight:700;padding:10px 15px;cursor:pointer;white-space:nowrap;border-bottom:3px solid transparent}
.ttt-sheet__ribbon-tab:hover,.ttt-sheet__ribbon-tab.is-active{color:var(--ttt-sheet-primary);border-bottom-color:var(--ttt-sheet-primary);background:var(--ttt-sheet-primary-soft)}
.ttt-sheet__ribbon-panel{display:none;align-items:center;gap:8px;flex-wrap:wrap;min-height:58px;padding:10px 12px}
.ttt-sheet__ribbon-panel.is-active{display:flex}
.ttt-sheet__action{height:38px;border:0;border-radius:9px;padding:0 14px;font:inherit;font-weight:700;cursor:pointer;color:#fff;box-shadow:0 2px 6px rgba(15,23,42,.12);transition:transform .12s ease,filter .12s ease}
.ttt-sheet__action--icon{width:36px;min-width:36px;padding:0;font-size:20px;line-height:1}
.ttt-sheet__action:hover{filter:brightness(.96);transform:translateY(-1px)}
.ttt-sheet__action--blue{background:#2563eb}.ttt-sheet__action--green{background:#15803d}.ttt-sheet__action--purple{background:#7c3aed}.ttt-sheet__action--orange{background:#d97706}.ttt-sheet__action--red{background:#c62828}.ttt-sheet__action--dark{background:#334155}.ttt-sheet__action--yellow{background:#ca8a04}.ttt-sheet__action--gray{background:#64748b}
.ttt-sheet__quick-filter-row th{top:44px!important;z-index:5;background:var(--ttt-sheet-surface)!important;padding:4px!important;height:42px!important}
.ttt-sheet__quick-filter-input{width:100%;height:31px;border:1px solid var(--ttt-sheet-border);border-radius:6px;padding:0 7px;font:inherit;background:var(--ttt-sheet-surface);color:inherit}
.ttt-sheet__context-menu{position:fixed;z-index:9999;min-width:180px;background:var(--ttt-sheet-surface);border:1px solid var(--ttt-sheet-border);border-radius:10px;box-shadow:0 14px 40px rgba(15,23,42,.22);padding:6px}
.ttt-sheet__context-menu button{display:block;width:100%;border:0;background:transparent;text-align:right;padding:9px 10px;border-radius:7px;font:inherit;color:inherit;cursor:pointer}
.ttt-sheet__context-menu button:hover{background:var(--ttt-sheet-primary-soft);color:var(--ttt-sheet-primary)}
.ttt-sheet__form-preview{border:1px solid var(--ttt-sheet-border);border-radius:12px;padding:14px;background:var(--ttt-sheet-bg);display:grid;grid-template-columns:repeat(2,minmax(180px,1fr));gap:12px}
.ttt-sheet__form-preview label{display:grid;gap:6px}.ttt-sheet__form-preview input,.ttt-sheet__form-preview select{height:38px;border:1px solid var(--ttt-sheet-border);border-radius:8px;padding:0 9px;font:inherit;background:#fff}
.ttt-sheet__grid th[draggable="true"]{cursor:grab}.ttt-sheet__grid th.ttt-sheet__drag-over{outline:2px dashed var(--ttt-sheet-primary);outline-offset:-3px}
@media(max-width:720px){.ttt-sheet__ribbon-top{align-items:stretch;flex-direction:column}.ttt-sheet__form-preview{grid-template-columns:1fr}.ttt-sheet__ribbon-panel{align-items:stretch}.ttt-sheet__action{flex:1}}

/* هماهنگی مستقیم با Design System سامانه TTT */
.ttt-sheet { font-family: inherit !important; }
.ttt-sheet__header { border-bottom:2px solid var(--ttt-gold); padding-bottom:14px; }
.ttt-sheet__title { color:var(--ttt-navy); font-size:24px; }
.ttt-sheet__ribbon, .ttt-sheet__filter-panel, .ttt-sheet__dialog { border-color:var(--ttt-border); box-shadow:var(--ttt-shadow); }
.ttt-sheet__ribbon-tab.is-active { color:var(--ttt-navy); border-color:var(--ttt-gold); }
.ttt-sheet__grid th { background:var(--ttt-navy) !important; color:#fff !important; }
.ttt-sheet button, .ttt-sheet input, .ttt-sheet select, .ttt-sheet textarea { font-family:inherit !important; }
.ttt-sheet__plate-editor { background:#f9fbfd; border:1px solid var(--ttt-border); border-radius:12px; }

/* ===== V7 Sheet Manager ===== */
.ttt-sheet__sheet-tabs{display:flex;align-items:center;gap:8px;overflow-x:auto;padding:0 0 12px;margin-bottom:14px;border-bottom:1px solid var(--ttt-sheet-border)}
.ttt-sheet__sheet-tab{display:inline-flex;align-items:center;justify-content:center;min-height:38px;padding:7px 14px;border:1px solid var(--ttt-sheet-border);border-radius:9px;background:var(--ttt-sheet-surface);color:var(--ttt-sheet-text);font-weight:800;text-decoration:none;white-space:nowrap;cursor:pointer}
.ttt-sheet__sheet-tab:hover{border-color:var(--ttt-gold);color:var(--ttt-navy)}
.ttt-sheet__sheet-tab.is-active{background:var(--ttt-navy);border-color:var(--ttt-navy);color:#fff}
.ttt-sheet__sheet-tab--add{background:var(--ttt-success);border-color:var(--ttt-success);color:#fff}
.ttt-sheet__help{color:var(--ttt-sheet-muted);line-height:1.8;margin:8px 0 0}
.ttt-sheet__manager-list{display:grid;gap:10px;max-height:58vh;overflow:auto}
.ttt-sheet__manager-item{display:grid;grid-template-columns:minmax(180px,1fr) 120px auto;align-items:center;gap:12px;padding:12px;border:1px solid var(--ttt-sheet-border);border-radius:10px;background:#fff}
.ttt-sheet__manager-item>span{color:var(--ttt-sheet-muted)}
.ttt-sheet__manager-item>div{display:flex;gap:6px;flex-wrap:wrap}
.ttt-sheet__button--danger{background:var(--ttt-danger)!important;border-color:var(--ttt-danger)!important;color:#fff!important}
@media(max-width:768px){.ttt-sheet__manager-item{grid-template-columns:1fr}.ttt-sheet__manager-item>div{justify-content:flex-start}}

/* ===== V7.1 Table breathing space =====
   فقط داخل ماژول شیت اعمال می‌شود و روی قالب اصلی TTT اثری ندارد. */
.ttt-sheet {
  padding-block: 8px 22px;
}

.ttt-sheet__viewport {
  margin-block: 22px 28px;
  border-radius: var(--ttt-sheet-radius);
}

.ttt-sheet__grid tbody tr:last-child td {
  border-bottom-color: var(--ttt-sheet-border-soft, var(--ttt-sheet-border));
}

.ttt-sheet__footer {
  padding-top: 2px;
  padding-bottom: 8px;
}

@media (max-width: 720px) {
  .ttt-sheet__viewport {
    margin-block: 16px 22px;
  }
}


/* ===== V8 Final Phase 1 =====
   فقط داخل ماژول شیت؛ بدون تغییر قالب و فونت عمومی TTT. */
.ttt-sheet__grid th,
.ttt-sheet__grid td,
.ttt-sheet__row-number {
  text-align: center !important;
  vertical-align: middle !important;
}
.ttt-sheet__cell,
.ttt-sheet__select,
.ttt-sheet__grid input,
.ttt-sheet__grid select,
.ttt-sheet__plate-editor {
  text-align: center !important;
  vertical-align: middle !important;
}
.ttt-sheet__plate-editor { justify-content: center !important; }
.ttt-sheet__jalali { cursor: pointer; }
.ttt-sheet__cell--invalid {
  box-shadow: inset 0 0 0 2px var(--ttt-danger) !important;
  background: var(--ttt-danger-soft) !important;
}

/* ===== محیط مستقل شیت‌ها و اطلاعات سازمانی ===== */
.ttt-admin-workspace-menu{justify-content:flex-start;gap:24px}
.ttt-admin-workspace-menu>a{color:#fff!important;font-size:12pt;font-weight:800;white-space:nowrap;text-decoration:none;padding:19px 4px;border-bottom:3px solid transparent}
.ttt-admin-workspace-menu>a:hover,.ttt-admin-workspace-menu>a.is-active{color:var(--ttt-gold)!important;border-bottom-color:var(--ttt-gold)}
.ttt-admin-workspace-menu__back{margin-right:auto}
.ttt-admin-workspace-placeholder{min-height:360px;display:grid;place-content:center;text-align:center;gap:16px}
.ttt-admin-workspace-placeholder h1{color:var(--ttt-navy);margin:0}
.ttt-admin-workspace-placeholder p{color:#64748b;margin:0}
.ttt-intake-header-menu{height:64px;min-height:64px}
.ttt-intake-header-menu>a{display:block}
.ttt-intake-table-scroll{width:100%;max-width:100%;overflow-x:auto!important;overflow-y:hidden;padding-bottom:8px;scrollbar-gutter:stable}
.ttt-intake-table{min-width:1680px;margin-bottom:0!important}
.ttt-intake-table th,.ttt-intake-table td{white-space:nowrap}

.ttt-sheet__selectors{display:flex;align-items:flex-end;gap:10px;flex-wrap:wrap;padding:0 0 12px;margin-bottom:14px;border-bottom:1px solid var(--ttt-sheet-border)}
.ttt-sheet__selectors label{display:grid;gap:5px;min-width:230px;color:var(--ttt-sheet-muted);font-size:12px;font-weight:700}
.ttt-sheet__selectors select{height:38px;border:1px solid var(--ttt-sheet-border);border-radius:8px;background:#fff;color:var(--ttt-sheet-text);padding:0 10px;font:inherit;font-weight:700}
.ttt-sheet__selectors .ttt-sheet__sheet-tab{height:38px}
.ttt-sheet__manager-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
.ttt-sheet__manager-heading h3{margin:0}
.ttt-sheet__ribbon-top{min-height:36px;padding:5px 10px}
.ttt-sheet__ribbon-tabs{gap:0;padding:0 6px}
.ttt-sheet__ribbon-tab{padding:7px 11px;font-size:12px;border-bottom-width:2px}
.ttt-sheet__ribbon-panel{min-height:48px;padding:6px 10px}
.ttt-sheet__action{height:32px;padding:0 10px;border-radius:7px;font-size:12px}
.ttt-sheet__search--compact{display:flex;align-items:center;gap:8px;width:min(560px,100%);font-size:12px;margin:0}
.ttt-sheet__search--compact input{height:34px;min-width:0;flex:1;border:1px solid var(--ttt-sheet-border);border-radius:7px;padding:0 10px;font:inherit;background:#fff;color:inherit}
.ttt-sheet__viewport{
  height:874px;
  min-height:874px;
  max-height:874px;
  overflow-x:auto;
  overflow-y:scroll;
}

.ttt-sheet__grid tbody td,
.ttt-sheet__grid tbody input,
.ttt-sheet__grid tbody select,
.ttt-sheet__grid .ttt-sheet__row-number{
  font-weight:700!important;
}

@media(max-width:900px){
  .ttt-admin-workspace-menu{justify-content:flex-start;overflow-x:auto;gap:16px;padding-inline:18px}
  .ttt-admin-workspace-menu__back{margin-right:0}
  .ttt-sheet__selectors label{min-width:min(100%,230px);flex:1}
}

/* اصلاح چیدمان: منوی متقارن، بازگشت ثابت در چپ و کنترل‌های هم‌راستا */
.ttt-admin-workspace-menu{position:relative;justify-content:center!important;padding-inline:145px!important;gap:clamp(18px,2.8vw,46px)!important}
.ttt-admin-workspace-menu__back{position:absolute;left:40px;margin:0!important}
.ttt-sheet__selectors{display:grid!important;grid-template-columns:minmax(340px,420px) minmax(300px,360px) max-content;align-items:end!important;justify-content:start;column-gap:12px;row-gap:8px}
.ttt-sheet__selectors label{width:100%;min-width:0;margin:0}
.ttt-sheet__selectors select,.ttt-sheet__selectors .ttt-sheet__sheet-tab{width:100%;height:40px!important;margin:0!important}
.ttt-sheet__selectors .ttt-sheet__sheet-tab{width:auto;min-width:150px;align-self:end}
.ttt-sheet__import-form{display:flex;align-items:end;gap:8px;flex-wrap:wrap;padding-inline-start:10px;border-inline-start:1px solid var(--ttt-sheet-border)}
.ttt-sheet__import-file{display:grid;gap:4px;font-size:11px;font-weight:700;color:var(--ttt-sheet-muted)}
.ttt-sheet__import-file input{max-width:260px;height:32px;border:1px solid var(--ttt-sheet-border);border-radius:7px;background:#fff;padding:3px 6px;font-size:11px}
.ttt-sheet__plate-editor{width:100%;min-width:315px;box-sizing:border-box;gap:7px!important;padding-inline:8px!important;direction:ltr!important;flex-wrap:nowrap}
.ttt-sheet__plate-province,.ttt-sheet__plate-two{flex:0 0 52px!important;width:52px!important;min-width:52px!important;max-width:52px!important}
.ttt-sheet__plate-three{flex:0 0 82px!important;width:82px!important;min-width:82px!important;max-width:82px!important}
.ttt-sheet__plate-letter{flex:0 0 42px!important;width:42px!important;min-width:42px!important;max-width:42px!important}
.ttt-sheet__plate-iran-box{flex:0 0 42px;min-width:42px;text-align:center;font-size:10px;line-height:1.2}

@media(max-width:1050px){
  .ttt-admin-workspace-menu{justify-content:flex-start!important;padding-inline:18px 110px!important;overflow-x:auto}
  .ttt-admin-workspace-menu__back{left:18px;background:var(--ttt-navy-dark);padding-inline:10px!important}
  .ttt-sheet__selectors{grid-template-columns:minmax(0,1fr) minmax(0,1fr)!important}
  .ttt-sheet__selectors .ttt-sheet__sheet-tab{grid-column:1/-1;justify-self:start}
}
@media(max-width:720px){
  .ttt-sheet__viewport{height:720px;min-height:720px;max-height:720px}
  .ttt-sheet__selectors{grid-template-columns:1fr!important}
  .ttt-sheet__selectors label,.ttt-sheet__selectors select,.ttt-sheet__selectors .ttt-sheet__sheet-tab{width:100%;min-width:0}
}

.ttt-sheet__grid tbody tr.ttt-sheet__duplicate-row td{background:#ffe1e1!important;color:#8b1111}
.ttt-sheet__grid tbody tr.ttt-sheet__merged-row td{background:#e9f1f7;font-weight:800!important;text-align:center!important}
.ttt-sheet__merged-title{width:100%;min-height:38px;border:0;background:transparent;text-align:center;font:inherit;font-weight:800}
.ttt-sheet__multi-selected{box-shadow:inset 0 0 0 2px #3b82f6!important;background:#dbeafe!important}
.ttt-sheet__header-selected{box-shadow:inset 0 -3px 0 #3b82f6!important;background:#dbeafe!important;color:#0b3760!important}
.ttt-sheet__grid th,.ttt-sheet__grid td{user-select:none}
.ttt-sheet__grid input,.ttt-sheet__grid select{user-select:text}
.ttt-sheet__action{text-decoration:none!important;display:inline-flex;align-items:center;justify-content:center}
.ttt-standalone-sheet-body .ttt-main-new{padding:0!important;margin:0!important;max-width:none!important}
.ttt-sheet--standalone{padding:6px!important}
.ttt-sheet--standalone .ttt-sheet__selectors,.ttt-sheet--standalone .ttt-sheet__header{display:none!important}
.ttt-sheet--standalone .ttt-sheet__viewport{height:calc(100vh - 155px);min-height:420px;max-height:none;margin-bottom:0}
