/* OfficeHub - self-contained stylesheet, no external fonts/CDNs */
:root {
  --bg: #f4efe6;
  --panel: #ffffff;
  --ink: #26241f;
  --muted: #6b6558;
  --line: #e6ddcc;
  --accent: #3b6e64;
  --accent-dark: #2b544c;
  --green: #3ba55d;
  --yellow: #d3a13d;
  --gray: #9a9284;
  --red: #c0453b;
  --radius: 10px;
  font-size: 15px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
}
a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.btn:hover { background: var(--accent-dark); text-decoration: none; }
.btn.secondary { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.secondary:hover { background: #f0ece2; }
.btn.danger { background: var(--red); }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Auth pages */
.auth-body {
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
}
.auth-card {
  background: var(--panel);
  padding: 36px 40px;
  border-radius: 14px;
  box-shadow: 0 10px 40px rgba(0,0,0,.08);
  width: 380px;
}
.auth-card h1 { margin: 0 0 4px; font-size: 22px; }
.auth-card label { display: block; margin: 14px 0 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.auth-card input, .auth-card select, .auth-card textarea {
  width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); font-size: 14px;
}
.auth-card form .btn { width: 100%; margin-top: 18px; padding: 12px; }
.muted { color: var(--muted); font-size: 13px; }
.notice { padding: 10px 14px; border-radius: 8px; font-size: 13px; }
.notice.error { background: #fbe9e7; color: var(--red); }
.notice.success { background: #e6f4ea; color: var(--green); }

/* App shell */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; background: #22302c; color: #dfe7e2; flex-shrink: 0;
  display: flex; flex-direction: column; padding: 20px 0;
}
.sidebar .brand { padding: 0 20px 18px; font-weight: 700; font-size: 17px; color: #fff; border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 12px; }
.sidebar .brand small { display:block; font-weight: 400; font-size: 11px; color: #9fb0a8; margin-top:2px;}
.sidebar nav a {
  display: block; padding: 10px 20px; color: #cfd8d2; font-size: 14px;
}
.sidebar nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; }
.sidebar nav a.active { background: var(--accent); color: #fff; font-weight: 600; }
.sidebar .me { margin-top: auto; padding: 14px 20px 0; border-top: 1px solid rgba(255,255,255,.08); font-size: 13px; }
.sidebar .me a { color: #9fb0a8; font-size: 12px; }

.main { flex: 1; padding: 28px 34px; max-width: 1100px; }
.page-head { display:flex; align-items:center; justify-content: space-between; margin-bottom: 20px; }
.page-head h1 { margin: 0; font-size: 22px; }

.banner { padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; font-size: 14px; }
.banner.warn { background: #fdf3e0; color: #8a5a10; border: 1px solid #f0d9a8; }
.banner.error { background: #fbe9e7; color: var(--red); border: 1px solid #f0bdb6; }
.banner.success { background: #e6f4ea; color: var(--green); border: 1px solid #bfe4ca; }

/* Office roster - grid of "desks" */
.office-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 16px;
}
.desk {
  background: var(--panel);
  border-radius: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  position: relative;
}
.desk .avatar {
  width: 46px; height: 46px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 16px; margin-bottom: 10px;
}
.desk .status-dot {
  width: 11px; height: 11px; border-radius: 50%; position: absolute; top: 16px; right: 16px;
  border: 2px solid var(--panel);
}
.status-dot.online { background: var(--green); }
.status-dot.away { background: var(--yellow); }
.status-dot.offline { background: var(--gray); }
.desk .name { font-weight: 600; font-size: 14.5px; }
.desk .title { color: var(--muted); font-size: 12.5px; margin-bottom: 8px; }
.desk .status-line { font-size: 12px; color: var(--muted); }
.desk .actions { margin-top: 10px; display: flex; gap: 6px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 20px; margin-bottom: 18px; }
.card h2 { margin-top: 0; font-size: 16px; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table th, table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
table th { color: var(--muted); font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: .03em; }

.badge { display:inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.badge.trial { background:#fdf3e0; color:#8a5a10; }
.badge.active { background:#e6f4ea; color:var(--green); }
.badge.suspended, .badge.past_due { background:#fbe9e7; color:var(--red); }
.badge.role-superadmin { background:#e9e3f7; color:#5a3fa0; }
.badge.role-org_admin { background:#e0eef7; color:#2a5c8a; }
.badge.role-employee { background:#f0ece2; color:var(--muted); }

/* Chat */
.chat-layout { display: flex; height: calc(100vh - 56px); }
.chat-channels { width: 230px; border-right: 1px solid var(--line); overflow-y: auto; padding: 10px 0; }
.chat-channels a { display:block; padding: 9px 18px; font-size: 13.5px; color: var(--ink); }
.chat-channels a.active { background: #eef2ee; font-weight: 600; }
.chat-channels .group-label { padding: 14px 18px 4px; font-size: 11px; text-transform: uppercase; color: var(--muted); letter-spacing:.04em; }
.chat-main { flex: 1; display: flex; flex-direction: column; }
.chat-header { padding: 14px 20px; border-bottom: 1px solid var(--line); display:flex; justify-content: space-between; align-items:center; }
.chat-messages { flex: 1; overflow-y: auto; padding: 18px 20px; }
.msg { margin-bottom: 14px; max-width: 70%; }
.msg .who { font-size: 12.5px; font-weight: 700; margin-bottom: 2px; }
.msg .when { font-size: 11px; color: var(--muted); margin-left: 6px; font-weight: 400; }
.msg .bubble { background: #eef2ee; padding: 9px 13px; border-radius: 10px; font-size: 14px; display:inline-block; }
.msg.mine .bubble { background: var(--accent); color: #fff; }
.msg.mine { margin-left: auto; text-align: right; }
.msg .bubble a { color: inherit; text-decoration: underline; }
.msg-row { display: flex; align-items: flex-end; gap: 8px; }
.msg.mine .msg-row { justify-content: flex-end; }
.msg-avatar { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.msg-avatar-fallback { display:flex; align-items:center; justify-content:center; color:#fff; font-size:11px; font-weight:700; }
.msg.meeting .bubble { background: #fff4d6; color: #7a5a10; border: 1px solid #f0d9a8; }
.chat-input { border-top: 1px solid var(--line); padding: 14px 20px; display:flex; gap:10px; }
.chat-input input[type=text] { flex:1; padding: 10px 14px; border-radius: 20px; border: 1px solid var(--line); font-size: 14px; }

.top-actions { display:flex; gap: 10px; }
.form-row { margin-bottom: 14px; }
.form-row label { display:block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.form-row input, .form-row select, .form-row textarea { width:100%; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--line); font-size: 14px; }
.grid-2 { display:grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.stat { background: var(--panel); border:1px solid var(--line); border-radius:12px; padding:16px 18px; }
.stat .num { font-size: 26px; font-weight: 700; }
.stat .label { color: var(--muted); font-size: 12.5px; }
.stat-row { display:grid; grid-template-columns: repeat(3,1fr); gap:14px; margin-bottom: 18px; }
code { background: #f0ece2; padding: 1px 6px; border-radius: 4px; }

/* Office floor map */
.office-floor {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas: "roomA roomB" "collab collab" "conference lounge";
  gap: 16px;
  margin-bottom: 20px;
}
.room[data-room="room-a"] { grid-area: roomA; }
.room[data-room="room-b"] { grid-area: roomB; }
.room[data-room="collab"] { grid-area: collab; }
.room[data-room="conference"] { grid-area: conference; }
.room[data-room="lounge"] { grid-area: lounge; }

.room {
  background: #efe3c8;
  border: 1px solid #d8c49a;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,.05);
}
.room-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 14px; background: #fff; border-bottom: 1px solid var(--line);
  position: relative; z-index: 3;
}
.room-name { font-weight: 700; font-size: 13.5px; }
.room-chat-link { font-size: 12px; }
.room-box {
  position: relative; height: 170px; cursor: pointer;
  background-color: #d9c298;
  background-image:
    repeating-linear-gradient(90deg, rgba(255,255,255,.10) 0 2px, transparent 2px 46px),
    linear-gradient(#e3cda3, #d3ba8c);
}
.room[data-room="collab"] .room-box { height: 190px; }
.room[data-room="conference"] .room-box,
.room[data-room="lounge"] .room-box { height: 210px; }

.room-window {
  position: absolute; top: 0; left: 0; right: 0; height: 16px;
  background-image: repeating-linear-gradient(90deg, #8fbb76 0 26px, #79a862 26px 30px);
  border-bottom: 3px solid #5f8a4d;
}

.room-plant {
  position: absolute; width: 22px; height: 22px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #8fbb76, #4f7a3d);
  box-shadow: 0 2px 3px rgba(0,0,0,.15);
}
.room-plant.plant-1 { left: 6%; bottom: 6%; }
.room-plant.plant-2 { right: 6%; bottom: 6%; }
.room[data-room="collab"] .room-plant,
.room[data-room="conference"] .room-plant,
.room[data-room="lounge"] .room-plant { width: 26px; height: 26px; }

.desk-shape {
  position: absolute;
  transform: translate(-50%, -50%);
  background: linear-gradient(#c7a877, #a9885d);
  border: 1px solid #8a6d45;
  border-radius: 6px;
  box-shadow: 0 2px 4px rgba(0,0,0,.15);
  z-index: 1;
}
.desk-shape.oval { border-radius: 50%; }
.desk-shape.round { border-radius: 50%; }

.seat-slot {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 54px; height: 54px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  z-index: 2;
}
.seat-slot .chair-shape {
  position: absolute;
  width: 30px; height: 22px;
  background: #2f2b26;
  border-radius: 5px;
  z-index: 0;
}
.seat-slot[data-face="down"] .chair-shape { top: -6px; }
.seat-slot[data-face="up"] .chair-shape { bottom: -6px; }
.seat-slot.drag-over { outline: 3px dashed var(--accent); outline-offset: 2px; border-radius: 50%; }
.seat-slot .seat-empty-hint {
  position: relative; z-index: 1;
  font-size: 9.5px; color: #fff; text-transform: uppercase; letter-spacing: .04em;
  background: rgba(59,110,100,.85); padding: 3px 7px; border-radius: 999px;
}
.seat-slot .seat-avatar-wrap { display:none; }
.seat-slot.occupied .chair-shape { opacity: 0; }
.seat-slot.occupied .seat-empty-hint { display: none; }
.seat-slot.occupied .seat-avatar-wrap { display: flex; z-index: 2; }

.seat-avatar-wrap { flex-direction: column; align-items: center; position: relative; cursor: default; }
.seat-avatar-wrap[data-mine="1"] { cursor: grab; }
.seat-avatar-wrap .avatar,
.seat-avatar-wrap .avatar-photo {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 13px;
  border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.15);
  position: relative;
  object-fit: cover;
}
.seat-avatar-wrap .dot {
  position: absolute; bottom: -1px; right: -1px;
  width: 10px; height: 10px; border-radius: 50%; border: 2px solid #fff;
}
.seat-avatar-wrap .who { font-size: 10px; margin-top: 3px; max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align:center; }

.unseated-tray { border-top: 1px dashed var(--line); padding-top: 12px; }
.unseated-tray.drag-over { background: #f3f7f3; }
.tray-avatars { display: flex; flex-wrap: wrap; gap: 16px; min-height: 60px; padding: 6px 0; }
.tray-avatar { display: flex; flex-direction: column; align-items: center; width: 64px; }
.tray-avatar[data-mine="1"] { cursor: grab; }
.tray-avatar .avatar,
.tray-avatar .avatar-photo {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 13px; position: relative;
  object-fit: cover;
}
.tray-avatar .dot { position: absolute; bottom: -1px; right: -1px; width: 10px; height: 10px; border-radius: 50%; border: 2px solid #faf6ee; }
.tray-avatar .who { font-size: 11px; margin-top: 4px; text-align:center; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:64px; }
.dot.online { background: var(--green); }
.dot.away { background: var(--yellow); }
.dot.offline { background: var(--gray); }

/* --- In-room voice/video calling --- */
.seat-avatar-wrap.in-call .avatar,
.seat-avatar-wrap.in-call .avatar-photo {
  box-shadow: 0 0 0 3px var(--accent, #3b6e64), 0 1px 4px rgba(0,0,0,.15);
}
.seat-video {
  width: 40px; height: 40px; border-radius: 50%;
  object-fit: cover; background: #222;
  border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.15);
  position: relative;
}
/* Camera off (or muted-out video): hide the video tile, fall back to the avatar circle underneath. */
.seat-avatar-wrap.cam-off .seat-video { display: none; }
.seat-avatar-wrap.mic-off::before {
  content: '🔇';
  position: absolute; bottom: -2px; left: -6px;
  width: 16px; height: 16px; line-height: 14px; text-align: center;
  border-radius: 50%; background: #c0392b; border: 2px solid #fff;
  font-size: 9px; z-index: 3;
}

.call-bar {
  position: sticky; bottom: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-top: 16px; padding: 10px 16px;
  background: #22302c; color: #fff; border-radius: 12px;
  box-shadow: 0 -2px 10px rgba(0,0,0,.15);
  z-index: 20;
}
.call-bar-label { font-size: 13px; opacity: .85; }
.call-bar-buttons { display: flex; gap: 10px; }
.call-btn {
  background: #33463f; color: #fff; border: none; border-radius: 999px;
  padding: 8px 16px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.call-btn:hover:not(:disabled) { background: #3f5850; }
.call-btn:disabled { opacity: .45; cursor: not-allowed; }
.call-btn.call-btn-off { background: #c0392b; }
.call-btn.call-btn-off:hover:not(:disabled) { background: #d14a3a; }
