/* Seren Finance — نفس هوية نظام النداء / الكوبونات */

:root {
  --seren-primary: #4f5829;
  --seren-primary-700: #3d4520;
  --seren-primary-50: #eeefd9;
  --seren-accent: #b89466;
  --seren-bg: #f4efe0;
  --seren-bg-alt: #faf6e8;
  --seren-surface: #ffffff;
  --seren-text: #1c1c1c;
  --seren-muted: #6b6b6b;
  --seren-border: #e0d9c4;
  --seren-error: #b3261e;
  --seren-warn: #b54708;
  --seren-success: #4a6b1f;
  --seren-info: #175cd3;
  --seren-radius-sm: 10px;
  --seren-radius-md: 14px;
  --seren-radius-lg: 22px;
  --seren-shadow-sm: 0 2px 8px rgba(15, 61, 46, 0.06);
  --seren-shadow-md: 0 10px 30px rgba(15, 61, 46, 0.1);

  /* توافق مع القوالب القديمة */
  --bg: var(--seren-bg);
  --card: var(--seren-surface);
  --text: var(--seren-text);
  --muted: var(--seren-muted);
  --primary: var(--seren-primary);
  --primary-hover: var(--seren-primary-700);
  --border: var(--seren-border);
  --error: var(--seren-error);
  --warn: var(--seren-warn);
  --success: var(--seren-success);
  --info: var(--seren-info);
  --radius: var(--seren-radius-md);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: "Tajawal", "Segoe UI", Tahoma, sans-serif;
  color: var(--seren-text);
  background:
    radial-gradient(1200px 600px at 100% -10%, rgba(79, 88, 41, 0.1), transparent 60%),
    radial-gradient(800px 500px at -10% 110%, rgba(184, 148, 102, 0.1), transparent 60%),
    var(--seren-bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--seren-primary); }

/* ---------- shell ---------- */

.seren-app { min-height: 100vh; display: flex; flex-direction: column; }

.seren-topbar {
  background: var(--seren-primary);
  color: #fff;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  box-shadow: var(--seren-shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.seren-topbar__brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.seren-topbar__brand strong { font-size: 15px; display: block; }

.seren-topbar__tag {
  font-size: 12px;
  opacity: 0.78;
  display: block;
  margin-top: 2px;
}

.seren-topbar__logo {
  height: 38px;
  width: auto;
  background: var(--seren-bg);
  padding: 5px 10px;
  border-radius: 8px;
}

.seren-topbar__actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.seren-topbar__link {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.seren-topbar__link:hover { background: rgba(255, 255, 255, 0.2); }

.seren-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.seren-pill--warn { background: #fef0c7; color: #93370d; border-color: #fcd34d; }

.seren-shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  flex: 1;
  min-height: 0;
}

@media (max-width: 860px) {
  .seren-shell { grid-template-columns: 1fr; }
  .seren-sidebar {
    border-bottom: 1px solid var(--seren-border);
    border-left: none !important;
  }
  .seren-nav { flex-direction: row !important; overflow-x: auto; }
}

.seren-sidebar {
  background: var(--seren-surface);
  border-left: 1px solid var(--seren-border);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.seren-nav { display: flex; flex-direction: column; gap: 6px; }

.seren-nav__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--seren-radius-sm);
  text-decoration: none;
  color: var(--seren-muted);
  font-weight: 700;
  font-size: 14px;
  transition: 180ms ease;
}

.seren-nav__item:hover {
  background: var(--seren-primary-50);
  color: var(--seren-primary);
}

.seren-nav__item--active {
  background: var(--seren-primary-50);
  color: var(--seren-primary-700);
  box-shadow: inset 3px 0 0 var(--seren-primary);
}

.seren-nav__icon { font-size: 1.1rem; }

.seren-sidebar__footer {
  margin-top: auto;
  padding: 12px 8px;
  color: var(--seren-muted);
  font-size: 11px;
}

.seren-main {
  padding: 22px 20px 48px;
  max-width: 1200px;
  width: 100%;
}

/* ---------- page head ---------- */

.seren-page-head { margin-bottom: 20px; }

.seren-page-head__title {
  margin: 0 0 4px;
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--seren-primary);
}

.seren-page-head__subtitle {
  margin: 0;
  font-size: 13px;
  color: var(--seren-muted);
}

/* ---------- stats ---------- */

.seren-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.seren-stat {
  background: var(--seren-surface);
  border: 1px solid var(--seren-border);
  border-radius: var(--seren-radius-md);
  padding: 16px;
  box-shadow: var(--seren-shadow-sm);
}

.seren-stat--accent {
  background: linear-gradient(135deg, var(--seren-primary), var(--seren-primary-700));
  border-color: transparent;
}
.seren-stat--accent .seren-stat__label { color: rgba(255,255,255,0.85); }
.seren-stat--accent .seren-stat__value { color: #fff; }

.seren-stat--green { border-color: rgba(74, 107, 31, 0.35); background: #f3f8ec; }
.seren-stat--yellow { border-color: rgba(181, 71, 8, 0.25); background: #fffaeb; }
.seren-stat--red { border-color: rgba(179, 38, 30, 0.25); background: #fef3f2; }

.seren-stat__value {
  display: block;
  font-size: 2rem;
  font-weight: 900;
  color: var(--seren-primary);
  line-height: 1.1;
}

.seren-stat__label {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--seren-muted);
}

/* ---------- panels ---------- */

.seren-panel,
.card {
  background: var(--seren-surface);
  border: 1px solid var(--seren-border);
  border-radius: var(--seren-radius-md);
  padding: 18px 20px;
  margin-bottom: 18px;
  box-shadow: var(--seren-shadow-sm);
}

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

.seren-panel__head h2,
.card h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--seren-primary-700);
}

/* ---------- toolbar / search ---------- */

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

.seren-search {
  display: flex;
  gap: 8px;
  align-items: center;
  flex: 1;
  min-width: 220px;
}

.seren-filters { display: flex; gap: 6px; flex-wrap: wrap; }

.seren-chip {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--seren-border);
  background: var(--seren-bg-alt);
  color: var(--seren-muted);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.seren-chip--active {
  background: var(--seren-primary);
  color: #fff;
  border-color: var(--seren-primary);
}

/* ---------- table ---------- */

.seren-table-wrap,
.table-wrap { overflow-x: auto; }

.seren-table,
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.seren-table th,
.seren-table td,
.data-table th,
.data-table td {
  border: 1px solid var(--seren-border);
  padding: 10px 12px;
  text-align: right;
}

.seren-table th,
.data-table th {
  background: var(--seren-primary-50);
  color: var(--seren-primary-700);
  font-weight: 800;
  font-size: 12px;
}

.seren-table__muted { color: var(--seren-muted); font-size: 12px; }
.seren-table__empty { text-align: center; color: var(--seren-muted); padding: 2rem !important; }

.seren-link {
  font-weight: 700;
  text-decoration: none;
  color: var(--seren-primary);
}

.seren-link:hover { text-decoration: underline; }

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

.seren-badge,
.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.seren-badge--green, .badge-green { background: #ecfdf3; color: var(--seren-success); }
.seren-badge--yellow, .badge-yellow { background: #fffaeb; color: var(--seren-warn); }
.seren-badge--red, .badge-red { background: #fef3f2; color: var(--seren-error); }
.seren-badge--muted { background: #f3f4f6; color: var(--seren-muted); }
.badge-mock { background: #fef0c7; color: #93370d; }

/* ---------- buttons ---------- */

.seren-btn,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0.65rem 1rem;
  border-radius: var(--seren-radius-sm);
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
  font-family: inherit;
  transition: 180ms ease;
}

.seren-btn--primary,
.btn-primary {
  background: var(--seren-primary);
  color: #fff;
}
.seren-btn--primary:hover,
.btn-primary:hover { background: var(--seren-primary-700); }

.seren-btn--secondary,
.btn-secondary {
  background: var(--seren-bg-alt);
  color: var(--seren-text);
  border: 1px solid var(--seren-border);
}

.seren-btn--ghost {
  background: transparent;
  color: var(--seren-muted);
  border: 1px solid var(--seren-border);
}

.seren-btn--sm, .btn-sm { padding: 0.4rem 0.75rem; font-size: 0.82rem; }
.btn-lg { width: 100%; padding: 0.9rem; font-size: 1.05rem; }

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

.form .field {
  display: block;
  margin-bottom: 1rem;
}

.form .field > span {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 700;
  font-size: 14px;
  color: var(--seren-primary-700);
}

input[type="text"],
input[type="search"],
textarea,
select,
.product-select {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border: 1.5px solid var(--seren-border);
  border-radius: var(--seren-radius-sm);
  font-size: 1rem;
  background: var(--seren-surface);
  outline: none;
  transition: border-color 180ms ease;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--seren-primary);
}

.hint { color: var(--seren-muted); font-size: 14px; }

/* ---------- alerts ---------- */

.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--seren-radius-sm);
  margin: 0.75rem 0;
  font-size: 14px;
}

.alert-error { background: #fef3f2; color: var(--seren-error); border: 1px solid #fecdca; }
.alert-success { background: #ecfdf3; color: var(--seren-success); border: 1px solid #abefc6; }
.alert-warn, .alert-info { background: #fffaeb; color: var(--seren-warn); border: 1px solid #fedf89; }
.alert-info { background: #eff8ff; color: var(--seren-info); border: 1px solid #b2ddff; }
.alert-review { background: #f4f3ff; color: #5925dc; border: 1px solid #d9d6fe; }

/* ---------- misc components ---------- */

.status-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.status-green { border-right: 4px solid var(--seren-success); padding-right: 0.5rem; }
.status-yellow { border-right: 4px solid var(--seren-warn); padding-right: 0.5rem; }
.status-red { border-right: 4px solid var(--seren-error); padding-right: 0.5rem; }

.workflow-card {
  background: var(--seren-bg-alt);
  border: 1px solid var(--seren-border);
  border-radius: var(--seren-radius-md);
  padding: 1rem 1.25rem;
  margin: 1rem 0;
}

.workflow-title { margin: 0; font-weight: 800; color: var(--seren-primary-700); }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 768px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
}

.meta-list { list-style: none; padding: 0; margin: 0; }
.meta-list li { padding: 0.25rem 0; font-size: 14px; }
.warnings-list li { color: var(--seren-warn); font-size: 14px; }

.preview-img { max-width: 100%; border-radius: var(--seren-radius-sm); border: 1px solid var(--seren-border); }
.preview-frame {
  width: 100%;
  min-height: 360px;
  border: 1px solid var(--seren-border);
  border-radius: var(--seren-radius-sm);
}

.json-box {
  background: #0f172a;
  color: #e2e8f0;
  padding: 1rem;
  border-radius: var(--seren-radius-sm);
  overflow-x: auto;
  font-size: 0.85rem;
  direction: ltr;
  text-align: left;
}

.actions-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 1rem 0;
  align-items: center;
}

.actions-primary {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--seren-border);
}

.compact-list { list-style: none; padding: 0; margin: 0; font-size: 0.8rem; }
.candidates-list { list-style: none; padding: 0; }
.tech-details { margin: 1rem 0; color: var(--seren-muted); }
.tech-details summary { cursor: pointer; font-weight: 700; color: var(--seren-text); }
.ai-section { margin: 1.25rem 0; padding-top: 0.5rem; border-top: 1px solid var(--seren-border); }
.hidden { display: none !important; }
.table-scroll { overflow-x: auto; }

/* upload page card width */
.seren-main .card--narrow {
  max-width: 560px;
}

.seren-pill--user {
  background: var(--seren-primary-50);
  color: var(--seren-primary-700);
  border: 1px solid var(--seren-border);
}

.seren-logout-form {
  display: inline;
  margin: 0;
}

.seren-topbar__link--btn {
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
  padding: 0;
}

.seren-login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(145deg, var(--seren-bg-alt) 0%, #eef1e4 50%, var(--seren-bg) 100%);
}

.seren-login-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border: 1px solid var(--seren-border);
  border-radius: var(--seren-radius-lg);
  box-shadow: var(--seren-shadow-md);
  padding: 2rem 1.75rem;
}

.seren-login-brand {
  text-align: center;
  margin-bottom: 1.5rem;
}

.seren-login-logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
}

.seren-login-divider {
  display: block;
  width: 48px;
  height: 3px;
  margin: 0.75rem auto;
  background: var(--seren-primary-500);
  border-radius: 999px;
}

.seren-login-brand h1 {
  margin: 0;
  font-size: 1.5rem;
  color: var(--seren-primary-700);
}

.seren-login-brand p {
  margin: 0.35rem 0 0;
  color: var(--seren-muted);
  font-size: 0.95rem;
}

.seren-login-form .field {
  margin-bottom: 1rem;
}

.seren-login-hint {
  margin: 1.25rem 0 0;
  font-size: 0.85rem;
  color: var(--seren-muted);
  text-align: center;
  line-height: 1.5;
}
