:root {
  --desktop: #1d7f84;
  --panel: #d7d3c7;
  --light: #ffffff;
  --shadow: #6d6a61;
  --dark: #151515;
  --blue: #062d78;
  --green: #10a020;
  --yellow: #d2a300;
  --red: #8b1111;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Tahoma, Verdana, Arial, sans-serif;
  font-size: 13px;
  background: var(--desktop);
  color: #111;
}
button, input, select { font: inherit; }
a { color: #003399; }
.desktop {
  min-height: 100vh;
  padding: 22px;
  background:
    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
    var(--desktop);
  background-size: 8px 8px;
}
.win-panel {
  background: var(--panel);
  border: 2px solid;
  border-color: var(--light) var(--shadow) var(--shadow) var(--light);
  box-shadow: 2px 2px 0 #222;
}
.titlebar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 24px;
  padding: 2px 5px;
  color: #fff;
  font-weight: bold;
  background: linear-gradient(90deg, var(--blue), #2d69c7);
}
.titlebar a, .titlebar button {
  width: 18px;
  height: 18px;
  border: 1px solid #555;
  background: var(--panel);
  color: #000;
  line-height: 14px;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.buddy-window {
  width: 260px;
  min-height: 440px;
}
.user-strip, .away-box, .toolbar { padding: 7px; border-bottom: 1px solid #aaa; }
.user-strip { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.away-box input, .toolbar input, .send-form input, .login-box input {
  width: 100%;
  border: 2px solid;
  border-color: var(--shadow) var(--light) var(--light) var(--shadow);
  padding: 5px;
  background: #fff;
}
.toolbar { display: flex; gap: 5px; }
.toolbar button, .send-form button, .login-box button {
  border: 2px solid;
  border-color: var(--light) var(--shadow) var(--shadow) var(--light);
  background: var(--panel);
  padding: 4px 9px;
  cursor: pointer;
}
.group-title {
  padding: 5px 7px;
  font-weight: bold;
  background: #c3c0b7;
  border-top: 1px solid #eee;
  border-bottom: 1px solid #888;
}
.buddy-list { padding: 5px; }
.buddy {
  display: grid;
  grid-template-columns: 16px 1fr;
  width: 100%;
  margin: 1px 0;
  padding: 4px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.buddy:hover { background: #0b55c4; color: #fff; }
.buddy small { grid-column: 2; color: #555; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.buddy:hover small { color: #eaf2ff; }
.lamp { width: 10px; height: 10px; margin-top: 3px; border-radius: 50%; background: #777; border: 1px solid #333; }
.buddy.online .lamp { background: var(--green); box-shadow: 0 0 3px var(--green); }
.buddy.away .lamp { background: var(--yellow); }
.buddy.idle .lamp { background: var(--yellow); border-style: dotted; }
.buddy.offline { opacity: .58; }
.buddy.offline .lamp { background: #777; }
.empty { padding: 12px; color: #555; }
.chat-window {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.hidden { display: none; }
.chat-meta { padding: 6px 8px; background: #ece9df; border-bottom: 1px solid #aaa; color: #444; }
.messages { flex: 1; overflow: auto; padding: 8px; background: #fff; border: 2px solid; border-color: var(--shadow) var(--light) var(--light) var(--shadow); margin: 7px; }
.msg { margin-bottom: 8px; line-height: 1.35; }
.msg.mine b { color: #003399; }
.msg.theirs b { color: #7b0000; }
.msg time { display: block; color: #777; font-size: 10px; }
.send-form { display: flex; gap: 6px; padding: 7px; }

.chat-popup { background: var(--desktop); padding: 5px; height: 100vh; overflow: hidden; }
.chat-popup .chat-window { height: 100%; width: 100%; position: relative; left: 0; top: 0; }
.login-screen { display: grid; place-items: center; background: #0c6f75; }
.login-box { width: 340px; padding: 18px; }
.login-box h1 { margin: 0 0 8px; font-size: 24px; }
.tagline { margin-top: 0; color: #333; }
.login-box label { display: block; margin-top: 10px; font-weight: bold; }
.login-box button { margin-top: 14px; width: 100%; }
.error { padding: 8px; margin: 10px 0; background: #ffe0e0; border: 1px solid var(--red); }
@media (max-width: 760px) {
  .desktop { padding: 10px; }
  .buddy-window, .chat-window { position: static; width: 100%; margin-bottom: 12px; }
  .chat-window { height: 420px; }
}

.is-popup { background: #008080; padding: 3px; height: 100vh; overflow: auto; }
.is-popup .buddy-window { position: relative; height: 100%; width: 100%; margin: 0; display: flex; flex-direction: column; }

.titlebar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 28px;
  padding: 0 5px;
  color: #fff;
  font-weight: bold;
  background: linear-gradient(to bottom, #0058e6 0%, #3a93ff 8%, #288eff 12%, #127ae5 20%, #1173e1 24%, #0869d8 56%, #0260d2 84%, #0056ce 88%, #0050c5 92%, #014cb3 96%, #002f6d 100%);
  border-radius: 5px 5px 0 0;
  font-family: 'Trebuchet MS', sans-serif;
  text-shadow: 1px 1px #000;
}
.title-content { display: flex; align-items: center; }
.title-buttons { display: flex; gap: 2px; }
.title-buttons button, .title-buttons span {
  width: 21px;
  height: 21px;
  border: 1px solid #fff;
  border-radius: 3px;
  background: linear-gradient(to bottom, #52b1f9 0%, #4092e3 100%);
  color: white;
  font-weight: bold;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  box-shadow: inset 0 0 1px #fff;
}
.title-buttons span {
  cursor: default;
}
.title-buttons button:last-child, .title-buttons span:last-child {
  background: linear-gradient(to bottom, #f3ad92 0%, #e9703e 100%);
}

.menu-bar {
  background: #f0f0e8;
  padding: 2px 5px;
  border-bottom: 1px solid #aca899;
  display: flex;
  gap: 10px;
  font-size: 11px;
}
.menu-bar span:first-child { text-decoration: underline; }

.im-logo-area {
  background: #fff;
  padding: 10px;
  display: flex;
  justify-content: center;
  border-bottom: 1px solid #aca899;
}

.user-strip-compact {
  padding: 2px 5px;
  background: #f0f0e8;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  border-bottom: 1px solid #aca899;
}
.small-icons { display: flex; gap: 3px; }

.buddy-list-xp {
  flex: 1;
  background: #fff;
  overflow-y: auto;
  padding: 5px;
}
.group-header {
  font-weight: bold;
  font-size: 12px;
  margin-top: 5px;
  padding: 2px;
  padding-left: 5px;
}
.group:first-child .group-header { background: #ffff00; }

.buddy-xp {
  display: flex;
  align-items: center;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 2px 5px;
  font-size: 12px;
  cursor: pointer;
}
.buddy-xp .lamp { margin-right: 5px; margin-top: 0; }
.buddy-xp:hover { background: #000080; color: #fff; }
.buddy-xp .name { flex: 1; text-align: left; }
.buddy-xp small { margin-left: 5px; color: #666; font-size: 10px; }

.buddy-footer {
  background: #f0f0e8;
  border-top: 1px solid #aca899;
  padding: 5px;
}
.footer-actions {
  display: flex;
  justify-content: space-around;
  margin-bottom: 2px;
}
.icon-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 10px;
  cursor: pointer;
}
.icon-btn .icon { font-size: 18px; margin-bottom: 2px; }

.ticker {
  background: #fff;
  border-top: 1px solid #000;
  font-size: 11px;
  padding: 2px 5px;
  white-space: nowrap;
  overflow: hidden;
}

/* Away Window Styles */
.away-window {
  width: 370px;
  background: #f0f0e8;
}
.away-content { padding: 10px; }
.field-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.field-label { margin-bottom: 5px; }
.formatting-toolbar {
  display: flex;
  gap: 2px;
  background: #f0f0e8;
  border: 1px solid #aca899;
  padding: 2px;
  margin-bottom: 0;
}
.formatting-toolbar button {
  height: 22px;
  min-width: 22px;
  background: #f0f0e8;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.formatting-toolbar button:hover { border-color: #316ac5; background: #c1d2ee; }

.away-textarea {
  width: 100%;
  height: 120px;
  border: 1px solid #7f9db9;
  padding: 5px;
  font-family: 'Times New Roman', serif;
  font-size: 16px;
  resize: none;
}
.away-info { font-size: 11px; margin-top: 10px; }
.away-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 15px;
}
.away-actions button {
  min-width: 80px;
  padding: 4px;
}
