:root {
  --primary: #5a7d5a;
  --primary-dark: #3f5a3f;
  --primary-light: #7a9b7a;
  --accent: #c4a574;
  --text: #2c3530;
  --text-muted: #6b7670;
  --text-light: #8a9690;
  --bg: #fdfcf8;
  --bg-card: #ffffff;
  --bg-muted: #f5f3ec;
  --bg-accent: #eef1ec;
  --border: #e3e0d4;
  --border-focus: #b8c4b1;
  --shadow-sm: 0 1px 2px rgba(44, 53, 48, 0.04);
  --shadow: 0 2px 8px rgba(44, 53, 48, 0.06), 0 1px 2px rgba(44, 53, 48, 0.04);
  --shadow-hover: 0 4px 16px rgba(44, 53, 48, 0.08), 0 2px 4px rgba(44, 53, 48, 0.04);
  --radius: 12px;
  --radius-sm: 6px;
  --radius-lg: 20px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

body {
  font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  font-size: 15px;
  letter-spacing: 0.01em;
  background-image:
    radial-gradient(circle at 15% 20%, rgba(122, 155, 122, 0.06), transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(196, 165, 116, 0.05), transparent 45%),
    url("data:image/svg+xml,%3Csvg width='120' height='120' viewBox='0 0 120 120' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%23c4d0c0' stroke-width='0.8' stroke-linecap='round' opacity='0.35'%3E%3Cpath d='M30 60 Q 40 40 50 60 T 70 60' /%3E%3Cpath d='M60 30 Q 50 40 60 50 T 60 70' /%3E%3Cpath d='M90 90 Q 100 80 110 90' /%3E%3Cpath d='M15 105 Q 25 95 35 105' /%3E%3C/g%3E%3C/svg%3E");
  background-attachment: fixed;
}

.container {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
.header {
  background: rgba(253, 252, 248, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 18px 0;
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 780px;
  margin: 0 auto;
  padding: 0 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: var(--text);
}

.brand-logo {
  height: 36px;
  width: auto;
  object-fit: contain;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
}

.brand-sub {
  font-size: 11px;
  color: var(--text-light);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.header-actions a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.header-actions a:hover {
  color: var(--primary);
  background: var(--bg-accent);
}

/* Main */
.main {
  padding: 56px 0 100px;
}

.page-title {
  font-size: 28px;
  font-weight: 600;
  margin: 0 0 10px;
  color: var(--text);
  letter-spacing: -0.01em;
}

.page-subtitle {
  font-size: 15px;
  color: var(--text-muted);
  margin: 0 0 36px;
  line-height: 1.7;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

/* Login */
.login-wrapper {
  min-height: calc(100vh - 80px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  position: relative;
}

.login-hero {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.login-hero::before {
  content: '';
  position: absolute;
  top: -10%;
  right: -15%;
  width: 60%;
  height: 60%;
  background: radial-gradient(circle, rgba(122, 155, 122, 0.12) 0%, transparent 70%);
  border-radius: 50%;
}

.login-hero::after {
  content: '';
  position: absolute;
  bottom: -10%;
  left: -10%;
  width: 50%;
  height: 50%;
  background: radial-gradient(circle, rgba(196, 165, 116, 0.1) 0%, transparent 70%);
  border-radius: 50%;
}

.login-card {
  max-width: 440px;
  width: 100%;
  padding: 48px 40px;
  text-align: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(44, 53, 48, 0.08), 0 4px 16px rgba(44, 53, 48, 0.04);
  position: relative;
  z-index: 1;
}

.login-card .brand-logo {
  height: 64px;
  margin: 0 auto 24px;
  display: block;
}

.login-leaf {
  display: block;
  margin: 0 auto 20px;
  width: 56px;
  height: 56px;
  color: var(--primary-light);
  opacity: 0.85;
}

.login-card h1 {
  font-size: 22px;
  margin: 0 0 10px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.login-card .page-subtitle {
  margin-bottom: 32px;
  font-size: 14px;
}

/* Forms */
.form-group {
  margin-bottom: 22px;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text);
  letter-spacing: 0.01em;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: inherit;
  transition: all 0.2s;
  background: var(--bg-card);
  color: var(--text);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(122, 155, 122, 0.15);
}

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

.form-textarea {
  min-height: 180px;
  resize: vertical;
  line-height: 1.7;
}

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7670' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s;
  text-decoration: none;
  gap: 8px;
  font-family: inherit;
  letter-spacing: 0.02em;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 4px 12px rgba(90, 125, 90, 0.25);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--bg-muted);
  border-color: var(--border-focus);
}

.btn-block { width: 100%; }
.btn-large { padding: 13px 28px; font-size: 15px; }

/* Messages / Alerts */
.error-message {
  background: #f9ebe9;
  color: #a44138;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 14px;
  border-left: 3px solid #c5756a;
}

/* Ticket list */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  gap: 16px;
  flex-wrap: wrap;
}

.ticket-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ticket-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  text-decoration: none;
  color: var(--text);
  display: block;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.ticket-item:hover {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}

.ticket-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

.ticket-number {
  font-size: 11px;
  color: var(--text-light);
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  letter-spacing: 0.03em;
}

.ticket-subject {
  font-size: 16px;
  font-weight: 600;
  margin: 6px 0 10px;
  color: var(--text);
  line-height: 1.5;
}

.ticket-meta {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--text-muted);
  align-items: center;
  flex-wrap: wrap;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  gap: 5px;
  letter-spacing: 0.02em;
}

.badge-open { background: #e7eff4; color: #375d78; }
.badge-in_progress { background: #f5ecd9; color: #826017; }
.badge-resolved { background: #e3ede2; color: #3f5a3f; }
.badge-closed { background: var(--bg-muted); color: var(--text-muted); }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}

.empty-state-icon {
  margin: 0 auto 20px;
  width: 64px;
  height: 64px;
  color: var(--primary-light);
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 16px;
  font-weight: 500;
  margin: 0 0 8px;
  color: var(--text);
}

.empty-state p {
  margin: 0 0 24px;
  font-size: 14px;
}

/* Back link */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  margin-bottom: 20px;
  transition: color 0.2s;
}

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

/* Ticket detail */
.ticket-detail-header {
  border-bottom: 1px solid var(--border);
  padding-bottom: 24px;
  margin-bottom: 28px;
}

.ticket-detail-title {
  font-size: 24px;
  font-weight: 600;
  margin: 10px 0;
  letter-spacing: -0.01em;
}

.thread {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.message {
  padding: 18px 22px;
  border-radius: var(--radius);
  background: var(--bg-muted);
  border: 1px solid var(--border);
}

.message-client {
  background: #f0f4ee;
  border-color: #d5dfd1;
  border-left: 3px solid var(--primary);
}

.message-staff {
  background: #faf4e8;
  border-color: #ebe0ca;
  border-left: 3px solid var(--accent);
}

.message-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 13px;
  gap: 12px;
  flex-wrap: wrap;
}

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

.message-time {
  color: var(--text-light);
  font-size: 12px;
}

.message-body {
  white-space: pre-wrap;
  word-wrap: break-word;
  font-size: 14.5px;
  color: var(--text);
  line-height: 1.75;
}

/* Reply form */
.reply-form {
  margin-top: 36px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

.reply-form h3 {
  font-size: 15px;
  margin: 0 0 16px;
  font-weight: 600;
  color: var(--text);
}

/* Footer */
.footer {
  text-align: center;
  padding: 28px 20px;
  font-size: 12px;
  color: var(--text-light);
  border-top: 1px solid var(--border);
}

.footer a {
  color: var(--text-muted);
  text-decoration: none;
}

.footer a:hover { color: var(--primary); }

/* Responsive */
@media (max-width: 600px) {
  .card {
    padding: 24px 20px;
  }
  .login-card {
    padding: 36px 28px;
  }
  .page-title {
    font-size: 22px;
  }
  .ticket-header {
    flex-direction: column;
    gap: 6px;
  }
  .main {
    padding: 32px 0 60px;
  }
}
