/* Jingjai Connect — ธีมเขียวสำหรับระบบผู้เช่าและระบบจัดการหอ */
.jc {
  --jc-50: #ecf8f3;
  --jc-100: #d3efe3;
  --jc-200: #a8dfc8;
  --jc-500: #149170;
  --jc-600: #0e7b5e;
  --jc-700: #0b634c;
  --jc-800: #0a4f3d;
  --jc-ink: #10231c;
  --jc-muted: #5f7069;
  --jc-line: #dbe7e2;
  --jc-bg: #f3f7f5;
  min-height: 100dvh;
  background: var(--jc-bg);
  color: var(--jc-ink);
  font-family: var(--font), sans-serif;
}
.jc .font-display,
.jc h1,
.jc h2,
.jc h3 {
  font-family: var(--font), var(--font), sans-serif;
}

/* ---------- shell ---------- */
.jc-shell {
  display: flex;
  min-height: 100dvh;
}
.jc-side {
  width: 264px;
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid var(--jc-line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow-y: auto;
}
.jc-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 18px 14px;
}
.jc-logo {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, #1fae86, #0b634c);
  box-shadow: 0 6px 14px -6px #0b634c;
}
.jc-nav {
  padding: 4px 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.jc-nav-group {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #92a59d;
  padding: 14px 10px 6px;
  text-transform: uppercase;
}
.jc-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  font-size: 14.5px;
  color: #34463f;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.jc-nav a svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: #7d918a;
}
.jc-nav a:hover {
  background: var(--jc-50);
}
.jc-nav a[aria-current="page"] {
  background: var(--jc-50);
  color: var(--jc-700);
  font-weight: 600;
}
.jc-nav a[aria-current="page"] svg {
  color: var(--jc-600);
}
.jc-nav .jc-count {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  border-radius: 99px;
  background: #e11d48;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
  padding: 0 6px;
}
.jc-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.jc-top {
  height: 56px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--jc-line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.jc-content {
  padding: 24px;
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
}
.jc-menu-btn {
  display: none;
}
.jc-backdrop {
  display: none;
}
@media (max-width: 900px) {
  .jc-side {
    position: fixed;
    left: 0;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.12);
  }
  .jc-shell[data-open="true"] .jc-side {
    transform: none;
  }
  .jc-shell[data-open="true"] .jc-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(10, 30, 22, 0.35);
    z-index: 40;
  }
  .jc-menu-btn {
    display: grid;
  }
  .jc-content {
    padding: 16px;
  }
  .jc-top {
    padding: 0 12px;
  }
}

/* ---------- pieces ---------- */
.jc-card {
  background: #fff;
  border: 1px solid var(--jc-line);
  border-radius: 18px;
  box-shadow: 0 1px 2px rgba(16, 35, 28, 0.04);
}
.jc-card-pad {
  padding: 20px;
}
.jc-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}
.jc-head-ico {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--jc-50);
  color: var(--jc-600);
  display: grid;
  place-items: center;
}
.jc-head-ico svg {
  width: 22px;
  height: 22px;
}
.jc-head h1 {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
}
.jc-head p {
  color: var(--jc-muted);
  font-size: 13.5px;
}

.jc-stat {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  padding: 16px 18px;
  border: 1px solid var(--jc-line);
  background: #fff;
}
.jc-stat .lbl {
  font-size: 12.5px;
  color: var(--jc-muted);
}
.jc-stat .val {
  font-family: var(--font), sans-serif;
  font-size: 26px;
  font-weight: 700;
  margin-top: 2px;
  line-height: 1.25;
}
.jc-stat .sub {
  font-size: 12px;
  color: var(--jc-muted);
}
.jc-stat .ico {
  position: absolute;
  right: 14px;
  top: 14px;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: grid;
  place-items: center;
}
.jc-stat .ico svg {
  width: 19px;
  height: 19px;
}
.tone-rose {
  background: linear-gradient(135deg, #fff1f3, #fde4e8);
}
.tone-rose .ico {
  background: #fecdd6;
  color: #be123c;
}
.tone-amber {
  background: linear-gradient(135deg, #fff9ee, #fdf0d5);
}
.tone-amber .ico {
  background: #fde4b0;
  color: #b45309;
}
.tone-green {
  background: linear-gradient(135deg, #effaf5, #dcf3e9);
}
.tone-green .ico {
  background: #c3ead8;
  color: #0e7b5e;
}
.tone-teal {
  background: linear-gradient(135deg, #eef7f5, #d9ece7);
}
.tone-teal .ico {
  background: #c7e2db;
  color: #0b634c;
}
.tone-sky {
  background: linear-gradient(135deg, #f0f7ff, #deedfd);
}
.tone-sky .ico {
  background: #cbe2fb;
  color: #1d4ed8;
}

.jc-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 99px;
  white-space: nowrap;
}
.jc-badge.b-green {
  background: #0e7b5e;
  color: #fff;
}
.jc-badge.b-amber {
  background: #fef3c7;
  color: #92400e;
}
.jc-badge.b-sky {
  background: #dbeafe;
  color: #1e40af;
}
.jc-badge.b-rose {
  background: #ffe4e6;
  color: #be123c;
}
.jc-badge.b-gray {
  background: #eef2f0;
  color: #52625b;
}
.jc-badge.b-line {
  background: #fff;
  border: 1px solid var(--jc-line);
  color: #3b4d46;
}

.jc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 40px;
  padding: 0 16px;
  border-radius: 11px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, opacity 0.15s, box-shadow 0.15s;
}
.jc-btn svg {
  width: 17px;
  height: 17px;
}
.jc-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.jc-btn-primary {
  background: var(--jc-600);
  color: #fff;
  box-shadow: 0 6px 16px -8px var(--jc-700);
}
.jc-btn-primary:hover:not(:disabled) {
  background: var(--jc-700);
}
.jc-btn-ghost {
  background: #fff;
  border-color: var(--jc-line);
  color: #2c3d36;
}
.jc-btn-ghost:hover:not(:disabled) {
  background: var(--jc-50);
}
.jc-btn-danger {
  background: #fff;
  border-color: #fecdd3;
  color: #be123c;
}
.jc-btn-danger:hover:not(:disabled) {
  background: #fff1f2;
}
.jc-btn-sm {
  height: 32px;
  padding: 0 11px;
  font-size: 13px;
  border-radius: 9px;
}
.jc-btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
}

.jc-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: #2c3d36;
}
.jc-input,
.jc-select,
.jc-textarea {
  width: 100%;
  border: 1px solid #cfdcd6;
  background: #fff;
  border-radius: 11px;
  padding: 9px 12px;
  font-size: 14.5px;
  color: var(--jc-ink);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.jc-input:focus,
.jc-select:focus,
.jc-textarea:focus {
  border-color: var(--jc-500);
  box-shadow: 0 0 0 3px rgba(20, 145, 112, 0.14);
}
.jc-input[readonly] {
  background: var(--jc-bg);
}
.jc-textarea {
  min-height: 110px;
  resize: vertical;
}
.jc-hint {
  font-size: 12px;
  color: var(--jc-muted);
  margin-top: 5px;
}

.jc-alert {
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 14px;
  border: 1px solid;
}
.jc-alert b {
  display: block;
  margin-bottom: 2px;
}
.jc-alert-ok {
  background: #ecf8f3;
  border-color: #b9e3d1;
  color: #0b634c;
}
.jc-alert-err {
  background: #fff1f2;
  border-color: #fecdd3;
  color: #9f1239;
}
.jc-alert-warn {
  background: #fff8eb;
  border-color: #f8d9a0;
  color: #8a4b08;
}
.jc-alert-info {
  background: #f0f7ff;
  border-color: #cfe1f8;
  color: #1e3a8a;
}

.jc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.jc-table th {
  text-align: left;
  font-weight: 600;
  font-size: 12.5px;
  color: var(--jc-muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--jc-line);
  white-space: nowrap;
  background: #fafcfb;
}
.jc-table td {
  padding: 11px 12px;
  border-bottom: 1px solid #edf3f0;
  vertical-align: middle;
}
.jc-table tr:last-child td {
  border-bottom: 0;
}
.jc-table-wrap {
  overflow-x: auto;
}
.jc-empty {
  border: 1.5px dashed #cfe0d8;
  border-radius: 16px;
  padding: 40px 20px;
  text-align: center;
  color: var(--jc-muted);
}
.jc-empty .ei {
  width: 52px;
  height: 52px;
  margin: 0 auto 12px;
  border-radius: 16px;
  background: var(--jc-50);
  color: var(--jc-600);
  display: grid;
  place-items: center;
}
.jc-empty b {
  display: block;
  color: var(--jc-ink);
  font-size: 15px;
  margin-bottom: 4px;
}

.jc-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 99px;
  border: 1px solid var(--jc-line);
  background: #fff;
  font-size: 13px;
  color: #34463f;
  text-decoration: none;
  cursor: pointer;
}
.jc-chip[aria-current="true"] {
  background: var(--jc-600);
  border-color: var(--jc-600);
  color: #fff;
}
.jc-chip .n {
  font-size: 11.5px;
  opacity: 0.75;
}

.jc-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.jc-step {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 14px;
  border-radius: 99px;
  border: 1px solid var(--jc-line);
  background: #fff;
  font-size: 13px;
  color: var(--jc-muted);
}
.jc-step[data-state="active"] {
  background: var(--jc-600);
  color: #fff;
  border-color: var(--jc-600);
}
.jc-step[data-state="done"] {
  background: var(--jc-50);
  color: var(--jc-700);
  border-color: var(--jc-200);
}

.jc-bars {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 180px;
  padding-top: 10px;
}
.jc-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 100%;
  justify-content: flex-end;
  min-width: 0;
}
.jc-bar i {
  display: block;
  width: 100%;
  max-width: 46px;
  border-radius: 8px 8px 3px 3px;
  background: linear-gradient(180deg, #23b48c, #0e7b5e);
  min-height: 3px;
}
.jc-bar i.out {
  background: linear-gradient(180deg, #fda4af, #e11d48);
}
.jc-bar span {
  font-size: 11.5px;
  color: var(--jc-muted);
  white-space: nowrap;
}
.jc-bar em {
  font-style: normal;
  font-size: 11px;
  color: #34463f;
  white-space: nowrap;
}

.jc-sig {
  width: 100%;
  height: 200px;
  border: 1.5px dashed #9fcdb9;
  border-radius: 14px;
  background: #fbfefc;
  touch-action: none;
  cursor: crosshair;
}

.jc-chat-bubble {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14.5px;
  white-space: pre-wrap;
  line-height: 1.6;
}
.jc-chat-me {
  margin-left: auto;
  background: var(--jc-600);
  color: #fff;
  border-bottom-right-radius: 5px;
}
.jc-chat-bot {
  background: var(--jc-50);
  border-bottom-left-radius: 5px;
}

.jc-auth {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: radial-gradient(1200px 600px at 10% -10%, #1fae8640, transparent 60%),
    radial-gradient(900px 500px at 110% 110%, #0b634c33, transparent 60%), var(--jc-bg);
}

/* ---------- print (ใบเสร็จ / สัญญา) ---------- */
.jc-paper {
  background: #fff;
  max-width: 820px;
  margin: 0 auto;
  padding: 48px 56px;
  border-radius: 6px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
  font-size: 15px;
  line-height: 1.75;
}
@media (max-width: 700px) {
  .jc-paper {
    padding: 24px 18px;
  }
}
@media print {
  .no-print {
    display: none !important;
  }
  .jc,
  .jc-auth {
    background: #fff !important;
  }
  .jc-paper {
    box-shadow: none;
    padding: 0;
    max-width: none;
  }
  @page {
    margin: 16mm;
  }
}

/* ===================== พื้นฐาน + utility (แทน Tailwind) ===================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  --font: "IBM Plex Sans Thai", "Noto Sans Thai", system-ui, sans-serif;
  font-family: var(--font);
  background: #f3f7f5;
  line-height: 1.55;
}
h1,
h2,
h3,
p,
ul,
ol,
dl,
dd {
  margin: 0;
}
ul,
ol {
  padding: 0;
  list-style: none;
}
ol.num {
  list-style: decimal;
  padding-left: 20px;
}
ol.num > li + li {
  margin-top: 6px;
}
a {
  color: inherit;
}
img {
  max-width: 100%;
}
button,
input,
select,
textarea {
  font: inherit;
}
summary {
  list-style: none;
}
summary::-webkit-details-marker {
  display: none;
}
.jc a.link {
  color: var(--jc-600);
  font-weight: 600;
}
.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.row.nowrap {
  flex-wrap: nowrap;
}
.row.top {
  align-items: flex-start;
}
.row.end {
  justify-content: flex-end;
}
.row.between {
  justify-content: space-between;
}
.grow {
  flex: 1;
  min-width: 0;
}
.stack > * + * {
  margin-top: 16px;
}
.stack-sm > * + * {
  margin-top: 10px;
}
.grid {
  display: grid;
  gap: 16px;
}
.grid.g-sm {
  gap: 10px;
}
.g2,
.g3,
.g4,
.split,
.split-r {
  grid-template-columns: 1fr;
}
@media (min-width: 640px) {
  .g2,
  .g4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .g3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .sm-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .sm-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .sm-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .span2 {
    grid-column: span 2;
  }
}
@media (min-width: 1024px) {
  .g3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .split {
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    align-items: start;
  }
  .split-r {
    grid-template-columns: 400px minmax(0, 1fr);
    align-items: start;
  }
  .g5-3 {
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  }
}
@media (min-width: 1200px) {
  .g4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
.muted {
  color: var(--jc-muted);
}
.small {
  font-size: 13.5px;
}
.xs {
  font-size: 12px;
}
.big {
  font-size: 18px;
}
.b {
  font-weight: 700;
}
.right {
  text-align: right;
}
.center {
  text-align: center;
}
.mono {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}
.num {
  font-variant-numeric: tabular-nums;
}
.pre {
  white-space: pre-line;
}
.nowrap-t {
  white-space: nowrap;
}
.trunc {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.w-full {
  width: 100%;
}
.mt {
  margin-top: 16px;
}
.mt-s {
  margin-top: 8px;
}
.mb {
  margin-bottom: 16px;
}
.mb-l {
  margin-bottom: 22px;
}
.rose {
  color: #be123c;
}
.green {
  color: var(--jc-600);
}
.max-560 {
  max-width: 560px;
}
.max-860 {
  max-width: 860px;
}
.box {
  border: 1px solid var(--jc-line);
  border-radius: 14px;
  padding: 14px;
}
.soft {
  background: var(--jc-50);
  border-radius: 12px;
  padding: 12px 14px;
}
.divide > * + * {
  border-top: 1px solid var(--jc-line);
}
.divide > * {
  padding: 10px 0;
}
.kv {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.lines td {
  padding: 6px 0;
  border-bottom: 1px dashed var(--jc-line);
}
.lines {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.hide-sm {
  display: none;
}
@media (min-width: 640px) {
  .hide-sm {
    display: block;
  }
}
.pop {
  position: relative;
}
.pop > .pop-body {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 30;
  width: 330px;
  max-width: calc(100vw - 32px);
  box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.25);
}
.pop.left > .pop-body {
  left: 0;
  right: auto;
}
.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: #cbd5d1;
}
.dot.green {
  background: var(--jc-500);
}
.dot.amber {
  background: #f59e0b;
}
.dot.rose {
  background: #f43f5e;
}
.thumb {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--jc-line);
}
.slip-img {
  display: block;
  height: 300px;
  background: #f2f5f4;
}
.slip-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.qr-box {
  width: 180px;
  height: 180px;
  border-radius: 12px;
  border: 1px solid var(--jc-line);
  background: #fff;
  padding: 4px;
}
.code-big {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: 0.3em;
  color: var(--jc-700);
}
.pick {
  display: block;
  cursor: pointer;
  padding: 12px;
}
.pick input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.pick:has(input:checked) {
  border-color: var(--jc-600);
  background: var(--jc-50);
}
.step-n {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 99px;
  background: var(--jc-600);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
}
.bar-track {
  height: 8px;
  border-radius: 99px;
  background: var(--jc-bg);
  overflow: hidden;
}
.bar-track i {
  display: block;
  height: 100%;
  background: var(--jc-500);
}
.contract-body {
  max-height: 420px;
  overflow-y: auto;
  border: 1px solid var(--jc-line);
  border-radius: 12px;
  background: #fbfdfc;
  padding: 18px;
  white-space: pre-line;
  line-height: 1.85;
}
.chat-box {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - 220px);
  min-height: 440px;
}
.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.jc-btn svg,
.jc-nav a svg {
  flex-shrink: 0;
}
.ico-sm {
  width: 16px;
  height: 16px;
}
details.bill > summary {
  cursor: pointer;
  padding: 14px 16px;
}
details.bill[open] > summary .chev {
  transform: rotate(90deg);
}
.chev {
  transition: transform 0.15s;
  color: var(--jc-muted);
}
.bill-body {
  border-top: 1px solid var(--jc-line);
  padding: 16px;
}
