@font-face {
  font-family: "Nunito Sans";
  font-style: normal;
  font-weight: 200 1000;
  src: url("./assets/fonts/NunitoSans-Variable.ttf") format("truetype");
}

@font-face {
  font-family: "Nunito Sans";
  font-style: italic;
  font-weight: 200 1000;
  src: url("./assets/fonts/NunitoSans-Italic-Variable.ttf") format("truetype");
}

:root {
  --white: #fff;
  --black: #000;
  --page: #f7f7f7;
  --surface: #fff;
  --surface-muted: #fbfbfb;
  --surface-soft: #f0f1f2;
  --field: #f7f7f7;
  --divider: #e8ebed;
  --text: #404142;
  --text-dark: #162419;
  --text-slate: #242d35;
  --muted: #a6aaad;
  --disabled: #babfc2;
  --grey-400: #d2d7db;
  --grey-600: #898c8f;
  --grey-700: #626466;
  --primary: #4597f7;
  --primary-dark: #2878d6;
  --primary-light: #edf6ff;
  --primary-form: #67adff;
  --success: #6ad46a;
  --success-light: #f1fbf1;
  --error: #ff614c;
  --error-light: #ffe5e5;
  --warning: #ff8e55;
  --warning-light: #fff4e5;
  --purple: #be71f5;
  --purple-light: #eef2ff;
  --cyan: #6acbd4;
  --coral: #ff998c;
  --shadow: 0 1px 2px rgba(40, 53, 57, 0.05), 0 8px 24px rgba(40, 53, 57, 0.05);
  --shadow-hover: 0 2px 4px -1px rgba(0, 0, 0, 0.16), 0 4px 5px rgba(0, 0, 0, 0.1), 0 1px 10px rgba(0, 0, 0, 0.08);
  --radius: 8px;
  --radius-tabs: 10px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--page);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--text);
  background: var(--page);
  font-family: "Nunito Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

svg {
  display: block;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.app-shell {
  width: min(1088px, 100%);
  margin: 0 auto;
  padding: calc(18px + env(safe-area-inset-top)) 16px 92px;
}

.app-header {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 44px;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.brand-mark {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  border: 1px solid var(--divider);
  border-radius: 12px;
  background: var(--white);
  box-shadow: 0 1px 2px rgba(40, 53, 57, 0.05);
}

.brand-mark img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.brand-copy {
  min-width: 0;
}

.brand-copy h1,
.section-title h2,
.drawer-header h2 {
  margin: 0;
  color: var(--text);
  font-size: 24px;
  font-weight: 800;
  line-height: 32px;
}

.brand-copy p,
.section-title p,
.drawer-header p,
.text-field small,
.upload-zone small,
.ticket-description,
.ticket-footer,
.message-meta {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
}

.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 0;
  border-radius: var(--radius);
  color: var(--primary-dark);
  background: var(--primary-light);
  transition: background-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.icon-button:hover {
  background: #d8eaff;
  box-shadow: var(--shadow-hover);
}

.icon-button:focus-visible,
.primary-button:focus-visible,
.secondary-button:focus-visible,
.status-tab:focus-visible,
.category-option:focus-visible,
.ticket-open:focus-visible,
.upload-zone:focus-within,
.mini-upload:focus-within {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.icon-button:active,
.primary-button:active,
.status-tab:active,
.ticket-open:active {
  transform: translateY(1px);
}

.main-layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.compose-panel,
.tickets-panel,
.drawer-sheet {
  border: 1px solid var(--divider);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.compose-panel,
.tickets-panel {
  padding: 18px;
}

.section-title {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title.compact {
  margin-bottom: 12px;
}

.section-title h2,
.drawer-header h2 {
  font-size: 18px;
  line-height: 28px;
}

.ticket-form {
  display: grid;
  gap: 14px;
}

.category-field {
  display: grid;
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.category-field legend,
.text-field > span {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  line-height: 20px;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.category-option {
  min-height: 46px;
  border: 1px solid var(--divider);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--white);
  font-size: 14px;
  font-weight: 800;
  line-height: 20px;
  transition: background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, color 0.18s ease;
}

.category-option:hover {
  border-color: var(--primary-form);
  color: var(--primary-dark);
  background: var(--primary-light);
}

.category-option.active {
  border-color: var(--primary);
  color: var(--white);
  background: var(--primary);
  box-shadow: 0 6px 14px rgba(69, 151, 247, 0.18);
}

.text-field {
  display: block;
  min-width: 0;
}

.text-field textarea {
  width: 100%;
  resize: vertical;
  min-height: 116px;
  border: 2px solid transparent;
  border-radius: var(--radius);
  outline: none;
  color: var(--text);
  background: var(--field);
  padding: 12px 16px;
  font-size: 16px;
  font-weight: 600;
  line-height: 24px;
  transition: border-color 0.18s ease, background-color 0.18s ease;
}

.text-field textarea:focus {
  border-color: var(--primary);
}

.text-field textarea::placeholder {
  color: var(--muted);
  font-weight: 600;
}

.text-field small {
  display: block;
  margin-top: 6px;
  text-align: right;
}

.upload-zone,
.mini-upload {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px dashed var(--grey-400);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--white);
  padding: 12px;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.upload-zone:hover,
.mini-upload:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
  background: var(--primary-light);
}

.upload-zone input,
.mini-upload input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-icon {
  display: grid;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: var(--radius);
  color: var(--primary-dark);
  background: var(--primary-light);
}

.upload-zone strong {
  display: block;
  font-size: 14px;
  font-weight: 800;
  line-height: 20px;
}

.file-list {
  display: grid;
  gap: 6px;
}

.file-pill {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 34px;
  padding: 7px 10px;
  border-radius: var(--radius);
  color: var(--text);
  background: var(--field);
  font-size: 13px;
  font-weight: 700;
}

.file-pill span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-pill button {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: var(--primary-dark);
  background: transparent;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  gap: 8px;
  border: 0;
  border-radius: var(--radius);
  color: var(--white);
  background: var(--primary);
  padding: 12px 16px;
  font-size: 16px;
  font-weight: 700;
  line-height: 24px;
  box-shadow: none;
  transition: background-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.primary-button:hover {
  background: var(--primary-dark);
  box-shadow: var(--shadow-hover);
}

.primary-button:disabled {
  cursor: not-allowed;
  color: var(--white);
  background: var(--disabled);
  box-shadow: none;
}

.status-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  min-height: 46px;
  margin-bottom: 14px;
  border-radius: var(--radius-tabs);
  background: var(--surface-soft);
  padding: 4px;
}

.status-tab {
  min-width: 0;
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  padding: 8px;
  font-size: 14px;
  font-weight: 800;
  line-height: 20px;
  transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.status-tab:hover {
  color: var(--primary-dark);
}

.status-tab.active {
  color: var(--primary);
  background: var(--white);
  box-shadow: 0 1px 2px rgba(40, 53, 57, 0.06);
}

.ticket-list {
  display: grid;
  gap: 10px;
}

.ticket-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--divider);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.ticket-card:hover {
  border-color: var(--grey-400);
  box-shadow: 0 8px 20px rgba(40, 53, 57, 0.06);
}

.ticket-open {
  display: grid;
  width: 100%;
  gap: 8px;
  min-width: 0;
  border: 0;
  color: inherit;
  background: transparent;
  padding: 0;
  text-align: left;
}

.ticket-topline,
.ticket-footer {
  display: flex;
  min-width: 0;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.ticket-id {
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 900;
  line-height: 16px;
}

.ticket-status,
.ticket-category,
.ticket-assignee {
  min-width: 0;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 800;
  line-height: 16px;
  white-space: nowrap;
}

.ticket-status {
  color: var(--primary-dark);
  background: var(--primary-light);
}

.ticket-status.new {
  color: var(--primary-dark);
  background: var(--primary-light);
}

.ticket-status.in_progress {
  color: var(--primary-dark);
  background: #d8eaff;
}

.ticket-status.waiting_reporter {
  color: #f79256;
  background: var(--warning-light);
}

.ticket-status.resolved {
  color: #57b657;
  background: var(--success-light);
}

.ticket-status.closed {
  color: var(--muted);
  background: var(--field);
}

.ticket-status.triaged {
  color: var(--purple);
  background: var(--purple-light);
}

.ticket-title {
  overflow: hidden;
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
  line-height: 22px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ticket-description {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.ticket-category {
  color: var(--grey-700);
  background: var(--field);
}

.ticket-assignee {
  flex: 1 1 auto;
  overflow: hidden;
  max-width: min(70%, 340px);
  margin-left: auto;
  color: var(--muted);
  background: transparent;
  padding-right: 0;
  text-align: right;
  text-overflow: ellipsis;
}

.ticket-actions {
  display: flex;
  gap: 8px;
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--primary-dark);
  background: var(--primary-light);
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 700;
  line-height: 20px;
  transition: background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.secondary-button:hover {
  border-color: var(--primary);
  background: var(--white);
  box-shadow: var(--shadow-hover);
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 180px;
  border: 1px dashed var(--grey-400);
  border-radius: var(--radius);
  color: var(--muted);
  background: var(--field);
  padding: 24px;
  text-align: center;
  font-weight: 700;
}

.ticket-drawer {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
}

.ticket-drawer.open {
  display: block;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(22, 36, 25, 0.22);
}

.drawer-sheet {
  position: absolute;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  width: min(460px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: hidden;
}

.drawer-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--divider);
  padding: 16px;
}

.drawer-content {
  display: grid;
  gap: 14px;
  max-height: calc(100vh - 124px);
  overflow: auto;
  padding: 16px;
}

.drawer-ticket {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--field);
}

.message-list {
  display: grid;
  gap: 10px;
}

.message-item {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--divider);
  background: var(--white);
}

.message-item.developer {
  border-left: 3px solid var(--primary);
}

.message-item.reporter {
  border-left: 3px solid var(--cyan);
}

.message-body {
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  line-height: 20px;
  white-space: pre-wrap;
}

.reply-form {
  display: grid;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--divider);
}

.reply-form.hidden {
  display: none;
}

.mini-upload {
  min-height: 40px;
  border-style: solid;
  padding: 8px 10px;
  color: var(--primary-dark);
  background: var(--primary-light);
  font-size: 14px;
  font-weight: 700;
}

.compact-files {
  gap: 4px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(76px + env(safe-area-inset-bottom));
  z-index: 30;
  display: none;
  width: min(420px, calc(100vw - 32px));
  transform: translateX(-50%);
  border-radius: var(--radius);
  color: var(--white);
  background: #25292a;
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 800;
  line-height: 20px;
  box-shadow: var(--shadow);
}

.toast.show {
  display: block;
}

.bottom-bar {
  position: fixed;
  left: 50%;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 10;
  display: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: min(360px, calc(100vw - 32px));
  transform: translateX(-50%);
  border: 1px solid var(--divider);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 6px;
}

.bottom-bar a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  border-radius: var(--radius);
  color: var(--primary-dark);
  text-decoration: none;
  font-size: 14px;
  font-weight: 800;
}

.bottom-bar a:first-child {
  background: var(--primary-light);
}

@media (max-width: 820px) {
  .app-shell {
    padding-right: 12px;
    padding-left: 12px;
  }

  .main-layout {
    grid-template-columns: 1fr;
  }

  .compose-panel,
  .tickets-panel {
    padding: 16px;
  }

  .bottom-bar {
    display: none;
  }
}

@media (max-width: 430px) {
  .app-header {
    grid-template-columns: 48px minmax(0, 1fr) 40px;
  }

  .brand-mark {
    width: 48px;
    height: 48px;
  }

  .brand-mark img {
    width: 36px;
    height: 36px;
  }

  .brand-copy h1 {
    font-size: 22px;
    line-height: 28px;
  }

  .status-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .status-tab {
    font-size: 13px;
  }

  .ticket-topline {
    align-items: flex-start;
  }

  .ticket-status {
    max-width: 48%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .ticket-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .ticket-assignee {
    flex: 0 1 auto;
    max-width: 100%;
    margin-left: 0;
    padding-left: 0;
    text-align: left;
  }

  .drawer-sheet {
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 92vh;
    border-bottom-right-radius: 0;
    border-bottom-left-radius: 0;
  }
}
