/* ============================================================
   Ingatan Gajah · Staff Hub
   Palette: ink slate base, warm amber accent (recall/memory)
   ============================================================ */
:root {
  --ink:        #1c1f2b;
  --ink-2:      #262a39;
  --ink-3:      #323748;
  --line:       #3a3f52;
  --paper:      #f7f6f2;
  --paper-2:    #ffffff;
  --muted:      #8a8fa3;
  --muted-2:    #b8bccc;
  --text:       #20232e;
  --amber:      #e8a33d;
  --amber-deep: #c9821f;
  --green:      #4caa78;
  --blue:       #5b8def;
  --red:        #d96a5b;
  --radius:     14px;
  --radius-sm:  9px;
  --shadow:     0 10px 40px rgba(20, 22, 30, .12);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
a { color: var(--amber-deep); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Brand ---------- */
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 11px;
  background: linear-gradient(145deg, var(--amber), var(--amber-deep));
  color: #2a2008; font-weight: 800; font-size: 17px;
  display: grid; place-items: center; letter-spacing: .5px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.4);
}
.brand-name { font-weight: 800; font-size: 16px; line-height: 1; }
.brand-sub  { font-size: 12px; color: var(--muted); margin-top: 3px; letter-spacing: .3px; }

/* ============================================================
   AUTH
   ============================================================ */
.auth-screen {
  min-height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; padding: 24px;
  background:
    radial-gradient(1200px 600px at 70% -10%, rgba(232,163,61,.16), transparent 60%),
    var(--ink);
}
.auth-card {
  width: 100%; max-width: 400px;
  background: var(--paper-2); border-radius: 20px;
  padding: 30px 28px; box-shadow: var(--shadow);
}
.auth-card .brand { margin-bottom: 22px; }
.auth-form h1 { font-size: 22px; margin: 0 0 18px; letter-spacing: -.3px; }
.auth-form label {
  display: block; font-size: 13px; font-weight: 600;
  color: #4a4f60; margin-bottom: 14px;
}
.auth-form input, .auth-form select {
  width: 100%; margin-top: 6px; padding: 11px 13px;
  border: 1.5px solid #e3e1da; border-radius: var(--radius-sm);
  font-size: 14.5px; font-family: inherit; background: #fcfbf9;
  transition: border-color .15s, box-shadow .15s;
}
.auth-form input:focus, .auth-form select:focus {
  outline: none; border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(232,163,61,.18);
}
.auth-switch { font-size: 13px; color: var(--muted); text-align: center; margin: 16px 0 0; }
.auth-foot { color: var(--muted-2); font-size: 12.5px; }

/* ---------- Buttons ---------- */
.btn {
  border: none; border-radius: var(--radius-sm);
  padding: 11px 16px; font-size: 14px; font-weight: 600;
  transition: transform .05s, filter .15s, background .15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  width: 100%; color: #2a2008;
  background: linear-gradient(145deg, var(--amber), var(--amber-deep));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35);
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-soft {
  background: var(--ink-2); color: var(--paper);
  padding: 8px 14px; font-size: 13px;
}
.btn-soft:hover { background: var(--ink-3); }
.btn-ghost { background: transparent; color: var(--muted); padding: 8px 12px; }

/* ---------- Notice ---------- */
.notice {
  padding: 11px 13px; border-radius: var(--radius-sm); font-size: 13px;
  margin-bottom: 16px; font-weight: 500;
}
.notice.ok   { background: #e7f5ee; color: #1f7a52; }
.notice.err  { background: #fbeae7; color: #b2402f; }
.notice.info { background: #eef3fd; color: #355fa8; }

/* ============================================================
   APP LAYOUT
   ============================================================ */
.app { display: grid; grid-template-columns: 260px 1fr; height: 100vh; }

.sidebar {
  background: var(--ink); color: var(--paper);
  display: flex; flex-direction: column;
  padding: 20px 14px; gap: 6px;
}
.sidebar .brand-name { color: var(--paper); }
.sidebar .brand { padding: 0 6px 16px; }
.side-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--muted); padding: 8px 10px 6px; font-weight: 700;
}
.division-list { display: flex; flex-direction: column; gap: 2px; }
.division-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 11px; border-radius: var(--radius-sm);
  color: var(--muted-2); font-size: 14px; font-weight: 600;
  background: none; border: none; text-align: left; width: 100%;
}
.division-item:hover { background: var(--ink-2); color: var(--paper); }
.division-item.active { background: var(--ink-3); color: var(--paper); }
.division-item .hash { color: var(--amber); font-weight: 800; }
.side-spacer { flex: 1; }

.user-box {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border-radius: var(--radius-sm); background: var(--ink-2);
}
.user-avatar {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  background: linear-gradient(145deg, var(--amber), var(--amber-deep));
  color: #2a2008; font-weight: 800; font-size: 14px;
  display: grid; place-items: center;
}
.user-meta { flex: 1; min-width: 0; }
.user-name { font-size: 13.5px; font-weight: 700; color: var(--paper); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-div  { font-size: 11.5px; color: var(--muted); }
.icon-btn {
  background: none; border: none; color: var(--muted-2);
  font-size: 17px; padding: 4px 6px; border-radius: 6px;
}
.icon-btn:hover { background: var(--ink-3); color: var(--red); }

/* ---------- Main ---------- */
.main { display: flex; flex-direction: column; min-width: 0; background: var(--paper); }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px; height: 60px; background: var(--paper-2);
  border-bottom: 1px solid #ebe9e2;
}
.topbar-title { font-size: 17px; font-weight: 800; letter-spacing: -.3px; }
.topbar-title::before { content: '#'; color: var(--amber); margin-right: 4px; }
.tabs { display: flex; gap: 4px; }
.tab {
  background: none; border: none; padding: 8px 14px; border-radius: 8px;
  font-size: 13.5px; font-weight: 600; color: var(--muted);
}
.tab:hover { background: #f0eee7; color: var(--text); }
.tab.active { background: var(--ink); color: var(--paper); }

.view { flex: 1; min-height: 0; padding: 22px; overflow: auto; }
.view-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.view-head h2 { font-size: 18px; margin: 0; letter-spacing: -.3px; }

/* ---------- Chat ---------- */
.view-chat { display: flex; flex-direction: column; padding: 0; }
.messages { flex: 1; overflow-y: auto; padding: 22px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 70%; }
.msg .msg-name { font-size: 12px; font-weight: 700; color: var(--amber-deep); margin-bottom: 3px; }
.msg .msg-bubble {
  background: var(--paper-2); border: 1px solid #ebe9e2;
  padding: 9px 13px; border-radius: 12px; border-top-left-radius: 4px;
  font-size: 14.5px; line-height: 1.45; white-space: pre-wrap; word-break: break-word;
}
.msg .msg-time { font-size: 11px; color: var(--muted-2); margin-top: 4px; }
.msg.mine { align-self: flex-end; }
.msg.mine .msg-name { text-align: right; color: var(--muted); }
.msg.mine .msg-bubble {
  background: var(--ink); color: var(--paper); border-color: var(--ink);
  border-radius: 12px; border-top-right-radius: 4px;
}
.msg.mine .msg-time { text-align: right; }
.chat-empty { color: var(--muted); text-align: center; margin: auto; font-size: 14px; }
.message-form {
  display: flex; gap: 10px; padding: 16px 22px;
  border-top: 1px solid #ebe9e2; background: var(--paper-2);
}
.message-form input {
  flex: 1; padding: 11px 15px; border: 1.5px solid #e3e1da;
  border-radius: 10px; font-size: 14.5px; font-family: inherit; background: #fcfbf9;
}
.message-form input:focus { outline: none; border-color: var(--amber); box-shadow: 0 0 0 3px rgba(232,163,61,.16); }
.message-form .btn { width: auto; }

/* ---------- Kanban ---------- */
.board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; align-items: start; }
.column { background: #efece5; border-radius: var(--radius); padding: 12px; }
.column-head { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 700; padding: 4px 6px 12px; }
.column-head .count { margin-left: auto; background: #fff; color: var(--muted); border-radius: 20px; padding: 1px 9px; font-size: 12px; }
.dot { width: 9px; height: 9px; border-radius: 50%; }
.dot-todo { background: var(--muted); }
.dot-progress { background: var(--blue); }
.dot-done { background: var(--green); }
.column-body { display: flex; flex-direction: column; gap: 9px; min-height: 60px; }
.column-body.drag-over { outline: 2px dashed var(--amber); outline-offset: 3px; border-radius: 10px; }
.card {
  background: var(--paper-2); border: 1px solid #e7e4dc; border-radius: 10px;
  padding: 11px 12px; box-shadow: 0 1px 2px rgba(0,0,0,.03); cursor: grab;
}
.card:active { cursor: grabbing; }
.card.dragging { opacity: .45; }
.card-title { font-size: 14px; font-weight: 600; line-height: 1.35; }
.card-desc { font-size: 12.5px; color: var(--muted); margin-top: 5px; line-height: 1.4; }
.card-foot { display: flex; align-items: center; gap: 8px; margin-top: 9px; }
.card-assignee { font-size: 11.5px; color: var(--amber-deep); font-weight: 600; background: #fbf2e1; padding: 2px 8px; border-radius: 20px; }
.card-edit { margin-left: auto; font-size: 12px; color: var(--muted-2); background: none; border: none; }
.card-edit:hover { color: var(--text); }

/* ---------- Progress ---------- */
.project-list { display: flex; flex-direction: column; gap: 12px; }
.project {
  background: var(--paper-2); border: 1px solid #ebe9e2;
  border-radius: var(--radius); padding: 16px 18px;
}
.project-top { display: flex; align-items: flex-start; gap: 12px; }
.project-name { font-size: 15.5px; font-weight: 700; }
.project-desc { font-size: 13px; color: var(--muted); margin-top: 3px; line-height: 1.45; }
.project-pct { margin-left: auto; font-size: 20px; font-weight: 800; color: var(--ink); }
.project-actions { display: flex; gap: 4px; margin-left: 8px; }
.bar { height: 9px; background: #efece5; border-radius: 20px; margin-top: 13px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 20px; background: linear-gradient(90deg, var(--amber), var(--green)); transition: width .4s ease; }
.project-meta { font-size: 12px; color: var(--muted); margin-top: 8px; }

/* ---------- Files ---------- */
.file-list { display: flex; flex-direction: column; gap: 8px; }
.file-row {
  display: flex; align-items: center; gap: 13px;
  background: var(--paper-2); border: 1px solid #ebe9e2;
  border-radius: var(--radius-sm); padding: 12px 15px;
}
.file-icon {
  width: 38px; height: 38px; border-radius: 9px; flex: none;
  background: #f3efe6; color: var(--amber-deep); font-weight: 700; font-size: 12px;
  display: grid; place-items: center; text-transform: uppercase;
}
.file-info { flex: 1; min-width: 0; }
.file-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.upload-label { display: inline-flex; align-items: center; }

.empty { color: var(--muted); font-size: 14px; padding: 28px; text-align: center; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(20,22,30,.5); display: grid; place-items: center; padding: 20px; z-index: 50; }
.modal-card { background: var(--paper-2); border-radius: 16px; padding: 24px; width: 100%; max-width: 420px; box-shadow: var(--shadow); }
.modal-card h3 { margin: 0 0 16px; font-size: 17px; }
.modal-card label { display: block; font-size: 13px; font-weight: 600; color: #4a4f60; margin-bottom: 13px; }
.modal-card input, .modal-card textarea, .modal-card select {
  width: 100%; margin-top: 6px; padding: 10px 12px; border: 1.5px solid #e3e1da;
  border-radius: var(--radius-sm); font-size: 14px; font-family: inherit; background: #fcfbf9; resize: vertical;
}
.modal-card input:focus, .modal-card textarea:focus, .modal-card select:focus {
  outline: none; border-color: var(--amber); box-shadow: 0 0 0 3px rgba(232,163,61,.16);
}
.modal-actions { display: flex; gap: 8px; margin-top: 6px; }
.modal-actions .btn { width: auto; flex: 1; }
.modal-actions .btn-danger { background: #fbeae7; color: var(--red); }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 30% 0 0; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .board { grid-template-columns: 1fr; }
  .tabs { gap: 0; }
  .tab { padding: 8px 10px; }
}

/* reduced motion */
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
[hidden] { display: none; }

/* ============================================================
   REAL-TIME — status kirim, online, sedang mengetik
   ============================================================ */
/* Pesan sendiri yg sedang dikirim (optimistic) — tampil samar dulu */
.msg.sending { opacity: .55; }
.msg.sending .msg-time { font-style: italic; }
/* Pesan gagal terkirim */
.msg.failed .msg-bubble { background: #5a2018; border-color: #5a2018; color: var(--paper); }
.msg.failed .msg-time { color: #f0a79b; font-weight: 600; cursor: pointer; }

/* Jumlah staff online (di topbar, samping nama divisi) */
.presence {
  margin-left: 10px; font-size: 12px; font-weight: 700;
  color: var(--green); letter-spacing: .2px; vertical-align: middle;
}

/* Baris "X sedang mengetik…" di atas kotak ketik */
.typing-indicator {
  min-height: 18px; padding: 0 22px 4px;
  font-size: 12.5px; font-style: italic; color: var(--muted);
  background: var(--paper-2);
}