/* Hakan Chat staff panel — redesign 2026-11-07.
   Full-viewport app shell, dark brand sidebar, readable type scale (14px base). */
@font-face {
  font-family: Hakan;
  src: url("/assets/regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: Hakan;
  src: url("/assets/semibold.woff2") format("woff2");
  font-weight: 600 800;
  font-display: swap;
}
:root {
  color-scheme: light;
  /* brand */
  --green: #3f7d70;
  --green-strong: #336a5e;
  --deep: #203b36;
  --sidebar: #1b302c;
  --sidebar-ink: #c9d8d3;
  --sidebar-line: rgba(255, 255, 255, 0.08);
  /* neutrals */
  --ink: #1f2b29;
  --ink-2: #44524f;
  --muted: #5f6e6a;
  --line: #e2e9e6;
  --line-strong: #cfdad6;
  --white: #fff;
  --bg: #f2f5f4;
  --soft: #f7faf9;
  --pale: #e6f0ec;
  /* states */
  --amber: #8a5a0b;
  --amber-bg: #fdf4df;
  --amber-line: #f0dcae;
  --red: #b23b3b;
  --red-bg: #fcecec;
  --blue: #2d6590;
  --blue-bg: #e9f2fa;
  /* shape */
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(27, 48, 44, 0.06);
  --shadow: 0 1px 2px rgba(27, 48, 44, 0.05), 0 8px 24px rgba(27, 48, 44, 0.06);
  --shadow-lg: 0 24px 64px rgba(27, 48, 44, 0.18);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  font-family: Hakan, Tahoma, sans-serif;
  font-size: 14px;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  height: 100%;
}
body {
  color: var(--ink);
  background: var(--bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
#app {
  min-height: 100%;
}
button,
input,
textarea,
select {
  font: inherit;
}
button,
a {
  touch-action: manipulation;
}
button {
  cursor: pointer;
  border: 0;
}
button:disabled {
  opacity: 0.5;
  cursor: default;
}
button,
input,
textarea,
select {
  outline-offset: 2px;
}
:focus-visible {
  outline: 2px solid var(--green);
}
input,
textarea,
select {
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--white);
  padding: 9px 12px;
  min-width: 0;
  min-height: 40px;
  font-size: 14px;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
input:hover,
textarea:hover,
select:hover {
  border-color: #b9c8c3;
}
input:focus,
textarea:focus,
select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(63, 125, 112, 0.15);
  outline: none;
}
input::placeholder,
textarea::placeholder {
  color: #8a9894;
}
input[type="checkbox"] {
  accent-color: var(--green);
  width: 18px;
  height: 18px;
  min-height: 0;
  padding: 0;
}
textarea {
  resize: vertical;
  line-height: 1.9;
}
[hidden] {
  display: none !important;
}

/* ---------- primitives ---------- */
.btn {
  border: 1px solid var(--line-strong);
  padding: 8px 14px;
  border-radius: var(--r-sm);
  background: var(--white);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  transition:
    background 0.15s,
    border-color 0.15s,
    color 0.15s;
}
.btn:hover {
  background: var(--soft);
  border-color: #b9c8c3;
}
.btn .icon {
  width: 17px;
  height: 17px;
}
.primary,
.btn.primary {
  background: var(--green);
  color: var(--white);
  border-color: var(--green);
}
.primary:hover,
.btn.primary:hover {
  background: var(--green-strong);
  border-color: var(--green-strong);
}
.danger {
  color: var(--red);
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 12px;
}
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}
.icon {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
  stroke: currentColor;
  stroke-width: 1.7;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--muted);
  flex-shrink: 0;
  transition:
    background 0.15s,
    color 0.15s;
}
.icon-btn:hover {
  background: var(--pale);
  color: var(--deep);
}
.badge {
  font-size: 12px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--pale);
  color: var(--green-strong);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  line-height: 1.7;
  white-space: nowrap;
}
.badge.pending {
  color: var(--amber);
  background: var(--amber-bg);
}
.badge.urgent {
  color: var(--red);
  background: var(--red-bg);
}
.badge.ai {
  color: var(--blue);
  background: var(--blue-bg);
}
.badge.plain {
  background: transparent;
  color: var(--muted);
  padding: 0;
}
.avatar,
.conv-avatar {
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  flex-shrink: 0;
  background: var(--pale);
  color: var(--green-strong);
}
.avatar {
  width: 36px;
  height: 36px;
  font-size: 15px;
}

/* ---------- app shell ---------- */
.workspace {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
.sidebar {
  background: var(--sidebar);
  color: var(--sidebar-ink);
  display: flex;
  flex-direction: column;
  padding: 20px 14px 14px;
  gap: 2px;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
}
.brand-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 10px 22px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--sidebar-line);
}
.sidebar .logo {
  width: 136px;
  height: auto;
  filter: brightness(0) invert(1);
}
.product-name {
  font-size: 12.5px;
  color: #8fb3a9;
}
.sidebar-label {
  font-size: 11.5px;
  color: #7f9a93;
  padding: 6px 12px 8px;
}
.nav-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 10px;
  padding: 9px 12px;
  text-align: right;
  background: transparent;
  color: var(--sidebar-ink);
  font-size: 14px;
  min-height: 44px;
  position: relative;
  transition:
    background 0.15s,
    color 0.15s;
}
.nav-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--white);
}
.nav-btn.active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--white);
  font-weight: 600;
}
.nav-short {
  display: none;
}
.nav-btn .count {
  margin-right: auto;
  font-size: 12px;
  min-width: 24px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: #7fc4b2;
  color: var(--sidebar);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sidebar-bottom {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--sidebar-line);
}
.profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px 0;
}
.sidebar .avatar {
  background: rgba(127, 196, 178, 0.18);
  color: #a9e0d1;
}
.profile-copy {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  color: var(--white);
  line-height: 1.5;
}
.profile-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-copy small {
  display: block;
  font-size: 12px;
  color: #8fb3a9;
}
.sidebar .icon-btn {
  color: #9fb8b1;
}
.sidebar .icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--white);
}
.main-column {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
.topbar {
  display: none;
}
.demo-strip {
  background: var(--amber-bg);
  color: var(--amber);
  border-bottom: 1px solid var(--amber-line);
  padding: 7px 20px;
  font-size: 12.5px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.demo-dot {
  width: 7px;
  height: 7px;
  background: currentColor;
  border-radius: 50%;
  flex-shrink: 0;
}
.main-content {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* ---------- inbox ---------- */
.inbox {
  display: flex;
  flex: 1;
  min-height: 0;
  min-width: 0;
  position: relative;
}
.conversation-list {
  width: 340px;
  flex-shrink: 0;
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  background: var(--white);
  min-height: 0;
}
.list-title {
  padding: 20px 18px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.list-title h1 {
  font-size: 20px;
  margin: 0;
  color: var(--deep);
  font-weight: 600;
}
.list-title .badge {
  font-weight: 600;
}
.search {
  position: relative;
  margin: 0 16px 12px;
}
.search .icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  width: 17px;
  height: 17px;
  pointer-events: none;
}
.search input {
  width: 100%;
  padding-right: 38px;
  background: var(--soft);
  border-color: var(--line);
  height: 42px;
}
.list-filters {
  display: flex;
  margin: 0 16px 14px;
  padding: 4px;
  gap: 2px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.filter {
  flex: 1;
  font-size: 13px;
  border-radius: 7px;
  padding: 6px 4px;
  color: var(--muted);
  background: transparent;
  min-height: 34px;
  white-space: nowrap;
  transition:
    background 0.15s,
    color 0.15s;
}
.filter:hover {
  color: var(--ink);
}
.filter.active {
  color: var(--deep);
  background: var(--white);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.list-scroll {
  overflow: auto;
  flex: 1;
  min-height: 0;
  border-top: 1px solid var(--line);
  scrollbar-width: thin;
}
.conv-item {
  width: 100%;
  text-align: right;
  background: var(--white);
  border-bottom: 1px solid var(--line);
  padding: 14px 16px;
  display: block;
  color: var(--ink);
  position: relative;
  transition: background 0.12s;
}
.conv-item:hover {
  background: var(--soft);
}
.conv-item.selected {
  background: #eef5f2;
}
.conv-item.selected::before {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--green);
}
.conv-top {
  display: flex;
  align-items: center;
  gap: 10px;
}
.conv-avatar {
  width: 38px;
  height: 38px;
  font-size: 15px;
}
.conv-name {
  font-size: 14.5px;
  font-weight: 600;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.conv-time {
  font-size: 12px;
  color: var(--muted);
  flex-shrink: 0;
}
.conv-preview {
  font-size: 13.5px;
  color: var(--ink-2);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  margin: 6px 48px 8px 0;
  line-height: 1.7;
}
.conv-bottom {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-right: 48px;
  flex-wrap: wrap;
}
.unread-dot {
  margin-right: auto;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  color: var(--white);
  background: var(--green);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}
.load-more {
  display: flex;
  margin: 12px auto;
  font-size: 13px;
  min-height: 36px;
}

/* conversation */
.conversation-detail {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--soft);
}
.detail-header {
  min-height: 72px;
  border-bottom: 1px solid var(--line);
  padding: 12px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  background: var(--white);
}
.detail-person {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
}
.detail-person > div {
  min-width: 0;
}
.detail-person h2 {
  font-size: 17px;
  margin: 0;
  font-weight: 600;
  color: var(--deep);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.5;
}
.detail-person p {
  font-size: 12.5px;
  color: var(--muted);
  margin: 0;
}
.detail-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.status-select {
  font-size: 13.5px;
  padding: 7px 10px;
  max-width: 130px;
  font-weight: 600;
}
.back-list {
  display: none;
}
.context-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 9px 22px;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--muted);
  flex-wrap: wrap;
  background: var(--white);
}
.context-bar .icon {
  width: 16px;
  height: 16px;
}
.context-bar a {
  color: var(--green-strong);
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
  white-space: nowrap;
  text-decoration: none;
  direction: ltr;
}
.context-bar a:hover {
  text-decoration: underline;
}
.context-bar .context-sep {
  width: 1px;
  height: 12px;
  background: var(--line-strong);
}
.chat-log {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding: 24px 28px 12px;
  scrollbar-width: thin;
}
.day-line {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  margin: 0 0 20px;
}
.day-line::before,
.day-line::after {
  content: "";
  height: 1px;
  background: var(--line-strong);
  flex: 1;
  max-width: 120px;
}
.msg {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-bottom: 18px;
}
.msg.agent,
.msg.ai {
  align-items: flex-end;
}
.msg-label {
  font-size: 12px;
  color: var(--muted);
  margin: 0 4px 5px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.msg-label .icon {
  width: 15px;
  height: 15px;
}
.message-bubble {
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: 16px 4px 16px 16px;
  padding: 10px 15px;
  font-size: 14.5px;
  line-height: 1.95;
  max-width: min(78%, 640px);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  unicode-bidi: plaintext;
  box-shadow: var(--shadow-sm);
}
.agent .message-bubble {
  background: var(--green);
  border-color: var(--green);
  color: var(--white);
  border-radius: 16px 16px 4px 16px;
}
.ai .message-bubble {
  background: var(--blue-bg);
  border-color: #d3e4f2;
  border-radius: 16px 16px 4px 16px;
}
.msg.internal .message-bubble {
  background: var(--amber-bg);
  border: 1px dashed #e2c27a;
  color: var(--ink);
  box-shadow: none;
}
.msg.system {
  align-items: center;
}
.msg.system .message-bubble {
  background: transparent;
  border: 1px solid var(--line-strong);
  font-size: 12.5px;
  color: var(--muted);
  border-radius: 999px;
  padding: 4px 14px;
  max-width: 100%;
  box-shadow: none;
}
.msg-time {
  font-size: 11.5px;
  color: var(--muted);
  margin: 4px 4px 0;
}
.file-link {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  text-align: right;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--green-strong);
  border-radius: var(--r-sm);
  padding: 7px 11px;
  font-size: 13px;
  margin-top: 8px;
}
.agent .file-link {
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.12);
  color: var(--white);
}

/* composer */
.composer-box {
  margin: 4px 22px 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  background: var(--white);
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.composer-box:focus-within {
  border-color: var(--green);
  box-shadow:
    0 0 0 3px rgba(63, 125, 112, 0.12),
    var(--shadow);
}
.composer-box:has(.compose-mode.note.active) {
  background: #fffcf3;
  border-color: #e2c27a;
}
.composer-box:has(.compose-mode.note.active):focus-within {
  box-shadow:
    0 0 0 3px rgba(226, 194, 122, 0.25),
    var(--shadow);
}
.composer-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 10px 0;
  align-items: center;
  border-bottom: 1px solid var(--line);
}
.compose-mode {
  border: 0;
  background: transparent;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 13.5px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.compose-mode:hover {
  color: var(--ink);
}
.compose-mode.active {
  color: var(--green-strong);
  border-bottom-color: var(--green);
  font-weight: 600;
}
.compose-mode.note.active {
  color: var(--amber);
  border-bottom-color: #d39a2c;
}
.composer-tabs .ai-button {
  margin-right: auto;
  color: var(--blue);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: var(--blue-bg);
  padding: 5px 11px;
  border-radius: 999px;
  margin-bottom: 6px;
}
.ai-button .icon {
  width: 15px;
  height: 15px;
}
.compose-input {
  resize: none;
  border: 0 !important;
  border-radius: 0;
  width: 100%;
  height: 92px;
  min-height: 64px;
  padding: 12px 16px;
  font-size: 14.5px;
  background: transparent;
  box-shadow: none !important;
}
.compose-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px 10px;
  gap: 8px;
}
.compose-footer select {
  font-size: 13px;
  padding: 6px 9px;
  max-width: 180px;
  min-height: 36px;
}
.compose-tools {
  display: flex;
  gap: 4px;
  align-items: center;
  min-width: 0;
}
.compose-tools .icon-btn {
  width: 36px;
  height: 36px;
}
.compose-helper {
  font-size: 12px;
  color: var(--muted);
  padding: 0 16px 10px;
}
.staff-attachment {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--soft);
  font-size: 13px;
  color: var(--green-strong);
  overflow-wrap: anywhere;
  border-top: 1px solid var(--line);
}
.staff-attachment .icon-btn {
  margin-right: auto;
  width: 30px;
  height: 30px;
}

/* details side */
.details-side {
  width: 300px;
  border-right: 1px solid var(--line);
  padding: 20px 18px;
  overflow: auto;
  flex-shrink: 0;
  background: var(--white);
}
.details-side h3 {
  font-size: 14.5px;
  font-weight: 600;
  margin: 0 0 16px;
  color: var(--deep);
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
  font-size: 14px;
  min-width: 0;
}
.field label {
  font-size: 13px;
  color: var(--ink-2);
  font-weight: 600;
}
.field select,
.field input,
.field textarea {
  width: 100%;
}
.side-rule {
  height: 1px;
  background: var(--line);
  margin: 20px 0;
}
.visitor-line {
  font-size: 14px;
  line-height: 1.8;
  overflow-wrap: anywhere;
  margin: 10px 0;
}
.visitor-line label {
  color: var(--muted);
  display: block;
  font-size: 12px;
}
.toggle-line {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 14px;
  line-height: 1.8;
  cursor: pointer;
}
.toggle-line input {
  margin: 0;
}
.sla-hint {
  font-size: 12.5px;
  color: var(--ink-2);
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  line-height: 1.9;
  margin-top: 18px;
}
.details-toggle {
  display: none;
}
.feedback-placeholder {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 16px;
  line-height: 1.9;
}

/* ---------- content pages ---------- */
.content-page {
  overflow-y: auto;
  flex: 1;
  padding: 32px clamp(20px, 4vw, 48px) 48px;
  min-width: 0;
}
.content-page > * {
  max-width: 1120px;
  margin-inline: auto;
}
.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.page-heading h1 {
  font-size: 26px;
  color: var(--deep);
  margin: 0 0 4px;
  font-weight: 600;
  line-height: 1.4;
}
.page-heading p {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.8;
  margin: 0;
}
.records {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.record {
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: var(--r);
  padding: 18px 20px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  box-shadow: var(--shadow-sm);
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.record:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
}
.record-main {
  flex: 1;
  min-width: 0;
}
.record h3 {
  font-size: 15.5px;
  margin: 0 0 4px;
  font-weight: 600;
  color: var(--deep);
}
.record p {
  font-size: 14px;
  line-height: 1.9;
  color: var(--ink-2);
  margin: 4px 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.record-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.record footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 13px;
  flex-wrap: wrap;
}
.empty {
  padding: 56px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  line-height: 2;
}
.empty .icon {
  width: 44px;
  height: 44px;
  padding: 11px;
  margin-bottom: 12px;
  color: var(--green);
  background: var(--pale);
  border-radius: 50%;
}
.loading {
  padding: 40px;
  color: var(--muted);
  font-size: 14px;
}
.error-panel {
  margin: 24px;
  padding: 16px 18px;
  font-size: 14px;
  color: var(--red);
  line-height: 1.9;
  background: var(--red-bg);
  border-radius: var(--r);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 20px;
}
.form-grid .wide {
  grid-column: 1/-1;
}
.settings-form {
  max-width: 1120px;
}
.form-section {
  padding: 24px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--white);
  box-shadow: var(--shadow-sm);
}
.form-section h2 {
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 18px;
  color: var(--deep);
}
.settings-help {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.9;
  margin: 6px 0 16px;
}
.settings-status {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.working-days {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 14px 16px;
  margin: 0 0 16px;
}
.working-days legend {
  font-size: 13px;
  color: var(--ink-2);
  font-weight: 600;
  padding-inline: 6px;
}

/* reports */
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.metric {
  padding: 18px 20px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.metric::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--green);
  opacity: 0.8;
}
.metric label {
  display: block;
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 600;
}
.metric strong {
  display: block;
  font-size: 32px;
  font-weight: 600;
  color: var(--deep);
  margin: 6px 0 2px;
  line-height: 1.3;
}
.metric small {
  font-size: 12.5px;
  color: var(--muted);
}
.chart-panel {
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 22px;
  margin-bottom: 20px;
  background: var(--white);
  box-shadow: var(--shadow-sm);
}
.chart-panel h2 {
  font-size: 16px;
  margin: 0 0 20px;
  color: var(--deep);
}
.bars {
  display: flex;
  gap: 14px;
  align-items: flex-end;
  height: 180px;
  direction: ltr;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0;
}
.bar-col {
  flex: 1;
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: flex-end;
  height: 100%;
  gap: 6px;
  min-width: 0;
}
.bar-col b {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
}
.bar-col i {
  display: block;
  background: linear-gradient(180deg, #5a9b8c, var(--green));
  width: min(40px, 80%);
  border-radius: 6px 6px 0 0;
  min-height: 3px;
}
.bar-col small {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  margin-bottom: -26px;
  height: 20px;
}
.chart-panel .bars {
  margin-bottom: 30px;
}
.report-note {
  font-size: 12.5px;
  line-height: 1.8;
  color: var(--muted);
  margin-top: 14px;
}
.table-wrap {
  overflow-x: auto;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table th {
  text-align: right;
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--soft);
}
.table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.table tr:last-child td {
  border-bottom: 0;
}
.table tbody tr:hover td {
  background: var(--soft);
}

/* ---------- login ---------- */
.login-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  background: var(--white);
}
.login-aside {
  background:
    radial-gradient(
      circle at 15% 85%,
      rgba(127, 196, 178, 0.22),
      transparent 45%
    ),
    radial-gradient(circle at 90% 10%, rgba(127, 196, 178, 0.12), transparent 40%),
    var(--sidebar);
  color: var(--sidebar-ink);
  padding: clamp(32px, 6vw, 72px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
}
.login-mark {
  width: 56px;
  height: auto;
  margin-bottom: 18px;
}
.login-aside h2 {
  font-size: clamp(26px, 3vw, 34px);
  color: var(--white);
  margin: 0;
  line-height: 1.4;
}
.login-aside p {
  font-size: 15.5px;
  line-height: 1.9;
  margin: 0 0 12px;
  max-width: 420px;
  color: #b5cbc5;
}
.login-aside ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.login-aside li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14.5px;
}
.login-aside li .icon {
  width: 36px;
  height: 36px;
  padding: 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.07);
  color: #a9e0d1;
}
.login-card {
  align-self: center;
  justify-self: center;
  width: 400px;
  max-width: calc(100% - 32px);
  padding: 40px 0;
}
.login-card .logo {
  width: 150px;
  margin-bottom: 36px;
  display: block;
}
.login-card h1 {
  font-size: 28px;
  color: var(--deep);
  margin: 0 0 6px;
  line-height: 1.4;
}
.login-card > p {
  font-size: 14.5px;
  color: var(--muted);
  line-height: 1.9;
  margin: 0 0 28px;
}
.login-card input {
  min-height: 46px;
}
.login-card .btn {
  width: 100%;
  margin-top: 8px;
  min-height: 48px;
  font-size: 15px;
}
.login-error {
  font-size: 13.5px;
  color: var(--red);
  line-height: 1.8;
}
.login-error:not(:empty) {
  margin: 4px 0 8px;
  padding: 8px 12px;
  background: var(--red-bg);
  border-radius: var(--r-sm);
}
.login-card > .connection-note {
  margin: 18px 0 0;
}
.connection-note {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.9;
  margin-top: 18px;
  text-align: center;
}

/* ---------- overlays ---------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 24px;
  right: 24px;
  max-width: 480px;
  margin: auto;
  z-index: 1000;
  background: var(--deep);
  color: var(--white);
  border-radius: var(--r);
  padding: 12px 18px;
  font-size: 14px;
  line-height: 1.8;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.25s var(--ease);
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}
dialog {
  border: 0;
  border-radius: var(--r-lg);
  max-width: calc(100% - 32px);
  width: 520px;
  padding: 26px;
  color: var(--ink);
  background: var(--white);
  box-shadow: var(--shadow-lg);
  font-family: Hakan, Tahoma, sans-serif;
}
dialog::backdrop {
  background: rgba(27, 48, 44, 0.42);
}
.dialog-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.dialog-top h2 {
  font-size: 19px;
  margin: 0;
  color: var(--deep);
}
.dialog-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-start;
  margin-top: 22px;
}
.dialog-error {
  font-size: 13.5px;
  color: var(--red);
  line-height: 1.8;
}
.text-link {
  color: var(--green-strong);
  text-decoration: none;
  font-size: 13.5px;
}
.text-link:hover {
  text-decoration: underline;
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

/* ---------- responsive ---------- */
@media (max-width: 1360px) {
  .conversation-list {
    width: 310px;
  }
  .details-side {
    display: none;
  }
  .details-side.show {
    display: block;
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 300px;
    z-index: 4;
    box-shadow: 12px 0 40px rgba(27, 48, 44, 0.14);
  }
  .details-toggle {
    display: inline-flex;
  }
}
@media (max-width: 1100px) {
  .workspace {
    grid-template-columns: 76px minmax(0, 1fr);
  }
  .sidebar {
    padding: 16px 10px 12px;
    align-items: stretch;
  }
  .brand-group {
    padding: 2px 0 16px;
    align-items: center;
  }
  .sidebar .logo {
    width: 40px;
    height: 26px;
    object-fit: cover;
    object-position: right;
  }
  .product-name,
  .sidebar-label,
  .nav-label,
  .profile-copy {
    display: none;
  }
  .nav-btn {
    justify-content: center;
    padding: 10px;
  }
  .nav-btn .count {
    position: absolute;
    top: 3px;
    left: 5px;
    min-width: 18px;
    height: 18px;
    font-size: 10.5px;
    padding: 0 4px;
  }
  .profile {
    flex-direction: column;
    padding: 4px 0 0;
  }
  .conversation-list {
    width: 290px;
  }
  .chat-log {
    padding-inline: 18px;
  }
  .composer-box {
    margin-inline: 14px;
  }
  .detail-header,
  .context-bar {
    padding-inline: 16px;
  }
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .login-wrap {
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr);
  }
}
@media (max-width: 760px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
  }
  .main-column {
    grid-row: 1;
  }
  .topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: var(--white);
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
    min-height: 56px;
  }
  .topbar .logo {
    width: 118px;
    height: auto;
  }
  .topbar .profile {
    padding: 0;
    gap: 6px;
    flex-direction: row;
  }
  .topbar .profile-copy {
    display: none;
  }
  .topbar .avatar {
    width: 34px;
    height: 34px;
    font-size: 14px;
  }
  /* sidebar becomes the bottom tab bar */
  .sidebar {
    grid-row: 2;
    flex-direction: row;
    padding: 4px 6px calc(4px + env(safe-area-inset-bottom));
    overflow-x: auto;
    overflow-y: hidden;
    border-top: 1px solid var(--sidebar-line);
  }
  .brand-group,
  .sidebar-label,
  .sidebar-bottom {
    display: none;
  }
  .nav-list {
    flex-direction: row;
    flex: 1;
    gap: 0;
  }
  .nav-btn {
    flex: 1 1 0;
    min-width: 0;
    flex-direction: column;
    gap: 3px;
    padding: 6px 2px;
    min-height: 54px;
    font-size: 10px;
    border-radius: 10px;
  }
  .nav-btn > .nav-short {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 400;
  }
  .nav-btn.active {
    background: rgba(255, 255, 255, 0.1);
  }
  .nav-btn .count {
    top: 2px;
    left: calc(50% - 22px);
  }
  .demo-strip {
    font-size: 11.5px;
    padding: 6px 14px;
    line-height: 1.7;
  }
  .conversation-list {
    width: 100%;
    border-left: 0;
  }
  .conversation-detail {
    display: none;
  }
  .inbox.has-selection .conversation-list {
    display: none;
  }
  .inbox.has-selection .conversation-detail {
    display: flex;
  }
  .back-list {
    display: inline-flex;
  }
  .detail-header {
    min-height: 62px;
    padding: 8px 10px;
    gap: 6px;
  }
  .detail-person {
    gap: 6px;
  }
  .detail-person .conv-avatar {
    display: none;
  }
  .detail-person h2 {
    font-size: 15px;
    max-width: 44vw;
  }
  .detail-person p {
    font-size: 11.5px;
  }
  .detail-actions {
    gap: 4px;
  }
  .detail-actions .btn:not(.details-toggle) {
    display: none;
  }
  .status-select {
    max-width: 104px;
    font-size: 13px;
    padding: 6px 8px;
  }
  .context-bar {
    padding: 7px 12px;
    font-size: 12px;
    gap: 6px;
  }
  .context-bar a {
    max-width: 150px;
  }
  .chat-log {
    padding: 16px 12px 8px;
  }
  .message-bubble {
    max-width: 90%;
    font-size: 14.5px;
  }
  .composer-box {
    margin: 4px 8px 8px;
    border-radius: var(--r);
  }
  .compose-input {
    font-size: 16px;
    height: 76px;
  }
  .composer-tabs .ai-button {
    font-size: 12px;
    padding: 4px 9px;
  }
  .compose-helper {
    display: none;
  }
  .compose-footer select {
    max-width: 130px;
  }
  .details-side.show {
    width: 100%;
    box-shadow: none;
  }
  .content-page {
    padding: 20px 14px 32px;
  }
  .page-heading {
    align-items: flex-start;
    margin-bottom: 18px;
  }
  .page-heading h1 {
    font-size: 22px;
  }
  .record {
    padding: 14px;
    gap: 8px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .form-grid .wide {
    grid-column: auto;
  }
  .form-section {
    padding: 18px 16px;
  }
  .metrics {
    gap: 10px;
  }
  .metric {
    padding: 14px;
  }
  .metric strong {
    font-size: 26px;
  }
  .chart-panel {
    padding: 16px;
  }
  .bars {
    gap: 6px;
  }
  .bar-col small {
    font-size: 10.5px;
  }
  input,
  textarea,
  select {
    font-size: 16px;
  }
  .table {
    font-size: 13px;
  }
  .table td,
  .table th {
    padding: 11px 10px;
  }
  dialog {
    padding: 20px;
  }
  .login-wrap {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto 1fr;
  }
  .login-aside {
    padding: 28px 20px 24px;
    gap: 8px;
  }
  .login-aside ul,
  .login-aside p {
    display: none;
  }
  .login-mark {
    width: 40px;
    margin-bottom: 6px;
  }
  .login-aside h2 {
    font-size: 22px;
  }
  .login-card {
    align-self: start;
    padding: 28px 0;
  }
  .login-card .logo {
    margin-bottom: 24px;
  }
}
