/* Ajami Works — partner & platform portals (aligned to public brand) */

:root {
  --bg-main: #0f1412;
  --bg-soft: #161d1a;
  --bg-card: #1d2521;
  --text-main: #f5f1e8;
  --text-muted: #b8b0a2;
  --accent-wood: #b8793f;
  --accent-dark: #7a4b26;
  --border: rgba(255, 255, 255, 0.12);
  --success: #6dd58c;
  --danger: #f5a3a3;
  --font: "Inter", system-ui, sans-serif;
  --r-sm: 8px;
  --r: 12px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--bg-soft);
  height: 100%;
}

body.portal-body {
  margin: 0;
  min-height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  background: var(--bg-main);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
}

a {
  color: var(--accent-wood);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.portal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.9rem 1.35rem;
  background: rgba(15, 20, 18, 0.96);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 50;
}

.portal-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--text-main);
  text-decoration: none;
}

.portal-brand:hover {
  text-decoration: none;
}

.portal-mark {
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 0.82rem;
  letter-spacing: -0.02em;
  color: #fff;
  background:
    radial-gradient(circle at 78% 24%, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 62%),
    linear-gradient(135deg, #101215 0%, #26292e 52%, #0b0c0e 100%);
  flex-shrink: 0;
}

.portal-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.portal-brand-name {
  font-size: 0.9rem;
  font-weight: 700;
}

.portal-brand-role {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.portal-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.15rem;
}

.portal-nav a {
  color: var(--text-muted);
  padding: 0.45rem 0.7rem;
  border-radius: var(--r-sm);
  font-size: 0.86rem;
  font-weight: 500;
  text-decoration: none;
}

.portal-nav a:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
  text-decoration: none;
}

.portal-main {
  width: min(1100px, 100%);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2.5rem;
  flex: 1 0 auto;
}

.portal-main h1 {
  margin: 0 0 1rem;
  font-size: clamp(1.4rem, 2.5vw, 1.85rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.portal-main h2 {
  margin: 1.25rem 0 0.75rem;
  font-size: 1.1rem;
  font-weight: 700;
}

.flash,
.errors {
  padding: 0.85rem 1rem;
  border-radius: var(--r-sm);
  margin-bottom: 1rem;
  font-size: 0.92rem;
}

.flash {
  color: var(--success);
  background: rgba(109, 213, 140, 0.12);
  border: 1px solid rgba(109, 213, 140, 0.28);
}

.errors {
  color: var(--danger);
  background: rgba(185, 28, 28, 0.18);
  border: 1px solid rgba(248, 113, 113, 0.35);
}

.errors ul {
  margin: 0;
  padding-inline-start: 1.1rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1rem 1.1rem;
  margin-bottom: 0.85rem;
  color: var(--text-main);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  background: linear-gradient(135deg, var(--accent-wood) 0%, var(--accent-dark) 100%);
  color: #fff;
  padding: 0.5rem 0.95rem;
  border: 0;
  border-radius: var(--r-sm);
  text-decoration: none;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  font-size: 0.88rem;
}

.btn:hover {
  filter: brightness(1.06);
  text-decoration: none;
  color: #fff;
}

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

.btn-ghost:hover {
  filter: none;
  background: rgba(255, 255, 255, 0.06);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--r);
}

.table-wrap table {
  min-width: 520px;
}

th,
td {
  border-bottom: 1px solid var(--border);
  padding: 0.65rem 0.75rem;
  text-align: left;
  font-size: 0.9rem;
  color: var(--text-muted);
}

th {
  color: var(--text-main);
  font-weight: 600;
  font-size: 0.8rem;
  background: rgba(255, 255, 255, 0.03);
}

tr:last-child td {
  border-bottom: 0;
}

label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0.75rem 0;
}

input,
textarea,
select {
  display: block;
  width: 100%;
  margin-top: 0.4rem;
  padding: 0.65rem 0.8rem;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  font: inherit;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: rgba(184, 121, 63, 0.55);
  background: rgba(184, 121, 63, 0.06);
}

select option {
  background: var(--bg-card);
  color: var(--text-main);
}

code {
  font-size: 0.85em;
  color: var(--accent-wood);
}

/* Auth screens */
.auth-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(184, 121, 63, 0.14), transparent 45%),
    radial-gradient(ellipse at 80% 100%, rgba(122, 75, 38, 0.12), transparent 40%),
    var(--bg-main);
}

.auth-card {
  width: min(420px, 100%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1.75rem 1.5rem 1.5rem;
}

.auth-card h1 {
  margin: 0.85rem 0 0.35rem;
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.auth-lead {
  margin: 0 0 1.25rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.auth-card .btn {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.75rem 1rem;
}

.auth-footer {
  margin-top: 1.1rem;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.auth-footer a {
  color: var(--accent-wood);
  font-weight: 600;
}

@media (max-width: 720px) {
  .portal-header {
    align-items: flex-start;
  }

  .portal-nav {
    width: 100%;
  }
}
