@font-face {
  font-family: "Porsa Noto";
  src: url("/assets/NotoSansArabic-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Porsa Noto";
  src: url("/assets/NotoSansArabic-Medium.ttf") format("truetype");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Porsa Noto";
  src: url("/assets/NotoSansArabic-Bold.ttf") format("truetype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

:root {
  font-family: "Porsa Noto", Tahoma, sans-serif;
  font-size: 14px;
  color: #111b2d;
  background: #f7f8fb;
  color-scheme: light;
  --border: #d9e1ed;
  --muted: #677282;
  --surface: #fff;
  --soft: #f1f4f9;
  --selected: #e3ebf8;
}
* { box-sizing: border-box; }
body { margin: 0; line-height: 1.55; }
a { color: inherit; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:disabled { opacity: .48; cursor: not-allowed; }
:focus-visible { outline: 3px solid #6483bb; outline-offset: 2px; }

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 292px;
  direction: ltr;
  min-height: 100vh;
}
.sidebar {
  grid-column: 2;
  grid-row: 1;
  direction: rtl;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 22px 14px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  border-radius: 38px 0 0 38px;
  box-shadow: -8px 0 28px #202c4509;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 14px 28px;
  text-decoration: none;
  font-size: 1.35rem;
  font-weight: 800;
}
.brand-mark { width: 34px; height: 34px; display: inline-flex; }
.brand-mark svg { width: 100%; height: 100%; }
.sidebar-group {
  margin: 14px 14px 9px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  color: #3c4759;
}
.sidebar-nav { display: grid; gap: 7px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 7px 12px;
  border: 1px solid transparent;
  border-radius: 16px;
  text-decoration: none;
  font-weight: 700;
  color: #3e495a;
}
.nav-item:hover { background: var(--soft); }
.nav-item.active { background: var(--selected); border-color: #d4deee; color: #111b2d; }
.nav-icon { width: 28px; text-align: center; font-size: 1.55rem; line-height: 1; }
.sidebar-spacer { flex: 1; }
.sidebar-footer {
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 18px 14px;
  text-align: center;
  color: var(--muted);
  background: #fcfdff;
}
.workspace { grid-column: 1; grid-row: 1; direction: rtl; min-width: 0; }
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  min-height: 64px;
  padding: 10px clamp(20px, 4vw, 64px);
  border-bottom: 1px solid #e4e9f1;
  color: #586374;
  font-size: .92rem;
}
.page-header a { text-decoration: none; font-weight: 700; }
.page-header a:hover { color: #253c67; }
.content { max-width: 1420px; margin: 0 auto; padding: 26px clamp(20px, 4vw, 64px) 54px; }
.page-intro { margin-bottom: 18px; }
.eyebrow { color: #667eac; font-size: .88rem; font-weight: 700; }
h1 { margin: 5px 0 7px; font-size: clamp(1.65rem, 2vw, 2.1rem); line-height: 1.4; }
.page-intro p { margin: 0; color: var(--muted); }

.search-panel, .card, #details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: 0 12px 30px #1b29400b;
}
.search-panel { padding: 18px 20px; }
.field-label { display: block; margin-bottom: 6px; font-weight: 700; }
.search-row { display: flex; gap: 12px; }
input[type="search"], select {
  background: var(--soft);
  color: #182437;
  border: 1px solid #d5ddec;
  border-radius: 13px;
  min-height: 42px;
  padding: 8px 12px;
}
input[type="search"] { flex: 1; min-width: 0; }
input::placeholder { color: #818b9a; }
button, .pdf-link {
  background: #e3ebf8;
  color: #172744;
  border: 1px solid #d3def0;
  border-radius: 12px;
  min-height: 38px;
  padding: 7px 14px;
  font-weight: 700;
  text-decoration: none;
}
button:hover, .pdf-link:hover { background: #d3e0f4; }
.primary-button { min-width: 112px; background: #172744; color: #fff; border-color: #172744; }
.primary-button:hover { background: #304468; }
.controls, .filters { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; margin-top: 12px; }
.controls label, .filters label { display: grid; gap: 6px; color: #465366; font-size: .9rem; }
.controls select, .filters select { min-width: 185px; }
.checkbox { display: flex !important; align-items: center; gap: 9px !important; min-height: 48px; }
.checkbox input { width: 17px; height: 17px; accent-color: #304e80; }
#status { color: var(--muted); min-height: 1.7em; margin: 12px 2px 14px; }
.layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(290px, .8fr); gap: 20px; align-items: start; direction: rtl; }
.results-section { min-width: 0; }
.section-heading { font-size: 1.17rem; margin: 0 3px 14px; }
.results { display: grid; gap: 14px; }
.card { padding: 20px 22px; }
.card h2 { font-size: 1.05rem; margin: 0 0 6px; overflow-wrap: anywhere; }
.card p { color: #4e5a6c; margin: 9px 0; overflow-wrap: anywhere; }
.card small { color: #718095; }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 16px; }
.text-button { background: var(--soft); }
.pdf-link { display: inline-flex; align-items: center; font-size: .88rem; }
#details { position: sticky; top: 18px; padding: 22px; overflow-wrap: anywhere; }
#details h2 { font-size: 1.15rem; margin: 0 0 12px; }
#details h3 { font-size: .96rem; margin: 18px 0 6px; }
#details p, #details li { color: #4e5a6c; }
#details ul { padding: 0 20px 0 0; }
#details .pdf-link { margin-top: 14px; }
.pager { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 1050px) {
  .app-shell { grid-template-columns: minmax(0, 1fr) 235px; }
  .layout { grid-template-columns: 1fr; }
  #details { position: static; }
}
@media (max-width: 720px) {
  .app-shell { display: block; }
  .sidebar {
    min-height: auto;
    padding: 10px 16px;
    border-radius: 0 0 22px 22px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .brand { padding: 0; }
  .sidebar-group, .sidebar-spacer, .sidebar-footer { display: none; }
  .sidebar-nav { display: flex; margin-top: 8px; }
  .nav-item { min-height: 40px; padding: 6px 10px; font-size: .86rem; }
  .nav-icon { width: 18px; font-size: 1.2rem; }
  .page-header { min-height: 55px; }
  .content { padding-top: 25px; }
  .search-panel { padding: 18px; }
  .search-row { flex-wrap: wrap; }
  .search-row button { width: 100%; }
  .controls select, .filters select { min-width: 0; max-width: 100%; }
}

/* Authentication and profile */
[hidden] { display: none !important; }

.login-panel {
  max-width: 440px;
  margin: 26px auto;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: 0 12px 30px #1b29400b;
}
.login-panel h2 { margin: 0 0 8px; font-size: 1.22rem; }
.login-panel p { color: var(--muted); margin: 0 0 18px; }
#login-form { display: grid; gap: 8px; }
#login-form label { margin-top: 7px; font-weight: 700; }
#login-form input {
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid #d5ddec;
  border-radius: 13px;
  background: var(--soft);
}
#login-form button { margin-top: 12px; }
#login-status { min-height: 1.5em; margin: 12px 0 0; color: #a33131; }

.profile-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 12px;
  margin: 10px 0;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--soft);
}
.profile-avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 50%;
  background: #334b76;
  color: #fff;
  font-weight: 700;
}
.profile-identity {
  min-width: 0;
  flex: 1;
  display: grid;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.profile-identity small { color: var(--muted); }
#logout-button { min-height: 34px; padding: 5px 10px; font-size: .86rem; }

@media (max-width: 720px) {
  .profile-card { margin: 8px 0 0; }
  .login-panel { margin: 18px auto; padding: 18px; }
}

/* Porsa login page; search styles remain scoped to the app shell. */
.login-screen {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(380px, 1fr);
  align-items: center;
  gap: clamp(18px, 3vw, 72px);
  min-height: 100vh;
  padding: 56px clamp(24px, 4vw, 84px);
  position: relative;
  direction: ltr;
  background: #f7f8fb;
}
.login-back {
  position: absolute;
  top: 24px;
  left: clamp(24px, 4vw, 84px);
  color: #485467;
  text-decoration: none;
}
.login-illustration { display: grid; place-items: center; min-width: 0; }
.login-illustration img {
  display: block;
  width: min(100%, 780px);
  height: auto;
  max-height: min(78vh, 800px);
  object-fit: contain;
}
.login-screen .login-panel {
  direction: rtl;
  width: min(100%, 720px);
  max-width: none;
  margin: 0 auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.login-logo {
  display: block;
  width: 76px;
  height: 76px;
  object-fit: contain;
  margin: 0 auto clamp(28px, 5vh, 62px);
}
.login-screen .login-panel h1 {
  margin: 0 0 5px;
  font-size: clamp(2rem, 2.45vw, 2.8rem);
  line-height: 1.4;
  color: #111827;
}
.login-screen .login-subtitle {
  margin: 0 0 clamp(34px, 7vh, 82px);
  color: #4b5563;
  font-size: clamp(1rem, 1.1vw, 1.24rem);
}
.login-screen #login-form { gap: 0; }
.login-screen #login-form label {
  margin: 0 0 12px;
  color: #111827;
  font-size: 1.14rem;
  font-weight: 700;
}
.login-screen #login-form input {
  width: 100%;
  height: 66px;
  margin: 0 0 34px;
  padding: 12px 20px;
  border: 1px solid #d5ddea;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 12px 25px #19294212;
  text-align: right;
}
.login-screen #login-form input::placeholder { color: #8b94a2; }
.login-screen #login-form button {
  width: 100%;
  height: 60px;
  margin-top: clamp(10px, 5vh, 60px);
  border-radius: 13px;
  background: #111827;
  border-color: #111827;
  font-size: 1.12rem;
}
.login-screen #login-form button:hover { background: #293346; }
.login-screen #login-status { min-height: 1.5em; margin: 16px 0 0; }
@media (max-width: 850px) {
  .login-screen {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 76px 24px 36px;
  }
  .login-illustration img { max-height: 220px; }
  .login-screen .login-panel { width: min(100%, 540px); }
  .login-logo { width: 58px; height: 58px; margin-bottom: 16px; }
  .login-screen .login-subtitle { margin-bottom: 26px; }
  .login-screen #login-form input { height: 54px; margin-bottom: 19px; }
  .login-screen #login-form button { margin-top: 10px; }
}
@media (max-width: 480px) {
  .login-illustration img { max-height: 145px; }
  .login-screen .login-panel h1 { font-size: 1.75rem; }
}

/* Compact search workspace */
:root { font-size: 13px; }
.app-shell { grid-template-columns: minmax(0, 1fr) 248px; }
.sidebar { padding: 16px 12px; border-radius: 24px 0 0 24px; }
.brand { padding: 4px 10px 18px; font-size: 1.2rem; }
.brand-mark { width: 28px; height: 28px; }
.sidebar-group { margin: 10px 10px 7px; padding-bottom: 8px; }
.sidebar-nav { gap: 4px; }
.nav-item { gap: 9px; min-height: 38px; padding: 6px 10px; border-radius: 12px; }
.nav-icon { width: 22px; font-size: 1.3rem; }
.sidebar-footer { padding: 11px 10px; border-radius: 16px; }
.profile-card { gap: 8px; padding: 9px; margin: 8px 0; border-radius: 14px; }
.profile-avatar { width: 32px; height: 32px; }
.page-header { min-height: 52px; padding: 8px clamp(18px, 3vw, 40px); }
.content { max-width: 1200px; padding: 18px clamp(18px, 3vw, 40px) 44px; }
.page-intro { margin-bottom: 12px; }
h1 { font-size: clamp(1.5rem, 1.85vw, 1.85rem); }
.search-panel, .card, #details {
  border-radius: 16px;
  box-shadow: 0 8px 20px #1b29400b;
}
.search-panel { padding: 14px 16px; }
.field-label { margin-bottom: 4px; }
.search-row { gap: 8px; }
input[type="search"], select {
  min-height: 38px;
  padding: 6px 10px;
  border-radius: 10px;
}
button, .pdf-link {
  min-height: 36px;
  padding: 5px 12px;
  border-radius: 10px;
}
.primary-button { min-width: 96px; }
.controls, .filters { gap: 8px; margin-top: 10px; }
.controls label, .filters label { gap: 4px; }
.controls select, .filters select { min-width: 164px; }
.checkbox { min-height: 38px; }
.checkbox input { width: 16px; height: 16px; }
#status { min-height: 0; margin: 10px 2px 14px; }
.layout { display: block; }
.layout.has-details {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, .75fr);
  gap: 16px;
  align-items: start;
}
.section-heading { font-size: 1.1rem; margin: 0 0 10px; }
.results { gap: 10px; }
.card { padding: 16px 18px; }
.actions { gap: 8px; margin-top: 12px; }
#details { top: 16px; padding: 16px; }
.pager { gap: 8px; margin-top: 14px; }
.empty-state {
  margin: 0;
  padding: 18px 20px;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 14px;
}
@media (max-width: 1050px) {
  .app-shell { grid-template-columns: minmax(0, 1fr) 220px; }
  .layout.has-details { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .sidebar { padding: 10px 16px; border-radius: 0 0 16px 16px; }
  .brand { padding: 0; }
  .content { padding-top: 18px; }
  .search-panel { padding: 14px; }
}
