:root {
    --bg: #f8f5ef;
    --card: #ffffff;
    --ink: #1b1b1b;
    --muted: #777;
    --line: #ece3d5;
    --orange: #b66a2a;
    --deep: #202020;
    --green: #0d7a4f;
    --red: #bf3030;
    --blue: #2f69bf;
    --purple: #6d4bb5;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Arial, Helvetica, sans-serif; background: var(--bg); color: var(--ink); }
a { color: inherit; text-decoration: none; }
.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: 260px; background: #171717; color: #fff; padding: 22px; display: flex; flex-direction: column; gap: 24px; position: fixed; left: 0; top: 0; bottom: 0; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 44px; height: 44px; border-radius: 14px; background: var(--orange); display: grid; place-items: center; font-weight: 800; }
.brand strong { display: block; font-size: 18px; }
.brand span { display: block; color: #c9c9c9; font-size: 12px; margin-top: 3px; }
.sidebar nav { display: grid; gap: 8px; }
.sidebar nav a { padding: 12px 14px; border-radius: 12px; color: #e8e8e8; background: rgba(255,255,255,0.04); }
.sidebar nav a:hover { background: rgba(182,106,42,0.32); }
.user-box { margin-top: auto; padding: 14px; border: 1px solid rgba(255,255,255,0.12); border-radius: 16px; }
.user-box small, .user-box span { display: block; color: #bbb; }
.user-box strong { display: block; margin: 4px 0; }
.main-content { flex: 1; margin-left: 260px; padding: 30px; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 22px; }
.page-head h1 { margin: 0; font-size: 30px; letter-spacing: -0.04em; }
.page-head p { margin: 6px 0 0; color: var(--muted); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 22px; box-shadow: 0 12px 30px rgba(70, 45, 20, 0.06); }
.grid { display: grid; gap: 18px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stat h3 { margin: 0; font-size: 34px; }
.stat p { margin: 8px 0 0; color: var(--muted); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 18px; overflow: hidden; }
th, td { text-align: left; padding: 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: #fbf7ef; font-size: 13px; color: #6d5b49; text-transform: uppercase; letter-spacing: 0.04em; }
tr:hover td { background: #fffaf2; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px; padding: 10px 14px; background: #2b2b2b; color: #fff; font-weight: 700; cursor: pointer; font-size: 14px; }
.btn:hover { opacity: 0.9; }
.btn.orange { background: var(--orange); }
.btn.light { background: #f2eadf; color: #332; }
.btn.green { background: var(--green); }
.btn.red { background: var(--red); }
.btn.blue { background: var(--blue); }
.btn.small { padding: 8px 10px; font-size: 12px; }
.form { display: grid; gap: 14px; max-width: 760px; }
.form label { display: grid; gap: 8px; font-weight: 700; }
input, select, textarea { width: 100%; border: 1px solid #dfd4c4; border-radius: 12px; padding: 12px 14px; font-size: 15px; background: #fff; }
textarea { min-height: 120px; resize: vertical; }
.alert { padding: 14px 16px; border-radius: 14px; margin-bottom: 18px; }
.alert.success { background: #e9f8f0; color: #075c38; border: 1px solid #b9ebd0; }
.alert.error { background: #fff1f1; color: #8b1010; border: 1px solid #ffd1d1; }
.badge { display: inline-flex; padding: 6px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.gray { background: #eeeeee; color: #555; }
.blue { background: #eaf2ff; color: #1e58a8; }
.orange { background: #fff1df; color: #a15d1d; }
.red { background: #ffe9e9; color: #a82222; }
.green { background: #e7f8ee; color: #087044; }
.purple { background: #f1eafe; color: #5c2bb7; }
.chat-layout { display: grid; grid-template-columns: 340px 1fr; gap: 20px; }
.chat-box { height: 62vh; overflow-y: auto; padding: 18px; background: #fff; border: 1px solid var(--line); border-radius: 22px; }
.msg { max-width: 74%; padding: 12px 14px; border-radius: 16px; margin-bottom: 12px; line-height: 1.45; white-space: pre-wrap; }
.msg.sent { margin-left: auto; background: #fff1df; border-top-right-radius: 4px; }
.msg.received { margin-right: auto; background: #f0f0f0; border-top-left-radius: 4px; }
.msg-meta { font-size: 11px; color: #777; margin-top: 6px; }
.chat-form { display: grid; gap: 12px; margin-top: 14px; }
.login-page { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(circle at top, #fff3df, #f8f5ef 45%, #171717 45%); }
.login-card { width: min(440px, 92vw); }
.login-card .brand { color: #111; margin-bottom: 18px; }
.help-text { color: var(--muted); font-size: 13px; line-height: 1.5; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.searchbar { display: flex; gap: 10px; margin-bottom: 16px; }
.searchbar input { max-width: 340px; }
@media (max-width: 900px) {
    .sidebar { position: static; width: 100%; }
    .app-shell { display: block; }
    .main-content { margin-left: 0; padding: 18px; }
    .grid-4, .grid-2, .chat-layout { grid-template-columns: 1fr; }
    .page-head { display: block; }
}
.pipeline { display: grid; gap: 10px; }
.pipeline-row { display: flex; justify-content: space-between; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: #fffaf4; }
.mini-item { padding: 12px 0; border-bottom: 1px solid var(--line); display: grid; gap: 4px; }
.mini-item:last-child { border-bottom: 0; }
.mini-item span { color: var(--muted); font-size: 13px; }
.mini-item a { color: var(--orange); font-weight: 800; }
.quick-grid { display: grid; gap: 8px; margin: 12px 0; }
.note-card { padding: 12px; border: 1px solid var(--line); border-radius: 14px; margin-bottom: 10px; background: #fffaf4; }
.note-card small { display:block; color: var(--muted); margin-top: 6px; }
.brand-logo-only {
    justify-content: center;
    padding: 10px 0 22px;
}

.sidebar .brand.brand-logo-only {
    width: 100%;
    height: 135px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 18px 0 24px;
    margin-bottom: 10px;
}
.sidebar .brand.brand-logo-only {
    width: 100%;
    min-height: 155px !important;
    height: 155px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
    padding: 18px 0 25px !important;
    margin-bottom: 12px !important;
}

.sidebar .brand-logo-only img.sidebar-logo,
.sidebar img.sidebar-logo,
img.sidebar-logo {
    width: 180px !important;
    max-width: 180px !important;
    height: auto !important;
    max-height: 140px !important;
    object-fit: contain !important;
    display: block !important;
}