:root {
  --bg: #f6f8fc;
  --panel: #ffffff;
  --panel-2: #f1f3f4;
  --text: #202124;
  --muted: #5f6368;
  --accent: #1a73e8;
  --accent-soft: #e8f0fe;
  --border: #e0e3e7;
  --shadow: 0 4px 16px rgba(60, 64, 67, 0.12);
}

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

[hidden] {
  display: none !important;
}

body {
  font-family: "Manrope", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

button,
input,
textarea,
select {
  font-family: inherit;
  font-size: 0.95rem;
}

button {
  cursor: pointer;
}

label {
  display: grid;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--muted);
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
  color: var(--text);
}

textarea {
  resize: vertical;
  min-height: 160px;
}

.primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-weight: 600;
  margin-top: 8px;
  box-shadow: var(--shadow);
}

.ghost {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 10px;
  padding: 8px 14px;
  font-weight: 600;
}

.status {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 8px;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
}

.auth-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 16px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-brand h1 {
  font-size: 1.2rem;
}

.auth-sub {
  color: var(--muted);
}

.auth-form {
  display: grid;
  gap: 16px;
}

.logo {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  display: grid;
  place-items: center;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.top-left {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
}

.brand-name {
  font-size: 1rem;
}

.top-search {
  flex: 1;
  max-width: 560px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel-2);
  border-radius: 999px;
  padding: 8px 16px;
  margin: 0 24px;
  border: 1px solid transparent;
}

.top-search svg {
  width: 18px;
  height: 18px;
  stroke: var(--muted);
  fill: none;
  stroke-width: 1.6;
}

.top-search input {
  border: none;
  background: transparent;
  padding: 0;
}

.top-search input:focus {
  outline: none;
}

.top-search.disabled {
  opacity: 0.5;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chip {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.8rem;
  font-weight: 600;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--panel-2);
  display: grid;
  place-items: center;
  font-weight: 700;
  color: var(--muted);
}

.workspace {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: calc(100vh - 64px);
}

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.compose-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  box-shadow: var(--shadow);
}

.compose-icon {
  display: inline-flex;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.nav-section {
  display: grid;
  gap: 8px;
}

.nav-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.nav-item {
  border: none;
  background: transparent;
  padding: 10px 12px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: var(--text);
}

.nav-item svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
}

.nav-item:hover,
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.logout {
  margin-top: auto;
}

.content {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.content-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.content-header h2 {
  font-size: 1.4rem;
}

.content-header p {
  color: var(--muted);
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.filter-label {
  font-size: 0.85rem;
  color: var(--muted);
}

.inbox-grid {
  display: grid;
  grid-template-columns: minmax(260px, 360px) 1fr;
  gap: 16px;
  min-height: 520px;
}

.inbox-list,
.inbox-detail {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.inbox-list {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: calc(100vh - 220px);
  overflow: auto;
}

.inbox-item {
  border: none;
  background: transparent;
  text-align: left;
  padding: 12px;
  border-radius: 12px;
  display: grid;
  gap: 6px;
  color: var(--text);
}

.inbox-item:hover {
  background: var(--panel-2);
}

.inbox-item.active {
  background: var(--accent-soft);
  border: 1px solid rgba(26, 115, 232, 0.3);
}

.item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.item-meta {
  font-size: 0.85rem;
  color: var(--muted);
}

.item-snippet {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.3;
}

.inbox-detail {
  padding: 20px;
  overflow: auto;
}

.empty-state {
  text-align: center;
  color: var(--muted);
  display: grid;
  gap: 8px;
  padding: 60px 24px;
}

.compose-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 16px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 20px;
  display: grid;
  gap: 16px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.compose-form {
  display: grid;
  gap: 16px;
}

.row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.toggle {
  display: flex;
  gap: 8px;
}

.toggle button {
  border: 1px solid var(--border);
  background: #fff;
  padding: 6px 12px;
  border-radius: 999px;
}

.toggle button.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.preview {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-2);
  min-height: 320px;
  overflow: hidden;
}

.preview iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
}

.users-layout {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 16px;
}

.user-form {
  display: grid;
  gap: 16px;
}

.user-table {
  display: grid;
  gap: 12px;
}

.user-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
}

.user-row span {
  color: var(--muted);
  font-size: 0.85rem;
}

.settings-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.settings-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 20px;
  display: grid;
  gap: 8px;
}

@media (max-width: 1200px) {
  .compose-grid {
    grid-template-columns: 1fr;
  }

  .users-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1024px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .sidebar {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px;
    border-right: none;
    border-bottom: 1px solid var(--border);
    align-items: center;
  }

  .compose-btn {
    order: -1;
  }

  .nav-section {
    flex: 1 1 200px;
  }

  .logout {
    margin-top: 0;
  }

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

  .inbox-list {
    max-height: 360px;
  }
}

@media (max-width: 720px) {
  .topbar {
    flex-wrap: wrap;
    height: auto;
    padding: 12px 16px;
    gap: 12px;
  }

  .top-search {
    order: 3;
    margin: 0;
    width: 100%;
  }

  .content {
    padding: 16px;
  }

  .sidebar {
    padding: 12px;
  }

  .content-header {
    align-items: flex-start;
  }
}

.detail-body {
  font-size: 0.95rem;
  line-height: 1.6;
}

.detail-body img {
  max-width: 100%;
}
