/* Transform Iran follow-up dashboard — day theme, RTL, Farsi-first.
   Brand:  gold #B28E44  cream #F7F3E9  navy #282F39  red #E92A2E
   Font:   Estedad (self-hosted, 9 weights) */

@font-face { font-family:"Estedad"; font-style:normal; font-weight:100; font-display:swap; src:url("/assets/fonts/Estedad-Thin.ttf")        format("truetype"); }
@font-face { font-family:"Estedad"; font-style:normal; font-weight:200; font-display:swap; src:url("/assets/fonts/Estedad-ExtraLight.ttf")  format("truetype"); }
@font-face { font-family:"Estedad"; font-style:normal; font-weight:300; font-display:swap; src:url("/assets/fonts/Estedad-Light.ttf")       format("truetype"); }
@font-face { font-family:"Estedad"; font-style:normal; font-weight:400; font-display:swap; src:url("/assets/fonts/Estedad-Regular.ttf")     format("truetype"); }
@font-face { font-family:"Estedad"; font-style:normal; font-weight:500; font-display:swap; src:url("/assets/fonts/Estedad-Medium.ttf")      format("truetype"); }
@font-face { font-family:"Estedad"; font-style:normal; font-weight:600; font-display:swap; src:url("/assets/fonts/Estedad-SemiBold.ttf")    format("truetype"); }
@font-face { font-family:"Estedad"; font-style:normal; font-weight:700; font-display:swap; src:url("/assets/fonts/Estedad-Bold.ttf")        format("truetype"); }
@font-face { font-family:"Estedad"; font-style:normal; font-weight:800; font-display:swap; src:url("/assets/fonts/Estedad-ExtraBold.ttf")   format("truetype"); }
@font-face { font-family:"Estedad"; font-style:normal; font-weight:900; font-display:swap; src:url("/assets/fonts/Estedad-Black.ttf")       format("truetype"); }

:root {
  /* Transform Iran brand palette — verified against TI Impact Report 2025
     + email dashboard styles.css. See memory/brand_transform_iran.md. */
  --gold:        #B28E44;   /* wordmark + KPI numbers + decorative */
  --gold-dark:   #8E6F35;   /* gold hover / text on cream */
  --red:         #E92A2E;   /* primary CTAs + theme headlines */
  --red-dark:    #C81F23;   /* red hover */
  --navy:        #282F39;   /* body text + section chips */
  --navy-soft:   #4A5260;
  --cream:       #F7F3E9;   /* page background */
  --cream-dark:  #EDE6D2;
  --paper:       #FFFFFF;
  --line:        #E2DBC8;
  --muted:       #8A8576;
  --good:        #4F9D5A;
  --bad:         #C44545;
  --shadow-sm:   0 1px 2px rgba(40,47,57,.06);
  --shadow-md:   0 6px 18px rgba(40,47,57,.08);
  --radius:      10px;
  --radius-lg:   14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--cream);
  color: var(--navy);
  font-family: "Estedad", Tahoma, "Iran Sans", Arial, sans-serif;
  font-feature-settings: "ss03" on, "ss06" on; /* Estedad alts: rounded ع / proportional digits */
  font-size: 15px;
  line-height: 1.6;
  direction: rtl;
}

a { color: var(--gold-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { color: var(--navy); margin: 0 0 12px; line-height: 1.3; font-weight: 700; }
h1 { font-size: 24px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }

/* ------------- layout ------------- */

.app-header {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  position: sticky;
  top: 0;
  z-index: 10;
}
/* Official TI wordmark on the visual-left (RTL end). Aspect 5.85:1.
   Height drives the size; width auto-scales. */
.app-header .logo-link { display: flex; align-items: center; }
.app-header .ti-logo {
  height: 30px;
  width: auto;
  display: block;
}
/* RTL flow: brand on the right (DOM first), nav sits to its left next to it,
   user-chip pushed all the way to the visual left via inline-start:auto. */
.app-header nav { display: flex; gap: 4px; }
.app-header .user-chip { margin-inline-start: auto; }
.app-header nav a {
  padding: 8px 14px;
  border-radius: 8px;
  color: var(--navy);
  font-weight: 500;
}
.app-header nav a:hover { background: var(--cream); text-decoration: none; }
.app-header nav a.active { background: var(--gold); color: #fff; }
.app-header .user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
}
.app-header .user-chip .role { color: var(--muted); }

/* ------------- page chip (TI brand signature element) ------------- */
/* Slanted-corner rectangle — appears as the h1 banner on every page.
   Reference: TI Impact Report 2025 page-title chips. */
.page-chip {
  display: inline-block;
  background: var(--navy);
  color: #fff;
  padding: 12px 28px 12px 22px;
  font-weight: 600;
  font-size: 18px;
  line-height: 1.2;
  margin-bottom: 18px;
  /* RTL: the slanted corner points "out" on the leading edge — the right */
  clip-path: polygon(14px 0, 100% 0, 100% 100%, 0 100%);
}
.page-chip-gold { background: var(--gold); }
.page-chip-red  { background: var(--red); }

.container {
  max-width: 1200px;
  margin: 24px auto;
  padding: 0 24px 48px;
}

.card {
  background: var(--paper);
  border: 1px solid var(--cream-dark);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}

.card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--cream-dark);
}

/* ------------- forms ------------- */

label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--navy);
}

input[type=text], input[type=email], input[type=tel], input[type=number], input[type=password],
select, textarea {
  display: block;
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  color: var(--navy);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  direction: rtl;
  text-align: right;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(178,142,68,.18);
}

textarea { min-height: 90px; resize: vertical; }

.field { margin-bottom: 16px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 720px) { .field-row { grid-template-columns: 1fr; } }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 8px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  background: var(--cream);
  color: var(--navy);
  transition: all .12s;
}
.btn:hover { background: var(--cream-dark); }
/* TI brand: primary CTAs are RED (matches the www.transformiran.com pill in
   the Impact Report). Gold is reserved for accents + KPI numbers. */
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); }
.btn-gold    { background: var(--gold); color: #fff; }
.btn-gold:hover { background: var(--gold-dark); }
.btn-danger  { background: var(--red); color: #fff; }
.btn-ghost   { background: transparent; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; fill: currentColor; }

/* ------------- tables ------------- */

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
table.data th, table.data td {
  padding: 10px 12px;
  text-align: right;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
table.data th {
  background: var(--cream);
  font-weight: 600;
  font-size: 13px;
  color: var(--muted);
}
table.data tbody tr:hover { background: rgba(178,142,68,.05); }

/* ------------- badges / chips ------------- */

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: var(--cream);
  color: var(--muted);
  border: 1px solid var(--line);
}
.badge-gold   { background: rgba(178,142,68,.15); color: var(--gold-dark); border-color: rgba(178,142,68,.3); }
.badge-green  { background: rgba(79,157,90,.15);  color: var(--good);      border-color: rgba(79,157,90,.3); }
.badge-red    { background: rgba(233,42,46,.12);  color: var(--red);       border-color: rgba(233,42,46,.3); }
/* Brand-red emphasis pill — same shape as the TI Impact Report
   "Iran at a Glance" red mini-pills (white ALL-CAPS on red). */
.badge-strong {
  background: var(--red);
  color: #fff;
  border: 0;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  padding: 3px 12px;
}

/* ------------- utility ------------- */

.muted    { color: var(--muted); }
.mono     { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.row      { display: flex; gap: 12px; align-items: center; }
.row-wrap { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer   { flex: 1; }
.hidden   { display: none !important; }
.right    { text-align: left; }   /* RTL: text-align "left" appears on the right visually */
.center   { text-align: center; }

.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  border: 1px solid;
}
.alert-error   { background: rgba(233,42,46,.06); border-color: rgba(233,42,46,.3); color: var(--red); }
.alert-success { background: rgba(79,157,90,.06); border-color: rgba(79,157,90,.3); color: var(--good); }
.alert-info    { background: rgba(178,142,68,.06); border-color: rgba(178,142,68,.3); color: var(--gold-dark); }
/* TI brand "quote box" — dotted red border on cream, navy italic body.
   For testimonials, prompts, anything intentional and human. */
.quote-box {
  border: 2px dashed var(--red);
  background: var(--cream);
  padding: 16px 20px;
  border-radius: 6px;
  color: var(--navy);
  font-style: italic;
  margin: 12px 0;
}

/* TI brand "KPI card" — tiny red ALL-CAPS label, big gold number,
   dashed-gold divider, navy supporting text. (Used heavily in M6 reports.) */
.kpi {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 20px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.kpi-label { color: var(--red); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
.kpi-value { color: var(--gold); font-weight: 700; font-size: 36px; font-variant-numeric: tabular-nums; line-height: 1; }
.kpi-divider { border: 0; border-top: 1px dashed var(--gold); opacity: .5; margin: 6px 0; }
.kpi-sub { color: var(--navy-soft); font-size: 12px; }

/* TI brand "diagonal gold stripes" corner accent — for hero sections.
   45° bands, used sparingly per brand guidance. */
.gold-stripes {
  background-image: repeating-linear-gradient(
    45deg,
    var(--gold) 0 18px,
    transparent 18px 36px
  );
}

/* Icon convention — inline SVG only, never emoji.
   Reference: brand_transform_iran.md "Icons — NEVER use OS emoji" */
.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon svg { width: 16px; height: 16px; fill: currentColor; display: block; }

/* ------------- login page ------------- */

.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(at 80% 20%, rgba(178,142,68,.18) 0, transparent 50%),
    radial-gradient(at 20% 80%, rgba(40,47,57,.06) 0, transparent 50%),
    var(--cream);
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--paper);
  border-radius: 16px;
  padding: 36px;
  box-shadow: 0 10px 40px rgba(40,47,57,.12);
  border: 1px solid var(--line);
}
.login-card h1 {
  font-size: 22px;
  color: var(--gold-dark);
  margin-bottom: 6px;
  text-align: center;
}
.login-card p.sub {
  color: var(--muted);
  text-align: center;
  margin-bottom: 24px;
  font-size: 14px;
}
