:root {
  --ink: #18201f;
  --canvas: #f3f5f2;
  --forest: #144f48;
  --mint: #d8ebe4;
  --amber: #f0b44d;
  --coral: #df6b55;
  --line: #dfe5e2;
  --muted: #66736f;
}

* { box-sizing: border-box; }
html { direction: rtl; }
body { margin: 0; min-width: 320px; color: var(--ink); background: var(--canvas); font-family: Tahoma, "Segoe UI", Arial, sans-serif; }
button, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.login-view { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, .9fr) 1.1fr; }
.login-panel { min-height: 100vh; display: grid; place-items: center; padding: 40px; background: #fff; }
.login-form { width: min(100%, 440px); }
.login-logo { width: 145px; height: auto; object-fit: contain; }
.eyebrow { margin: 28px 0 0; color: var(--forest); font-size: 14px; font-weight: 800; }
.login-form h1 { margin: 8px 0 0; font-size: clamp(28px, 4vw, 36px); }
.lead { margin: 12px 0 28px; color: var(--muted); line-height: 1.8; }
.login-form label { display: block; margin-top: 18px; }
.login-form label span { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 800; }
.login-form input { width: 100%; height: 48px; border: 1px solid #cbd4d0; border-radius: 6px; padding: 0 14px; text-align: left; }
.login-form input:focus { outline: 3px solid rgba(240, 180, 77, .35); border-color: var(--forest); }
.primary-button { width: 100%; height: 48px; margin-top: 20px; border: 0; border-radius: 6px; background: var(--forest); color: #fff; font-weight: 800; }
.login-error { min-height: 20px; margin: 12px 0 0; color: #b42318; font-size: 13px; font-weight: 700; }
.security-note { color: var(--muted); font-size: 12px; }
.login-brand { min-height: 100vh; display: flex; flex-direction: column; justify-content: space-between; padding: 44px; color: #fff; background: var(--forest); }
.brand-top { display: flex; align-items: center; justify-content: space-between; font-size: 13px; }
.brand-top span { border: 1px solid rgba(255,255,255,.28); border-radius: 6px; padding: 9px 12px; }
.brand-message { max-width: 620px; }
.brand-message > p { color: var(--mint); font-weight: 800; }
.brand-message h2 { margin: 16px 0 36px; font-size: clamp(36px, 5vw, 58px); line-height: 1.3; }
.brand-metrics { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; padding-top: 24px; border-top: 1px solid rgba(255,255,255,.2); }
.brand-metrics strong, .brand-metrics span { display: block; }
.brand-metrics strong { font-size: 32px; }
.brand-metrics span { margin-top: 6px; color: rgba(255,255,255,.7); font-size: 14px; }
.login-brand small { color: rgba(255,255,255,.6); direction: ltr; text-align: left; }

.topbar { position: sticky; top: 0; z-index: 30; height: 64px; display: flex; align-items: center; gap: 12px; padding: 0 24px; border-bottom: 1px solid var(--line); background: #fff; }
.top-logo { width: 95px; height: 45px; object-fit: contain; }
.header-separator { width: 1px; height: 28px; background: var(--line); }
.header-title { min-width: 0; }
.header-title strong, .header-title small { display: block; }
.header-title small { margin-top: 3px; color: var(--muted); }
.top-actions { margin-right: auto; display: flex; }
.icon-button { width: 40px; height: 40px; display: grid; place-items: center; border: 0; background: transparent; color: #52605c; font-weight: 800; }
.app-layout { display: grid; grid-template-columns: 240px minmax(0,1fr); }
.sidebar { position: sticky; top: 64px; height: calc(100vh - 64px); padding: 14px 12px; border-left: 1px solid var(--line); background: #fff; }
.sidebar-heading { display: none; }
.role-box { padding: 13px; margin-bottom: 16px; border-radius: 6px; background: var(--mint); }
.role-box small, .role-box strong { display: block; }
.role-box small { color: var(--forest); font-weight: 800; }
.role-box strong { margin-top: 5px; }
.nav-item { width: 100%; height: 44px; display: flex; align-items: center; gap: 12px; border: 0; border-radius: 6px; padding: 0 13px; background: transparent; color: #5c6864; font-weight: 800; text-align: right; }
.nav-item:hover { background: #f0f3f2; }
.nav-item.active { background: var(--forest); color: #fff; }
.version { position: absolute; right: 14px; left: 14px; bottom: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.version strong, .version span { display: block; font-size: 12px; }
.version span { margin-top: 4px; color: var(--muted); }
.content { min-width: 0; padding: 26px; }
.content-inner { max-width: 1500px; margin: auto; }
.welcome { display: flex; align-items: end; justify-content: space-between; gap: 22px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.welcome .eyebrow { margin: 0; }
.welcome h1 { margin: 7px 0 8px; font-size: clamp(26px,4vw,36px); }
.welcome > div > p:last-child { margin: 0; color: var(--muted); }
.search { position: relative; width: 320px; flex: 0 0 auto; }
.search span { position: absolute; right: 13px; top: 9px; color: var(--muted); font-size: 22px; }
.search input { width: 100%; height: 44px; padding: 0 40px 0 12px; border: 1px solid #cbd4d0; border-radius: 6px; background: #fff; }
.summary-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; margin-top: 24px; }
.summary { position: relative; min-height: 145px; padding: 18px; border: 1px solid var(--line); border-radius: 6px; background: #fff; box-shadow: 0 14px 40px rgba(20,79,72,.06); }
.summary small { display: block; color: var(--muted); font-weight: 800; }
.summary > strong { display: block; margin-top: 12px; font-size: 32px; }
.summary p { margin: 17px 0 0; color: var(--muted); font-size: 12px; font-weight: 700; }
.summary-icon { position: absolute; top: 16px; left: 16px; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 6px; font-weight: 900; }
.summary-icon.green { color: var(--forest); background: var(--mint); }
.summary-icon.yellow { color: #805600; background: #fff0c9; }
.summary-icon.red { color: var(--coral); background: #fae3de; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0,1.55fr) minmax(320px,.75fr); gap: 24px; margin-top: 24px; }
.main-column, .side-column { min-width: 0; display: grid; gap: 24px; align-content: start; }
.panel { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: #fff; box-shadow: 0 14px 40px rgba(20,79,72,.06); }
.panel > header { min-height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.panel h2 { margin: 0; font-size: 16px; }
.panel header button { border: 0; background: transparent; color: var(--forest); font-size: 12px; font-weight: 800; }
.table-wrap { max-width: 100%; overflow-x: auto; }
table { width: 100%; min-width: 760px; border-collapse: collapse; font-size: 13px; }
th { padding: 12px 14px; color: var(--muted); background: #f7f9f8; text-align: right; font-size: 11px; }
td { padding: 13px 14px; border-top: 1px solid #eef1f0; white-space: nowrap; }
.badge { display: inline-block; border-radius: 4px; padding: 5px 8px; font-size: 11px; font-weight: 800; }
.badge.ok { color: #087a55; background: #e8f7f1; }
.badge.warn { color: #8a5a00; background: #fff3d7; }
.badge.danger { color: #b42318; background: #fff0ee; }
.task-row { display: grid; grid-template-columns: 1.1fr .9fr 1.45fr .85fr auto; gap: 10px; align-items: center; padding: 15px 16px; border-top: 1px solid #eef1f0; font-size: 13px; }
.task-row:first-child { border-top: 0; }
.task-row strong { font-size: 13px; }
.task-row span { color: var(--muted); }
.platforms { padding: 8px; }
.platform { width: 100%; display: grid; grid-template-columns: 40px minmax(0,1fr) auto; gap: 11px; align-items: center; padding: 12px; border: 0; border-radius: 6px; background: transparent; text-align: right; }
.platform:hover { background: #f6f8f7; }
.platform-letter { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 6px; color: var(--forest); background: var(--mint); font-weight: 900; }
.platform-copy strong, .platform-copy small, .platform-balance strong, .platform-balance small { display: block; }
.platform-copy { min-width: 0; }
.platform-copy strong { direction: ltr; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.platform-copy small, .platform-balance small { margin-top: 4px; color: var(--muted); }
.platform-balance { text-align: left; }
.alerts { display: grid; gap: 12px; padding: 16px; }
.alert { border-radius: 6px; padding: 13px; }
.alert strong { font-size: 13px; }
.alert p { margin: 6px 0 0; font-size: 12px; line-height: 1.7; }
.alert.danger { color: #a52a22; background: #fff0ee; }
.alert.warning { color: #765000; background: #fff4d9; }
.alert.success { color: #087452; background: #e9f7f1; }
.mobile-only { display: none; }

@media (max-width: 1050px) {
  .summary-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .dashboard-grid { grid-template-columns: minmax(0,1fr); }
}

@media (max-width: 760px) {
  .login-view { display: block; }
  .login-brand { display: none; }
  .login-panel { padding: 28px 20px; }
  .mobile-only { display: grid; }
  .topbar { padding: 0 12px; }
  .header-separator, .header-title small { display: none; }
  .header-title strong { max-width: 145px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
  .app-layout { display: block; }
  .sidebar { position: fixed; top: 0; right: 0; z-index: 60; width: 285px; height: 100vh; transform: translateX(100%); transition: transform .2s ease; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-heading { height: 48px; display: flex; align-items: center; justify-content: space-between; }
  .sidebar-overlay { position: fixed; inset: 0; z-index: 50; border: 0; background: rgba(0,0,0,.35); }
  .content { padding: 20px 14px; overflow: hidden; }
  .welcome { display: block; }
  .search { display: block; width: 100%; margin-top: 18px; }
  .summary-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .summary { min-height: 140px; padding: 14px; }
  .summary > strong { font-size: 27px; }
  .summary-icon { position: static; margin-bottom: 12px; }
  .task-row { grid-template-columns: 1fr auto; }
  .task-row span:nth-child(2), .task-row span:nth-child(3) { grid-column: 1 / -1; }
}

@media (max-width: 420px) {
  .summary-grid { grid-template-columns: 1fr; }
  .top-logo { width: 74px; }
}
