/* ============================================================
   CAREC Business Forum 2026 — Government portal design system
   Self-contained (no CDN). Invest Mongolia brand palette.
   ============================================================ */

:root {
  --imblue:   #001F60;   /* Pantone 2757C */
  --imblue-2: #013183;
  --imblue-3: #0a4bb5;
  --imred:    #F32836;   /* Pantone 1788C */
  --imred-2:  #d81f2c;
  --imyellow: #F98E2B;   /* Pantone 715C  */
  --imyellow-2:#e07d1f;

  --bg:       #f4f6fb;
  --card:     #ffffff;
  --line:     #e6e9f0;
  --line-2:   #eef1f7;
  --text:     #16203a;
  --muted:    #667089;
  --muted-2:  #97a0b5;

  --shadow-sm: 0 1px 2px rgba(16,32,80,.06), 0 1px 3px rgba(16,32,80,.04);
  --shadow-md: 0 4px 12px rgba(16,32,80,.08);
  --shadow-lg: 0 12px 32px rgba(16,32,80,.14);

  --sidebar-w: 264px;
  --radius: 14px;
}

* , *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea, button { font-size: 100%; }
ul { margin: 0; padding: 0; list-style: none; }
table { border-collapse: collapse; width: 100%; }
h1,h2,h3,h4 { margin: 0; }

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

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--imblue) 0%, #00184c 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 40;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 22px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,.10);
}
.brand-dots { display: flex; flex-direction: column; gap: 4px; }
.dot { width: 9px; height: 9px; border-radius: 50%; }
.dot-y { background: var(--imyellow); }
.dot-r { background: var(--imred); }
.dot-w { background: #fff; }
.brand-logo {
  flex-shrink: 0; background: #fff; border-radius: 10px;
  padding: 4px; width: 46px; height: 46px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
.brand-logo img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.brand-logo-md { width: 72px; height: 72px; padding: 6px; border-radius: 12px; }
.brand-logo-lg { width: 96px; height: 96px; padding: 8px; border-radius: 14px; }
.brand-title { font-weight: 800; font-size: 17px; letter-spacing: .3px; }
.brand-sub { font-size: 11.5px; color: rgba(255,255,255,.6); margin-top: 1px; }

.side-nav { padding: 14px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.side-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 10px;
  color: rgba(255,255,255,.78);
  font-size: 14px; font-weight: 500;
  border: none; background: transparent; width: 100%; text-align: left;
  transition: background .15s, color .15s;
}
.side-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.side-link-active {
  background: #fff; color: var(--imblue); font-weight: 700;
  box-shadow: var(--shadow-sm);
}
.side-link-active:hover { background: #fff; color: var(--imblue); }
.side-ico { width: 19px; height: 19px; display: inline-flex; flex-shrink: 0; }
.side-ico svg { width: 100%; height: 100%; }
.sidebar-foot { padding: 12px; border-top: 1px solid rgba(255,255,255,.10); }
.side-logout { color: rgba(255,255,255,.85); }
.side-logout:hover { background: var(--imred); color: #fff; }

.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.4); z-index: 39;
}
.sidebar-overlay.show { display: block; }

.app-body {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  display: flex; flex-direction: column;
}

/* ---------- Topbar ---------- */
.topbar {
  height: 66px; flex-shrink: 0;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 16px;
  padding: 0 28px;
  position: sticky; top: 0; z-index: 20;
}
.menu-btn {
  display: none; background: transparent; border: none;
  color: var(--imblue); width: 26px; height: 26px; padding: 0;
}
.menu-btn svg { width: 100%; height: 100%; }
.topbar-title { font-size: 19px; font-weight: 700; color: var(--imblue); flex: 1; }
.topbar-user { display: flex; align-items: center; gap: 12px; }
.user-meta { text-align: right; }
.user-name { font-size: 13.5px; font-weight: 600; }
.user-role { font-size: 11.5px; color: var(--muted); }
.user-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--imblue-2), var(--imblue-3));
  color: #fff; font-weight: 700; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  text-transform: uppercase;
}

.app-main { padding: 28px; max-width: 1200px; width: 100%; }

/* ---------- Page header ---------- */
.page-head { margin-bottom: 22px; }
.page-title { font-size: 24px; font-weight: 800; color: var(--imblue); }
.page-sub { color: var(--muted); font-size: 14px; margin-top: 4px; }

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 22px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 10px; border: 1px solid transparent;
  font-size: 14px; font-weight: 600; transition: all .15s; white-space: nowrap;
}
.btn-primary { background: var(--imred); color: #fff; }
.btn-primary:hover { background: var(--imred-2); }
.btn-accent { background: var(--imyellow); color: #fff; }
.btn-accent:hover { background: var(--imyellow-2); }
.btn-blue { background: var(--imblue); color: #fff; }
.btn-blue:hover { background: var(--imblue-2); }
.btn-outline { background: #fff; color: var(--imblue); border-color: var(--imblue); }
.btn-outline:hover { background: rgba(0,31,96,.05); }
.btn-ghost { background: #f1f3f8; color: var(--text); }
.btn-ghost:hover { background: #e7eaf2; }
.btn-sm { padding: 7px 13px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-danger-link { background: none; border: none; color: var(--imred); font-weight: 600; font-size: 13px; }
.btn-danger-link:hover { text-decoration: underline; }
.btn-green { background: #16a34a; color: #fff; }
.btn-green:hover { background: #15803d; }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.input, .select, .textarea {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--text); font-family: inherit;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--imblue-3);
  box-shadow: 0 0 0 3px rgba(10,75,181,.14);
}
.input:disabled { background: #f4f6fb; color: var(--muted); }
.textarea { resize: vertical; }
select[multiple] { min-height: 120px; }

/* ---------- Grids ---------- */
.grid { display: grid; gap: 18px; }
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.stat-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }

/* ---------- Filters row ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 22px; }
.filters .select, .filters .input { width: auto; min-width: 160px; }
.filters .grow { flex: 1; min-width: 200px; }

/* ---------- Match / directory card ---------- */
.mcard { display: flex; flex-direction: column; padding: 20px; }
.mcard-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 4px; }
.mcard-company { font-size: 16px; font-weight: 700; color: var(--imblue); }
.mcard-person { font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.mcard-industry { font-size: 12px; color: var(--muted-2); margin-top: 2px; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.tag { font-size: 11.5px; background: rgba(0,31,96,.06); color: var(--imblue); padding: 3px 9px; border-radius: 999px; }
.reasons { font-size: 13.5px; color: var(--muted); margin: 12px 0; flex: 1; }
.reasons li { display: flex; gap: 8px; align-items: flex-start; padding: 2px 0; }
.reasons .ok { color: #16a34a; flex-shrink: 0; font-weight: 700; }
.mcard-actions { display: flex; gap: 10px; padding-top: 14px; border-top: 1px solid var(--line-2); }
.mcard-actions > * { flex: 1; }

/* ---------- Score badge ---------- */
.score { flex-shrink: 0; font-size: 13px; font-weight: 700; padding: 5px 11px; border-radius: 999px; }
.score-hi { background: #dcfce7; color: #15803d; }
.score-mid { background: #fef3c7; color: #b45309; }
.score-lo { background: #eef1f7; color: var(--muted); }

/* ---------- Stat cards ---------- */
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 16px; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 6px;
}
.stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat-val { font-size: 28px; font-weight: 800; color: var(--imblue); line-height: 1; }
.stat-label { font-size: 12.5px; color: var(--muted); }
.stat-ico { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; }
.stat-ico svg { width: 18px; height: 18px; }
.ico-blue { background: rgba(0,31,96,.10); color: var(--imblue); }
.ico-red  { background: rgba(243,40,54,.10); color: var(--imred); }
.ico-yellow { background: rgba(249,142,43,.14); color: var(--imyellow-2); }
.ico-green { background: #dcfce7; color: #15803d; }

/* ---------- Distribution bars ---------- */
.dist { display: flex; flex-direction: column; gap: 10px; }
.dist-row .dist-top { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.dist-bar { height: 8px; background: #eef1f7; border-radius: 999px; overflow: hidden; }
.dist-fill { height: 100%; background: linear-gradient(90deg, var(--imyellow), var(--imred)); border-radius: 999px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); background: #fff; box-shadow: var(--shadow-sm); }
table.data { font-size: 13.5px; }
table.data thead th {
  text-align: left; padding: 13px 16px; background: #f7f9fc;
  color: var(--muted); font-weight: 600; font-size: 12.5px;
  text-transform: uppercase; letter-spacing: .02em; white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
table.data tbody td { padding: 13px 16px; border-top: 1px solid var(--line-2); vertical-align: middle; }
table.data tbody tr:hover { background: #fafbfe; }

/* ---------- Section heading ---------- */
.section-title { font-size: 17px; font-weight: 700; color: var(--imblue); margin-bottom: 14px; }
.section { margin-top: 30px; }

/* ---------- Status pills ---------- */
.pill { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.pill-pending  { background: #fef3c7; color: #b45309; }
.pill-accepted { background: #dbeafe; color: #1d4ed8; }
.pill-confirmed{ background: #dcfce7; color: #15803d; }
.pill-rejected { background: #fee2e2; color: #b91c1c; }
.pill-cancelled{ background: #eef1f7; color: var(--muted); }
.pill-completed{ background: #f1f3f8; color: var(--muted-2); }
.pill-active   { background: #dcfce7; color: #15803d; }
.pill-inactive { background: #eef1f7; color: var(--muted); }

/* ---------- Schedule items ---------- */
.sched-item { display: flex; align-items: center; gap: 18px; padding: 16px 20px; }
.sched-time { width: 118px; flex-shrink: 0; text-align: center; }
.sched-time .t { font-size: 15px; font-weight: 800; color: var(--imblue); }
.sched-mid { flex: 1; border-left: 1px solid var(--line); padding-left: 18px; }
.sched-loc { text-align: right; font-size: 13px; color: var(--muted); }
.sched-loc .tbl { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 700; color: var(--text); }

/* ---------- Requests ---------- */
.req-item { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; justify-content: space-between; padding: 16px 18px; }
.req-info .who { font-weight: 600; color: var(--imblue); }
.req-info .topic { font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.req-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- Empty / message ---------- */
.empty { text-align: center; color: var(--muted); padding: 48px 0; }
.msg-ok { color: #15803d; font-size: 13.5px; }
.msg-err { color: var(--imred); font-size: 13.5px; }

/* ---------- Login (split panel) ---------- */
.login-split { display: flex; min-height: 100vh; }
.login-brand-panel {
  flex: 1.1; position: relative; overflow: hidden;
  background: linear-gradient(150deg, var(--imblue) 0%, #002a72 55%, #013183 100%);
  color: #fff; padding: 48px 56px;
  display: flex; flex-direction: column; justify-content: space-between;
}
.lbp-glow {
  position: absolute; width: 460px; height: 460px; border-radius: 50%;
  background: radial-gradient(circle, rgba(249,142,43,.28), transparent 70%);
  bottom: -160px; right: -120px; pointer-events: none;
}
.lbp-top { position: relative; z-index: 1; }
.lbp-mid { position: relative; z-index: 1; }
.lbp-title { font-size: 40px; font-weight: 800; line-height: 1.1; letter-spacing: -.5px; }
.lbp-sub { margin-top: 16px; font-size: 15px; color: rgba(255,255,255,.72); line-height: 1.6; }
.lbp-features { margin-top: 32px; display: flex; flex-direction: column; gap: 14px; }
.lbp-features li { display: flex; align-items: center; gap: 12px; font-size: 14.5px; color: rgba(255,255,255,.9); }
.lbp-features li span {
  flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%;
  background: rgba(249,142,43,.22); color: var(--imyellow);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px;
}
.lbp-foot { position: relative; z-index: 1; font-size: 13px; color: rgba(255,255,255,.55); }

.login-form-panel { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px; background: var(--bg); }
.login-form-inner { width: 100%; max-width: 380px; }
.lfp-title { font-size: 26px; font-weight: 800; color: var(--imblue); }
.lfp-sub { color: var(--muted); margin-top: 4px; margin-bottom: 26px; font-size: 14px; }
.login-demo { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.login-demo b { color: var(--text); }
.login-demo .mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
.login-demo p { margin: 4px 0; }

@media (max-width: 860px) {
  .login-brand-panel { display: none; }
  .login-form-panel { flex: 1; }
}

/* ---------- Table utilization matrix ---------- */
.grid-matrix { font-size: 12px; }
.grid-matrix th, .grid-matrix td { text-align: center; padding: 0; }
.grid-matrix thead th { padding: 8px 6px; font-size: 11px; }
.sticky-col { position: sticky; left: 0; background: #f7f9fc; z-index: 2; text-align: left !important; padding: 8px 12px !important; white-space: nowrap; }
.slot-label { font-weight: 700; color: var(--imblue); background: #fff !important; }
.cell { width: 26px; height: 30px; border: 1px solid var(--line-2); }
.cell-free { background: #f3f6fb; }
.cell-busy { background: var(--imred); cursor: pointer; transition: transform .1s; }
.cell-busy:hover { background: var(--imred-2); transform: scale(1.15); position: relative; z-index: 1; }

.legend-box { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: middle; margin-right: 4px; }
.legend-free { background: #f3f6fb; border: 1px solid var(--line); }
.legend-busy { background: var(--imred); }

/* ---------- Modal ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(16,32,80,.5); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 20px; }
.modal-box { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg); max-width: 460px; width: 100%; padding: 24px; }

/* utility bits still referenced */
.meet-loc { font-size: 13px; font-weight: 600; color: var(--imblue); background: rgba(0,31,96,.06); padding: 5px 11px; border-radius: 8px; white-space: nowrap; }
.mb-0 { margin-bottom: 0; }
.mt-2 { margin-top: 8px; }
.flex { display: flex; }
.gap-2 { gap: 8px; }
.hidden { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 780px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s ease; }
  .sidebar.sidebar-open { transform: translateX(0); }
  .app-body { margin-left: 0; }
  .menu-btn { display: inline-flex; }
  .app-main { padding: 18px; }
  .user-meta { display: none; }
}

/* ---------- Registration page ---------- */
.reg-wrap { min-height: 100vh; background: var(--bg); display: flex; justify-content: center; padding: 24px 16px; }
.reg-card { width: 100%; max-width: 680px; overflow: hidden; padding: 0; }
.reg-head { background: linear-gradient(135deg, var(--imblue), #013183); padding: 24px 26px; }
.reg-head .login-sub { color: rgba(255,255,255,.75); }

/* ---------- "All other organizations" section (legacy) ---------- */
.all-orgs-head { display:flex; align-items:center; gap:10px; margin:30px 0 14px; }
.all-orgs-head .line { flex:1; height:1px; background:var(--line); }
.all-orgs-head .t { font-size:15px; font-weight:700; color:var(--imblue); }

/* ---------- Mobile refinements ---------- */
@media (max-width: 640px) {
  .app-main { padding: 16px 14px; }
  .page-title { font-size: 20px; }
  .grid-cards { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .filters { flex-direction: column; }
  .filters .select, .filters .input, .filters .grow { width: 100%; min-width: 0; }
  .filters .btn { width: 100%; }
  .grid-2 { grid-template-columns: 1fr; }
  /* meeting request rows stack cleanly */
  .req-item { flex-direction: column; align-items: stretch; }
  .req-actions { justify-content: flex-start; flex-wrap: wrap; }
  .req-actions .btn { flex: 1; }
  /* schedule rows */
  .sched-item { flex-wrap: wrap; gap: 10px; }
  .sched-time { width: auto; text-align: left; }
  .sched-mid { border-left: none; padding-left: 0; width: 100%; }
  .sched-loc { text-align: left; }
  /* modal fits small screens and can scroll */
  .modal-overlay { padding: 12px; align-items: flex-start; overflow-y: auto; }
  .modal-box { max-height: 92vh; overflow-y: auto; }
  /* topbar tighter */
  .topbar { padding: 0 16px; }
  .topbar-title { font-size: 16px; }
  /* tables scroll horizontally rather than squashing */
  .table-wrap { -webkit-overflow-scrolling: touch; }
  .reg-card { max-width: 100%; }
  select[multiple] { min-height: 100px; }
}
@media (max-width: 400px) {
  .stat-grid { grid-template-columns: 1fr; }
  .mcard-actions { flex-direction: column; }
}

/* ---------- In-app notice dialog (replaces browser alert/confirm) ---------- */
.notice-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(10, 22, 60, .55);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  opacity: 0; transition: opacity .18s ease;
}
.notice-overlay.show { opacity: 1; }
.notice-box {
  background: #fff; width: 100%; max-width: 420px;
  border-radius: 18px; box-shadow: var(--shadow-lg);
  padding: 28px 24px 20px; text-align: center;
  transform: translateY(12px) scale(.97); transition: transform .2s ease;
}
.notice-overlay.show .notice-box { transform: none; }
.notice-icon {
  width: 56px; height: 56px; border-radius: 50%; margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center;
}
.notice-icon svg { width: 28px; height: 28px; }
.notice-success .notice-icon { background: #e8f7ee; color: #15803d; }
.notice-error   .notice-icon { background: #fdecee; color: var(--imred); }
.notice-info    .notice-icon { background: #e8eefb; color: var(--imblue-3); }
.notice-warning .notice-icon { background: #fff3e6; color: #b45309; }
.notice-title { font-size: 18px; font-weight: 700; color: var(--imblue); margin-bottom: 6px; }
.notice-msg { font-size: 14.5px; color: var(--muted); line-height: 1.55; }
.notice-details {
  margin: 16px 0 0; padding: 4px 14px; text-align: left;
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
}
.notice-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; font-size: 14px; }
.notice-row + .notice-row { border-top: 1px solid var(--line); }
.notice-row span:first-child { color: var(--muted); }
.notice-row span:last-child { font-weight: 600; color: var(--text); text-align: right; }
.notice-actions { display: flex; gap: 10px; margin-top: 22px; }
.notice-actions .btn { flex: 1; justify-content: center; min-height: 44px; }

@media (max-width: 640px) {
  /* bottom sheet on phones */
  .notice-overlay { align-items: flex-end; padding: 0; }
  .notice-box {
    max-width: none; border-radius: 22px 22px 0 0;
    padding: 12px 20px calc(20px + env(safe-area-inset-bottom));
    transform: translateY(100%);
  }
  .notice-box::before {
    content: ""; display: block; width: 40px; height: 4px; border-radius: 4px;
    background: var(--line); margin: 0 auto 18px;
  }
  .notice-actions { flex-direction: column-reverse; }
  .notice-actions .btn { min-height: 48px; font-size: 15px; }
}
