:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --panel: #ffffff;
  --ink: #1c2624;
  --muted: #65716d;
  --line: #d9dfda;
  --accent: #147a6f;
  --accent-strong: #0d5e56;
  --warm: #b75f2a;
  --danger: #b3261e;
  --shadow: 0 18px 60px rgba(24, 38, 34, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(20, 122, 111, 0.08), transparent 320px),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  min-height: 42px;
  padding: 0 16px;
  transition: background 160ms ease, transform 160ms ease;
}

button:hover {
  background: var(--accent-strong);
}

button:active {
  transform: translateY(1px);
}

button.secondary {
  background: #edf2ef;
  color: var(--ink);
}

button.secondary:hover {
  background: #dfe8e4;
}

button.danger {
  background: #fae7e5;
  color: var(--danger);
}

button.danger:hover {
  background: #f4d2ce;
}

.app {
  width: min(1040px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.composer {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 24px;
}

.brand,
.toolbar,
.composer-actions,
.item-head,
.item-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand,
.toolbar,
.composer-actions,
.item-head {
  justify-content: space-between;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 5vw, 44px);
  line-height: 1.05;
  letter-spacing: 0;
}

.status {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  min-width: 76px;
  padding: 8px 12px;
  text-align: center;
  white-space: nowrap;
}

.status.online {
  border-color: rgba(20, 122, 111, 0.28);
  color: var(--accent-strong);
}

.status.error {
  border-color: rgba(179, 38, 30, 0.28);
  color: var(--danger);
}

.text-form {
  margin-top: 24px;
}

textarea,
input[type="text"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfb;
  color: var(--ink);
  outline: none;
}

textarea {
  min-height: 148px;
  padding: 16px;
  resize: vertical;
}

input[type="text"] {
  min-height: 42px;
  padding: 0 12px;
}

textarea:focus,
input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(20, 122, 111, 0.14);
}

.composer-actions {
  margin-top: 12px;
}

.composer-actions input {
  flex: 1;
}

.drop-zone {
  display: grid;
  gap: 6px;
  place-items: center;
  margin-top: 18px;
  min-height: 140px;
  border: 1.5px dashed #9fb2ab;
  border-radius: 8px;
  background: #f7faf8;
  cursor: pointer;
  padding: 22px;
  text-align: center;
}

.drop-zone.dragging {
  border-color: var(--warm);
  background: #fff8f1;
}

.drop-zone input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.drop-title {
  color: var(--ink);
  display: block;
  font-size: 18px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.drop-copy,
#lastSync,
.meta {
  color: var(--muted);
  font-size: 14px;
}

.upload-progress {
  background: #dfe8e4;
  border-radius: 999px;
  display: block;
  height: 8px;
  margin-top: 6px;
  overflow: hidden;
  width: min(360px, 100%);
}

.upload-progress[hidden] {
  display: none;
}

.upload-progress span {
  background: var(--accent);
  display: block;
  height: 100%;
  transition: width 180ms ease;
  width: 0%;
}

.toolbar {
  margin: 24px 0 14px;
}

.toolbar > div {
  display: grid;
  gap: 2px;
}

.items {
  display: grid;
  gap: 12px;
}

.item,
.empty {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.item-title {
  min-width: 0;
}

.item-title strong {
  display: block;
  overflow-wrap: anywhere;
}

.kind {
  color: var(--warm);
  font-size: 13px;
  font-weight: 800;
}

.text-content {
  margin: 14px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.55;
}

.item-actions {
  justify-content: flex-end;
  margin-top: 14px;
  flex-wrap: wrap;
}

.item-actions a {
  align-items: center;
  background: var(--accent);
  border-radius: 6px;
  color: #fff;
  display: inline-flex;
  min-height: 42px;
  padding: 0 16px;
  text-decoration: none;
}

.item-actions a:hover {
  background: var(--accent-strong);
}

.file-row {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: 44px 1fr;
  margin-top: 14px;
}

.file-icon {
  align-items: center;
  background: #eaf3f0;
  border-radius: 8px;
  color: var(--accent-strong);
  display: flex;
  font-weight: 900;
  height: 44px;
  justify-content: center;
  width: 44px;
}

.empty {
  color: var(--muted);
  display: grid;
  gap: 6px;
  min-height: 120px;
  place-items: center;
  text-align: center;
}

.empty strong {
  color: var(--ink);
}

.toast-region {
  bottom: 20px;
  display: grid;
  gap: 10px;
  pointer-events: none;
  position: fixed;
  right: 20px;
  width: min(360px, calc(100% - 40px));
  z-index: 20;
}

.toast {
  background: #17211f;
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  box-shadow: 0 16px 40px rgba(24, 38, 34, 0.22);
  color: #fff;
  opacity: 0;
  overflow-wrap: anywhere;
  padding: 12px 14px;
  transform: translateY(8px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.success {
  border-left-color: var(--accent);
}

.toast.info {
  border-left-color: var(--warm);
}

.toast.error {
  border-left-color: var(--danger);
}

@media (max-width: 720px) {
  .app {
    width: min(100% - 20px, 1040px);
    padding-top: 16px;
  }

  .composer {
    padding: 18px;
  }

  .brand,
  .toolbar,
  .composer-actions,
  .item-head {
    align-items: stretch;
    flex-direction: column;
  }

  .brand {
    gap: 16px;
  }

  .status {
    width: fit-content;
  }

  .composer-actions button,
  .toolbar button {
    width: 100%;
  }

  .item-actions {
    justify-content: stretch;
  }

  .item-actions button,
  .item-actions a {
    flex: 1;
    justify-content: center;
  }
}
