/* Shetab administration — Persian, calm, accessible and responsive. */
:root,
html[data-theme="light"],
html[data-theme="dark"] {
  --primary: #006276;
  --primary-strong: #004d5e;
  --network: #16a3ad;
  --action: #13a875;
  --impact: #e8a923;
  --danger: #c94b45;
  --ink: #27363a;
  --muted: #66757a;
  --line: #dbe7e7;
  --surface: #ffffff;
  --canvas: #f4fafa;
  --sidebar: #173f42;
  --sidebar-hover: #24565a;
  --header-bg: #ffffff;
  --header-color: var(--ink);
  --body-bg: var(--canvas);
  --body-fg: var(--ink);
  --body-quiet-color: var(--muted);
  --body-loud-color: var(--ink);
  --breadcrumbs-bg: #e8f4f4;
  --breadcrumbs-fg: var(--primary);
  --link-fg: var(--primary);
  --link-hover-color: var(--network);
  --hairline-color: var(--line);
  --border-color: var(--line);
  --darkened-bg: #eef6f6;
  --selected-bg: #e1f2f2;
  --selected-row: #edf8f6;
  --button-bg: var(--primary);
  --button-hover-bg: var(--primary-strong);
  --default-button-bg: var(--action);
  --default-button-hover-bg: #0d8b60;
  --delete-button-bg: var(--danger);
  --object-tools-bg: var(--primary);
  --object-tools-hover-bg: var(--primary-strong);
  --close-button-bg: #718085;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { direction: rtl; background: var(--canvas); }
body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: Vazirmatn, IRANSans, Tahoma, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.8;
}
a:link, a:visited { color: var(--primary); }
a:hover, a:focus { color: var(--network); }

/* Header */
#header {
  min-height: 82px;
  padding: 12px 28px;
  background: var(--surface);
  color: var(--ink);
  border-top: 5px solid var(--primary);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 5px 22px rgba(20, 75, 80, .07);
  align-items: center;
  gap: 22px;
}
#branding { min-width: 290px; }
.shetab-admin-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink) !important;
  text-decoration: none;
}
.shetab-admin-brand img {
  width: 54px;
  height: 54px;
  object-fit: contain;
  border-radius: 14px;
  background: #fff;
}
.shetab-admin-brand span { display: flex; flex-direction: column; line-height: 1.35; }
.shetab-admin-brand strong { font-size: 20px; color: var(--primary); }
.shetab-admin-brand small { margin-top: 4px; color: var(--muted); font-size: 11px; }
#user-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 auto 0 0;
  color: var(--muted);
  font-size: 13px;
}
#user-tools a { border: 0; color: var(--primary); font-weight: 700; }
#user-tools form { display: inline; }
#user-tools button { color: var(--primary); font-weight: 700; }
.shetab-welcome:before { content: "خوش آمدید، "; color: var(--muted); }
.shetab-welcome { color: var(--ink); font-weight: 800; }
.shetab-public-link {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 8px 18px;
  color: #fff !important;
  background: var(--primary);
  border-radius: 12px;
  text-decoration: none;
  font-weight: 800;
}
.shetab-public-link:before { content: "↗"; margin-left: 7px; }

/* Layout and right navigation */
#container { min-width: 0; }
.main { align-items: stretch; }
#nav-sidebar {
  flex: 0 0 270px;
  order: -1;
  min-height: calc(100vh - 82px);
  padding: 20px 14px;
  background: var(--sidebar);
  border: 0;
  color: #fff;
  right: 0;
}
.toggle-nav-sidebar {
  right: 270px;
  left: auto;
  border-right: 0;
  border-left: 1px solid var(--line);
  color: var(--primary);
  background: #fff;
}
.main.shifted > #nav-sidebar { margin-right: -271px; margin-left: 0; }
.main.shifted > #content-start { max-width: 100%; }
#nav-filter {
  width: 100%;
  margin: 0 0 18px;
  padding: 10px 13px;
  color: #fff;
  background: rgba(255,255,255,.09);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 10px;
}
#nav-filter::placeholder { color: rgba(255,255,255,.65); }
#nav-sidebar .module { margin: 0; background: transparent; border: 0; box-shadow: none; }
#nav-sidebar .module caption {
  padding: 10px 12px 8px;
  color: rgba(255,255,255,.55);
  background: transparent;
  font-size: 11px;
  font-weight: 800;
}
#nav-sidebar table { width: 100%; }
#nav-sidebar tr { border: 0; }
#nav-sidebar th, #nav-sidebar td { padding: 0; }
#nav-sidebar a {
  display: block;
  margin: 2px 0;
  padding: 10px 12px;
  color: rgba(255,255,255,.86);
  border-radius: 9px;
  text-decoration: none;
  transition: .15s ease;
}
#nav-sidebar a:hover { color: #fff; background: var(--sidebar-hover); }
#nav-sidebar .current-model { background: rgba(22,163,173,.18); }
#nav-sidebar .current-model a { color: #fff; font-weight: 800; }
#nav-sidebar .addlink { font-size: 0; text-align: center; }
#nav-sidebar .addlink:after { content: "+"; font-size: 17px; color: #a9ded5; }
#content-start { min-width: 0; flex: 1; }
#content { padding: 30px 34px 55px; }
.breadcrumbs {
  padding: 12px 34px;
  color: var(--muted);
  background: #eaf5f5;
  border: 0;
}
.breadcrumbs a { color: var(--primary); font-weight: 700; }

/* Page headings and toolbar */
h1 { margin: 0 0 22px; color: var(--ink); font-size: 29px; font-weight: 900; }
h2 { color: var(--ink); font-weight: 900; }
.object-tools { margin-top: -55px; }
.object-tools a:link, .object-tools a:visited {
  min-height: 40px;
  padding: 8px 16px;
  border-radius: 11px;
  background: var(--primary);
  font-weight: 800;
}
.object-tools a.addlink:before { content: "+ "; }
.object-tools a.addlink:after { display: none; }

/* Common cards, lists and forms */
.module,
#changelist .changelist-form-container,
#changelist-filter,
.inline-group,
.submit-row {
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  box-shadow: 0 8px 28px rgba(30, 77, 81, .06);
  overflow: hidden;
}
.module h2, .module caption, .inline-group h2 {
  padding: 13px 18px;
  color: var(--ink);
  background: #eaf5f5;
  font-size: 15px;
  font-weight: 900;
}
.aligned label { width: 190px; color: var(--ink); font-weight: 800; }
.aligned .form-row { padding: 17px 20px; border-bottom-color: #edf3f3; }
.form-row.errors { border: 1px solid #efb2ad; background: #fff5f4; }
.help, p.help, form p.help, div.help, form div.help, div.help li { color: var(--muted); font-size: 12px; }
input, textarea, select, .vTextField {
  max-width: 100%;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #cbdada;
  border-radius: 9px;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus, .vTextField:focus {
  border-color: var(--network);
  box-shadow: 0 0 0 3px rgba(22,163,173,.13);
  outline: 0;
}
input[type="checkbox"] { accent-color: var(--action); width: 17px; height: 17px; }
select { min-height: 40px; }
.select2-container--admin-autocomplete .select2-selection--single {
  min-height: 40px;
  padding-top: 5px;
  border-color: #cbdada;
  border-radius: 9px;
}
fieldset.collapse summary { color: var(--primary); font-weight: 800; }
.submit-row { padding: 14px 18px; position: sticky; bottom: 10px; z-index: 3; }
.submit-row input, .button, input[type=submit], input[type=button], .submit-row a.deletelink {
  min-height: 40px;
  padding: 9px 18px;
  border: 0;
  border-radius: 10px;
  font-family: inherit;
  font-weight: 900;
  cursor: pointer;
}
.submit-row input.default { background: var(--action); }
.submit-row a.deletelink { display: inline-flex; align-items: center; }

/* Change lists */
#changelist { display: flex; gap: 20px; align-items: flex-start; }
#changelist .changelist-form-container { flex: 1; min-width: 0; }
#changelist-filter { flex: 0 0 230px; padding-bottom: 12px; }
#changelist-filter h2 { border-radius: 0; }
#changelist-filter h3 { margin: 15px 14px 4px; color: var(--ink); font-size: 13px; }
#changelist-filter li { margin: 1px 8px; }
#changelist-filter a { display: block; padding: 5px 8px; border-radius: 7px; }
#changelist-filter li.selected a { color: var(--primary); background: #e4f4f1; font-weight: 900; }
#changelist-search { padding: 14px; border-bottom: 1px solid var(--line); }
#changelist-search #searchbar { min-height: 40px; }
#changelist-search input[type=submit] { background: var(--primary); }
.actions { padding: 12px 15px !important; background: #f8fbfb; }
.actions select { min-width: 240px; }
.results { overflow-x: auto; }
.results table { width: 100%; }
thead th { padding: 13px 10px; color: var(--ink); background: #edf7f7; font-weight: 900; }
tbody tr:nth-child(even) { background: #fbfdfd; }
tbody tr:hover { background: #f0f8f7; }
tbody td, tbody th { padding: 13px 10px; border-bottom: 1px solid #e8eeee; vertical-align: middle; }
.paginator { padding: 15px !important; border-top: 1px solid var(--line); }

/* Dashboard */
.shetab-dashboard #content { max-width: 1500px; }
.shetab-dashboard-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 25px;
  margin-bottom: 22px;
  padding: 28px 30px;
  color: #fff;
  background: linear-gradient(125deg, var(--primary-strong), var(--primary) 60%, var(--network));
  border-radius: 20px;
  box-shadow: 0 16px 40px rgba(0,98,118,.20);
}
.shetab-dashboard-hero h1 { margin: 3px 0 5px; color: #fff; font-size: 27px; }
.shetab-dashboard-hero p { margin: 0; color: rgba(255,255,255,.82); }
.shetab-kicker { color: var(--network); font-size: 11px; font-weight: 900; letter-spacing: .02em; }
.shetab-dashboard-hero .shetab-kicker { color: #a9e7df; }
.shetab-hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.shetab-hero-actions .button { display: inline-flex; align-items: center; text-decoration: none; white-space: nowrap; }
.shetab-hero-actions .primary { color: var(--primary) !important; background: #fff; }
.shetab-hero-actions .secondary { color: #fff !important; background: rgba(255,255,255,.13); border: 1px solid rgba(255,255,255,.32); }
.shetab-kpis { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin: 0 0 22px; }
.shetab-kpis > a {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 18px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 15px;
  text-decoration: none;
  box-shadow: 0 7px 22px rgba(30,77,81,.05);
}
.shetab-kpis > a:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(30,77,81,.10); }
.shetab-kpis span { display: flex; flex-direction: column; line-height: 1.45; }
.shetab-kpis strong { color: var(--ink); font-size: 25px; }
.shetab-kpis small { color: var(--muted); }
.kpi-icon { display: grid; place-items: center; width: 45px; height: 45px; border-radius: 13px; font-style: normal; font-size: 22px; }
.kpi-icon.project { color: var(--primary); background: #dff1f4; }
.kpi-icon.center { color: #bd7c0b; background: #fff2d5; }
.kpi-icon.actor { color: #0c8c62; background: #ddf5ec; }
.kpi-icon.user { color: #6463a8; background: #eeeeff; }
.shetab-dashboard-grid { display: grid; grid-template-columns: minmax(0,1.8fr) minmax(300px,1fr); gap: 20px; }
.shetab-card { background: #fff; border: 1px solid var(--line); border-radius: 17px; box-shadow: 0 8px 28px rgba(30,77,81,.06); overflow: hidden; }
.shetab-card-head { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.shetab-card-head h2 { margin: 2px 0 0; font-size: 18px; }
.shetab-card-head > a { font-weight: 800; text-decoration: none; }
.shetab-shortcuts { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); padding: 7px; }
.shetab-shortcuts > a {
  display: grid;
  grid-template-columns: 40px 1fr 20px;
  align-items: center;
  gap: 10px;
  margin: 5px;
  padding: 14px;
  color: var(--ink);
  border: 1px solid #e7eeee;
  border-radius: 12px;
  text-decoration: none;
}
.shetab-shortcuts > a:hover { background: #f0f9f8; border-color: #badede; }
.shetab-shortcuts i { display: grid; place-items: center; width: 38px; height: 38px; color: var(--primary); background: #e6f3f4; border-radius: 10px; font-size: 20px; font-style: normal; }
.shetab-shortcuts span { display: flex; flex-direction: column; min-width: 0; }
.shetab-shortcuts b { color: var(--ink); }
.shetab-shortcuts small { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.shetab-shortcuts em { color: var(--network); font-style: normal; font-size: 19px; }
.shetab-queues { display: grid; gap: 20px; align-content: start; }
.queue-count { padding: 15px 20px 6px; color: var(--primary); font-size: 28px; font-weight: 900; }
.queue-count small { color: var(--muted); font-size: 12px; font-weight: 500; }
.queue-count.impact { color: #bd7c0b; }
.queue-count.action { color: var(--action); }
.queue-list { padding: 5px 12px 14px; }
.queue-list a { display: flex; flex-direction: column; padding: 10px; color: var(--ink); border-radius: 9px; text-decoration: none; }
.queue-list a:hover { background: #f1f8f8; }
.queue-list b { font-size: 13px; }
.queue-list small, .queue-list p { color: var(--muted); font-size: 11px; }

/* Status components */
.shetab-badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 900; white-space: nowrap; }
.shetab-badge.primary { color: #005164; background: #dbeff2; }
.shetab-badge.network { color: #057982; background: #dff4f5; }
.shetab-badge.action { color: #087b56; background: #dff5ec; }
.shetab-badge.impact { color: #9a6508; background: #fff0cc; }
.shetab-badge.danger { color: #a53630; background: #fde6e3; }
.shetab-badge.neutral { color: #5d6b70; background: #eaf0f0; }
.shetab-progress { position: relative; width: 112px; height: 24px; overflow: hidden; background: #e8efef; border-radius: 999px; }
.shetab-progress i { display: block; height: 100%; background: linear-gradient(90deg,var(--action),#4fc99f); }
.shetab-progress span { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink); font-size: 10px; font-weight: 900; }
.shetab-json-editor { width: min(100%, 900px) !important; font-family: Consolas, monospace !important; direction: ltr; text-align: left; line-height: 1.6; }
.messagelist { margin: 0 0 20px; padding: 0; }
.messagelist li { padding: 12px 16px; border-radius: 10px; border: 1px solid #cfe2df; box-shadow: 0 5px 18px rgba(30,77,81,.05); }
.messagelist li.success { color: #087b56; background: #e4f6ef; }
.errornote, ul.errorlist { border-radius: 9px; }
#footer { display: flex; justify-content: center; gap: 8px; padding: 24px; color: var(--muted); }
#footer span { color: var(--primary); font-weight: 900; }

/* Login */
body.login { min-height: 100vh; background: radial-gradient(circle at 85% 10%,#d8f1ed,transparent 34%), var(--canvas); }
.login #container { width: min(430px, calc(100% - 30px)); margin-top: 8vh; border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 22px 60px rgba(23,63,66,.15); overflow: hidden; }
.login #header { min-height: 110px; padding: 18px 24px; justify-content: center; border-top-width: 6px; }
.login #branding { min-width: 0; }
.login .shetab-admin-brand small { max-width: 250px; }
.login #content { padding: 28px; }
.login .form-row { padding: 8px 0; }
.login .form-row label { color: var(--ink); font-weight: 800; }
.login .form-row #id_username, .login .form-row #id_password { width: 100%; min-height: 46px; }
.login .submit-row { position: static; padding: 12px 0 0; border: 0; box-shadow: none; }
.login .submit-row input { width: 100%; min-height: 46px; background: var(--primary); }

@media (max-width: 1050px) {
  .shetab-kpis { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .shetab-dashboard-grid { grid-template-columns: 1fr; }
  #nav-sidebar { flex-basis: 235px; }
  .toggle-nav-sidebar { right: 235px; }
  .main.shifted > #nav-sidebar { margin-right: -236px; }
}
@media (max-width: 767px) {
  #header { min-height: 70px; padding: 9px 14px; flex-wrap: wrap; }
  #branding { min-width: 0; flex: 1; }
  .shetab-admin-brand img { width: 43px; height: 43px; }
  .shetab-admin-brand strong { font-size: 17px; }
  .shetab-admin-brand small, .shetab-welcome, #user-tools > a:not(:last-child) { display: none; }
  #user-tools { margin: 0; }
  .shetab-public-link { min-height: 36px; padding: 6px 10px; font-size: 11px; }
  #content { padding: 20px 14px 40px; }
  .breadcrumbs { padding: 10px 14px; }
  .shetab-dashboard-hero { align-items: flex-start; flex-direction: column; padding: 22px; }
  .shetab-dashboard-hero h1 { font-size: 22px; }
  .shetab-kpis { grid-template-columns: 1fr 1fr; }
  .shetab-kpis > a { padding: 12px; }
  .shetab-shortcuts { grid-template-columns: 1fr; }
  #changelist { display: block; }
  #changelist-filter { margin-top: 15px; }
  .object-tools { float: none; display: flex; margin: 0 0 16px; padding: 0; }
  .aligned label { float: none; display: block; width: auto; padding: 0 0 5px; }
  .aligned .form-row > div { margin-left: 0; margin-right: 0; }
  .submit-row { position: static; }
}
@media (max-width: 480px) {
  .shetab-kpis { grid-template-columns: 1fr; }
  .shetab-hero-actions { width: 100%; }
  .shetab-hero-actions .button { justify-content: center; flex: 1; }
}
