:root {
  color-scheme: light;
  --background: #f3f6f2;
  --surface: #fff;
  --ink: #182c27;
  --muted: #546961;
  --line: #d9e3dc;
  --accent: #176853;
  --accent-dark: #11513f;
  --tint: #e8f3eb;
  --soft: #f7f9f7;
  --danger: #9c332b;
  --danger-tint: #fff2ef;
  --radius: 16px;
  font-family: Inter, "PingFang SC", "Microsoft Yahei", system-ui, sans-serif;
  line-height: 1.5;
  font-size: 16px;
  font-synthesis: none;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: var(--background); color: var(--ink); }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.95rem, 4.5vw, 2.65rem); line-height: 1.2; font-weight: 730; letter-spacing: -.045em; }
h2 { font-size: 1.12rem; font-weight: 680; letter-spacing: -.025em; }
h3 { font-size: .93rem; font-weight: 680; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; font-synthesis: inherit; }
button, select { cursor: pointer; }
button:disabled, select:disabled { cursor: default; }
:focus-visible { outline: 3px solid #368e77; outline-offset: 3px; }
::selection { background: #c8e8d5; color: #0e382c; }

.shell { width: min(100% - 64px, 1120px); margin-inline: auto; }
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-inner { min-height: 68px; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.brand { display: inline-flex; gap: 10px; align-items: center; color: var(--ink); text-decoration: none; font-weight: 730; letter-spacing: -.025em; }
.brand { flex-shrink: 0; }
.account-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 2px 8px; min-width: 0; }
.account-name { max-width: 11rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: .85rem; }
.brand-mark, .login-mark {
  display: inline-grid; place-items: center; background: var(--accent); color: white;
  border-radius: 8px; width: 32px; height: 32px; font: 1.15rem / 1 system-ui, sans-serif;
}
.main { padding-block: clamp(28px, 5vw, 64px) 64px; }
.page-heading { margin-block-end: 24px; }
.page-heading p { margin-block-start: 9px; color: var(--muted); }
.inbox-grid { display: grid; grid-template-columns: minmax(300px, .8fr) minmax(0, 1.2fr); align-items: start; gap: 20px; }
.card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 3px 8px rgba(18, 48, 30, .045); min-width: 0; }
.compose { padding: 22px; }
.card-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.history-heading { padding: 20px 22px 16px; }
.history-heading p { margin-block-start: 3px; color: var(--muted); font-size: .83rem; }
.tab-list { display: flex; gap: 4px; margin-block: 15px 12px; padding: 4px; border-radius: 10px; background: var(--soft); border: 1px solid var(--line); }
.tab { flex: 1; min-height: 36px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: .9rem; font-weight: 620; }
.tab[aria-selected="true"] { color: var(--accent-dark); background: var(--surface); box-shadow: 0 1px 3px rgba(18, 48, 30, .15); }
.tab:hover { color: var(--ink); }

textarea, input:not([type="file"]), select {
  min-height: 42px; padding: 8px 11px; border: 1px solid #cddbd2;
  border-radius: 8px; background: var(--surface); color: var(--ink);
}
textarea { display: block; width: 100%; min-height: 163px; max-height: 65vh; resize: vertical; padding: 11px 13px; line-height: 1.58; }
textarea::placeholder { color: #64756e; }
select { font-size: .88rem; }
.form-footer { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 9px; margin-block-start: 14px; }
.select-field { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .85rem; font-weight: 560; }
.button {
  display: inline-flex; min-height: 40px; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 12px; border: 1px solid transparent; border-radius: 8px;
  font-weight: 650; font-size: .88rem; line-height: 1.34; text-align: center;
  text-decoration: none; white-space: nowrap;
}
.button-primary { background: var(--accent); color: white; padding-inline: 15px; }
.button-primary:hover:not(:disabled) { background: var(--accent-dark); }
.button-primary:disabled { background: #e2ebe5; color: #63766e; }
.button-secondary { background: var(--surface); border-color: #cddbd2; color: var(--accent-dark); }
.button-secondary:hover:not(:disabled) { border-color: #a3bea9; background: var(--tint); }
.button-quiet { color: var(--muted); background: transparent; }
.button-quiet:hover:not(:disabled) { color: var(--ink); background: var(--soft); }
.button-danger { color: var(--danger); }
.button-danger:hover:not(:disabled) { color: var(--danger); background: var(--danger-tint); }
.button-secondary:disabled, .button-quiet:disabled { opacity: .64; }

.drop-zone {
  min-height: 163px; padding: 14px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px;
  border: 1px dashed #abc5b2; border-radius: 10px; color: var(--muted);
  background: var(--soft); text-align: center;
}
.drop-zone.is-dragging, .drop-zone:focus-within { border-color: var(--accent); background: var(--tint); }
.upload-mark { display: grid; place-items: center; border-radius: 9px; width: 34px; height: 34px; background: var(--tint); color: var(--accent); font-size: 1.2rem; }
.file-label { color: var(--accent-dark); font-weight: 700; padding: 3px 7px; border-radius: 5px; cursor: pointer; }
.file-label:hover { text-decoration: underline; }
.drop-zone:focus-within .file-label { outline: 2px solid var(--accent); }
.drop-zone p { font-size: .8rem; }
.selected-files { margin-block-start: 9px; padding: 6px 8px 8px 11px; border: 1px solid var(--line); border-radius: 8px; font-size: .83rem; }
.selected-files-heading, .selected-files li { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.selected-files ul { list-style: none; margin: 0; padding: 0; max-height: 10rem; overflow: auto; }
.selected-files li { padding-block: 4px; border-top: 1px solid var(--line); }
.selected-files li > span { min-width: 0; overflow-wrap: anywhere; }
.selected-files small { flex-shrink: 0; color: var(--muted); }
.upload-progress { margin-block-start: 9px; color: var(--muted); font-size: .8rem; }
progress { display: block; width: 100%; margin-block-end: 3px; accent-color: var(--accent); }

.item-list { list-style: none; margin: 0; padding: 0; }
.item { border-top: 1px solid var(--line); padding: 15px 22px; display: grid; grid-template-columns: 2.15rem minmax(0, 1fr); gap: 11px; }
.kind-badge { width: 2.15rem; height: 2.15rem; border-radius: 8px; display: grid; place-items: center; font-size: .76rem; font-weight: 750; background: var(--tint); color: var(--accent-dark); }
.kind-badge.is-file { background: #ecf1f7; color: #26486b; }
.item-name { font-size: .96rem; font-weight: 690; overflow-wrap: anywhere; line-height: 1.35; }
.item-preview { margin-block-start: 4px; font-size: .82rem; overflow-wrap: anywhere; color: var(--muted); white-space: pre-wrap; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.item-preview-expanded { display: block; max-height: 50vh; overflow: auto; }
.item-meta { margin-block-start: 6px; color: var(--muted); font-size: .76rem; }
.item-actions { margin-block-start: 6px; display: flex; flex-wrap: wrap; column-gap: 3px; align-items: center; }
.item-actions .button { min-height: 36px; padding: 5px 8px; font-size: .79rem; }
.item-actions .button:first-child { margin-inline-start: -8px; }
.empty { padding: 22px; border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; }

.login-panel { max-width: 420px; margin: clamp(16px, 7vh, 64px) auto 0; padding: clamp(22px, 6vw, 36px); }
.login-mark { width: 40px; height: 40px; margin-block-end: 16px; }
.login-panel h1 { margin-block-end: 20px; font-size: 1.7rem; }
.login-panel form { display: grid; gap: 12px; }
.login-field { display: grid; gap: 6px; min-width: 0; }
.login-panel label, .share-result label { font-size: .86rem; font-weight: 670; }
.login-panel .button { margin-block-start: 6px; }
.login-panel .auth-switch { margin-block-start: 12px; margin-inline-start: -12px; }
.field-hint { color: var(--muted); font-size: .82rem; overflow-wrap: anywhere; }
.notice, .error { color: var(--muted); font-size: .88rem; }
.error { color: var(--danger); margin-block-start: 9px; overflow-wrap: anywhere; }
.history .notice { margin: 0 22px 14px; }

.dialog { margin: auto; padding: 20px; width: min(520px, calc(100% - 30px)); max-height: calc(100% - 30px); color: var(--ink); border: 1px solid var(--line); border-radius: 15px; background: var(--surface); box-shadow: 0 12px 48px rgba(16, 40, 30, .17); }
.inline-feedback { margin-block-start: 8px; color: var(--accent-dark); font-size: .84rem; }
.dialog::backdrop { background: rgba(18, 43, 34, .46); }
.dialog-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.dialog-heading p, .share-info, .share-result p, .share-history p { color: var(--muted); font-size: .84rem; overflow-wrap: anywhere; }
.share-info { margin-block: 12px; }
.share-form { display: flex; flex-wrap: wrap; gap: 9px; justify-content: space-between; }
.share-result { margin-block-start: 12px; padding: 10px; border-radius: 8px; background: var(--tint); }
.share-url-row { display: flex; gap: 7px; margin-block: 5px 4px; }
.share-url-row input { min-width: 0; flex: 1; font-size: .8rem; }
.share-history { border-top: 1px solid var(--line); padding-block-start: 12px; margin-block-start: 15px; }
.share-history p { margin-block-start: 4px; }
.share-list { list-style: none; padding: 0; margin: 6px 0 0; }
.share-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 3px 0; color: var(--muted); font-size: .82rem; }

.management-dialog { width: min(680px, calc(100% - 30px)); }
.management-section { margin-block-start: 16px; border-top: 1px solid var(--line); padding-block-start: 14px; }
.management-section > .field-hint { margin-block-start: 6px; }
.management-list { display: grid; list-style: none; margin: 4px 0 0; padding: 0; }
.management-list > li { padding-block: 8px; min-width: 0; }
.management-list > li + li { border-top: 1px solid var(--line); }
.management-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 12px; }
.management-row > div { min-width: 0; }
.management-row .management-label { font-size: .9rem; font-weight: 650; overflow-wrap: anywhere; }
.management-actions { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.management-actions .button { min-height: 36px; font-size: .81rem; }
.new-invite-code { display: block; width: 100%; margin-block: 4px; font-size: .83rem; }
#new-invite .management-actions { margin-block-start: 7px; }
.member-content { margin-block-start: 5px; }
.member-content summary { cursor: pointer; color: var(--accent-dark); font-size: .82rem; }
.member-content .shared-text { margin: 5px 0 0; max-height: 42vh; overflow: auto; font-size: .82rem; }

.shared-main { max-width: 700px; }
.shared-card { padding: clamp(20px, 5vw, 34px); }
.shared-card h1 { font-size: clamp(1.4rem, 6vw, 2rem); overflow-wrap: anywhere; }
.shared-meta { margin-block: 8px 17px; font-size: .9rem; color: var(--muted); }
.shared-text { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 14px; padding: 13px; border: 1px solid var(--line); border-radius: 8px; background: var(--soft); font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: .915rem; line-height: 1.52; }
.feedback { position: fixed; z-index: 3; right: clamp(12px, 5vw, 32px); bottom: clamp(12px, 4vw, 27px); max-width: calc(100% - 24px); padding: 9px 13px; border-radius: 8px; background: #1d3d32; color: white; box-shadow: 0 3px 12px rgba(14, 34, 25, .18); font-size: .875rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 760px) {
  .shell { width: min(100% - 36px, 620px); }
  .inbox-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .header-inner { min-height: 60px; }
}
@media (max-width: 410px) {
  .shell { width: calc(100% - 24px); }
  .header-inner { gap: 8px; }
  .account-actions { gap: 0 2px; padding-block: 3px; }
  .account-actions .button { min-height: 36px; padding-inline: 7px; font-size: .81rem; }
  .account-name { max-width: 5rem; }
  .compose, .history-heading { padding-inline: 15px; }
  .item { padding-inline: 15px; }
  .share-url-row { flex-wrap: wrap; }
  .share-url-row input { width: 100%; flex-basis: 100%; }
}
