:root {
  --bg: #0f1410;
  --bg-2: #182018;
  --panel: #1c261d;
  --line: #2d3b2f;
  --text: #e8f0e9;
  --muted: #9aaf9d;
  --accent: #c6a35a;
  --accent-2: #8fbf7a;
  --danger: #d86b6b;
  --ok: #6fcf97;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  --font: "Segoe UI", "IBM Plex Sans", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1000px 500px at 10% -10%, rgba(198, 163, 90, 0.18), transparent 55%),
    radial-gradient(800px 400px at 100% 0%, rgba(143, 191, 122, 0.12), transparent 50%),
    linear-gradient(180deg, var(--bg), #101611 40%, var(--bg-2));
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 28px 20px 60px; }
.wrap-wide { max-width: 1280px; }
.dash-page { padding-top: 18px; padding-bottom: 28px; }
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 16px; margin-bottom: 28px;
}
.topbar-compact { margin-bottom: 14px; }
.top-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.nav-link {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
}
.nav-link:hover { color: var(--text); text-decoration: none; background: rgba(255,255,255,0.03); }
.nav-link.active {
  color: var(--accent);
  border-color: rgba(198, 163, 90, 0.35);
  background: rgba(198, 163, 90, 0.12);
}
.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.18);
}
.lang-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  padding: 5px 8px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
}
.lang-btn:hover { color: var(--text); text-decoration: none; }
.lang-btn.active {
  color: #1a1f1b;
  background: var(--accent);
}
.login-card .lang-switch {
  align-self: center;
  margin-top: 4px;
}
.btn-sm {
  padding: 7px 12px !important;
  font-size: 0.82rem !important;
  border-radius: 9px !important;
}
.brand { font-size: 1.35rem; font-weight: 700; letter-spacing: 0.02em; }
.brand span { color: var(--accent); }
.brand-block {
  display: flex; align-items: center; gap: 14px; margin-bottom: 4px;
}
.brand-inline {
  display: flex; align-items: center; gap: 12px;
}
.logo {
  width: 64px; height: 64px; border-radius: 50%;
  object-fit: cover; flex-shrink: 0;
  box-shadow: 0 8px 20px rgba(198, 163, 90, 0.28);
}
.logo-sm {
  width: 42px; height: 42px; border-radius: 50%;
  object-fit: cover; flex-shrink: 0;
}
.muted { color: var(--muted); }
.pill {
  display: inline-block; padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted); font-size: 0.8rem;
}

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 900px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

.card {
  background: rgba(28, 38, 29, 0.92);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 18px;
}
.card h2, .card h3 { margin: 0 0 12px; font-size: 1.05rem; }
.card p { margin-top: 0; }

.stack { display: grid; gap: 10px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

label { display: grid; gap: 6px; font-size: 0.88rem; color: var(--muted); }
input, select, textarea, button {
  font: inherit;
}
input, select, textarea {
  width: 100%;
  background: #121913;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}
textarea { min-height: 110px; resize: vertical; }

button, .btn {
  appearance: none;
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  background: linear-gradient(135deg, var(--accent), #a8843d);
  color: #1a1408;
  font-weight: 700;
  cursor: pointer;
}
button.secondary, .btn.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}
button.danger, .btn.danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(216, 107, 107, 0.45);
}
button:disabled { opacity: 0.55; cursor: not-allowed; }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td {
  text-align: left; padding: 10px 8px;
  border-bottom: 1px solid var(--line); vertical-align: top;
}
th { color: var(--muted); font-weight: 600; }

.badge {
  display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: 0.75rem;
  border: 1px solid var(--line);
}
.badge.ok { color: var(--ok); border-color: rgba(111, 207, 151, 0.4); }
.badge.warn { color: var(--accent); border-color: rgba(198, 163, 90, 0.45); }
.badge.err { color: var(--danger); border-color: rgba(216, 107, 107, 0.45); }

.login-shell {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
}
.login-card { width: min(420px, 100%); }
.alert {
  padding: 10px 12px; border-radius: 10px; margin-bottom: 12px;
  border: 1px solid var(--line); background: #152018;
}
.alert.error { color: #ffb4b4; border-color: rgba(216, 107, 107, 0.5); }
.alert.ok { color: #b7f0cd; border-color: rgba(111, 207, 151, 0.45); }
.hidden { display: none !important; }
.tiny { font-size: 0.8rem; color: var(--muted); }

.field-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.88rem;
  color: var(--muted);
}
.account-picker {
  display: grid;
  gap: 10px;
}
.account-picker-row {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
a.btn:hover { text-decoration: none; }
.account-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #121913;
  cursor: pointer;
}
.account-option:has(input:checked) {
  border-color: rgba(198, 163, 90, 0.7);
  box-shadow: 0 0 0 1px rgba(198, 163, 90, 0.35);
}
.account-option input {
  width: auto;
  margin: 0;
}
.account-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  background: #1c261d;
  flex-shrink: 0;
}
.account-meta {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.account-meta strong {
  font-size: 0.95rem;
  color: var(--text);
}
.account-meta small {
  color: var(--muted);
  font-size: 0.8rem;
}

.post-progress { min-width: 160px; }
.progress-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #121913;
  border: 1px solid var(--line);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8fbf7a, var(--accent));
  transition: width 0.35s ease;
}
.progress-meta {
  margin-top: 6px;
}

/* Dashboard chat layout */
.dash-shell {
  display: grid;
  grid-template-columns: minmax(240px, 300px) 1fr;
  gap: 0;
  height: min(82vh, 860px);
  background: rgba(22, 30, 23, 0.96);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.group-pane {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: #121a13;
  min-height: 0;
}
.group-pane-head {
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--line);
}
.group-pane-head h2 {
  margin: 0 0 10px;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.group-search {
  width: 100%;
  border-radius: 10px;
  padding: 8px 12px;
  background: #0e140f;
  font-size: 0.88rem;
}
.group-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.group-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: inherit;
  text-align: left;
  font-weight: 400;
  cursor: pointer;
  margin-bottom: 2px;
}
.group-item:hover { background: rgba(198, 163, 90, 0.07); }
.group-item.active {
  background: rgba(198, 163, 90, 0.16);
  box-shadow: inset 0 0 0 1px rgba(198, 163, 90, 0.28);
}
.group-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.78rem;
  color: #1a1408;
  background: linear-gradient(145deg, var(--accent), #8a6a2e);
}
.group-meta {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
}
.group-meta-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}
.group-meta strong {
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.group-meta .snippet {
  font-size: 0.76rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.group-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #1a1408;
  font-size: 0.7rem;
  font-weight: 700;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
}
.group-badge.empty {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  font-weight: 600;
}
.pane-empty {
  padding: 18px 12px;
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0;
}

.chat-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: #161e17;
}
.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(18, 26, 19, 0.95);
}
.chat-header h2 {
  margin: 0 0 2px;
  font-size: 1.02rem;
}
.chat-header-text { min-width: 0; }
.chat-main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(700px 280px at 90% -10%, rgba(198, 163, 90, 0.07), transparent 55%),
    #161e17;
}
.feed-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  padding-bottom: 2px;
}
.feed-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.chat-feed {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.chat-empty {
  margin: auto;
  text-align: center;
  color: var(--muted);
  max-width: 280px;
  display: grid;
  gap: 6px;
  padding: 24px;
}
.chat-empty strong {
  color: var(--text);
  font-size: 0.95rem;
}
.post-bubble {
  max-width: min(560px, 94%);
  align-self: flex-start;
  background: #1c261d;
  border: 1px solid var(--line);
  border-radius: 14px 14px 14px 5px;
  padding: 12px 14px;
}
.post-bubble.running {
  border-color: rgba(198, 163, 90, 0.4);
  background: linear-gradient(180deg, rgba(198, 163, 90, 0.08), #1c261d 40%);
  max-width: min(600px, 96%);
}
.post-bubble.sent-bubble {
  max-width: min(620px, 96%);
}
.bubble-who {
  display: grid;
  gap: 1px;
  min-width: 0;
}
.bubble-who strong {
  font-size: 0.86rem;
  color: var(--accent);
}
.post-bubble-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 8px;
}
.post-bubble-body {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.9rem;
  line-height: 1.45;
  margin-bottom: 10px;
}
.post-bubble-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}
.post-bubble .post-progress { flex: 1; min-width: 140px; }
.sent-edit-form { gap: 8px; }
.sent-edit-form textarea {
  min-height: 96px;
  font-size: 0.9rem;
}
.sent-actions {
  justify-content: flex-end;
  gap: 8px;
}
.sent-delete-form { margin: 0; }
.btn-load-older {
  align-self: center;
  margin: 0 0 8px;
  padding: 7px 14px !important;
  font-size: 0.8rem !important;
  font-weight: 600;
  background: transparent !important;
  color: var(--muted) !important;
  border: 1px solid var(--line) !important;
  border-radius: 999px !important;
}
.btn-load-older:hover {
  color: var(--accent) !important;
  border-color: rgba(198, 163, 90, 0.45) !important;
}
.feed-note {
  margin: 8px 0 0;
  text-align: center;
  opacity: 0.85;
}

.chat-compose {
  border-top: 1px solid var(--line);
  padding: 12px 14px 14px;
  background: #121a13;
}
.compose-form {
  display: grid;
  gap: 12px;
}
.compose-section { min-width: 0; }
.compose-message {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
}
.compose-content-label {
  display: grid;
  gap: 6px;
  margin: 0;
  min-width: 0;
}
.compose-content-label .field-label { margin: 0; }
.chat-compose textarea {
  min-height: 68px;
  border-radius: 12px;
  resize: vertical;
}
.btn-mulai {
  min-width: 88px;
  height: 44px;
  align-self: end;
}
.compose-active {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(198, 163, 90, 0.35);
  background: rgba(198, 163, 90, 0.1);
}
.compose-active-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.compose-active-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.compose-active-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.compose-active-text strong {
  font-size: 0.9rem;
  color: var(--text);
  font-weight: 650;
}
.compose-active-preview {
  font-size: 0.82rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-top: 2px;
  border-top: 1px solid rgba(198, 163, 90, 0.18);
}
.compose-hint { margin: 0; color: var(--muted); font-size: 0.88rem; }

.interval-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.interval-option {
  flex: 0 0 auto;
  min-width: 0;
  cursor: pointer;
  position: relative;
}
.interval-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.interval-option span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #0e140f;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}
.interval-option:has(input:checked) span {
  border-color: rgba(198, 163, 90, 0.65);
  background: rgba(198, 163, 90, 0.18);
  color: var(--accent);
}
.compose-accounts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.account-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 5px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #0e140f;
  cursor: pointer;
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 600;
}
.account-chip input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.account-chip .account-avatar {
  width: 26px;
  height: 26px;
}
.account-chip:has(input:checked) {
  border-color: rgba(198, 163, 90, 0.65);
  background: rgba(198, 163, 90, 0.14);
  color: var(--accent);
}

@media (max-width: 900px) {
  .dash-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 70vh;
  }
  .group-pane {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    max-height: 220px;
  }
  .chat-pane { min-height: 520px; }
  .compose-message { grid-template-columns: 1fr; }
  .btn-mulai { width: 100%; }
}