/* Jinimate — Global Stylesheet */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #ffffff;
  --bg2: #f5f5f5;
  --bg3: #ebebeb;
  --text: #111111;
  --text2: #555555;
  --text3: #888888;
  --border: #cccccc;
  --accent: #1a1a1a;
  --accent2: #444444;
  --green: #1a7a3c;
  --red: #b91c1c;
  --yellow: #92400e;
  --blue: #1d4ed8;
  --radius: 4px;
  --font: system-ui, -apple-system, sans-serif;
}

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}

/* Layout */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 200px;
  min-height: 100vh;
  border-right: 1px solid var(--border);
  background: var(--bg2);
  padding: 16px 0;
  flex-shrink: 0;
}
.main { flex: 1; padding: 24px; max-width: 860px; }
.page-title { font-size: 18px; font-weight: 600; margin-bottom: 20px; border-bottom: 1px solid var(--border); padding-bottom: 10px; }

/* Sidebar nav */
.sidebar-brand { padding: 0 16px 16px; font-weight: 700; font-size: 16px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.nav-link {
  display: block;
  padding: 8px 16px;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
}
.nav-link:hover, .nav-link.active { background: var(--bg3); font-weight: 500; }
.nav-section { padding: 12px 16px 4px; font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.05em; }

/* Forms */
.form-group { margin-bottom: 14px; }
label { display: block; font-size: 12px; font-weight: 500; margin-bottom: 4px; color: var(--text2); }
input[type=text], input[type=email], input[type=password], input[type=number],
select, textarea {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { resize: vertical; min-height: 80px; }

/* Buttons */
.btn {
  display: inline-block;
  padding: 7px 14px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-family: var(--font);
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: var(--accent2); }
.btn-outline { background: transparent; color: var(--accent); }
.btn-outline:hover { background: var(--bg2); }
.btn-danger { background: var(--red); border-color: var(--red); }
.btn-danger:hover { opacity: 0.85; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-green { background: var(--green); border-color: var(--green); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Alerts */
.alert { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px; font-size: 13px; }
.alert-error { background: #fef2f2; border: 1px solid #fca5a5; color: var(--red); }
.alert-success { background: #f0fdf4; border: 1px solid #86efac; color: var(--green); }
.alert-info { background: #eff6ff; border: 1px solid #93c5fd; color: var(--blue); }
.alert-warn { background: #fffbeb; border: 1px solid #fcd34d; color: var(--yellow); }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; padding: 8px 10px; border-bottom: 2px solid var(--border); font-weight: 600; font-size: 12px; color: var(--text2); }
td { padding: 8px 10px; border-bottom: 1px solid var(--bg3); }
tr:hover td { background: var(--bg2); }

/* Cards / Sections */
.card { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.card-title { font-weight: 600; margin-bottom: 12px; font-size: 14px; }

/* Stats row */
.stats-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.stat-box { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; min-width: 130px; }
.stat-num { font-size: 24px; font-weight: 700; }
.stat-label { font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.04em; }

/* Status badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 500; }
.badge-green { background: #dcfce7; color: var(--green); }
.badge-red { background: #fee2e2; color: var(--red); }
.badge-gray { background: var(--bg3); color: var(--text2); }
.badge-yellow { background: #fef9c3; color: var(--yellow); }

/* Notice / Checklist */
.notice { padding: 10px 14px; background: var(--bg2); border-left: 3px solid var(--accent); margin-bottom: 10px; font-size: 13px; }
.notice.done { border-color: var(--green); }
.notice.warn { border-color: #f59e0b; }

/* Chat UI */
.chat-layout { display: flex; gap: 0; height: calc(100vh - 90px); }
.thread-list { width: 240px; border-right: 1px solid var(--border); overflow-y: auto; flex-shrink: 0; }
.thread-item { padding: 10px 14px; border-bottom: 1px solid var(--bg3); cursor: pointer; }
.thread-item:hover, .thread-item.active { background: var(--bg2); }
.thread-name { font-weight: 500; font-size: 13px; }
.thread-preview { font-size: 11px; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-unread { float: right; background: var(--accent); color: #fff; border-radius: 10px; font-size: 10px; padding: 1px 6px; }

.chat-panel { flex: 1; display: flex; flex-direction: column; }
.chat-header { padding: 12px 16px; border-bottom: 1px solid var(--border); font-weight: 500; font-size: 13px; }
.chat-messages { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 75%; padding: 8px 12px; border-radius: var(--radius); font-size: 13px; line-height: 1.5; }
.msg-customer { background: var(--bg2); align-self: flex-start; }
.msg-merchant { background: var(--accent); color: #fff; align-self: flex-end; }
.msg-ai { background: #eff6ff; border: 1px solid #bfdbfe; align-self: flex-end; }
.msg-meta { font-size: 10px; color: var(--text3); margin-top: 2px; }

.chat-input-bar { padding: 10px 16px; border-top: 1px solid var(--border); display: flex; gap: 8px; }
.chat-input-bar input { flex: 1; }

/* Auth pages */
.auth-wrap { max-width: 380px; margin: 60px auto; padding: 0 16px; }
.auth-title { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.auth-sub { color: var(--text2); margin-bottom: 24px; font-size: 13px; }
.auth-divider { text-align: center; margin: 14px 0; color: var(--text3); font-size: 12px; position: relative; }
.auth-divider::before { content: ''; position: absolute; top: 50%; left: 0; right: 0; height: 1px; background: var(--border); z-index: 0; }
.auth-divider span { position: relative; background: #fff; padding: 0 10px; z-index: 1; }

/* Lang toggle */
.lang-toggle { font-size: 12px; color: var(--text2); cursor: pointer; border: 1px solid var(--border); border-radius: var(--radius); padding: 3px 8px; background: none; }

/* Top bar */
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 0 24px; height: 44px; border-bottom: 1px solid var(--border); background: var(--bg); font-size: 13px; }

/* Pagination */
.pagination { display: flex; gap: 6px; margin-top: 14px; }
.page-btn { padding: 4px 10px; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; font-size: 12px; background: var(--bg); }
.page-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Utility */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-gap { display: flex; gap: 10px; align-items: center; }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }
.text-muted { color: var(--text3); font-size: 12px; }
.text-right { text-align: right; }
.hidden { display: none !important; }
.w-full { width: 100%; }
hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
