/* Freshdesk Admin — MendipSys-family styling (CSS variables, dark theme via
   [data-theme=dark], same ms_theme localStorage key as the other apps). */

:root {
  --bg: #f7f8fc;
  --panel: #ffffff;
  --border: #dfe2ea;
  --text: #202333;
  --muted: #73788b;
  --accent: #005e85;
  --shadow: 0 10px 30px rgba(35, 25, 66, .07);
  --red: #c0392b;   --red-bg: #fdecea;
  --blue: #1f5f9e;  --blue-bg: #e8f1fb;
  --green: #1e7e46; --green-bg: #e7f5ec;
  --grey: #5c6270;  --grey-bg: #eef0f4;
  --amber: #9a6b00; --amber-bg: #fdf3dd;
}
[data-theme="dark"] {
  --bg: #15161d;
  --panel: #1e2029;
  --border: #33364a;
  --text: #e8eaf2;
  --muted: #9aa0b5;
  --accent: #5db3d9;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --red-bg: #3a2220;  --blue-bg: #1d2a3a;
  --green-bg: #1e3227; --grey-bg: #272a36;
  --amber: #e3b04b;   --amber-bg: #33290f;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 18px; }
h2 { font-size: 14px; margin: 0 0 .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
small { color: var(--muted); }

/* ── Top bar ── */
.topbar { background: var(--panel); border-bottom: 1px solid var(--border); }
.topbar-inner {
  max-width: 1200px; margin: 0 auto; padding: .65rem 1rem;
  display: flex; align-items: center; gap: 1.4rem;
}
.brand { font-weight: 700; font-size: 15px; color: var(--text); }
.brand span { color: var(--accent); }
.topbar nav { display: flex; gap: 1rem; flex: 1; }
.topbar-user { display: flex; gap: .8rem; align-items: center; color: var(--muted); }

/* ── Layout ── */
.page { max-width: 1200px; margin: 1.2rem auto; padding: 0 1rem; }
.cols { display: flex; gap: 1rem; align-items: flex-start; flex-wrap: wrap; }
.grow { flex: 1 1 560px; }
.side { flex: 0 1 320px; display: flex; flex-direction: column; gap: 1rem; }
.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow); padding: 1rem 1.1rem;
}
.notice {
  background: var(--red-bg); border: 1px solid var(--red); color: var(--text);
  border-radius: 10px; padding: .7rem 1rem; margin-bottom: 1rem;
}

/* ── Stats ── */
.stat-row { display: flex; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.stat {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow); padding: .7rem 1.2rem; min-width: 110px;
}
.stat-n { display: block; font-size: 22px; font-weight: 700; }
.stat-n small { font-size: 13px; font-weight: 400; }
.stat-l { color: var(--muted); font-size: 12px; }

/* ── Table ── */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); padding: .35rem .5rem; border-bottom: 1px solid var(--border);
}
.tbl td { padding: .45rem .5rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .empty { color: var(--muted); text-align: center; padding: 1.4rem; }

/* ── Chips / dots / lists ── */
.chip {
  display: inline-block; padding: 1px 9px; border-radius: 999px;
  font-size: 12px; white-space: nowrap;
}
.chip-red   { background: var(--red-bg);   color: var(--red); }
.chip-blue  { background: var(--blue-bg);  color: var(--blue); }
.chip-green { background: var(--green-bg); color: var(--green); }
.chip-grey  { background: var(--grey-bg);  color: var(--grey); }
.chip-amber { background: var(--amber-bg); color: var(--amber); }

.btn {
  padding: .55rem 1.1rem; border: 0; border-radius: 10px; cursor: pointer;
  background: var(--accent); color: #fff; font-size: 13px; font-weight: 600;
  align-self: center;
}
.btn:disabled { opacity: .6; cursor: default; }
.tbl td.why { color: var(--muted); font-size: 13px; max-width: 260px; }

/* ── Sources / retrieval test ── */
.search-row { display: flex; gap: .6rem; margin-bottom: 1rem; }
.search-row input {
  flex: 1; padding: .55rem .8rem; border: 1px solid var(--border);
  border-radius: 10px; background: var(--bg); color: var(--text); font-size: 14px;
}
.hit { border-top: 1px solid var(--border); padding: .8rem 0; }
.hit-head { display: flex; gap: .6rem; align-items: baseline; flex-wrap: wrap; margin-bottom: .45rem; }
.hit-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; font-size: 13px; }
.hit-body { font-size: 13px; color: var(--muted); }
.hit-label {
  display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); margin-bottom: .25rem;
}
.hit-cols > div { background: var(--bg); border-radius: 8px; padding: .6rem .7rem; }
@media (max-width: 720px) { .hit-cols { grid-template-columns: 1fr; } }
.empty { color: var(--muted); }

/* ── Bench / drafts ── */
.bench-form label { display: block; color: var(--muted); font-size: 13px; margin-bottom: .6rem; }
.bench-form input, .bench-form textarea {
  display: block; width: 100%; margin-top: .3rem; padding: .5rem .7rem;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); color: var(--text); font-size: 14px; font-family: inherit;
}
.bench-row { display: flex; gap: 1rem; align-items: flex-end; margin-bottom: .3rem; }
.bench-row label { flex: 0 0 160px; margin-bottom: .6rem; }
.bench-row label.grow { flex: 1; }
.bench-or { color: var(--muted); font-size: 12px; padding-bottom: 1.1rem; }
.draft-body {
  background: var(--bg); border-radius: 10px; padding: 1rem 1.1rem;
  font-size: 14px; line-height: 1.55; white-space: normal;
}
.btn-off { background: var(--grey); }
.toggle-form { align-self: center; }
.bench-form select {
  display: block; width: 100%; margin-top: .3rem; padding: .5rem .7rem;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); color: var(--text); font-size: 14px;
}
.notice-ok { background: var(--green-bg); border-color: var(--green); }
.btn-link { background: none; border: 0; color: var(--accent); cursor: pointer; font-size: 13px; }
.fb-row { display: flex; gap: .5rem; align-items: center; margin-top: .8rem; }
.fb-row input[type=text] {
  flex: 1; padding: .45rem .7rem; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); color: var(--text); font-size: 13px;
}
.btn-thumb {
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: .35rem .6rem; cursor: pointer; font-size: 15px; opacity: .55;
}
.btn-thumb.on { opacity: 1; border-color: var(--accent); background: var(--blue-bg); }
.draft-link { display: inline-block; margin-top: .3rem; font-size: 12px; white-space: nowrap; }
.email-body { border-left: 3px solid var(--border); max-height: 24rem; overflow-y: auto; }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: .45rem; }
.dot-on  { background: var(--green); }
.dot-off { background: var(--border); }

ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain li { padding: .3rem 0; display: flex; align-items: baseline; gap: .45rem; flex-wrap: wrap; }
ul.plain.tight li { padding: .15rem 0; }

/* ── Login ── */
.login-page { display: flex; min-height: 100vh; align-items: center; justify-content: center; }
.login-box {
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow); padding: 2rem; width: min(92vw, 24rem);
}
.login-box h1 { margin: 0 0 1rem; }
.login-box label { display: block; margin: .8rem 0; color: var(--muted); font-size: 13px; }
.login-box input {
  width: 100%; margin-top: .3rem; padding: .55rem .7rem;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); color: var(--text); font-size: 14px;
}
.login-box button {
  width: 100%; margin-top: 1rem; padding: .6rem;
  background: var(--accent); color: #fff; border: 0; border-radius: 8px;
  font-size: 14px; font-weight: 600; cursor: pointer;
}
.login-error {
  background: var(--red-bg); color: var(--red); border-radius: 8px;
  padding: .55rem .8rem; margin-bottom: .6rem; font-size: 13px;
}

/* ── Beta pill ── */
.beta-pill {
  position: fixed; right: .8rem; bottom: .8rem;
  background: var(--accent); color: #fff; border-radius: 999px;
  padding: 2px 10px; font-size: 11px; opacity: .75; pointer-events: none;
}
