/* EV Easy Live Office — pixel-office theme. No inline styles (CSP style-src 'self'). */
@font-face {
  font-family: 'Sarabun';
  src: url('/fonts/Sarabun-Regular.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Sarabun';
  src: url('/fonts/Sarabun-Bold.ttf') format('truetype');
  font-weight: 700;
  font-display: swap;
}

:root {
  --green: #1f7a3f;
  --green-dark: #155c2f;
  --green-light: #2f9e52;
  --ink: #1c2024;
  --muted: #6b7280;
  --bg: #0f1713;
  --panel: #ffffff;
  --panel-2: #f3f6f4;
  --border: #d9e0db;
  --chip: #ffffff;
  font-family: 'Sarabun', 'Noto Sans Thai', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Sarabun', 'Noto Sans Thai', system-ui, sans-serif;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---- top bar ---- */
#topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 8px 16px;
  background: linear-gradient(180deg, var(--green) 0%, var(--green-dark) 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  z-index: 5;
}

#brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

#brand-logo { font-size: 20px; }

#brand-title {
  font-weight: 700;
  font-size: 17px;
  white-space: nowrap;
}

#demo-banner {
  margin-left: 6px;
  background: #ffd23f;
  color: #4a3b00;
  font-weight: 700;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
}

#kpi-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  flex: 1 1 auto;
  padding-bottom: 2px;
}

.kpi-chip {
  display: flex;
  flex-direction: column;
  min-width: 118px;
  background: var(--chip);
  color: var(--ink);
  border-radius: 10px;
  padding: 5px 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  flex: 0 0 auto;
}

.kpi-dept { font-size: 11px; color: var(--green-dark); font-weight: 700; }
.kpi-name { font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-value { font-size: 16px; font-weight: 700; color: var(--ink); }
.kpi-value.empty { color: #b4bcb6; }

/* ---- stage: office + sidebar ---- */
#stage {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
}

#office-wrap {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background:
    radial-gradient(circle at 50% 0%, #1b2a20 0%, #0f1713 70%);
  min-width: 0;
}

#office-canvas {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
  background: #cdd2cf;
}

#sidebar {
  flex: 0 0 340px;
  display: flex;
  flex-direction: column;
  background: var(--panel-2);
  border-left: 1px solid var(--border);
  min-height: 0;
}

#sidebar h2 {
  margin: 0;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--green-dark);
  background: #e6efe8;
  border-bottom: 1px solid var(--border);
}

#decisions-panel {
  flex: 0 0 auto;
  max-height: 46%;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-bottom: 2px solid var(--border);
}

#activity-panel {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#decisions-hint {
  margin: 0;
  padding: 4px 14px;
  font-size: 12px;
  color: var(--muted);
  min-height: 14px;
}

#decisions-list, #activity-list {
  list-style: none;
  margin: 0;
  padding: 8px 10px;
  overflow-y: auto;
  flex: 1 1 auto;
}

.empty { color: var(--muted); font-size: 13px; padding: 8px; }

/* decisions */
.decision {
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 4px solid var(--muted);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 8px;
}
.decision.status-pending { border-left-color: #e0a106; }
.decision.status-approved { border-left-color: var(--green-light); }
.decision.status-rejected { border-left-color: #d14343; }
.decision.status-done { border-left-color: #3b82f6; }

.decision-q { font-size: 13px; line-height: 1.35; }
.decision-from {
  display: inline-block;
  font-weight: 700;
  color: var(--green-dark);
  margin-right: 6px;
}
.decision-meta { font-size: 11px; color: var(--muted); margin: 4px 0 6px; }
.decision-actions { display: flex; gap: 6px; }

.btn {
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  border: none;
  border-radius: 6px;
  padding: 5px 10px;
  cursor: pointer;
  color: #fff;
}
.btn-approve { background: var(--green-light); }
.btn-reject { background: #d14343; }
.btn-done { background: #3b82f6; }
.btn:disabled { background: #c5ccc7; color: #eef2ef; cursor: not-allowed; }

/* activity */
.activity-item {
  display: flex;
  gap: 8px;
  padding: 5px 6px;
  font-size: 13px;
  border-bottom: 1px solid #e7ece8;
  align-items: baseline;
}
.activity-time { color: var(--muted); font-size: 11px; flex: 0 0 auto; font-variant-numeric: tabular-nums; }
.activity-text { color: var(--ink); word-break: break-word; }
.activity-item.type-handoff .activity-text { color: #1d5fb0; }
.activity-item.type-meeting .activity-text { color: #6d3fb0; }
.activity-item.type-decision .activity-text { color: #a56a00; font-weight: 700; }

/* ---- login overlay ---- */
#login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 18, 13, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}
#login-overlay[hidden] { display: none; }

#login-form {
  background: var(--panel);
  border-radius: 12px;
  padding: 22px 24px;
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}
#login-form h2 { margin: 0 0 8px; color: var(--green-dark); font-size: 18px; }
#login-form label { font-size: 12px; color: var(--muted); margin-top: 4px; }
#login-form input {
  font-family: inherit;
  font-size: 14px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
}
#login-form .error { color: #d14343; font-size: 12px; min-height: 14px; margin: 4px 0 0; }
#login-submit {
  margin-top: 12px;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}
#login-submit:hover { background: var(--green-dark); }

@media (max-width: 1100px) {
  #sidebar { flex-basis: 300px; }
  #brand-title { font-size: 15px; }
}
