@import url("https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300..700;1,9..40,300..700&family=DM+Mono:wght@400;500&display=swap");

:root {
  --brand: #a6be38;
  --brand-dark: #8da02e;
  --brand-subtle: #eef3d6;
  --bg: #f5f4f0;
  --bg-warm: #eceae4;
  --surface: #fff;
  --surface-raised: #fff;
  --text: #2a2a28;
  --text-secondary: #74736e;
  --text-tertiary: #a09f9a;
  --border: #dfddd8;
  --border-light: #eceae6;
  --radius: 8px;
  --radius-sm: 5px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
  --font: "DM Sans", system-ui, sans-serif;
  --mono: "DM Mono", "SF Mono", monospace;
  --blue: #2563eb;
  --amber: #d97706;
  --red: #dc2626;
  --transition: 0.15s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ═══════ HEADER ═══════ */

header {
  background: var(--text);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
  position: sticky;
  top: 0;
  z-index: 100;
}

header h1 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--brand);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

nav a {
  text-decoration: none;
  color: #a09f9a;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  transition:
    color var(--transition),
    background var(--transition);
}

nav a:hover {
  color: #e0dfda;
}

nav a.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

main {
  max-width: 1000px;
  margin: 1.5rem auto;
  padding: 0 1.25rem;
}

/* ═══════ BUTTONS ═══════ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.45rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 550;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.4;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand-dark);
  box-shadow: var(--shadow-sm);
}

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

.btn-small {
  padding: 0.3rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
}

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

#logout-btn {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.15);
  color: #a09f9a;
  box-shadow: none;
}

#logout-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #e0dfda;
}

/* ═══════ FORMS ═══════ */

.login-container {
  max-width: 340px;
  margin: 12vh auto 0;
  padding: 2rem;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}

.login-container h1 {
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 1.75rem;
  color: var(--brand-dark);
  text-align: center;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.form-group {
  margin-bottom: 0.85rem;
  flex: 1;
}

.form-group label {
  display: block;
  font-size: 0.75rem;
  font-weight: 550;
  margin-bottom: 0.3rem;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-family: var(--font);
  background: var(--surface);
  color: var(--text);
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 2px var(--brand-subtle);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-tertiary);
}

.form-group textarea {
  resize: vertical;
  line-height: 1.55;
}

.form-row {
  display: flex;
  gap: 0.85rem;
}

.form-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1rem;
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.form-actions .btn-primary {
  width: auto;
}

.error {
  color: var(--red);
  font-size: 0.8rem;
  margin-top: 0.5rem;
}

.field-hint {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  margin-bottom: 0.5rem;
  line-height: 1.5;
}

.save-status {
  font-size: 0.8rem;
  color: var(--brand-dark);
  font-family: var(--mono);
}

/* Loader */
.loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 0;
  gap: 1.25rem;
}

.loader-blocks {
  display: flex;
  gap: 5px;
  align-items: flex-end;
  height: 40px;
}

.loader-block {
  width: 8px;
  background: var(--brand);
  border-radius: 2px;
  animation: buildUp 1.2s ease-in-out infinite;
}

.loader-block:nth-child(1) {
  height: 12px;
  animation-delay: 0s;
}
.loader-block:nth-child(2) {
  height: 20px;
  animation-delay: 0.1s;
}
.loader-block:nth-child(3) {
  height: 28px;
  animation-delay: 0.2s;
}
.loader-block:nth-child(4) {
  height: 20px;
  animation-delay: 0.3s;
}
.loader-block:nth-child(5) {
  height: 12px;
  animation-delay: 0.4s;
}

@keyframes buildUp {
  0%,
  100% {
    transform: scaleY(1);
    opacity: 0.4;
  }
  40% {
    transform: scaleY(1.8);
    opacity: 1;
  }
  60% {
    transform: scaleY(1.8);
    opacity: 1;
  }
}

.loader-text {
  font-size: 0.75rem;
  font-family: var(--mono);
  color: var(--text-tertiary);
  letter-spacing: 0.03em;
}

.empty-state {
  color: var(--text-tertiary);
  font-size: 0.85rem;
  padding: 2rem 0;
  text-align: center;
}

/* ═══════ TOOLBAR ═══════ */

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: 1rem;
}

.filters {
  display: flex;
  gap: 0.4rem;
}

.filters input[type="search"] {
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-family: var(--font);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  width: 200px;
}

.filters input[type="search"]:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 2px var(--brand-subtle);
}

.filters select {
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-family: var(--font);
  background: var(--surface);
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

.filters select:focus {
  outline: none;
  border-color: var(--brand);
}

.page-header {
  margin-bottom: 1rem;
}

.page-header h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

/* ═══════ INQUIRY CARDS ═══════ */

.inquiry-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
  box-shadow: var(--shadow-sm);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  align-items: start;
}

.inquiry-card:hover {
  border-color: var(--brand);
  box-shadow: var(--shadow);
}

.inquiry-card-body {
  min-width: 0;
}

.inquiry-card-meta {
  text-align: right;
  flex-shrink: 0;
}

.inquiry-header {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.3rem;
  flex-wrap: wrap;
}

.inquiry-channel,
.inquiry-status,
.inquiry-priority {
  font-family: var(--mono);
  font-size: 0.65rem;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  text-transform: uppercase;
  font-weight: 500;
  letter-spacing: 0.03em;
  line-height: 1.5;
}

.inquiry-channel {
  background: var(--bg-warm);
  color: var(--text-secondary);
}

.inquiry-status {
  background: var(--bg-warm);
}

.inquiry-priority {
  background: var(--bg-warm);
  color: var(--text-secondary);
}

.status-new {
  color: var(--blue);
  background: #eff5ff;
}

.status-in_progress {
  color: var(--amber);
  background: #fef9ee;
}

.status-responded {
  color: var(--brand-dark);
  background: var(--brand-subtle);
}

.status-closed {
  color: var(--text-tertiary);
  background: var(--bg-warm);
}

.status-spam {
  color: var(--red);
  background: #fef2f2;
}

.priority-urgent {
  color: var(--red) !important;
  background: #fef2f2 !important;
  font-weight: 600;
}

.priority-high {
  color: var(--amber) !important;
  background: #fef9ee !important;
}

.card-actions {
  display: flex;
  gap: 0.3rem;
  margin-top: 0.3rem;
}

.card-archive {
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-size: 0.65rem;
  font-family: var(--mono);
  cursor: pointer;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  opacity: 0;
  transition:
    opacity 0.15s,
    color 0.15s,
    background 0.15s;
}

.inquiry-card:hover .card-archive {
  opacity: 1;
}

.card-archive:hover {
  color: var(--text);
  background: var(--bg-warm);
}

.card-delete {
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-size: 0.7rem;
  font-family: var(--mono);
  cursor: pointer;
  padding: 0.15rem 0.35rem;
  border-radius: 3px;
  opacity: 0;
  transition:
    opacity 0.15s,
    color 0.15s,
    background 0.15s;
  margin-top: 0.3rem;
}

.inquiry-card:hover .card-delete {
  opacity: 1;
}

.card-delete:hover {
  color: var(--red);
  background: #fef2f2;
}

@keyframes yeet {
  0% {
    transform: scale(1) translateX(0) rotate(0deg);
    opacity: 1;
  }
  20% {
    transform: scale(1.02) translateX(-8px) rotate(-1deg);
    opacity: 1;
  }
  100% {
    transform: scale(0.8) translateX(120%) rotate(8deg);
    opacity: 0;
    max-height: 0;
    margin: 0;
    padding: 0;
    border-width: 0;
    overflow: hidden;
  }
}

/* Undo toast */
.undo-toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-family: var(--font);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  z-index: 300;
  animation: toastIn 0.3s ease;
}

.undo-btn {
  background: none;
  border: none;
  color: var(--brand);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.undo-btn:hover {
  color: #fff;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.undo-toast-fade {
  animation: toastOut 0.3s ease forwards;
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateX(-50%) translateY(10px);
  }
}

.card-deleting {
  animation: yeet 0.45s ease-in forwards;
  pointer-events: none;
}

.inquiry-card h3 {
  font-size: 0.88rem;
  font-weight: 550;
  margin-bottom: 0.15rem;
  letter-spacing: -0.01em;
  line-height: 1.35;
}

.inquiry-from {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.inquiry-date {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-tertiary);
  letter-spacing: 0.01em;
}

.inquiry-summary {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
  font-style: italic;
  line-height: 1.4;
}

.inquiry-assigned {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  margin-top: 0.2rem;
}

/* ═══════ DETAIL PAGE ═══════ */

.detail-top {
  margin-bottom: 1rem;
}

.back-link {
  color: var(--text-tertiary);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 500;
  transition: color var(--transition);
}

.back-link:hover {
  color: var(--brand-dark);
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 1rem;
  align-items: start;
}

.detail-subject h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
  letter-spacing: -0.015em;
  line-height: 1.3;
}

.detail-subject .inquiry-header {
  margin-bottom: 0.85rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 0.85rem;
  box-shadow: var(--shadow-sm);
}

.detail-sidebar .panel {
  margin-bottom: 0.5rem;
}

.detail-sidebar h3 {
  font-size: 0.65rem;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 0.3rem;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.detail-sidebar select {
  width: 100%;
  padding: 0.3rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-family: var(--font);
  background: var(--surface);
  color: var(--text);
}

.detail-sidebar select:focus {
  outline: none;
  border-color: var(--brand);
}

.detail-contact-bar {
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: baseline;
  color: var(--text-secondary);
}

.detail-contact-bar strong {
  font-weight: 600;
  color: var(--text);
}

.detail-text {
  font-family: var(--font);
  white-space: pre-wrap;
  word-wrap: break-word;
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text);
}

.detail-body {
  border-left: 3px solid var(--border);
}

/* ═══════ THREAD ═══════ */

.thread {
  margin-top: 1.25rem;
}

.thread h3 {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  margin-bottom: 0.5rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border-light);
}

.thread-item {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 0.65rem 0.85rem;
  margin-bottom: 0.4rem;
  box-shadow: var(--shadow-sm);
}

.thread-meta {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  margin-bottom: 0.2rem;
  font-family: var(--mono);
  display: flex;
  align-items: center;
}

.thread-meta strong {
  color: var(--text-secondary);
  font-weight: 500;
}

.note-item {
  border-left: 3px solid var(--brand);
  background: #fdfef8;
}

.response-item {
  border-left: 3px solid var(--blue);
  background: #fafbff;
}

.inbound-item {
  border-left: 3px solid var(--text-tertiary);
  background: var(--surface);
}

.response-options {
  margin-top: 0.4rem;
  margin-bottom: 0;
}

.response-options .form-group {
  margin-bottom: 0.3rem;
}

.response-options label {
  font-size: 0.7rem;
}

.msg-delete {
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-size: 0.7rem;
  font-family: var(--mono);
  cursor: pointer;
  padding: 0 0.3rem;
  border-radius: 3px;
  opacity: 0;
  transition:
    opacity 0.15s,
    color 0.15s,
    background 0.15s;
  margin-left: auto;
}

.thread-item:hover .msg-delete {
  opacity: 1;
}

.msg-delete:hover {
  color: var(--red);
  background: #fef2f2;
}

@keyframes poof {
  0% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
  30% {
    transform: scale(1.04) rotate(-1deg);
    opacity: 0.9;
  }
  60% {
    transform: scale(0.7) rotate(2deg);
    opacity: 0.4;
  }
  100% {
    transform: scale(0) rotate(-5deg);
    opacity: 0;
    max-height: 0;
    margin: 0;
    padding: 0;
    border-width: 0;
    overflow: hidden;
  }
}

.msg-deleting {
  animation: poof 0.4s ease-in forwards;
  pointer-events: none;
}

.thread-form {
  margin-top: 0.65rem;
}

.thread-form textarea {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-family: var(--font);
  resize: vertical;
  background: var(--surface);
  color: var(--text);
  line-height: 1.55;
}

.thread-form textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 2px var(--brand-subtle);
}

.thread-form select {
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-family: var(--font);
  background: var(--surface);
}

.thread-form .form-actions {
  margin-top: 0.4rem;
}

.thread-form .btn-primary {
  width: auto;
}

/* ═══════ CANNED RESPONSES ═══════ */

.canned-card {
  margin-bottom: 0.5rem;
}

.canned-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}

.canned-header h3 {
  font-size: 0.88rem;
  font-weight: 550;
}

.canned-meta {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.7rem;
}

.canned-category {
  background: var(--bg-warm);
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  text-transform: uppercase;
  font-weight: 600;
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
}

.canned-usage {
  color: var(--text-tertiary);
  font-family: var(--mono);
  font-size: 0.7rem;
}

.canned-preview {
  max-height: 5em;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 0.8rem;
  line-height: 1.5;
  position: relative;
}

.canned-preview::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2em;
  background: linear-gradient(transparent, var(--surface));
}

.canned-vars {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-tertiary);
  margin-top: 0.3rem;
}

/* ═══════ AI PANEL ═══════ */

.ai-panel {
  border-color: var(--brand);
  border-left: 3px solid var(--brand);
  background: #fcfdf7;
}

.ai-panel h3 {
  color: var(--brand-dark) !important;
}

.ai-btn {
  width: 100%;
  margin-bottom: 0.3rem;
  text-align: center;
  font-weight: 500;
  background: var(--surface);
  border-color: var(--border);
  color: var(--text-secondary);
  transition: all var(--transition);
}

.ai-btn:hover {
  border-color: var(--brand);
  color: var(--brand-dark);
  background: var(--brand-subtle);
}

.ai-btn:disabled {
  opacity: 0.45;
  cursor: wait;
}

#ai-status {
  font-size: 0.72rem;
  color: var(--brand-dark);
  font-style: italic;
  min-height: 1em;
  margin: 0.2rem 0 0.3rem;
  font-family: var(--mono);
}

.ai-result {
  margin-top: 0.4rem;
  padding-top: 0.4rem;
  border-top: 1px solid var(--border-light);
}

.ai-field {
  font-size: 0.75rem;
  margin-bottom: 0.15rem;
  line-height: 1.4;
  color: var(--text);
}

.ai-label {
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  font-size: 0.6rem;
  display: block;
  letter-spacing: 0.06em;
  font-family: var(--mono);
}

/* Draft composer */
.draft-composer {
  margin-top: 1rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  background: #fcfdf7;
  border-left: 3px solid var(--brand);
  overflow: hidden;
}

.draft-guidance {
  padding: 0.65rem 0.85rem;
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
}

.draft-guidance textarea {
  flex: 1;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-family: var(--font);
  resize: vertical;
  background: var(--surface);
  color: var(--text);
  line-height: 1.45;
}

.draft-guidance textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 2px var(--brand-subtle);
}

.draft-guidance .btn {
  flex-shrink: 0;
  align-self: flex-end;
}

#draft-status {
  font-size: 0.72rem;
  color: var(--brand-dark);
  font-family: var(--mono);
  font-style: italic;
  align-self: center;
  white-space: nowrap;
}

.ai-draft-section {
  padding: 0.65rem 0.85rem;
  border-top: 1px solid var(--border-light);
}

.draft-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--brand-dark);
  margin-bottom: 0.35rem;
  font-family: var(--mono);
}

.ai-draft-section .detail-text {
  color: var(--text-secondary);
  font-size: 0.84rem;
}

.ai-draft-section .form-actions {
  margin-top: 0.65rem;
}

/* Sidebar actions */
.sidebar-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.sidebar-action-btn {
  flex: 1;
  text-align: center;
}

.delete-action {
  color: var(--red);
  border-color: #fecaca;
}

.delete-action:hover {
  background: #fef2f2;
  border-color: var(--red);
}

/* Context add button */
.context-add-btn {
  background: none;
  border: 1px solid var(--brand);
  color: var(--brand-dark);
  font-size: 0.65rem;
  font-family: var(--mono);
  font-weight: 600;
  width: 1.2rem;
  height: 1.2rem;
  line-height: 1;
  border-radius: 50%;
  cursor: pointer;
  vertical-align: middle;
  margin-left: 0.3rem;
  transition: all var(--transition);
}

.context-add-btn:hover {
  background: var(--brand);
  color: #fff;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fadeIn 0.15s ease;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.25rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  animation: modalIn 0.2s ease;
}

.modal h3 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.modal textarea {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-family: var(--font);
  resize: vertical;
  margin-bottom: 0.5rem;
}

.modal textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 2px var(--brand-subtle);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Sidebar links */
.sidebar-link {
  display: block;
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--border-light);
  transition: color var(--transition);
}

.sidebar-link:last-child {
  border-bottom: none;
}

.sidebar-link:hover {
  color: var(--brand-dark);
}

/* ═══════ RESPONSIVE ═══════ */

@media (max-width: 700px) {
  header {
    padding: 0 1rem;
  }

  header h1 {
    font-size: 0.75rem;
  }

  nav a {
    font-size: 0.75rem;
    padding: 0.3rem 0.45rem;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .detail-sidebar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.5rem;
  }

  .detail-sidebar .panel {
    margin-bottom: 0;
  }

  .form-row {
    flex-direction: column;
    gap: 0;
  }

  .inquiry-card {
    grid-template-columns: 1fr;
  }

  .inquiry-card-meta {
    text-align: left;
  }
}
