:root {
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: var(--text);
  background: var(--canvas);
  font-size: 14px;
  line-height: 1.45;
  color-scheme: light;
  --text: #242925;
  --canvas: #f6f7f5;
  --surface: #ffffff;
  --subtle: #f0f2ef;
  --hover: #e9ede8;
  --border: #dfe4de;
  --muted: #697269;
  --accent: #32644d;
  --accent-soft: #e5eee7;
  --radius: 6px;
  --radius-panel: 10px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
textarea,
select {
  font: inherit;
}
button {
  cursor: pointer;
  transition: background 0.12s;
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
textarea {
  outline: none;
}
input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
}
[hidden] {
  display: none !important;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1 {
  font-size: 24px;
  letter-spacing: -0.4px;
  font-weight: 600;
}
h2 {
  font-size: 18px;
  font-weight: 600;
}
h3 {
  font-size: 15px;
}
p {
  line-height: 1.6;
}
.muted,
.hint {
  color: var(--muted);
}
.small {
  font-size: 12px;
}
.primary {
  border: 0;
  background: var(--accent);
  color: white;
  border-radius: var(--radius);
  padding: 10px 16px;
  font-weight: 600;
}
.primary:hover:not(:disabled) {
  background: #254e3b;
}
.secondary {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius);
  padding: 8px 12px;
}
.secondary:hover:not(:disabled),
.quiet:hover:not(:disabled) {
  background: var(--hover);
}
.quiet {
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  padding: 8px;
}
.error {
  color: #b33841;
  font-size: 13px;
  margin: 12px 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.4px;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  background: #34483b;
  color: white;
  border-radius: var(--radius);
  font-size: 18px;
}
.login-screen {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: 390px;
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 32px;
  border-radius: var(--radius-panel);
}
.login-card .brand {
  margin-bottom: 32px;
}
.login-card h1 {
  font-size: 24px;
}
.login-card .primary {
  width: 100%;
}
.hint {
  font-size: 12px;
  text-align: center;
  margin: 24px 0 0;
}
label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin: 16px 0;
}
label input,
label select {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}
.workspace {
  display: flex;
  height: 100dvh;
  overflow: hidden;
}
.project-picker {
  margin: 8px 16px 0;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.03em;
}
.project-picker select {
  color: #242925;
  font-size: 14px;
  margin-top: 5px;
}
.management-dialog { width: min(780px, calc(100vw - 32px)); }
.project-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}
.project-row > div:first-child { flex: 1; min-width: 0; }
.project-row strong, .project-row .small { display: block; overflow-wrap: anywhere; }
.project-row .small { margin-top: 5px; }
.row-actions { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.identity-form { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.identity-form input { width: 160px; min-width: 0; border: 1px solid var(--border); border-radius: 5px; padding: 6px; }
.separated { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--border); }
fieldset { margin: 20px 0; padding: 4px 18px 12px; border: 1px solid var(--border); border-radius: 6px; }
legend { font-weight: 600; padding: 0 6px; }
.checkbox-label { display: flex; flex-direction: row-reverse; align-items: center; justify-content: flex-end; gap: 10px; }
.checkbox-label input { width: auto; margin: 0; accent-color: var(--accent); }
@media (max-width: 600px) {
  .project-row { align-items: flex-start; flex-direction: column; }
  .row-actions { justify-content: flex-start; }
}
.sidebar {
  width: 320px;
  min-width: 280px;
  background: var(--canvas);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}
.sidebar-head {
  min-height: 64px;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.list-controls {
  padding: 12px 16px 0;
}
input[type="search"] {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.tabs {
  display: flex;
  gap: 4px;
  margin: 16px 0 12px;
  background: var(--subtle);
  border-radius: var(--radius);
  padding: 3px;
}
.tabs button {
  flex: 1;
  background: transparent;
  border: 0;
  border-radius: 4px;
  padding: 8px;
  color: var(--muted);
  font-weight: 500;
}
.tabs .selected {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px #24292514;
}
.ticket-list {
  flex: 1;
  overflow: auto;
  padding: 0 8px;
}
.ticket {
  display: block;
  border: 0;
  background: none;
  width: 100%;
  padding: 12px;
  text-align: left;
  border-radius: var(--radius);
  margin-bottom: 2px;
  color: inherit;
}
.ticket:hover {
  background: var(--hover);
}
.ticket.selected {
  background: var(--accent-soft);
  box-shadow: inset 2px 0 var(--accent);
}
.ticket-top {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ticket-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.ticket-time {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.ticket-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}
.ticket-preview span:first-child {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.count {
  font-size: 12px;
  background: var(--accent);
  color: white;
  border-radius: 10px;
  padding: 2px 6px;
}
.sidebar-foot {
  padding: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 4px;
  align-items: center;
}
.sidebar-foot > div {
  flex: 1;
  overflow: hidden;
  padding-left: 6px;
}
.sidebar-foot strong,
.sidebar-foot span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-foot strong {
  font-size: 13px;
  margin-bottom: 4px;
}
.conversation {
  flex: 1;
  min-width: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
}
.empty {
  margin: auto;
  text-align: center;
  color: var(--muted);
  padding: 24px;
}
.empty h1 {
  color: #424b42;
  font-size: 20px;
}
.empty-icon {
  display: block;
  font-size: 32px;
  color: #9caec6;
  margin-bottom: 22px;
}
.dialogue {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}
.dialogue-head {
  min-height: 64px;
  flex-shrink: 0;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}
.customer-title {
  border: 0;
  background: none;
  text-align: left;
  flex: 1;
  min-width: 0;
  color: inherit;
}
.customer-title strong {
  display: block;
  font-size: 16px;
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pill {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: var(--radius);
  background: var(--subtle);
  color: var(--muted);
}
#back {
  display: none;
}
.messages {
  flex: 1;
  overflow: auto;
  padding: 24px 32px;
  background: var(--canvas);
  scrollbar-gutter: stable;
}
.older {
  display: block;
  margin: 0 auto 24px;
}
#message-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.message {
  max-width: min(80%, 72ch);
  align-self: flex-start;
}
.message.outgoing {
  align-self: flex-end;
}
.message-meta {
  display: flex;
  gap: 8px;
  margin: 0 4px 4px;
  font-size: 12px;
  color: var(--muted);
}
.outgoing .message-meta {
  justify-content: flex-end;
}
.bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 12px 16px;
  border-radius: 3px var(--radius-panel) var(--radius-panel);
  font-size: 15px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.outgoing .bubble {
  background: #edf3ee;
  border-color: #dce6dd;
  border-radius: var(--radius-panel) 3px var(--radius-panel) var(--radius-panel);
}
.message.internal .bubble {
  background: #fff8e4;
}
.bubble img,
.bubble video {
  display: block;
  max-width: 100%;
  max-height: 340px;
  border-radius: var(--radius);
  margin-bottom: 8px;
}
.bubble a {
  color: var(--accent);
}
.message-error {
  font-size: 12px;
  color: #b33841;
  margin-top: 5px;
}
.composer-area {
  padding: 16px 24px 12px;
  border-top: 1px solid var(--border);
  position: relative;
  background: var(--surface);
}
.composer {
  display: flex;
  align-items: flex-end;
  padding: 4px;
  border: 1px solid #c4cdc4;
  border-radius: var(--radius-panel);
  gap: 8px;
}
.composer:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
textarea {
  resize: none;
  max-height: 160px;
  min-height: 40px;
  min-width: 0;
  flex: 1;
  padding: 10px 2px;
  border: 0;
  line-height: 1.5;
  font-size: 15px;
  background: none;
  color: inherit;
}
textarea::placeholder {
  color: var(--muted);
  opacity: 1;
  white-space: nowrap;
}
.icon-button {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border: 0;
  background: none;
  color: var(--muted);
  border-radius: var(--radius);
  padding: 8px;
}
.icon-button:hover:not(:disabled) {
  background: var(--hover);
}
.icon-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.send {
  height: 40px;
  flex-shrink: 0;
  padding: 10px 16px;
}
.send span {
  margin-left: 8px;
}
.composer-hint {
  display: flex;
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
}
.attachment {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--subtle);
  border-radius: var(--radius);
  padding: 2px 10px;
  margin-bottom: 8px;
  font-size: 12px;
}
.reply-options {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  box-shadow: 0 8px 24px #24292514;
  max-height: 280px;
  overflow: auto;
  padding: 6px;
  z-index: 3;
}
.reply-option {
  display: block;
  width: 100%;
  border: 0;
  border-radius: var(--radius);
  padding: 12px;
  text-align: left;
  background: var(--surface);
  white-space: pre-wrap;
  color: inherit;
  line-height: 1.5;
}
.reply-option:hover,
.reply-option.selected {
  background: var(--accent-soft);
}
.notice {
  background: #fff5e7;
  border-bottom: 1px solid #f0dfc3;
  padding: 10px 20px;
  font-size: 13px;
  line-height: 1.5;
  color: #85612f;
}
.customer-card {
  width: 290px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  padding: 24px;
  overflow: auto;
}
.customer-card header,
dialog header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.customer-card dt {
  color: var(--muted);
  font-size: 12px;
  margin: 24px 0 7px;
}
.customer-card dd {
  margin: 0;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  padding: 24px;
  width: 660px;
  max-width: 95vw;
  max-height: 90dvh;
  color: inherit;
}
dialog::backdrop {
  background: #24292555;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}
.account-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
}
.account-row > div {
  flex: 1;
}
.account-row span {
  display: block;
  margin-top: 5px;
}
#account-form {
  margin-top: 30px;
}
.list-empty {
  padding: 30px 16px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}
@media (max-width: 1000px) {
  .customer-card {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    box-shadow: -8px 0 24px #24292510;
    z-index: 5;
  }
  .sidebar {
    width: 280px;
  }
  .dialogue-head {
    padding: 12px 16px;
  }
  .composer-area {
    padding: 12px 16px;
  }
  .reply-options {
    left: 16px;
    right: 16px;
  }
  .messages {
    padding: 20px;
  }
  .message {
    max-width: 90%;
  }
}
@media (max-width: 650px) {
  .sidebar {
    width: 100%;
    min-width: 0;
  }
  .conversation {
    display: none;
  }
  .workspace.open-chat .sidebar {
    display: none;
  }
  .workspace.open-chat .conversation {
    display: flex;
  }
  #back {
    display: block;
  }
  .dialogue-head {
    min-height: 64px;
    padding: 12px;
  }
  .message {
    max-width: 95%;
  }
  .send {
    font-size: 0;
    padding: 8px 14px;
  }
  .send span {
    font-size: 20px;
    margin: 0;
  }
  .composer-hint {
    display: none;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .customer-card {
    width: min(320px, 95vw);
  }
}
