:root {
  color-scheme: light;
  --paper: #f5f7f2;
  --surface: #ffffff;
  --ink: #17242a;
  --muted: #667275;
  --line: #d8dfdc;
  --teal: #114b5f;
  --teal-soft: #dceff1;
  --leaf: #2f6f4e;
  --amber: #f4a261;
  --amber-soft: #fff3df;
  --rose: #bd3f36;
  --rose-soft: #ffe7e2;
  --shadow: 0 18px 46px rgba(21, 45, 50, 0.11);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

body.is-locked .app-shell {
  display: none;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

button:disabled,
select:disabled,
textarea:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

svg {
  width: 1.2rem;
  height: 1.2rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.svg-sprite {
  display: none;
}

.app-shell {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 42px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
}

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

.brand img {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  border-radius: 8px;
  box-shadow: 0 12px 24px rgba(17, 75, 95, 0.16);
}

.brand h1,
.brand p,
.panel-heading h2,
.section-heading h2,
.clip-card strong,
.empty-state p,
.lock-panel h2,
.lock-panel p {
  margin: 0;
}

.brand h1 {
  font-size: clamp(1.35rem, 2.4vw, 1.9rem);
  line-height: 1.1;
}

.brand p,
.panel-heading span,
.section-heading span,
.clip-meta span,
.empty-state,
.lock-panel p {
  color: var(--muted);
}

.brand p {
  margin-top: 4px;
  font-size: 0.94rem;
}

.toolbar,
.button-row,
.clip-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-button {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--teal);
  background: var(--surface);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  align-items: start;
  gap: 20px;
}

.control-panel {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 14px;
}

.settings-panel,
.composer-panel,
.clip-card,
.lock-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.settings-panel,
.composer-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.panel-heading,
.section-heading,
.clip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-heading h2,
.section-heading h2 {
  font-size: 1.04rem;
}

.select-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--teal);
  background: var(--surface);
}

.select-field select {
  min-width: 0;
  border: 0;
  color: var(--ink);
  background: transparent;
  outline: none;
}

.composer-form,
.field {
  display: grid;
  gap: 10px;
}

.field span {
  font-size: 0.92rem;
  font-weight: 800;
}

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

textarea {
  min-height: 160px;
  padding: 12px;
  resize: vertical;
  line-height: 1.5;
}

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

textarea:focus,
input[type="password"]:focus,
select:focus-visible,
.icon-button:focus-visible,
.primary-button:focus-visible,
.secondary-button:focus-visible,
.danger-button:focus-visible,
.copy-button:focus-visible {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(17, 75, 95, 0.16);
  outline: none;
}

.primary-button,
.secondary-button,
.danger-button,
.copy-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  text-decoration: none;
  white-space: nowrap;
  font-weight: 800;
}

.primary-button {
  border: 1px solid var(--teal);
  color: #fff;
  background: var(--teal);
}

.secondary-button,
.copy-button {
  border: 1px solid var(--line);
  color: var(--teal);
  background: var(--surface);
}

.danger-button {
  border: 1px solid #f0c7c1;
  color: var(--rose);
  background: var(--rose-soft);
}

.button-row {
  justify-content: space-between;
}

.image-drop {
  display: grid;
  min-height: 210px;
  overflow: hidden;
  place-items: center;
  border: 1.5px dashed #a8b8b5;
  border-radius: 8px;
  background: linear-gradient(135deg, #fbfcfa, #edf7f4);
}

.image-drop.is-dragging {
  border-color: var(--teal);
  background: var(--teal-soft);
}

.image-drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.image-empty {
  display: grid;
  justify-items: center;
  gap: 8px;
  color: var(--teal);
  font-weight: 800;
}

.image-empty svg {
  width: 2rem;
  height: 2rem;
}

.image-drop img {
  width: 100%;
  height: 100%;
  max-height: 330px;
  display: block;
  object-fit: contain;
  background: #fdfdfb;
}

.items-section {
  min-width: 0;
  padding-top: 16px;
}

.section-heading {
  margin-bottom: 14px;
}

.items-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.clip-card {
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.clip-head {
  padding: 12px 12px 0;
}

.kind-badge {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  color: var(--teal);
  background: var(--teal-soft);
}

.kind-badge.is-text {
  color: var(--leaf);
  background: #e7f3e8;
}

.clip-meta {
  min-width: 0;
  display: grid;
  gap: 3px;
  margin-right: auto;
}

.clip-meta strong,
.clip-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clip-meta strong {
  font-size: 0.96rem;
}

.clip-meta span {
  font-size: 0.82rem;
}

.delete-button {
  width: 36px;
  height: 36px;
  color: var(--rose);
}

.clip-content {
  min-height: 170px;
  padding: 12px;
}

.clip-text {
  width: 100%;
  max-height: 260px;
  overflow: auto;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fbfcfa;
  font: 0.92rem/1.5 Consolas, "SFMono-Regular", "Microsoft YaHei UI", monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.clip-image-frame {
  display: grid;
  min-height: 210px;
  overflow: hidden;
  place-items: center;
  border-radius: 8px;
  background: var(--amber-soft);
}

.clip-image-frame img {
  width: 100%;
  height: 100%;
  max-height: 300px;
  display: block;
  object-fit: contain;
}

.clip-actions {
  justify-content: space-between;
  padding: 0 12px 12px;
}

.copy-button {
  width: 100%;
  color: #fff;
  border-color: var(--leaf);
  background: var(--leaf);
}

.empty-state {
  min-height: 380px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
}

.empty-state svg {
  width: 3rem;
  height: 3rem;
  color: var(--amber);
}

.lock-screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  background:
    linear-gradient(135deg, rgba(244, 162, 97, 0.16), transparent 36%),
    var(--paper);
}

.lock-screen[hidden] {
  display: none;
}

.lock-panel {
  width: min(430px, 100%);
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
}

.lock-panel > svg {
  width: 2.2rem;
  height: 2.2rem;
  color: var(--teal);
}

.unlock-form {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.contact-link {
  color: var(--teal);
  font-weight: 800;
  text-decoration: none;
}

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

  .control-panel {
    position: static;
  }

  .items-section {
    padding-top: 4px;
  }
}

@media (max-width: 580px) {
  .app-shell {
    width: min(100% - 20px, 1220px);
    padding-top: 10px;
  }

  .topbar {
    align-items: flex-start;
  }

  .brand img {
    width: 40px;
    height: 40px;
  }

  .toolbar {
    gap: 6px;
  }

  .icon-button {
    width: 38px;
    height: 38px;
  }

  .button-row,
  .unlock-form {
    grid-template-columns: 1fr;
    display: grid;
  }

  .items-list {
    grid-template-columns: 1fr;
  }

  .settings-panel,
  .composer-panel {
    padding: 14px;
  }
}
