/* Williams Plumbing price tool — professional dashboard styling.
   Palette: deep navy + blue accent + slate grays. Self-contained, no frameworks. */

:root {
  --navy:       #14233a;
  --navy-2:     #1c3050;
  --blue:       #2563eb;
  --blue-dark:  #1d4ed8;
  --slate-900:  #0f172a;
  --slate-700:  #334155;
  --slate-500:  #64748b;
  --slate-400:  #94a3b8;
  --slate-200:  #e2e8f0;
  --slate-100:  #f1f5f9;
  --bg:         #f5f7fa;
  --white:      #ffffff;
  --green:      #16a34a;
  --amber:      #d97706;
  --red:        #dc2626;
  --shadow:     0 1px 3px rgba(15,23,42,.08), 0 1px 2px rgba(15,23,42,.06);
  --radius:     10px;
  --font:       -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font);
  color: var(--slate-900);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
}
a { color: var(--blue-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------- Top header bar ---------------- */
.topbar {
  height: 58px;
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand .mark {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, var(--blue), #38bdf8);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; font-size: 15px;
}
.brand .name { font-weight: 600; font-size: 15px; letter-spacing: .2px; }
.brand .sub { color: var(--slate-400); font-size: 12px; margin-top: -2px; }
.topbar .spacer { flex: 1; }
.topbar .clock { font-variant-numeric: tabular-nums; color: #cbd5e1; font-size: 13px; margin-right: 18px; text-align: right; }
.topbar .clock .date { color: var(--slate-400); font-size: 11px; }
.topbar .user { display: flex; align-items: center; gap: 9px; }
.topbar .user .who { text-align: right; font-size: 12px; }
.topbar .user .who b { font-size: 13px; }
.topbar .user .who span { color: var(--slate-400); display: block; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--blue); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px; flex: none;
}
.btn-logout {
  margin-left: 14px; color: #cbd5e1; border: 1px solid #33486a;
  padding: 5px 11px; border-radius: 7px; font-size: 12px;
}
.btn-logout:hover { background: #33486a; text-decoration: none; color: #fff; }

/* ---------------- Layout ---------------- */
.layout {
  display: grid;
  grid-template-columns: 232px 1fr 312px;
  gap: 18px;
  padding: 18px;
  max-width: 1500px;
  margin: 0 auto;
  align-items: start;
}

/* ---------------- Sidebar ---------------- */
.sidebar { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px; }
.nav-group-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--slate-400); padding: 14px 12px 6px; font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 8px; color: var(--slate-700);
  font-weight: 500; cursor: pointer;
}
.nav-item:hover { background: var(--slate-100); text-decoration: none; }
.nav-item.active { background: #e8f0fe; color: var(--blue-dark); }
.nav-item svg { width: 17px; height: 17px; flex: none; stroke: currentColor; }
.nav-item .badge { margin-left: auto; font-size: 11px; background: var(--slate-100); color: var(--slate-500); border-radius: 20px; padding: 1px 8px; }

/* ---------------- Cards ---------------- */
.card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { padding: 14px 18px; border-bottom: 1px solid var(--slate-200); display: flex; align-items: center; gap: 9px; }
.card-head h2 { margin: 0; font-size: 14px; font-weight: 600; }
.card-head .dot-live { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(22,163,74,.15); }
.card-body { padding: 18px; }

/* ---------------- Chat ---------------- */
.chat { display: flex; flex-direction: column; min-height: 560px; }
.chat-messages { flex: 1; padding: 22px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.msg { display: flex; gap: 11px; max-width: 86%; }
.msg .bubble { padding: 11px 15px; border-radius: 14px; font-size: 14px; }
.msg.assistant .ico { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg,var(--blue),#38bdf8); color:#fff; display:flex; align-items:center; justify-content:center; font-weight:700; font-size:13px; flex:none; }
.msg.assistant .bubble { background: var(--slate-100); color: var(--slate-900); border-top-left-radius: 4px; }
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.msg.user .bubble { background: var(--blue); color: #fff; border-top-right-radius: 4px; }
.chat-hint { text-align:center; color: var(--slate-400); font-size:12px; margin-top: 6px; }
.composer { border-top: 1px solid var(--slate-200); padding: 14px; display: flex; gap: 10px; align-items: flex-end; }
.composer textarea {
  flex: 1; resize: none; border: 1px solid var(--slate-200); border-radius: 10px;
  padding: 11px 13px; font-family: var(--font); font-size: 14px; line-height:1.45; min-height: 46px; max-height: 160px;
  outline: none;
}
.composer textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.btn {
  background: var(--blue); color: #fff; border: none; border-radius: 10px;
  padding: 11px 18px; font-size: 14px; font-weight: 600; cursor: pointer; font-family: var(--font);
}
.btn:hover { background: var(--blue-dark); }

/* ---------------- Aside (user + status) ---------------- */
.aside { display: flex; flex-direction: column; gap: 18px; }
.user-card .card-body { display: flex; flex-direction: column; align-items: center; text-align: center; }
.user-card .avatar-lg { width: 64px; height: 64px; border-radius: 50%; font-size: 22px; margin-bottom: 12px; }
.user-card .u-name { font-weight: 600; font-size: 16px; }
.user-card .u-role { display:inline-block; margin-top:5px; font-size: 11px; font-weight:600; text-transform:uppercase; letter-spacing:.5px; color: var(--blue-dark); background:#e8f0fe; padding: 3px 10px; border-radius: 20px; }
.u-meta { width: 100%; margin-top: 16px; border-top: 1px solid var(--slate-200); padding-top: 14px; }
.u-meta .row { display: flex; justify-content: space-between; font-size: 12.5px; padding: 5px 0; }
.u-meta .row span { color: var(--slate-500); }
.u-meta .row b { font-weight: 600; }
.pill { font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 20px; }
.pill.green { color: var(--green); background: rgba(22,163,74,.12); }

/* status dashboard */
.status-list { display: flex; flex-direction: column; }
.status-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--slate-100); }
.status-row:last-child { border-bottom: none; }
.status-row .label { flex: 1; color: var(--slate-700); }
.status-row .state { font-size: 12px; font-weight: 600; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.dot.green { background: var(--green); box-shadow: 0 0 0 3px rgba(22,163,74,.14); }
.dot.amber { background: var(--amber); box-shadow: 0 0 0 3px rgba(217,119,6,.14); }
.dot.red   { background: var(--red);   box-shadow: 0 0 0 3px rgba(220,38,38,.14); }
.state.green { color: var(--green); }
.state.amber { color: var(--amber); }
.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 4px; }
.metric { background: var(--slate-100); border-radius: 9px; padding: 12px; }
.metric .n { font-size: 20px; font-weight: 700; color: var(--navy); }
.metric .l { font-size: 11.5px; color: var(--slate-500); margin-top: 2px; }

/* ---------------- Login page ---------------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--navy), var(--navy-2)); }
.login-card { background: #fff; border-radius: 14px; box-shadow: 0 20px 50px rgba(0,0,0,.25); width: 380px; padding: 34px 32px; }
.login-card .brand { justify-content: center; margin-bottom: 6px; }
.login-card h1 { font-size: 19px; text-align: center; margin: 14px 0 4px; }
.login-card .tagline { text-align: center; color: var(--slate-500); font-size: 13px; margin-bottom: 22px; }
.login-card label { display:block; font-size: 12.5px; font-weight: 600; color: var(--slate-700); margin: 12px 0 5px; }
.login-card input[type=text], .login-card input[type=password] {
  width: 100%; border: 1px solid var(--slate-200); border-radius: 9px; padding: 11px 12px; font-size: 14px; font-family: var(--font); outline: none;
}
.login-card input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.login-card .btn { width: 100%; margin-top: 20px; padding: 12px; }
.login-card .errors { background: #fef2f2; color: var(--red); border: 1px solid #fecaca; border-radius: 8px; padding: 9px 12px; font-size: 12.5px; margin-bottom: 6px; }
.login-foot { text-align:center; color: var(--slate-400); font-size: 11px; margin-top: 18px; }

/* logout as a POST button (Django 5 requires POST for logout) */
.logout-form { display: inline; margin-left: 14px; }
.btn-logout { background: transparent; font-family: inherit; cursor: pointer; }

/* change-password link in the user card */
.btn-changepw { display:block; margin-top:14px; text-align:center; font-size:12.5px; font-weight:600;
  color: var(--blue-dark); border:1px solid var(--slate-200); border-radius:8px; padding:8px; }
.btn-changepw:hover { background: var(--slate-100); text-decoration:none; }

/* generic in-app form panel (e.g. change password) */
.form-panel { max-width: 460px; }
.form-panel label { display:block; font-size:12.5px; font-weight:600; color:var(--slate-700); margin:14px 0 5px; }
.form-panel input { width:100%; border:1px solid var(--slate-200); border-radius:9px; padding:11px 12px;
  font-size:14px; font-family:var(--font); outline:none; }
.form-panel input:focus { border-color:var(--blue); box-shadow:0 0 0 3px rgba(37,99,235,.12); }
.field-help { font-size:11.5px; color:var(--slate-500); margin-top:5px; line-height:1.4; }
.field-error { font-size:12px; color:var(--red); margin-top:5px; }
.form-actions { margin-top:22px; display:flex; gap:10px; align-items:center; }
.btn-secondary { color:var(--slate-700); border:1px solid var(--slate-200); border-radius:10px;
  padding:11px 18px; font-size:14px; font-weight:600; }
.btn-secondary:hover { background:var(--slate-100); text-decoration:none; }
