/*
  TBS Plateforme Intégrée — design tokens & shared components.

  Palette derived from the real Tunis Business School wordmark/crest
  (tunis-business-school.tn): a bronze-to-gold gradient (#786124 -> #E9CF5E)
  on black/white. Institutional red (#D21034, close to the Tunisian flag
  red) is reserved for the mandatory government identity bar and is never
  used as the TBS accent — semantic vs. brand colors stay separate.

  2026 refresh: same brand tokens, pushed toward a more contemporary
  "tech-forward higher-ed" register — layered depth, refined motion,
  a dark "console" shell for the extranet/back-office SaaS-style spaces,
  full responsive audit (375 / 768 / 1024 / 1440).
*/

@import url("https://fonts.googleapis.com/css2?family=Spectral:wght@500;600;700&family=Public+Sans:wght@400;500;600;700;800&family=Cairo:wght@400;600;700&display=swap");

:root {
  /* brand */
  --tbs-gold-dark: #786124;
  --tbs-gold: #8c7530;
  --tbs-gold-mid: #a68a3d;
  --tbs-gold-light: #e9cf5e;
  --tbs-gold-wash: #f7f0dc;
  --tbs-gold-glow: rgba(233, 207, 94, 0.35);

  /* neutrals, warm-biased toward the gold */
  --tbs-ink: #211c10;
  --tbs-ink-900: #16130b;
  --tbs-ink-soft: #4a4230;
  --tbs-ink-faint: #7a715a;
  --tbs-paper: #fbf9f3;
  --tbs-surface: #ffffff;
  --tbs-surface-sunk: #f6f2e6;
  --tbs-line: #e6dfc9;
  --tbs-line-soft: #f1ecdb;
  --tbs-line-strong: #d8cea8;

  /* government identity bar */
  --gov-red: #d21034;
  --gov-red-ink: #7c0a1f;

  /* semantic (status) — deliberately distinct from the gold accent */
  --status-pending-bg: #fdf1d6;
  --status-pending-fg: #8a5a00;
  --status-progress-bg: #dfeaf9;
  --status-progress-fg: #1c5aa6;
  --status-resolved-bg: #dff2e4;
  --status-resolved-fg: #1e7d3c;
  --status-rejected-bg: #fbe3e1;
  --status-rejected-fg: #ab2b21;

  /* app shell ("console") — dark, for extranet + back-office */
  --app-bg: #0f0d07;
  --app-sidebar-bg: linear-gradient(190deg, #1b1710 0%, #14110a 70%);
  --app-sidebar-fg: rgba(255, 255, 255, 0.86);
  --app-sidebar-fg-soft: rgba(255, 255, 255, 0.48);
  --app-sidebar-border: rgba(255, 255, 255, 0.08);
  --app-sidebar-hover: rgba(255, 255, 255, 0.06);
  --app-sidebar-active-bg: rgba(233, 207, 94, 0.14);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-pill: 999px;

  --shadow-xs: 0 1px 2px rgba(23, 19, 10, 0.06);
  --shadow-sm: 0 2px 8px rgba(23, 19, 10, 0.07), 0 1px 2px rgba(23, 19, 10, 0.05);
  --shadow-md: 0 8px 24px rgba(23, 19, 10, 0.10), 0 2px 6px rgba(23, 19, 10, 0.06);
  --shadow-lg: 0 20px 48px rgba(23, 19, 10, 0.16), 0 4px 12px rgba(23, 19, 10, 0.08);
  --shadow-card: var(--shadow-sm);
  --shadow-gold: 0 10px 28px rgba(140, 117, 48, 0.28);

  --ease: 180ms cubic-bezier(0.2, 0.7, 0.3, 1);
  --ease-slow: 320ms cubic-bezier(0.2, 0.7, 0.3, 1);

  --font-display: "Spectral", "Georgia", serif;
  --font-body: "Public Sans", "Segoe UI", system-ui, sans-serif;
  --font-ar: "Cairo", "Segoe UI", system-ui, sans-serif;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--tbs-paper);
  color: var(--tbs-ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
}

html[lang="ar"] body,
[dir="rtl"] body { font-family: var(--font-ar); }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
  text-wrap: balance;
  margin: 0 0 0.5em;
  color: var(--tbs-ink);
}
html[lang="ar"] h1, html[lang="ar"] h2, html[lang="ar"] h3, html[lang="ar"] h4 { font-family: var(--font-ar); }

h1 { font-size: clamp(1.9rem, 1.5rem + 1.8vw, 2.75rem); letter-spacing: -0.01em; }
h2 { font-size: clamp(1.4rem, 1.2rem + 0.9vw, 1.9rem); letter-spacing: -0.005em; }
h3 { font-size: 1.2rem; }

p { margin: 0 0 1em; max-width: 68ch; }
a { color: var(--tbs-gold-dark); transition: color var(--ease); }
a:hover { color: var(--tbs-ink); }

:focus-visible {
  outline: 2px solid var(--tbs-gold-mid);
  outline-offset: 2px;
  border-radius: 3px;
}

.skip-link {
  position: absolute;
  inset-inline-start: 12px;
  top: -60px;
  background: var(--tbs-ink);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  z-index: 1000;
  transition: top var(--ease);
}
.skip-link:focus { top: 12px; }

.container {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 24px;
}
@media (max-width: 640px) { .container { padding: 0 18px; } }

.uppercase-label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--tbs-gold-dark);
}

.icon { width: 18px; height: 18px; flex: none; display: inline-block; vertical-align: -3px; }
.icon-lg { width: 22px; height: 22px; }
.icon-sm { width: 15px; height: 15px; }

/* -------------------------------------------------------------------- */
/* Government identity bar (mandatory, front office only)               */
/* -------------------------------------------------------------------- */

.gov-bar {
  background: var(--gov-red);
  background-image: linear-gradient(90deg, var(--gov-red), #b90d2c 60%, var(--gov-red-ink));
  color: #fff;
  font-size: 0.82rem;
}
.gov-bar .container {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 7px;
  padding-bottom: 7px;
  flex-wrap: wrap;
}
.gov-bar .flag {
  width: 22px;
  height: 15px;
  border-radius: 2px;
  flex: none;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.4);
}
.gov-bar strong { font-weight: 700; }
.gov-bar .sep { opacity: 0.6; }
.gov-bar .gov-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
@media (max-width: 480px) { .gov-bar { font-size: 0.74rem; } }

/* -------------------------------------------------------------------- */
/* Front-office header                                                  */
/* -------------------------------------------------------------------- */

.tbs-header {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--tbs-line);
  position: sticky;
  top: 0;
  z-index: 60;
  box-shadow: 0 1px 0 rgba(23,19,10,0.02);
}
.tbs-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-top: 13px;
  padding-bottom: 13px;
}
.tbs-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.tbs-crest {
  width: 46px; height: 46px; border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, var(--tbs-gold-light), var(--tbs-gold-dark) 78%);
  box-shadow: 0 3px 10px rgba(120, 97, 36, 0.35), inset 0 0 0 1px rgba(255,255,255,0.25);
  display: flex; align-items: center; justify-content: center;
  color: #241d08; font-family: var(--font-display); font-weight: 700; font-size: 1.1rem;
  flex: none;
  transition: transform var(--ease);
}
.tbs-brand:hover .tbs-crest { transform: scale(1.05) rotate(-2deg); }
.tbs-brand-text { line-height: 1.15; }
.tbs-brand-text .top { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; }
.tbs-brand-text .bottom { font-size: 0.76rem; color: var(--tbs-ink-soft); text-transform: uppercase; letter-spacing: 0.05em; }

.tbs-nav-group { display: flex; align-items: center; gap: 16px; }

.tbs-nav { display: flex; align-items: center; gap: 18px; flex-wrap: nowrap; }
.tbs-nav a {
  position: relative;
  text-decoration: none; color: var(--tbs-ink); font-weight: 600; font-size: 0.94rem;
  padding: 6px 2px;
}
.tbs-nav a::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: 0; height: 2px;
  background: var(--tbs-gold); transition: right var(--ease);
}
.tbs-nav a:hover, .tbs-nav a.active { color: var(--tbs-gold-dark); }
.tbs-nav a:hover::after, .tbs-nav a.active::after { right: 0; }

.mobile-toggle {
  display: none;
  align-items: center; justify-content: center;
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--tbs-line);
  background: var(--tbs-surface);
  color: var(--tbs-ink);
  cursor: pointer;
  flex: none;
}
.mobile-toggle .icon-x { display: none; }
.mobile-toggle[aria-expanded="true"] .icon-menu { display: none; }
.mobile-toggle[aria-expanded="true"] .icon-x { display: inline-block; }

.lang-switch { display: flex; gap: 4px; }
.lang-switch button {
  border: 1px solid var(--tbs-line); background: var(--tbs-surface); color: var(--tbs-ink-soft);
  font: inherit; font-size: 0.78rem; font-weight: 700; padding: 5px 9px; border-radius: var(--radius-pill); cursor: pointer;
  transition: background var(--ease), color var(--ease), border-color var(--ease);
}
.lang-switch button:hover { border-color: var(--tbs-gold-mid); color: var(--tbs-gold-dark); }
.lang-switch button[aria-current="true"] { background: var(--tbs-gold-dark); border-color: var(--tbs-gold-dark); color: #fff; }

@media (max-width: 960px) {
  .mobile-toggle { display: inline-flex; }
  .tbs-nav {
    position: absolute;
    inset-inline: 0;
    top: 100%;
    z-index: 55;
    background: var(--tbs-surface);
    border-bottom: 1px solid var(--tbs-line);
    box-shadow: var(--shadow-md);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    max-height: 0;
    overflow: hidden;
    padding: 0 24px;
    transition: max-height var(--ease-slow);
  }
  .tbs-nav.open { max-height: 80vh; overflow-y: auto; padding-top: 8px; padding-bottom: 18px; }
  .tbs-nav a { padding: 13px 4px; border-bottom: 1px solid var(--tbs-line-soft); }
  .tbs-nav a::after { display: none; }
  .tbs-nav a:hover, .tbs-nav a.active { background: var(--tbs-gold-wash); padding-inline-start: 10px; }
  .tbs-nav .lang-switch { border-top: 1px solid var(--tbs-line-soft); margin-top: 10px; padding-top: 16px; justify-content: center; }
}
@media (max-width: 640px) { .tbs-nav { padding-inline: 18px; } }

/* -------------------------------------------------------------------- */
/* Hero                                                                  */
/* -------------------------------------------------------------------- */

.hero {
  position: relative;
  background:
    radial-gradient(720px 420px at 88% -10%, rgba(233,207,94,0.35), transparent 60%),
    linear-gradient(125deg, #2a2210 0%, var(--tbs-gold-dark) 46%, var(--tbs-gold-mid) 78%, var(--tbs-gold-light) 130%);
  color: #fff;
  padding: clamp(40px, 6vw, 68px) 0 clamp(48px, 7vw, 76px);
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.12) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(120deg, rgba(0,0,0,0.5), transparent 55%);
  pointer-events: none;
}
.hero .container { position: relative; display: grid; grid-template-columns: 1.3fr 1fr; gap: 40px; align-items: center; }
.hero-eyebrow { text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.78rem; font-weight: 700; color: var(--tbs-gold-light); margin-bottom: 10px; }
.hero h1 { color: #fff; margin-bottom: 14px; }
.hero p.lead { color: rgba(255,255,255,0.92); font-size: 1.05rem; max-width: 52ch; }
.hero-actions { display: flex; gap: 12px; margin-top: 22px; flex-wrap: wrap; }
@media (max-width: 820px) { .hero .container { grid-template-columns: 1fr; } }
@media (max-width: 480px) { .hero-actions .btn { flex: 1 1 auto; justify-content: center; } }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px; border-radius: var(--radius-sm); font-weight: 700; font-size: 0.92rem;
  text-decoration: none; border: 1px solid transparent; cursor: pointer; font-family: inherit;
  transition: transform var(--ease), box-shadow var(--ease), background var(--ease), border-color var(--ease), color var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--tbs-gold-light); color: #241d08; box-shadow: 0 6px 16px rgba(233,207,94,0.35); }
.btn-primary:hover { background: #f2e08a; color: #241d08; box-shadow: 0 8px 20px rgba(233,207,94,0.45); transform: translateY(-1px); }
.btn-ghost { background: rgba(255,255,255,0.08); color: #fff; border-color: rgba(255,255,255,0.5); }
.btn-ghost:hover { background: rgba(255,255,255,0.18); color: #fff; border-color: #fff; }
.btn-outline { background: transparent; border-color: var(--tbs-gold-dark); color: var(--tbs-gold-dark); }
.btn-outline:hover { background: var(--tbs-gold-wash); }
.btn-dark { background: var(--tbs-ink); color: #fff; box-shadow: var(--shadow-sm); }
.btn-dark:hover { background: #3a331e; color: #fff; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-sm { padding: 7px 13px; font-size: 0.82rem; }
.btn-danger { background: var(--status-rejected-fg); color: #fff; }
.btn-danger:hover { background: #8f221a; }

/* Logout control — rendered as a <form><button> for POST-only LogoutView,
   styled to sit flush with the surrounding nav links. */
.logout-form { display: inline-flex; margin: 0; }
.logout-link {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: none; padding: 0; margin: 0;
  color: inherit; font: inherit; cursor: pointer; text-decoration: none;
  opacity: 0.85; transition: opacity var(--ease), color var(--ease);
}
.logout-link:hover { opacity: 1; color: var(--tbs-gold-light); }

/* -------------------------------------------------------------------- */
/* Sections / cards                                                     */
/* -------------------------------------------------------------------- */

.section { padding: clamp(32px, 5vw, 56px) 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 24px; gap: 16px; flex-wrap: wrap; }
.section-head h2 { margin: 0; }
.section-head .see-all { font-weight: 700; font-size: 0.88rem; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.section-head .see-all .icon { transition: transform var(--ease); }
.section-head .see-all:hover .icon { transform: translateX(3px); }
html[dir="rtl"] .section-head .see-all:hover .icon { transform: translateX(-3px); }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 22px; }
@media (max-width: 480px) { .card-grid { grid-template-columns: 1fr; } }

.card {
  background: var(--tbs-surface); border: 1px solid var(--tbs-line); border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow-sm); display: flex; flex-direction: column;
  transition: transform var(--ease-slow), box-shadow var(--ease-slow), border-color var(--ease);
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--tbs-line-strong); }
.card-band { height: 6px; background-image: linear-gradient(90deg, var(--tbs-gold), var(--tbs-gold-light)); }
.card-body { padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 9px; flex: 1; }
.card-cat { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--tbs-gold-dark); }
.card h3 { font-size: 1.05rem; margin: 0; }
.card h3 a { color: var(--tbs-ink); text-decoration: none; }
.card h3 a:hover { color: var(--tbs-gold-dark); }
.card .excerpt { color: var(--tbs-ink-soft); font-size: 0.92rem; margin: 0; flex: 1; }
.card .meta { font-size: 0.78rem; color: var(--tbs-ink-faint); }

.event-row { display: flex; gap: 14px; padding: 13px 0; border-top: 1px solid var(--tbs-line-soft); align-items: baseline; }
.event-row:first-child { border-top: none; }
.event-date { font-weight: 700; color: var(--tbs-gold-dark); white-space: nowrap; min-width: 118px; font-variant-numeric: tabular-nums; }

.partner-strip { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.partner-chip {
  border: 1px solid var(--tbs-line); border-radius: var(--radius-pill); padding: 8px 16px;
  font-size: 0.84rem; font-weight: 600; color: var(--tbs-ink-soft); background: var(--tbs-surface);
  transition: border-color var(--ease), transform var(--ease);
}
.partner-chip:hover { border-color: var(--tbs-gold-mid); transform: translateY(-1px); }

.partner-section .partner-note { font-size: 0.8rem; font-style: italic; color: var(--tbs-ink-faint); }
.partner-group { margin-bottom: 26px; }
.partner-group:last-child { margin-bottom: 0; }
.partner-group-label {
  text-transform: uppercase; letter-spacing: 0.07em; font-size: 0.74rem; font-weight: 700;
  color: var(--tbs-gold-dark); margin-bottom: 14px;
}
.partner-logo {
  display: inline-flex; align-items: center; justify-content: center;
  height: 72px; padding: 12px 22px; min-width: 120px;
  background: var(--tbs-surface); border: 1px solid var(--tbs-line); border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--ease-slow), border-color var(--ease-slow), transform var(--ease-slow);
}
.partner-logo:hover { box-shadow: var(--shadow-sm); border-color: var(--tbs-line-strong); transform: translateY(-2px); }
.partner-logo img {
  max-height: 34px; max-width: 130px; width: auto; height: auto;
  filter: grayscale(1) opacity(0.55);
  transition: filter var(--ease-slow);
}
.partner-logo:hover img { filter: grayscale(0) opacity(1); }
@media (max-width: 480px) {
  .partner-logo { height: 60px; padding: 10px 16px; min-width: 100px; }
  .partner-logo img { max-height: 26px; max-width: 100px; }
}

/* -------------------------------------------------------------------- */
/* Footer (mandatory government mentions repeated here too)             */
/* -------------------------------------------------------------------- */

.tbs-footer {
  background: linear-gradient(180deg, var(--tbs-ink) 0%, var(--tbs-ink-900) 100%);
  color: rgba(255,255,255,0.86); padding: 48px 0 26px; margin-top: 40px;
  border-top: 3px solid transparent;
  border-image: linear-gradient(90deg, var(--tbs-gold-dark), var(--tbs-gold-light), var(--tbs-gold-dark)) 1;
}
.tbs-footer a { color: #fff; text-decoration: none; opacity: 0.85; }
.tbs-footer a:hover { opacity: 1; color: var(--tbs-gold-light); }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 32px; }
.footer-grid h4 { color: #fff; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.06em; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 0.9rem; }
.footer-contact { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: 0.88rem; color: rgba(255,255,255,0.78); }
.footer-contact li { display: flex; align-items: flex-start; gap: 9px; }
.footer-contact .icon { color: var(--tbs-gold-light); margin-top: 2px; }
.footer-mentions { border-top: 1px solid rgba(255,255,255,0.15); margin-top: 30px; padding-top: 18px; font-size: 0.8rem; color: rgba(255,255,255,0.62); display: flex; flex-direction: column; gap: 4px; }
@media (max-width: 780px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .footer-grid { grid-template-columns: 1fr; gap: 26px; } }

/* -------------------------------------------------------------------- */
/* Generic content page                                                 */
/* -------------------------------------------------------------------- */

.page-header { padding: 36px 0 6px; }
.breadcrumb { font-size: 0.82rem; color: var(--tbs-ink-soft); margin-bottom: 8px; }
.prose { white-space: pre-line; max-width: 72ch; color: var(--tbs-ink-soft); }
.prose p { max-width: none; }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table.plain { border-collapse: collapse; width: 100%; min-width: 520px; }
table.plain th, table.plain td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--tbs-line); font-size: 0.92rem; }
html[dir="rtl"] table.plain th, html[dir="rtl"] table.plain td { text-align: right; }
table.plain th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--tbs-ink-soft); background: var(--tbs-surface-sunk); position: sticky; top: 0; }
table.plain tbody tr { transition: background var(--ease); }
table.plain tbody tr:hover { background: var(--tbs-gold-wash); }
table.plain tbody tr:last-child td { border-bottom: none; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px 4px 9px; border-radius: var(--radius-pill); font-size: 0.76rem; font-weight: 700; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge-en_attente { background: var(--status-pending-bg); color: var(--status-pending-fg); }
.badge-en_cours { background: var(--status-progress-bg); color: var(--status-progress-fg); }
.badge-resolu { background: var(--status-resolved-bg); color: var(--status-resolved-fg); }
.badge-rejete { background: var(--status-rejected-bg); color: var(--status-rejected-fg); }
.badge-accepte { background: var(--status-resolved-bg); color: var(--status-resolved-fg); }
.badge-refuse { background: var(--status-rejected-bg); color: var(--status-rejected-fg); }

.alert { padding: 13px 16px; border-radius: var(--radius-sm); font-size: 0.9rem; margin-bottom: 16px; border: 1px solid transparent; }
.alert-success { background: var(--status-resolved-bg); color: var(--status-resolved-fg); border-color: rgba(30,125,60,0.18); }
.alert-error { background: var(--status-rejected-bg); color: var(--status-rejected-fg); border-color: rgba(171,43,33,0.18); }
.alert-info { background: var(--status-progress-bg); color: var(--status-progress-fg); border-color: rgba(28,90,166,0.18); }

/* forms */
.field { margin-bottom: 16px; display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 600; font-size: 0.88rem; }
.field input[type="text"], .field input[type="email"], .field input[type="password"],
.field input[type="url"], .field input[type="date"], .field input[type="datetime-local"],
.field input[type="tel"], .field select, .field textarea {
  border: 1px solid var(--tbs-line); border-radius: var(--radius-sm); padding: 10px 12px;
  font: inherit; background: var(--tbs-surface); color: var(--tbs-ink); width: 100%;
  transition: border-color var(--ease), box-shadow var(--ease);
}
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--tbs-line-strong); }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--tbs-gold-mid); box-shadow: 0 0 0 3px var(--tbs-gold-glow);
}
.field textarea { resize: vertical; }
.field .helptext { font-size: 0.78rem; color: var(--tbs-ink-faint); }
.field .errorlist { list-style: none; margin: 0; padding: 0; color: var(--status-rejected-fg); font-size: 0.82rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .field-row { grid-template-columns: 1fr; } }
.checkbox-field { flex-direction: row; align-items: center; gap: 8px; }
.checkbox-field label { font-weight: 500; }

/* -------------------------------------------------------------------- */
/* App shell (extranet + back-office) — modern console                  */
/* -------------------------------------------------------------------- */

body.app-shell { background: var(--tbs-paper); }

.app-topbar {
  background: var(--tbs-ink-900); color: #fff; padding: 12px 0; font-size: 0.85rem;
  position: sticky; top: 0; z-index: 70;
  box-shadow: 0 1px 0 rgba(255,255,255,0.06), var(--shadow-sm);
}
.app-topbar .container { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.app-topbar-left { display: flex; align-items: center; gap: 12px; }
.app-topbar-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-family: var(--font-display); white-space: nowrap; }
.app-topbar-brand .tag { background: var(--tbs-gold-light); color: #241d08; border-radius: 4px; padding: 2px 8px; font-size: 0.66rem; letter-spacing: 0.05em; font-weight: 800; }
.app-topbar-user { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: flex-end; }
.app-topbar-user a, .app-topbar-user .logout-link { color: #fff; text-decoration: none; opacity: 0.85; display: inline-flex; align-items: center; gap: 6px; }
.app-topbar-user a:hover { opacity: 1; }
.app-topbar-user > span { opacity: 0.7; font-size: 0.82rem; }

.app-sidebar-toggle {
  display: none;
  align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.18); background: rgba(255,255,255,0.06); color: #fff;
  cursor: pointer; flex: none;
}
.app-sidebar-toggle .icon-x { display: none; }
.app-sidebar-toggle[aria-expanded="true"] .icon-menu { display: none; }
.app-sidebar-toggle[aria-expanded="true"] .icon-x { display: inline-block; }

.app-layout { display: grid; grid-template-columns: 248px 1fr; align-items: start; min-height: calc(100vh - 49px); }
.app-sidebar {
  background: var(--app-sidebar-bg); color: var(--app-sidebar-fg);
  padding: 22px 0 30px; position: sticky; top: 49px; align-self: start;
  height: calc(100vh - 49px); overflow-y: auto;
  border-right: 1px solid var(--app-sidebar-border);
}
html[dir="rtl"] .app-sidebar { border-right: none; border-left: 1px solid var(--app-sidebar-border); }
.app-sidebar nav { display: flex; flex-direction: column; }
.app-sidebar .group-label { padding: 16px 22px 7px; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--app-sidebar-fg-soft); font-weight: 700; }
.app-sidebar a {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 22px; text-decoration: none; color: var(--app-sidebar-fg); font-size: 0.92rem; font-weight: 500;
  border-inline-start: 3px solid transparent;
  transition: background var(--ease), color var(--ease), border-color var(--ease);
}
.app-sidebar a .icon { color: var(--app-sidebar-fg-soft); transition: color var(--ease); flex: none; }
.app-sidebar a:hover { background: var(--app-sidebar-hover); }
.app-sidebar a.active { border-inline-start-color: var(--tbs-gold-light); background: var(--app-sidebar-active-bg); color: #fff; font-weight: 700; }
.app-sidebar a.active .icon { color: var(--tbs-gold-light); }

.app-scrim { display: none; }

.app-main { padding: 30px 32px 64px; max-width: 1080px; }
.app-main h1 { margin-bottom: 4px; }
.app-main .subtitle { color: var(--tbs-ink-soft); margin-bottom: 26px; }

@media (max-width: 900px) {
  .app-layout { grid-template-columns: 1fr; min-height: 0; }
  .app-sidebar-toggle { display: inline-flex; }
  .app-sidebar {
    position: fixed; z-index: 90; top: 0; bottom: 0;
    inset-inline-start: 0;
    width: min(280px, 82vw); height: 100vh;
    transform: translateX(-100%);
    transition: transform var(--ease-slow);
    box-shadow: var(--shadow-lg);
  }
  html[dir="rtl"] .app-sidebar { transform: translateX(100%); }
  .app-sidebar.open { transform: translateX(0); }
  .app-scrim.open {
    display: block; position: fixed; inset: 0; z-index: 80;
    background: rgba(15, 13, 7, 0.55);
  }
  .app-main { padding: 24px 18px 48px; }
}
@media (max-width: 480px) {
  .app-topbar-brand .top-label { display: none; }
  .app-topbar-user > span { display: none; }
}

.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 18px; margin-bottom: 30px; }
.stat-tile {
  position: relative;
  background: var(--tbs-surface); border: 1px solid var(--tbs-line); border-radius: var(--radius-lg);
  padding: 20px 22px; box-shadow: var(--shadow-sm); overflow: hidden;
  transition: transform var(--ease-slow), box-shadow var(--ease-slow);
}
.stat-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-tile::before {
  content: ""; position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 4px;
  background-image: linear-gradient(180deg, var(--tbs-gold-light), var(--tbs-gold-dark));
}
.stat-tile-icon {
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  background: var(--tbs-gold-wash); color: var(--tbs-gold-dark);
  display: flex; align-items: center; justify-content: center; margin-bottom: 12px;
}
.stat-tile .n { font-family: var(--font-display); font-size: 2.1rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--tbs-ink); line-height: 1; }
.stat-tile .l { font-size: 0.82rem; color: var(--tbs-ink-soft); margin-top: 6px; }

.panel { background: var(--tbs-surface); border: 1px solid var(--tbs-line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: 24px 26px; margin-bottom: 22px; overflow: hidden; }
.panel h2, .panel h3 { margin-top: 0; }
.panel-list { display: flex; flex-direction: column; }
.panel-row { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--tbs-line-soft); font-size: 0.9rem; align-items: center; flex-wrap: wrap; }
.panel-row:first-child { border-top: none; }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; gap: 12px; flex-wrap: wrap; }

.thread { display: flex; flex-direction: column; gap: 12px; margin: 20px 0; }
.thread-msg { background: var(--tbs-surface); border: 1px solid var(--tbs-line); border-radius: var(--radius-md); padding: 13px 17px; box-shadow: var(--shadow-xs); }
.thread-msg .who { font-weight: 700; font-size: 0.82rem; color: var(--tbs-gold-dark); margin-bottom: 4px; }
.thread-msg .when { font-weight: 400; color: var(--tbs-ink-faint); margin-left: 6px; }
.thread-msg.self { border-color: var(--tbs-gold); background: var(--tbs-gold-wash); }

.cv-repeatable { border: 1px dashed var(--tbs-line-strong); border-radius: var(--radius-sm); padding: 12px; margin-bottom: 10px; position: relative; }
.cv-repeatable-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 480px) { .cv-repeatable-grid { grid-template-columns: 1fr; } }
.cv-remove { position: absolute; top: 8px; inset-inline-end: 8px; background: none; border: none; color: var(--status-rejected-fg); font-weight: 700; cursor: pointer; font-size: 0.8rem; }
.skill-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--tbs-gold-wash); border-radius: var(--radius-pill); padding: 5px 11px; font-size: 0.82rem; margin: 3px; }
.skill-chip button { border: none; background: none; color: var(--status-rejected-fg); cursor: pointer; font-weight: 700; }

.empty-state { text-align: center; padding: 44px 20px; color: var(--tbs-ink-faint); }

@media (max-width: 480px) {
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar .btn { justify-content: center; }
  .panel { padding: 18px 18px; }
}
