:root {
  --blue: #1a6fc4;
  --blue-light: #e8f1fb;
  --blue-dark: #0d4f96;
  --text-primary: #1a1a2e;
  --text-secondary: #5a6070;
  --text-muted: #8a91a0;
  --bg: #ffffff;
  --bg-secondary: #f7f8fa;
  --border: rgba(0,0,0,0.09);
  --border-mid: rgba(0,0,0,0.15);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --font-sans: 'DM Sans', system-ui, sans-serif;
  --font-title: 'Geologica', system-ui, sans-serif;
  --green: #2a9d5c;
  --orange: #d4860a;
  --red: #c4244d;
  --gray: #8a91a0;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: var(--font-sans); color: var(--text-primary); background: var(--bg-secondary); line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; }
button { cursor: pointer; font-family: var(--font-sans); }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 2rem; background: #fff; border-bottom: 0.5px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.brand img { height: 42px; }
.topnav { display: flex; align-items: center; gap: 1rem; }
.lang-switch { display: flex; align-items: center; gap: 4px; font-size: 13px; margin-right: 0.5rem; }
.lang-opt { color: var(--text-muted); font-weight: 500; transition: color 0.2s; padding: 2px 4px; }
.lang-opt:hover { color: var(--text-primary); }
.lang-opt.active { color: var(--blue); }
.lang-sep { color: var(--border-mid); }
.user-badge { font-size: 13px; color: var(--text-secondary); }
.btn-ghost { background: transparent; border: 0.5px solid var(--border-mid); padding: 0.5rem 1rem; border-radius: var(--radius-sm); font-size: 13px; color: var(--text-primary); }
.btn-ghost:hover { border-color: var(--blue); color: var(--blue); }

.container { max-width: 800px; margin: 0 auto; padding: 2rem; }
.view { animation: fade 0.3s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.hero { text-align: center; margin-bottom: 2.5rem; }
.hero h1 { font-family: var(--font-title); font-size: 2.2rem; font-weight: 300; margin-bottom: 0.8rem; }
.hero p { color: var(--text-secondary); font-weight: 300; max-width: 560px; margin: 0 auto; }

.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.choice-card {
  background: #fff; border: 0.5px solid var(--border); border-radius: var(--radius-lg);
  padding: 1.8rem; display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
  text-align: center; transition: transform 0.2s, border-color 0.2s;
}
.choice-card:hover { transform: translateY(-3px); border-color: var(--blue); }
.choice-card i { font-size: 28px; color: var(--blue); margin-bottom: 0.5rem; }
.choice-card strong { font-family: var(--font-title); font-weight: 500; font-size: 1.05rem; }
.choice-card span { font-size: 13px; color: var(--text-secondary); font-weight: 300; }

h2 { font-family: var(--font-title); font-weight: 400; font-size: 1.6rem; margin-bottom: 1.2rem; }
.back { background: none; border: none; color: var(--text-secondary); font-size: 14px; display: inline-flex; align-items: center; gap: 0.4rem; margin-bottom: 1.2rem; }
.back:hover { color: var(--blue); }

.card { background: #fff; border: 0.5px solid var(--border); border-radius: var(--radius-lg); padding: 2rem; }
.form { display: flex; flex-direction: column; gap: 1.2rem; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.field { display: flex; flex-direction: column; gap: 0.4rem; }
.field label { font-size: 12px; font-weight: 500; color: var(--text-secondary); }
.field input, .field select, .field textarea {
  font-family: var(--font-sans); font-size: 14px; color: var(--text-primary);
  background: var(--bg-secondary); border: 0.5px solid var(--border-mid);
  border-radius: var(--radius-sm); padding: 0.65rem 0.9rem; outline: none; width: 100%;
  transition: border-color 0.2s, background 0.2s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--blue); background: #fff; }
.field textarea { resize: vertical; }
.hint { font-size: 13px; color: var(--text-secondary); font-weight: 300; }

.btn-primary { background: var(--blue); color: #fff; border: none; padding: 0.75rem 1.6rem; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; display: inline-flex; align-items: center; gap: 0.5rem; justify-content: center; align-self: flex-start; transition: background 0.2s; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-primary:disabled { opacity: 0.6; cursor: default; }

.msg { padding: 0.7rem 1rem; border-radius: var(--radius-sm); font-size: 14px; }
.msg.error { background: #fef0f0; color: #c0392b; border: 0.5px solid #f5c6c6; }
.msg.success { background: #e8f4ee; color: #1a7a3f; border: 0.5px solid #b8dcca; }

.switch { font-size: 13px; color: var(--text-secondary); }
.switch a { font-weight: 500; }

.list-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.2rem; }
.ticket-list { display: flex; flex-direction: column; gap: 0.6rem; }
.ticket-row {
  background: #fff; border: 0.5px solid var(--border); border-radius: var(--radius-md);
  padding: 1rem 1.2rem; display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; transition: border-color 0.2s; cursor: pointer;
}
.ticket-row:hover { border-color: var(--blue); }
.ticket-row .tr-main { display: flex; flex-direction: column; gap: 2px; }
.ticket-row .tr-ref { font-size: 11px; color: var(--text-muted); font-family: var(--font-title); }
.ticket-row .tr-subject { font-size: 14px; font-weight: 500; }
.ticket-row .tr-date { font-size: 12px; color: var(--text-secondary); }

.badge { font-size: 11px; padding: 0.25rem 0.7rem; border-radius: 20px; font-weight: 500; white-space: nowrap; }
.badge.open { background: #e8f1fb; color: var(--blue); }
.badge.pending { background: #fef3e8; color: var(--orange); }
.badge.answered { background: #e8f4ee; color: var(--green); }
.badge.closed { background: #f0f0f2; color: var(--gray); }

.ticket-header { margin-bottom: 1.2rem; }
.ticket-header .ref { font-size: 12px; color: var(--text-muted); font-family: var(--font-title); }
.ticket-header h2 { margin: 0.2rem 0 0.6rem; }
.ticket-header .meta { display: flex; align-items: center; gap: 1rem; font-size: 12px; color: var(--text-secondary); flex-wrap: wrap; }

.thread { display: flex; flex-direction: column; gap: 0.8rem; margin-bottom: 1.2rem; }
.bubble { padding: 1rem 1.2rem; border-radius: var(--radius-md); max-width: 85%; }
.bubble .bub-head { font-size: 12px; font-weight: 500; margin-bottom: 0.3rem; display: flex; justify-content: space-between; gap: 1rem; }
.bubble .bub-body { font-size: 14px; font-weight: 300; white-space: pre-wrap; }
.bubble .bub-time { font-size: 11px; color: var(--text-muted); font-weight: 400; }
.bubble.customer { background: #fff; border: 0.5px solid var(--border); align-self: flex-start; }
.bubble.staff { background: var(--blue-light); border: 0.5px solid var(--blue); align-self: flex-end; }
.bubble.staff .bub-head { color: var(--blue-dark); }

.reply { margin-top: 0.5rem; }

@media (max-width: 600px) {
  .container { padding: 1.25rem; }
  .row { grid-template-columns: 1fr; }
  .bubble { max-width: 100%; }
}
