/* ============================================================
   Oppz Design System — Linkeyz light language.
   Light gray canvas, white cards, black pill buttons, Inter font,
   clean SVG line icons, monochrome palette with green for matches.
   Fully responsive (RTL + LTR). No emoji.
   ============================================================ */

:root {
  --bg: #F4F5F7;
  --card: #FFFFFF;
  --text: #111111;
  --text-2: #6B7280;
  --text-3: #9AA0A6;
  --border: #EAEBEE;
  --border-strong: #DADCE0;

  --ink: #111111;          /* primary action / active accent (black) */
  --ink-hover: #2E2E2E;
  --ink-soft: #F2F3F5;     /* active nav background */

  --green: #1E7E45;
  --green-soft: #E6F4EA;
  --amber: #B45309;
  --amber-soft: #FEF3C7;
  --red: #C5221F;
  --red-soft: #FCE8E6;
  --blue: #1A56DB;
  --blue-soft: #E1EFFE;
  --gray-soft: #F2F3F5;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(17, 17, 17, 0.04);
  --shadow-md: 0 2px 8px rgba(17, 17, 17, 0.06);
  --shadow-lg: 0 12px 32px -10px rgba(17, 17, 17, 0.18);
  --sidebar-w: 248px;
  --font: 'Inter', 'Heebo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* SVG icons */
.ic { display: inline-block; vertical-align: middle; flex-shrink: 0; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }

.main {
  flex: 1;
  margin-inline-start: var(--sidebar-w);
  padding: 28px 32px 64px;
  max-width: 1180px;
  width: 100%;
}

.page-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 24px; flex-wrap: wrap;
}
.page-header h1 { font-size: 25px; font-weight: 700; letter-spacing: -0.4px; }
.page-header .sub { color: var(--text-2); font-size: 14px; margin-top: 3px; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed; top: 0; inset-inline-start: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--card);
  border-inline-end: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 140;
}
.sidebar__header {
  display: flex; align-items: center; gap: 11px;
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--border);
}
.sidebar__logo {
  width: 38px; height: 38px; border-radius: 11px;
  background: var(--ink);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 19px;
}
.sidebar__brand { font-size: 19px; font-weight: 800; letter-spacing: -0.4px; line-height: 1.1; }
.sidebar__brand small { display: block; font-size: 11px; font-weight: 400; color: var(--text-3); letter-spacing: 0; margin-top: 2px; }

.sidebar__nav { flex: 1; padding: 14px 12px; overflow-y: auto; }
.sidebar__section {
  font-size: 11px; font-weight: 600; color: var(--text-3);
  padding: 16px 10px 6px; text-transform: uppercase; letter-spacing: 0.6px;
}
.sidebar__link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--text-2); font-size: 14px; font-weight: 500;
  margin-bottom: 2px; position: relative;
  transition: background 0.14s, color 0.14s;
}
.sidebar__link:hover { background: var(--gray-soft); color: var(--text); }
.sidebar__link--active {
  background: var(--ink-soft); color: var(--text); font-weight: 600;
}
.sidebar__link--active::before {
  content: ''; position: absolute; inset-inline-start: 0; top: 8px; bottom: 8px;
  width: 3px; border-radius: 3px; background: var(--ink);
}
.sidebar__link-icon { display: inline-flex; align-items: center; color: currentColor; }
.sidebar__badge {
  margin-inline-start: auto; min-width: 20px; height: 20px; padding: 0 6px;
  background: var(--ink); color: #fff;
  border-radius: 10px; font-size: 11px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.sidebar__footer { padding: 14px; border-top: 1px solid var(--border); }
.sidebar__user { display: flex; align-items: center; gap: 11px; margin-bottom: 12px; }
.sidebar__avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--ink-soft); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; color: var(--text);
}
.sidebar__user-name { font-size: 13px; font-weight: 600; }
.sidebar__user-role { font-size: 11px; color: var(--text-3); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 22px; border-radius: 50px; border: 1px solid transparent;
  font-size: 14px; font-weight: 600; cursor: pointer;
  min-height: 44px; transition: all 0.16s ease; white-space: nowrap;
}
.btn .ic { width: 17px; height: 17px; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--ink-hover); }
.btn-accent { background: var(--ink); color: #fff; }
.btn-accent:hover { background: var(--ink-hover); }
.btn-outline { background: var(--card); color: var(--text); border-color: var(--border-strong); }
.btn-outline:hover { background: var(--gray-soft); }
.btn-danger { background: var(--card); color: var(--red); border-color: var(--border-strong); }
.btn-danger:hover { background: var(--red-soft); border-color: var(--red-soft); }
.btn-sm { padding: 7px 15px; min-height: 36px; font-size: 13px; }
.btn-sm .ic { width: 15px; height: 15px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Cards & KPIs ---------- */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.card-title { font-size: 16px; font-weight: 700; margin-bottom: 16px; letter-spacing: -0.2px; }

.kpi-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: 14px; margin-bottom: 24px;
}
.kpi {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow); transition: box-shadow 0.2s, transform 0.2s;
}
.kpi:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kpi__value { font-size: 30px; font-weight: 800; letter-spacing: -0.6px; }
.kpi__label { font-size: 13px; color: var(--text-2); margin-top: 3px; }
.kpi--accent .kpi__value { color: var(--ink); }
.kpi--green .kpi__value { color: var(--green); }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 12px; border-radius: 50px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge .ic { width: 13px; height: 13px; }
.badge--green { background: var(--green-soft); color: var(--green); }
.badge--amber { background: var(--amber-soft); color: var(--amber); }
.badge--red { background: var(--red-soft); color: var(--red); }
.badge--blue { background: var(--blue-soft); color: var(--blue); }
.badge--violet { background: var(--ink-soft); color: var(--text); }
.badge--gray { background: var(--gray-soft); color: var(--text-2); }

.score-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 54px; padding: 7px 12px; border-radius: 50px;
  font-size: 14px; font-weight: 800;
}
.score-badge--high { background: var(--green-soft); color: var(--green); }
.score-badge--mid { background: var(--amber-soft); color: var(--amber); }
.score-badge--low { background: var(--gray-soft); color: var(--text-2); }

/* ---------- Lists / rows ---------- */
.row-list { display: flex; flex-direction: column; gap: 10px; }
.row-item {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 15px 18px;
  box-shadow: var(--shadow); transition: box-shadow 0.15s, transform 0.15s;
}
.row-item:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.row-item__body { flex: 1; min-width: 0; }
.row-item__title { font-weight: 700; font-size: 15px; letter-spacing: -0.2px; }
.row-item__meta { font-size: 13px; color: var(--text-2); margin-top: 4px; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row-item__meta .ic { width: 13px; height: 13px; }
.row-item__icon {
  width: 42px; height: 42px; border-radius: 11px; flex-shrink: 0;
  background: var(--ink-soft); display: flex; align-items: center; justify-content: center;
  color: var(--text);
}
.row-item__icon .ic { width: 20px; height: 20px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 600px; }
th { text-align: start; padding: 13px 16px; font-size: 12px; color: var(--text-3); font-weight: 600; border-bottom: 1px solid var(--border); background: #FAFBFC; white-space: nowrap; }
td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #FAFBFC; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 7px; color: var(--text); }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 14px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  font-family: inherit; font-size: 15px; background: var(--card); color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(17,17,17,0.07);
}
.field textarea { resize: vertical; min-height: 92px; }
.field .hint { font-size: 12px; color: var(--text-3); margin-top: 5px; }

.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 16px; }
.alert--error { background: var(--red-soft); color: var(--red); }
.alert--success { background: var(--green-soft); color: var(--green); }
.alert--info { background: var(--ink-soft); color: var(--text); }

/* ---------- Filter tabs ---------- */
.filter-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.filter-tab {
  padding: 8px 16px; border-radius: 50px; font-size: 13px; font-weight: 500;
  background: var(--card); border: 1px solid var(--border-strong); color: var(--text);
  cursor: pointer; transition: all 0.14s; white-space: nowrap;
}
.filter-tab:hover { background: var(--gray-soft); }
.filter-tab--active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- Auth pages ---------- */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: var(--bg);
}
.auth-card {
  width: 100%; max-width: 420px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 18px; padding: 38px 32px;
  box-shadow: var(--shadow-lg);
}
.auth-logo { display: flex; align-items: center; gap: 12px; justify-content: center; margin-bottom: 10px; }
.auth-logo .sidebar__logo { width: 46px; height: 46px; font-size: 23px; border-radius: 13px; }
.auth-title { text-align: center; font-size: 23px; font-weight: 800; margin-bottom: 4px; letter-spacing: -0.4px; }
.auth-sub { text-align: center; color: var(--text-2); font-size: 14px; margin-bottom: 26px; }
.auth-card .field { margin-bottom: 15px; }
.auth-foot { text-align: center; margin-top: 20px; font-size: 13px; color: var(--text-2); }
.auth-foot a { color: var(--text); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Chat (simulator) ---------- */
.chat {
  max-width: 760px; height: calc(100vh - 188px); min-height: 460px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 18px; box-shadow: var(--shadow-md);
  display: flex; flex-direction: column; overflow: hidden;
}
.chat__header {
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; background: var(--card);
}
.chat__avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--ink);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 17px;
}
.chat__title { font-weight: 700; font-size: 15px; }
.chat__status { font-size: 12px; color: var(--green); }
.chat__body {
  flex: 1; overflow-y: auto; padding: 20px;
  background: #F0F1F3;
  display: flex; flex-direction: column; gap: 10px;
}
.msg {
  max-width: 82%; padding: 10px 14px; border-radius: 14px;
  font-size: 14.5px; line-height: 1.55; white-space: pre-wrap; word-wrap: break-word;
  animation: msg-in 200ms ease; box-shadow: var(--shadow);
}
.msg--user { align-self: flex-end; background: var(--ink); color: #fff; border-bottom-inline-end-radius: 4px; }
.msg--bot { align-self: flex-start; background: #FFFFFF; border: 1px solid var(--border); border-bottom-inline-start-radius: 4px; }
.msg b, .msg strong { font-weight: 700; }
.msg i, .msg em { font-style: italic; opacity: 0.85; }
@keyframes msg-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.chat__quick { display: flex; gap: 8px; padding: 12px 16px 0; flex-wrap: wrap; background: var(--card); }
.quick-btn {
  background: var(--card); border: 1px solid var(--border-strong); border-radius: 50px;
  padding: 7px 15px; font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.14s;
}
.quick-btn:hover { background: var(--ink-soft); border-color: var(--text-3); }

.chat__form { display: flex; gap: 8px; padding: 12px 16px; background: var(--card); border-top: 1px solid var(--border); align-items: center; }
.chat__input {
  flex: 1; padding: 11px 16px; border: 1px solid var(--border-strong);
  border-radius: 50px; font-family: inherit; font-size: 15px;
}
.chat__input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(17,17,17,0.07); }
.chat__mic, .chat__send {
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.15s;
}
.chat__mic { border: 1px solid var(--border-strong); background: var(--card); color: var(--text); }
.chat__mic:hover { background: var(--ink-soft); }
.chat__mic.recording { background: var(--red); border-color: var(--red); color: #fff; animation: mic-pulse 1.2s infinite; }
@keyframes mic-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(197,34,31,0.4); } 50% { box-shadow: 0 0 0 8px rgba(197,34,31,0); } }
.chat__send { border: none; background: var(--ink); color: #fff; }
.chat__send:hover { background: var(--ink-hover); }
.chat__send .ic, .chat__mic .ic { width: 19px; height: 19px; }

.chat__recbar { display: flex; align-items: center; gap: 10px; padding: 8px 18px; background: var(--red-soft); color: var(--red); font-size: 13px; font-weight: 600; }
.chat__recbar[hidden] { display: none; }
.rec-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--red); animation: rec-blink 1s infinite; }
@keyframes rec-blink { 0%,100% { opacity: 1; } 50% { opacity: 0.25; } }

.typing { display: inline-flex; gap: 4px; padding: 13px 16px; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%,80%,100% { opacity: 0.3; } 40% { opacity: 1; } }

/* ---------- Match comparison ---------- */
.compare-grid { display: grid; grid-template-columns: 1fr auto 1fr; gap: 18px; align-items: start; }
.compare-vs {
  align-self: center; width: 52px; height: 52px; border-radius: 50%;
  background: var(--ink); color: #fff; font-weight: 800; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}
.compare-side { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.compare-side--mine { border-color: var(--ink); }
.compare-side h3 { font-size: 16px; margin-bottom: 4px; display: flex; align-items: center; gap: 7px; }
.compare-side .owner-tag { font-size: 12px; color: var(--text-3); margin-bottom: 14px; }
.detail-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.detail-row:last-child { border-bottom: none; }
.detail-row .k { color: var(--text-2); }
.detail-row .v { font-weight: 600; text-align: end; }

.locked-box {
  background: var(--gray-soft); border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm); padding: 14px; text-align: center;
  color: var(--text-2); font-size: 13px; display: flex; align-items: center; justify-content: center; gap: 8px;
}
.locked-box .ic { width: 15px; height: 15px; }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 56px 20px; color: var(--text-2); }
.empty__icon {
  width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 14px;
  background: var(--ink-soft); display: flex; align-items: center; justify-content: center;
  color: var(--text-3);
}
.empty__icon .ic { width: 26px; height: 26px; }
.empty__title { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 6px; }

/* ---------- Domain bars (admin) ---------- */
.bar-row { display: flex; align-items: center; gap: 12px; margin-bottom: 11px; font-size: 13px; }
.bar-row .bar-label { width: 150px; color: var(--text-2); display: flex; align-items: center; gap: 8px; }
.bar-row .bar-label .ic { width: 15px; height: 15px; }
.bar-row .bar-track { flex: 1; height: 9px; background: var(--gray-soft); border-radius: 6px; overflow: hidden; }
.bar-row .bar-fill { height: 100%; background: var(--ink); border-radius: 6px; }
.bar-row .bar-num { width: 34px; font-weight: 700; text-align: end; }

/* ---------- Language switch ---------- */
.lang-switch { display: flex; align-items: center; gap: 8px; justify-content: center; font-size: 12.5px; color: var(--text-3); margin-bottom: 10px; }
.lang-switch a { color: var(--text-2); font-weight: 500; }
.lang-switch a:hover { color: var(--text); }
.lang-switch .lang-active { color: var(--text); font-weight: 700; }

/* ---------- Mobile ---------- */
.mobile-topbar { display: none; }
.sidebar-overlay { display: none; }

@media (max-width: 980px) {
  .layout { display: block; }
  .main { margin-inline-start: 0; padding: 16px 16px 90px; }
  .sidebar { transform: translateX(100%); transition: transform 0.25s ease; box-shadow: var(--shadow-lg); }
  [dir="ltr"] .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.show { display: block; position: fixed; inset: 0; background: rgba(17,17,17,0.4); z-index: 130; }
  .mobile-topbar {
    display: flex; align-items: center; justify-content: space-between;
    background: var(--card); border-bottom: 1px solid var(--border);
    padding: 11px 16px; position: sticky; top: 0; z-index: 120;
  }
  .mobile-topbar .brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 17px; }
  .mobile-topbar .brand .sidebar__logo { width: 30px; height: 30px; font-size: 16px; border-radius: 9px; }
  .hamburger { background: none; border: none; cursor: pointer; color: var(--text); display: flex; padding: 6px; }
  .page-header h1 { font-size: 21px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 11px; }
  .kpi { padding: 16px; }
  .kpi__value { font-size: 25px; }
  .form-grid { grid-template-columns: 1fr; }
  .compare-grid { grid-template-columns: 1fr; gap: 12px; }
  .compare-vs { justify-self: center; transform: rotate(90deg); }
  .chat { height: calc(100dvh - 150px); max-width: 100%; border-radius: 14px; }
  .auth-card { padding: 30px 22px; }
  .row-item { padding: 14px; gap: 12px; }
  .page-header .btn { padding: 9px 16px; font-size: 13px; min-height: 40px; }
}

@media (max-width: 420px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .filter-tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
  .filter-tab { flex-shrink: 0; }
  .row-item__meta { gap: 8px; font-size: 12px; }
}
