:root {
  --bg: #f5f5f0;
  --card: #ffffff;
  --ink: #1a1a1a;
  --muted: #6b6b6b;
  --accent: #1f6f5c;
  --accent-hover: #175646;
  --warn: #b3541e;
  --danger: #a3342c;
  --border: #e2e0d8;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}

header h1 {
  font-size: 20px;
  margin: 0;
}

main {
  max-width: 640px;
  margin: 24px auto;
  padding: 0 16px;
}

.billing-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 16px;
  border-radius: 8px;
  background: #f0f4f2;
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
  flex-wrap: wrap;
}
.billing-banner:empty { display: none; }
.billing-banner button { margin-top: 0; }
.billing-ok { color: var(--accent); font-weight: 600; }
.billing-warn { color: var(--warn); font-weight: 600; }

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.tab {
  background: none;
  color: var(--muted);
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 10px 16px;
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.tab:hover { background: none; color: var(--ink); }

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
}

.card h2 {
  margin-top: 0;
  font-size: 16px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

label {
  display: block;
  margin-bottom: 12px;
  font-size: 14px;
  color: var(--muted);
}

input, select {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 15px;
  color: var(--ink);
  background: #fff;
}

button {
  background: var(--accent);
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  margin-top: 8px;
}

button:hover { background: var(--accent-hover); }
button:disabled { background: #bbb; cursor: not-allowed; }
button.secondary { background: #e2e0d8; color: var(--ink); }
button.secondary:hover { background: #d3d0c4; }

.row { display: flex; gap: 8px; align-items: center; }
.hidden { display: none !important; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.hint { font-size: 13px; color: var(--muted); }

#expRawText {
  white-space: pre-wrap;
  word-break: break-word;
  background: #f5f5f0;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
  font-size: 12px;
  max-height: 200px;
  overflow-y: auto;
}

#preview img, #expPreview img {
  max-width: 100%;
  max-height: 360px;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  margin: 10px 0;
  display: block;
}

.item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 10px;
  display: flex;
  gap: 12px;
  align-items: center;
}

.item-details { flex: 1; min-width: 0; }

.thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  flex-shrink: 0;
  display: block;
}

.thumb-empty {
  width: 56px;
  height: 56px;
  border-radius: 6px;
  border: 1px dashed var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--muted);
  text-align: center;
  padding: 4px;
}

.item .name { font-weight: 600; }
.item .meta { font-size: 13px; color: var(--muted); }
.item .days.soon { color: var(--warn); font-weight: 600; }
.item .days.expired { color: var(--danger); font-weight: 600; }
.item button { margin-top: 0; }

.share-card { text-align: center; }

.button-link {
  display: inline-block;
  background: #25D366;
  color: white;
  text-decoration: none;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 14px;
  margin-top: 8px;
}
.button-link:hover { background: #1ebd5a; }

.app-footer {
  max-width: 640px;
  margin: 0 auto 32px;
  padding: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  font-size: 13px;
}
.app-footer a {
  color: var(--muted);
  text-decoration: none;
}
.app-footer a:hover { color: var(--accent); text-decoration: underline; }

.item-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}
.item-actions button { margin-top: 0; }
