:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #667085;
  --line: #dde5ef;
  --primary: #0b4f8a;
  --primary-2: #0e7c86;
  --accent: #13a66b;
  --danger: #cf3f4b;
  --warn: #b7791f;
  --shadow: 0 16px 40px rgba(19, 37, 61, .10);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--bg); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 430px) 1fr;
  background: linear-gradient(135deg, #0b4f8a, #0e7c86 55%, #13a66b);
}
.login-panel {
  background: var(--panel);
  padding: 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: var(--shadow);
}
.login-art {
  color: white;
  padding: 54px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 560px;
}
.brand-mark { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 24px; }
.brand-icon {
  width: 38px; height: 38px; border-radius: 8px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--accent)); color: white; font-weight: 900;
}
.login-art h1 { font-size: clamp(36px, 5vw, 72px); line-height: 1; margin: 24px 0 12px; letter-spacing: 0; max-width: 780px; }
.login-art p { max-width: 620px; font-size: 18px; opacity: .92; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 76px 1fr; }
.app-shell.expanded { grid-template-columns: 248px 1fr; }
.sidebar {
  background: #0c2440; color: #d9e8f6; min-height: 100vh; position: sticky; top: 0;
  display: flex; flex-direction: column; transition: width .2s ease; z-index: 5;
}
.topbar {
  height: 66px; background: var(--panel); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px; padding: 0 24px; position: sticky; top: 0; z-index: 4;
}
.burger, .icon-btn {
  width: 40px; height: 40px; border: 1px solid var(--line); background: white; color: var(--ink);
  border-radius: 8px; display: grid; place-items: center;
}
.burger span, .burger::before, .burger::after {
  content: ""; width: 18px; height: 2px; background: currentColor; display: block; margin: 2px 0;
}
.top-title { font-weight: 800; font-size: 19px; }
.top-spacer { flex: 1; }
.user-pill { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }

.side-head { height: 66px; display: flex; align-items: center; gap: 12px; padding: 0 18px; border-bottom: 1px solid rgba(255,255,255,.09); }
.side-title { display: none; font-weight: 800; color: white; white-space: nowrap; }
.expanded .side-title { display: inline; }
.nav { padding: 12px 10px; display: grid; gap: 6px; }
.nav button {
  border: 0; background: transparent; color: inherit; min-height: 48px; border-radius: 8px;
  display: flex; align-items: center; gap: 14px; padding: 0 14px; width: 100%;
}
.nav button:hover, .nav button.active { background: rgba(255,255,255,.11); color: #fff; }
.nav .label { display: none; white-space: nowrap; }
.expanded .nav .label { display: inline; }
.nav .ico { width: 24px; text-align: center; font-weight: 900; }
.logout { margin-top: auto; padding-bottom: 12px; }

.content { padding: 24px; max-width: 1480px; width: 100%; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.page-head h1 { margin: 0; font-size: 28px; letter-spacing: 0; }
.subtle { color: var(--muted); margin: 4px 0 0; }
.grid { display: grid; gap: 16px; }
.stats { grid-template-columns: repeat(4, minmax(170px, 1fr)); }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 8px 22px rgba(20, 41, 66, .05); padding: 18px;
}
.stat .value { font-size: 34px; font-weight: 850; }
.stat .label { color: var(--muted); }
.split { grid-template-columns: 1.3fr .9fr; align-items: start; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 13px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
tr:hover td { background: #f8fbfe; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn {
  border: 1px solid var(--line); background: white; color: var(--ink); border-radius: 8px;
  min-height: 38px; padding: 0 13px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
}
.btn.primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn.green { background: var(--accent); color: white; border-color: var(--accent); }
.btn.danger { color: var(--danger); border-color: #f2c3c7; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.field { display: grid; gap: 6px; margin-bottom: 12px; }
label { color: #344054; font-size: 13px; font-weight: 700; }
input, textarea, select {
  border: 1px solid var(--line); border-radius: 8px; min-height: 40px; padding: 9px 11px;
  background: white; color: var(--ink); width: 100%;
}
textarea { min-height: 96px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.full { grid-column: 1 / -1; }
.badge { display: inline-flex; align-items: center; min-height: 24px; border-radius: 999px; padding: 0 9px; font-size: 12px; font-weight: 800; background: #eaf2fb; color: var(--primary); }
.badge.green { background: #e7f7ef; color: #08784d; }
.badge.warn { background: #fff4df; color: var(--warn); }
.badge.red { background: #fde8ea; color: var(--danger); }
.muted-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.muted-list li { padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.mini { color: var(--muted); font-size: 13px; }

.kanban { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 6px; }
.lane { background: #eef4fa; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; min-height: 520px; }
.lane h3 { margin: 0 0 12px; display: flex; justify-content: space-between; align-items: center; font-size: 16px; }
.task-card { background: white; border: 1px solid var(--line); border-radius: var(--radius); padding: 13px; margin-bottom: 10px; box-shadow: 0 8px 20px rgba(21, 45, 74, .06); }
.task-card.overdue { border-color: #f1a7ae; box-shadow: 0 0 0 2px #fde8ea inset; }
.task-card strong { display: block; margin-bottom: 6px; }
.task-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.lane.drop { outline: 2px solid var(--primary-2); outline-offset: 2px; }

.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.conversation-layout { display: grid; grid-template-columns: 320px 1fr; gap: 16px; height: calc(100vh - 140px); min-height: 560px; }
.conversation-list, .chat-window { overflow: auto; }
.conversation-item { width: 100%; text-align: left; border: 0; background: white; border-bottom: 1px solid var(--line); padding: 14px; }
.conversation-item.active { background: #eaf4fb; }
.message { max-width: 70%; padding: 10px 12px; border-radius: 8px; margin: 8px 0; background: #eef4fa; }
.message.mine { margin-left: auto; background: #dff4ec; }
.chat-compose { display: grid; grid-template-columns: 1fr auto; gap: 10px; position: sticky; bottom: 0; background: white; padding-top: 12px; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(13, 28, 48, .45); display: grid; place-items: center; z-index: 20; padding: 18px;
}
.modal { background: white; border-radius: var(--radius); width: min(720px, 100%); max-height: 92vh; overflow: auto; box-shadow: var(--shadow); }
.modal-head { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); padding: 16px 18px; }
.modal-head h2 { margin: 0; font-size: 20px; }
.modal-body { padding: 18px; }
.toast { position: fixed; right: 20px; bottom: 20px; background: #102a43; color: white; padding: 12px 14px; border-radius: 8px; z-index: 30; box-shadow: var(--shadow); }
.error { color: var(--danger); font-weight: 700; }

@media (max-width: 980px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .app-shell, .app-shell.expanded { grid-template-columns: 1fr; }
  .sidebar { position: fixed; width: 76px; left: 0; bottom: 0; transform: translateX(-100%); transition: transform .2s ease; }
  .app-shell.expanded .sidebar { transform: translateX(0); width: 248px; }
  .expanded .side-title, .expanded .nav .label { display: inline; }
  .content { padding: 16px; }
  .stats, .split, .detail-layout, .conversation-layout { grid-template-columns: 1fr; }
  .kanban { grid-template-columns: repeat(4, 260px); }
  .form-grid { grid-template-columns: 1fr; }
}
