/* Plovane Internal — monochrome, quiet, modern.
   No brand accent color: interactive states use elevation, border weight,
   and a single near-white for primary actions.
*/

:root {
  --bg:           #0a0a0a;
  --panel:        #121212;
  --panel-2:      #181818;   /* hovered / elevated */
  --border:       #242424;
  --border-hi:    #333333;   /* hover */
  --text:         #f2f2f2;
  --text-dim:     #8b8b8b;
  --text-hint:    #666666;
  --danger:       #ef4444;
  --success:      #22c55e;
  --radius:       12px;
  --radius-sm:    8px;
  --shadow:       0 1px 0 rgba(255,255,255,0.03) inset, 0 0 0 1px var(--border);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.005em;
}

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

code, pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, "Cascadia Code", monospace;
  font-size: 0.85em;
  background: var(--panel-2);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--text);
}

.hidden { display: none !important; }
.err { color: var(--danger); min-height: 1.2em; }
.hint { color: var(--text-hint); font-size: 0.85rem; }

/* ── Topbar ────────────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 52px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}
.brand:hover { color: var(--text); }
.brand-logo {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: block;
}
.brand-name { font-weight: 600; }
.brand-sub {
  color: var(--text-dim);
  font-weight: 400;
  padding-left: 4px;
  border-left: 1px solid var(--border);
  margin-left: 4px;
  padding-left: 12px;
}
.who {
  margin-left: auto;
  color: var(--text-dim);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

/* ── Buttons ───────────────────────────────────────────────────────────── */
.linkbtn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
  padding: 6px 10px;
  border-radius: 6px;
  transition: background 120ms, color 120ms;
}
.linkbtn:hover { background: var(--panel-2); color: var(--text); }

button[type="submit"] {
  background: var(--text);
  color: #0a0a0a;
  border: none;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: opacity 120ms;
}
button[type="submit"]:hover { opacity: 0.88; }
button[type="submit"]:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

/* ── Inputs ────────────────────────────────────────────────────────────── */
input, select, textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.9rem;
  width: 100%;
  transition: border-color 120ms, background 120ms;
}
input:hover, select:hover, textarea:hover { border-color: var(--border-hi); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--text-dim);
  background: var(--panel);
}

/* ── Sign in ───────────────────────────────────────────────────────────── */
.signin {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 24px 40px;
}
.signin-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.signin-card h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.signin-card label,
.card label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-dim);
  font-weight: 500;
}

/* ── Home tiles ────────────────────────────────────────────────────────── */
.home { padding: 40px 24px; max-width: 1080px; margin: 0 auto; }
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.tile {
  display: flex;
  gap: 14px;
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  transition: background 120ms, border-color 120ms, transform 120ms;
  cursor: pointer;
}
.tile:hover {
  background: var(--panel-2);
  border-color: var(--border-hi);
  transform: translateY(-1px);
}
.tile.disabled { opacity: 0.4; pointer-events: none; }
.tile-icon {
  font-size: 1.05rem;
  width: 36px;
  height: 36px;
  min-width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  /* Force non-emoji glyph rendering so unicode symbols stay monochrome */
  font-family: "Segoe UI Symbol", "Apple Symbols", "Noto Sans Symbols", sans-serif;
}
.tile:hover .tile-icon { color: var(--text); border-color: var(--border-hi); }
.tile-body h2 {
  margin: 0 0 4px;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.tile-body p {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.83rem;
  line-height: 1.45;
}

/* ── Section pages (team / users / analytics / ops / mail-admin) ───────── */
.mail-admin { padding: 32px 24px; max-width: 1080px; margin: 0 auto; }
.mail-admin h1 {
  margin: 16px 0 24px;
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.mail-admin h1 .hint { font-weight: 400; font-size: 0.85rem; }
.back { margin-bottom: 4px; }

/* Cards */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 16px;
}
.card h2 {
  margin: 0 0 16px;
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-hint);
}
.card form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  align-items: end;
}

/* Tables */
.card:has(table) { overflow-x: auto; }
table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
}
th, td {
  text-align: left;
  padding: 10px 6px;
  border-bottom: 1px solid var(--border);
}
th {
  color: var(--text-hint);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.72rem;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--panel-2); }

/* Chat — messenger layout: contact sidebar + conversation pane */
.chat-page {
  padding: 16px 24px;
  max-width: 1200px;
  margin: 0 auto;
  height: calc(100vh - 53px);
  display: flex;
  flex-direction: column;
}
.chat-shell {
  flex: 1;
  display: flex;
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
}
.chat-sidebar {
  width: 280px;
  min-width: 280px;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 12px;
}
.chat-sidebar-title {
  margin: 4px 8px 12px;
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-hint);
}
.chat-channels { display: flex; flex-direction: column; gap: 2px; }
.chat-contact {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font: inherit;
  width: 100%;
}
.chat-contact:hover { background: var(--panel-2); }
.chat-contact-active { background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--border-hi); }
.chat-contact-info { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.chat-contact-name { font-size: 0.88rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-contact-status { font-size: 0.74rem; color: var(--text-hint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.chat-avatar {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--panel-2);
  border: 1px solid var(--border-hi);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-dim);
}
.chat-avatar-icon { font-size: 1rem; font-family: "Segoe UI Symbol", "Apple Symbols", "Noto Sans Symbols", sans-serif; }

.chat-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat-main-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.chat-active-label { font-weight: 600; font-size: 0.95rem; }

.chat-log {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding: 16px 18px;
}
.chat-msg {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  max-width: 70%;
  align-self: flex-start;
}
.chat-msg-own {
  background: var(--text);
  color: #0a0a0a;
  align-self: flex-end;
}
.chat-msg-own .hint { color: #444; }
.chat-msg-meta { font-size: 0.75rem; margin-bottom: 4px; }
.chat-msg-body { font-size: 0.9rem; white-space: pre-wrap; word-break: break-word; }
.chat-form {
  display: flex;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
}
.chat-form input { flex: 1; }

/* Stat blocks */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}
.stat {
  padding: 16px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: left;
}
.stat-num {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.stat-lbl {
  font-size: 0.75rem;
  color: var(--text-hint);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
