/* =============================================================================
   Cyber Warfare Intelligence Lab — Employee Portal
   Standalone theme (no dependency on the public cwil.in site's CSS).
   ============================================================================= */

:root {
  --bg: #05070d;
  --bg-elevated: #0b0f1a;
  --panel: #10182b;
  --panel-border: rgba(120, 160, 255, 0.14);
  --panel-border-strong: rgba(120, 160, 255, 0.28);
  --text: #e7ecff;
  --text-dim: #93a0c4;
  --text-faint: #5c6690;
  --accent: #4c8dff;
  --accent-2: #8a5cff;
  --accent-3: #ff4cd6;
  --success: #33d68e;
  --warning: #ffb545;
  --danger: #ff5c6c;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  --font: "Segoe UI", system-ui, -apple-system, "Inter", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(76, 141, 255, 0.16), transparent 60%),
    radial-gradient(1000px 500px at 110% 10%, rgba(138, 92, 255, 0.14), transparent 60%),
    var(--bg);
  min-height: 100%;
}

a { color: var(--accent); }

::selection { background: rgba(76, 141, 255, 0.35); }

.hidden { display: none !important; }

/* --- Buttons --------------------------------------------------------------- */
button {
  font-family: inherit;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 999px;
  border: 1px solid var(--panel-border-strong);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.btn:hover { background: rgba(255, 255, 255, 0.07); border-color: var(--accent); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 6px 24px rgba(76, 141, 255, 0.35);
}
.btn-primary:hover { filter: brightness(1.08); }

.btn-danger {
  border-color: rgba(255, 92, 108, 0.4);
  color: var(--danger);
}
.btn-danger:hover { background: rgba(255, 92, 108, 0.12); }

.btn-sm { padding: 6px 14px; font-size: 12.5px; }
.btn-block { width: 100%; }

/* --- Forms ------------------------------------------------------------------ */
label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

input, select, textarea {
  width: 100%;
  font-family: inherit;
  font-size: 14.5px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 11px 13px;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  background: rgba(76, 141, 255, 0.06);
}
textarea { resize: vertical; min-height: 90px; }

.field { margin-bottom: 16px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .field-row { grid-template-columns: 1fr; } }

/* --- Cards / panels ---------------------------------------------------------- */
.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.01));
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 20px;
  backdrop-filter: blur(10px);
}

.card-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin: 0 0 14px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.stat-tile {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.stat-tile .label { font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; }
.stat-tile .value { font-size: 28px; font-weight: 700; margin-top: 6px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* --- Badges ------------------------------------------------------------------ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border: 1px solid transparent;
}
.badge-ok       { color: var(--success); background: rgba(51, 214, 142, 0.12); border-color: rgba(51, 214, 142, 0.3); }
.badge-warn     { color: var(--warning); background: rgba(255, 181, 69, 0.12); border-color: rgba(255, 181, 69, 0.3); }
.badge-danger   { color: var(--danger); background: rgba(255, 92, 108, 0.12); border-color: rgba(255, 92, 108, 0.3); }
.badge-neutral  { color: var(--text-dim); background: rgba(255, 255, 255, 0.05); border-color: var(--panel-border); }
.badge-accent   { color: var(--accent); background: rgba(76, 141, 255, 0.12); border-color: rgba(76, 141, 255, 0.3); }

/* --- Tables ------------------------------------------------------------------ */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--panel-border); }
th { color: var(--text-dim); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 700; }
tbody tr:hover { background: rgba(255, 255, 255, 0.02); }
.table-wrap { overflow-x: auto; }

/* --- Toast -------------------------------------------------------------------- */
#toast-stack {
  position: fixed;
  top: 18px;
  right: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 999;
}
.toast {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow);
  border: 1px solid var(--panel-border-strong);
  background: var(--panel);
  color: var(--text);
  max-width: 340px;
  animation: toast-in 0.2s ease;
}
.toast.error { border-color: rgba(255, 92, 108, 0.5); color: #ffd3d7; }
.toast.success { border-color: rgba(51, 214, 142, 0.5); color: #d6ffef; }
@keyframes toast-in { from { transform: translateY(-8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* --- Modal --------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(3, 5, 10, 0.7);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 900;
  padding: 20px;
}
.modal {
  width: 100%; max-width: 520px;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--panel-border-strong);
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: var(--shadow);
}
.modal h2 { margin-top: 0; }
.modal-close {
  float: right;
  background: none; border: none; color: var(--text-dim);
  font-size: 20px; cursor: pointer; line-height: 1;
}

/* =============================================================================
   Login page
   ============================================================================= */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015));
  border: 1px solid var(--panel-border-strong);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  box-shadow: var(--shadow);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 26px;
}
.brand-mark {
  width: 46px; height: 46px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px; letter-spacing: 0.02em;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 6px 20px rgba(76, 141, 255, 0.4);
  flex-shrink: 0;
}
.brand-name { font-size: 15px; font-weight: 800; line-height: 1.2; }
.brand-sub { font-size: 11.5px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.06em; }

.login-card h1 { font-size: 20px; margin: 0 0 6px; }
.login-card p.lede { color: var(--text-dim); font-size: 13.5px; margin: 0 0 24px; }

.form-error {
  background: rgba(255, 92, 108, 0.1);
  border: 1px solid rgba(255, 92, 108, 0.35);
  color: #ffd3d7;
  border-radius: 10px;
  padding: 10px 13px;
  font-size: 13px;
  margin-bottom: 16px;
}

.no-signup-note {
  margin-top: 22px;
  font-size: 12.5px;
  color: var(--text-faint);
  text-align: center;
  line-height: 1.5;
}

/* =============================================================================
   Dashboard shell
   ============================================================================= */
.shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 200; height: 100%; transform: translateX(-100%); transition: transform 0.2s ease; }
  .sidebar.open { transform: translateX(0); }
}

.sidebar {
  background: var(--bg-elevated);
  border-right: 1px solid var(--panel-border);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sidebar .brand { padding: 0 8px; margin-bottom: 24px; }

.nav-group-label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 16px 10px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text-dim);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  background: none;
  text-align: left;
  width: 100%;
}
.nav-item:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }
.nav-item.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(76, 141, 255, 0.22), rgba(138, 92, 255, 0.18));
  border-color: rgba(76, 141, 255, 0.35);
}
.nav-item .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.7; flex-shrink: 0; }

.sidebar-footer { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--panel-border); }

.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 26px;
  background: rgba(5, 7, 13, 0.75);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--panel-border);
}
.topbar h1 { font-size: 17px; margin: 0; }
.topbar .who { display: flex; align-items: center; gap: 12px; }
.avatar-chip {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: #fff;
}
.menu-toggle { display: none; background: none; border: none; color: var(--text); font-size: 20px; cursor: pointer; }
@media (max-width: 900px) { .menu-toggle { display: block; } }

.content { padding: 24px 26px 60px; max-width: 1180px; }

.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fade-in 0.18s ease; }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.section-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 18px; flex-wrap: wrap;
}
.section-header h2 { margin: 0; font-size: 19px; }
.section-header p { margin: 4px 0 0; color: var(--text-dim); font-size: 13px; }

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

.list-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0; border-bottom: 1px solid var(--panel-border);
  gap: 12px;
}
.list-item:last-child { border-bottom: none; }
.list-item .meta { font-size: 12px; color: var(--text-dim); }

.empty-state {
  text-align: center;
  color: var(--text-faint);
  padding: 34px 10px;
  font-size: 13.5px;
}

/* --- Photo / avatar upload --------------------------------------------------- */
.photo-frame {
  width: 96px; height: 96px; border-radius: 16px;
  border: 1px solid var(--panel-border-strong);
  background: rgba(255, 255, 255, 0.03);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; flex-shrink: 0;
  font-size: 30px; font-weight: 800; color: var(--text-faint);
}
.photo-frame img { width: 100%; height: 100%; object-fit: cover; }

.photo-frame-sm {
  width: 38px; height: 38px; border-radius: 9px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.03);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; flex-shrink: 0;
  font-size: 13px; font-weight: 700; color: var(--text-faint);
}
.photo-frame-sm img { width: 100%; height: 100%; object-fit: cover; }

.photo-upload-label {
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.photo-upload-label input[type="file"] { display: none; }

/* --- Chat / support ------------------------------------------------------------ */
.chat-window {
  height: 420px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px 4px 10px;
}
.chat-bubble { max-width: 78%; padding: 10px 14px; border-radius: 14px; font-size: 13.5px; line-height: 1.5; }
.chat-bubble.user { align-self: flex-end; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border-bottom-right-radius: 4px; }
.chat-bubble.assistant { align-self: flex-start; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--panel-border); border-bottom-left-radius: 4px; }
.chat-input-row { display: flex; gap: 10px; margin-top: 14px; }
.chat-input-row textarea { min-height: 44px; max-height: 120px; }

/* --- Utility ------------------------------------------------------------------- */
.muted { color: var(--text-dim); }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.text-right { text-align: right; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
