:root {
  --bg: #f6f8fc;
  --surface: #ffffff;
  --surface-soft: #f1f3f4;
  --text: #202124;
  --muted: #5f6368;
  --faint: #80868b;
  --line: #dadce0;
  --accent: #1a73e8;
  --accent-soft: #e8f0fe;
  --danger: #d93025;
  --radius: 16px;
  --sans: "Google Sans", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --shadow-soft: 0 1px 2px rgba(60, 64, 67, 0.1), 0 1px 3px rgba(60, 64, 67, 0.08);
  --shadow-pop: 0 8px 24px rgba(60, 64, 67, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(860px 460px at 12% -12%, #e8f0fe 0%, transparent 58%),
    radial-gradient(780px 430px at 100% 0%, #e6f4ea 0%, transparent 52%),
    var(--bg);
  font-family: var(--sans);
}

.wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 14px 14px 28px;
}

.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid #e4e7eb;
  border-radius: 24px;
  padding: 12px 16px;
  box-shadow: var(--shadow-soft);
}

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

.logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  position: relative;
  border: 1px solid #d2e3fc;
  background: linear-gradient(145deg, #fff, #f7f9fd);
}

.logo::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 6px;
  background:
    linear-gradient(135deg, #4285f4 0%, #4285f4 25%, transparent 25%) top left / 50% 50% no-repeat,
    linear-gradient(225deg, #ea4335 0%, #ea4335 25%, transparent 25%) top right / 50% 50% no-repeat,
    linear-gradient(315deg, #fbbc05 0%, #fbbc05 25%, transparent 25%) bottom right / 50% 50% no-repeat,
    linear-gradient(45deg, #34a853 0%, #34a853 25%, transparent 25%) bottom left / 50% 50% no-repeat;
}

h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
}

.subtitle {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.searchbar {
  height: 46px;
  border-radius: 24px;
  display: flex;
  align-items: center;
  padding: 0 18px;
  color: #5f6368;
  background: #eaf1fb;
  border: 1px solid #d2e3fc;
  font-size: 14px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  border: 1px solid #d2e3fc;
  background: var(--accent-soft);
  color: #174ea6;
  padding: 8px 12px;
  font-size: 12px;
}

.pill code {
  font-family: var(--sans);
  font-weight: 600;
}

.pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #1e8e3e;
}

.shell {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 14px;
}

.sidebar {
  padding-top: 4px;
}

.compose-cta {
  width: 100%;
  border: 1px solid #d2e3fc;
  background: #c2e7ff;
  color: #001d35;
  border-radius: 16px;
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: default;
}

.nav {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  text-decoration: none;
  color: #3c4043;
  font-size: 14px;
  border-radius: 0 18px 18px 0;
  padding: 9px 14px;
}

.nav-item:hover {
  background: #edf2fa;
}

.nav-item.active {
  background: #d3e3fd;
  color: #001d35;
  font-weight: 600;
}

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

.card {
  background: var(--surface);
  border: 1px solid #e4e7eb;
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.card-h {
  padding: 14px 16px;
  border-bottom: 1px solid #edf0f2;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-h h2 {
  margin: 0;
  font-size: 15px;
}

.card-h .meta {
  color: var(--muted);
  font-size: 12px;
}

.card-b {
  padding: 14px 16px;
}

.card-b-inbox {
  padding: 0;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

textarea {
  width: 100%;
  min-height: 132px;
  resize: vertical;
  border-radius: 14px;
  border: 1px solid var(--line);
  padding: 12px 14px;
  font-family: var(--sans);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

textarea::placeholder {
  color: #9aa0a6;
}

textarea:focus {
  border-color: #8ab4f8;
  box-shadow: 0 0 0 4px rgba(26, 115, 232, 0.14);
}

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

.hint {
  color: var(--faint);
  font-size: 12px;
}

.btns {
  display: inline-flex;
  gap: 8px;
}

button {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
  color: #3c4043;
  padding: 8px 14px;
  font-size: 13px;
  font-family: var(--sans);
  font-weight: 600;
  cursor: pointer;
}

button:hover {
  background: #f8f9fa;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

button.primary:hover {
  background: #1669d6;
  border-color: #1669d6;
}

button[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.status {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.status .spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #d2e3fc;
  border-top-color: var(--accent);
  display: none;
  animation: spin 1s linear infinite;
}

.status.loading .spinner {
  display: inline-block;
}

.status.error {
  color: var(--danger);
}

.status.ok {
  color: #188038;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.inbox-toolbar {
  padding: 12px 16px;
  border-bottom: 1px solid #edf0f2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: #3c4043;
  background: #f8fafd;
}

.inbox-count {
  color: var(--muted);
}

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

.item {
  display: grid;
  grid-template-columns: 110px minmax(320px, 1fr) 190px 54px;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid #edf0f2;
  background: #fff;
}

.item:last-child {
  border-bottom: 0;
}

.item:hover {
  background: #f8fafd;
}

.cell {
  min-width: 0;
}

.cell-id {
  color: #1a73e8;
  font-size: 12px;
  font-weight: 600;
}

.cell-text {
  color: #3c4043;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.cell-date {
  font-size: 12px;
  color: var(--faint);
  white-space: nowrap;
  text-align: left;
}

.cell-actions {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.iconbtn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid transparent;
  background: #f1f3f4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #5f6368;
  cursor: pointer;
}

.iconbtn:hover {
  background: #e8eaed;
}

.iconbtn.danger {
  background: #fce8e6;
  color: var(--danger);
}

.iconbtn.danger:hover {
  background: #f7d9d6;
}

.empty {
  margin: 16px;
  padding: 16px;
  border: 1px dashed #d2d7de;
  border-radius: 12px;
  background: #fafbfc;
  color: var(--muted);
  font-size: 13px;
}

footer {
  border: 1px solid #e4e7eb;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  padding: 12px 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}

.weather-info {
  width: 100%;
  border-top: 1px solid #edf0f2;
  padding-top: 10px;
  margin-top: 4px;
  text-align: center;
  font-size: 13px;
  color: #3c4043;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  padding: 16px;
  display: grid;
  place-items: center;
  background: rgba(32, 33, 36, 0.45);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  width: min(420px, 100%);
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow-pop);
  padding: 18px;
}

.modal h3 {
  margin: 0 0 8px;
  font-size: 17px;
}

.modal p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.modal-actions {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.danger-btn {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.danger-btn:hover {
  background: #c5221f;
  border-color: #c5221f;
}

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

  .searchbar {
    order: 3;
  }

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

  .sidebar {
    display: none;
  }

  .item {
    grid-template-columns: 94px 1fr auto;
    grid-template-areas:
      "id text actions"
      "date text actions";
    align-items: start;
    gap: 6px 10px;
  }

  .cell-id {
    grid-area: id;
  }

  .cell-text {
    grid-area: text;
    white-space: normal;
    line-height: 1.35;
  }

  .cell-date {
    grid-area: date;
  }

  .cell-actions {
    grid-area: actions;
    align-self: center;
  }
}
