:root {
  color-scheme: light;
  --bg: #f6efef;
  --panel: #ffffff;
  --panel-alt: #eef1f5;
  --line: #d9e0e6;
  --text: #1f252c;
  --muted: #7c8893;
  --accent: #2baa43;
  --accent-soft: #edf8ee;
  --shadow: 0 20px 48px rgba(47, 59, 75, 0.1);
  font-family: Roboto, "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(43, 170, 67, 0.08), transparent 28%),
    linear-gradient(180deg, #fbf8f8, var(--bg));
  color: var(--text);
}

button,
input,
select,
textarea {
  font: inherit;
}

.admin-shell {
  min-height: 100vh;
}

.login-view,
.dashboard-view {
  min-height: 100vh;
}

.login-view {
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card,
.sidebar,
.detail-view,
.meta-card {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.login-card {
  width: min(460px, 100%);
  padding: 28px;
  border-radius: 28px;
}

.login-kicker {
  display: inline-flex;
  padding: 8px 12px;
  border-radius: 999px;
  background: #f8fafb;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.login-card h1,
.detail-header h2,
.sidebar-header h2 {
  margin: 14px 0 8px;
}

.login-card p,
.empty-state p,
.detail-header p {
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 16px;
  margin-top: 20px;
}

.login-form label,
.reply-form {
  display: grid;
  gap: 8px;
}

.login-form input,
.reply-form textarea,
.detail-actions select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f7f9fb;
  padding: 14px 16px;
  color: var(--text);
}

.login-form button,
.reply-actions button,
.file-button {
  border: 0;
  border-radius: 16px;
  padding: 14px 18px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
}

.error-text {
  color: #c33c3c;
  margin-top: 14px;
}

.dashboard-view {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 18px;
  padding: 18px;
}

.sidebar,
.detail-view {
  border-radius: 28px;
  overflow: hidden;
}

.sidebar {
  display: flex;
  flex-direction: column;
}

.sidebar-header,
.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px;
  border-bottom: 1px solid var(--line);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px 20px 0;
}

.filter-chip,
.ghost-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 999px;
  padding: 10px 14px;
  cursor: pointer;
}

.filter-chip.is-active {
  background: var(--accent-soft);
  border-color: rgba(43, 170, 67, 0.28);
  color: var(--accent);
}

.conversation-list {
  display: grid;
  gap: 12px;
  padding: 16px 20px 20px;
  overflow: auto;
}

.conversation-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 14px;
  background: #fff;
  cursor: pointer;
}

.conversation-card.is-active {
  border-color: rgba(43, 170, 67, 0.35);
  box-shadow: 0 12px 30px rgba(43, 170, 67, 0.12);
}

.conversation-card header,
.conversation-card footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.conversation-card p {
  color: var(--muted);
  margin: 10px 0;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 700;
  background: var(--accent-soft);
  color: var(--accent);
}

.detail-view {
  display: flex;
  flex-direction: column;
}

.empty-state {
  margin: auto;
  text-align: center;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  padding: 20px;
  min-height: 0;
}

.messages-panel,
.meta-panel {
  min-height: 0;
}

.messages-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.message-feed {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 18px;
  min-height: 420px;
  max-height: calc(100vh - 260px);
  overflow: auto;
}

.message-day {
  text-align: center;
  color: var(--muted);
  margin: 8px 0 16px;
}

.message-row {
  display: flex;
  margin-bottom: 14px;
}

.message-row.customer,
.message-row.operator {
  flex-direction: column;
}

.message-row.customer {
  align-items: flex-start;
}

.message-row.operator {
  align-items: flex-end;
}

.message-label {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.message-bubble {
  max-width: 78%;
  border-radius: 18px;
  padding: 14px 16px;
  line-height: 1.5;
  background: var(--panel-alt);
}

.message-row.operator .message-bubble {
  background: var(--accent);
  color: #fff;
}

.message-time {
  display: block;
  margin-top: 8px;
  font-size: 11px;
  opacity: 0.8;
  text-align: right;
}

.message-attachments {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: inherit;
  text-decoration: none;
}

.operator-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.quick-reply-btn {
  border: 1.5px solid var(--accent);
  background: #fff;
  color: var(--accent);
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 700;
}

.reply-form {
  border: 1px solid var(--line);
  background: #f4f7f8;
  border-radius: 22px;
  padding: 14px;
}

.reply-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.file-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.meta-panel {
  display: grid;
  gap: 18px;
}

.meta-card {
  border-radius: 24px;
  padding: 18px;
}

.meta-card h3 {
  margin-top: 0;
}

.meta-list {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 10px 12px;
  margin: 0;
}

.meta-list dt {
  color: var(--muted);
}

.meta-list dd {
  margin: 0;
}

.attachment-list {
  display: grid;
  gap: 10px;
}

@media (max-width: 1080px) {
  .dashboard-view,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .message-feed {
    max-height: none;
  }
}

@media (max-width: 640px) {
  .dashboard-view {
    padding: 12px;
  }

  .sidebar-header,
  .detail-header,
  .content-grid {
    padding: 16px;
  }

  .message-bubble {
    max-width: 90%;
  }
}
