@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@300;400;500;600&family=DM+Mono:wght@400;500&display=swap');

:root {
  --primary: #1a1a1a;
  --secondary: #4a4a4a;
  --accent: #0066cc;
  --bg-light: #fafafa;
  --bg-white: #ffffff;
  --border: #e5e5e5;
  --success: #00a650;
  --error: #cc0000;
}

.priority-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 2px;
}

.priority-badge.priority-high {
    background: rgba(204, 0, 0, 0.1);
    color: var(--error);
}

.priority-badge.priority-medium {
    background: rgba(255, 152, 0, 0.1);
    color: var(--warning);
}

.priority-badge.priority-low {
    background: rgba(0, 166, 80, 0.1);
    color: var(--success);
}

.priority-badge.priority-critical {
    background: var(--error);
    color: white;
}

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

body {
  font-family: 'IBM Plex Sans', -apple-system, sans-serif;
  color: var(--primary);
  line-height: 1.6;
  background: var(--bg-white);
  -webkit-font-smoothing: antialiased;
}

/* Header */
.header {
  position: fixed;
  top: 0;
  width: 100%;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  padding: 1.25rem 2rem;
  display: flex;
  align-items: center;
  gap: 2rem;
}

.header-brand {
  font-weight: 600;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  color: var(--primary);
}

.header-title {
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--secondary);
}

.lang-switcher {
  margin-left: auto;
  display: flex;
  gap: 1rem;
}

.lang-switcher a {
  font-family: 'DM Mono', monospace;
  font-size: 0.8rem;
  color: var(--secondary);
  text-decoration: none;
  padding: 0.25rem 0.5rem;
  border: 1px solid transparent;
  transition: all 0.2s;
}

.lang-switcher a:hover {
  color: var(--primary);
  border-color: var(--border);
}

.lang-switcher a[aria-current="true"] {
  color: var(--accent);
  border-color: var(--accent);
}

/* Layout */
.main {
  padding-top: 5rem;
  min-height: 100vh;
  background: var(--bg-light);
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 3rem 2rem;
}

/* Hero */
.hero {
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.hero-title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
  line-height: 1.2;
}

.hero-subtext {
  color: var(--secondary);
  font-size: 1rem;
  margin-bottom: 1.25rem;
}

.hero-list {
  padding-left: 1.25rem;
  color: var(--secondary);
  font-size: 0.95rem;
  line-height: 1.8;
}

/* Card */
.card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  padding: 2rem;
  margin-bottom: 1.25rem;
  transition: border-color 0.2s;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  letter-spacing: -0.01em;
}

.card-subtitle {
  color: var(--secondary);
  font-size: 0.95rem;
  margin-bottom: 1.25rem;
}

.card-error {
  color: var(--error);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--error);
  background: rgba(204, 0, 0, 0.03);
}

.card-placeholder {
  color: var(--secondary);
  font-size: 0.95rem;
  margin-bottom: 1.25rem;
  opacity: 0.7;
}

/* Prompt text */
p.prompt-text,
p {
  color: var(--secondary);
  font-size: 1rem;
  margin-bottom: 1rem;
  line-height: 1.6;
}

/* RAG answer */
.card pre {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--primary);
  white-space: pre-wrap;
  word-break: break-word;
}

.card small {
  font-family: 'DM Mono', monospace;
  font-size: 0.75rem;
  color: var(--secondary);
  opacity: 0.7;
}

/* Forms */
.token-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.form-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--primary);
}

.form-input {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 2px solid var(--border);
  font-family: inherit;
  font-size: 1rem;
  color: var(--primary);
  background: var(--bg-white);
  transition: border-color 0.2s;
  outline: none;
  border-radius: 0;
}

.form-input:focus {
  border-color: var(--accent);
}

textarea.form-input {
  resize: vertical;
  min-height: 100px;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.875rem 2rem;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s ease;
  text-align: center;
  border-radius: 0;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  width: 100%;
  margin-top: 0.5rem;
}

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

.btn-secondary {
  background: var(--bg-white);
  color: var(--primary);
  border-color: var(--border);
  width: 100%;
  margin-bottom: 0.5rem;
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  padding: 2rem;
  text-align: center;
}

.footer-text {
  font-family: 'DM Mono', monospace;
  font-size: 0.8rem;
  color: var(--secondary);
  opacity: 0.5;
}

/* File input accessible pattern (MDN standard visually-hidden) */
.file-input-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
}

.attach-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

@media (min-width: 641px) {
  .attach-actions {
    flex-direction: row;
  }
}

.attach-actions > div {
  position: relative;
  display: inline-block;
}

/* Ensure single-button wrapper also becomes relative */
div:has(> #attach-input),
div:has(> #attach-camera) {
  position: relative;
  display: inline-block;
}

.attach-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  background: var(--bg-white);
  color: var(--secondary);
  font-size: 0.85rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.attach-label:active {
  transform: translateY(1px);
}

.attach-filename {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--secondary);
  word-break: break-word;
}

/* Responsive */
@media (max-width: 640px) {
  .header {
    padding: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .lang-switcher {
    margin-left: 0;
    width: 100%;
  }
  .header-lang-label {
    display: none;
  }

  .container {
    padding: 2rem 1rem;
  }

  .card {
    padding: 1.5rem;
  }

  /* Engineer: tickets table → cards */
  .tickets-table thead {
    display: none;
  }

  .tickets-table,
  .tickets-table tbody,
  .tickets-table tr,
  .tickets-table td {
    display: block;
    width: 100%;
  }

  .tickets-table tr {
    border: 1px solid var(--border);
    margin-bottom: 0.75rem;
    padding: 1rem;
  }

  .tickets-table tr:hover td {
    background: none;
  }

  .tickets-table td {
    padding: 0.25rem 0;
    border-bottom: none;
    font-size: 0.9rem;
  }

  .tickets-table td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--secondary);
    margin-bottom: 0.2rem;
  }

  /* Engineer dashboard: vendor cards stack */
  .vendor-grid {
    grid-template-columns: 1fr !important;
  }

  /* Ticket detail: meta grid stack */
  .ticket-meta {
    grid-template-columns: 1fr !important;
  }

  .snapshot-grid {
    grid-template-columns: 1fr !important;
  }

  .status-buttons {
    flex-direction: column;
  }

  .status-buttons .btn-status {
    width: 100%;
  }
}
