:root {
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --bg: #f4f5f7;
  --card-bg: #ffffff;
  --border: #e2e4e9;
  --text: #1a1d23;
  --text-muted: #6b7280;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
}

* {
  box-sizing: border-box;
}

/* Author `display` rules below (flex on views/modal) win the cascade over the
   UA default `[hidden] { display: none }`, since specificity ties resolve in
   favor of author styles. Re-assert it globally so toggling `hidden` always
   hides the element, regardless of what else targets it. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

.view {
  min-height: 100vh;
  padding: 32px 24px 64px;
  max-width: 760px;
  margin: 0 auto;
}

#login-view {
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
}

.brand-subtitle {
  color: var(--text-muted);
  margin: 4px 0 24px;
}

.login-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
}

label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin: 12px 0 6px;
}

input,
textarea,
select {
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg);
  color: var(--text);
  width: 100%;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

textarea {
  resize: vertical;
  font-family: inherit;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  margin-top: 18px;
}

.btn-primary:hover {
  background: var(--accent-dark);
}

.btn-text {
  background: none;
  border: none;
  color: var(--text-muted);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 8px;
}

.btn-text:hover {
  color: var(--text);
}

.btn-icon {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 40px;
  height: 40px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
}

.btn-icon:hover {
  background: var(--bg);
  color: var(--text);
}

.form-error {
  background: var(--danger-bg);
  color: var(--danger);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  margin: 12px 0 0;
}

.empty-state {
  color: var(--text-muted);
  text-align: center;
  padding: 48px 0;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

#search-input {
  flex: 1;
}

.menu-wrapper {
  position: relative;
  flex-shrink: 0;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-width: 160px;
  padding: 6px;
  z-index: 10;
}

.dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 8px 10px;
  border-radius: 6px;
  font: inherit;
  color: var(--text);
  cursor: pointer;
}

.dropdown-item:hover {
  background: var(--bg);
}

.ticket-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ticket-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
}

.ticket-card:hover {
  border-color: var(--accent);
}

.ticket-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.ticket-card-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.ticket-title {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ticket-meta {
  font-size: 13px;
  color: var(--text-muted);
}

.ticket-badges {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.badge {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.badge-priority-low {
  background: #eef2ff;
  color: #4338ca;
}

.badge-priority-medium {
  background: #fef3c7;
  color: #92400e;
}

.badge-priority-high {
  background: #fee2e2;
  color: #b91c1c;
}

.badge-status-open {
  background: #dcfce7;
  color: #166534;
}

.badge-status-closed {
  background: #f1f2f4;
  color: var(--text-muted);
}

.detail-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}

.detail-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.detail-heading h2 {
  margin: 0;
  font-size: 20px;
}

.detail-badges {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.detail-description {
  color: var(--text);
  margin: 16px 0 28px;
  white-space: pre-wrap;
}

.comment-list {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.comment-item {
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.comment-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.comment-author {
  font-weight: 600;
  color: var(--text);
}

.comment-body {
  margin: 0;
  white-space: pre-wrap;
}

.comment-form {
  display: flex;
  flex-direction: column;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 18, 24, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
}

.modal-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  width: 100%;
  max-width: 440px;
}

.modal-card h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

.modal-actions .btn-primary {
  margin-top: 0;
}
