:root {
  --bg: #f7f6f4;
  --card: #ffffff;
  --text: #121212;
  --text-secondary: #6b6b6b;
  --border: #e8e6e3;
  --accent: #2f6fed;
  --accent-soft: #eef3ff;
  --success: #16a34a;
  --error: #dc2626;
  --warning: #f59e0b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app-shell {
  min-height: 100vh;
  padding: 0;
}

.phone-frame {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 16px;
}

.home-header {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 4px 0 24px;
}

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

.brand-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.brand-copy {
  display: grid;
  gap: 1px;
}

.brand-title {
  margin: 0;
  font-size: 22px;
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-tagline {
  margin: 0;
  font-size: 12px;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}

.storage-card,
.action-tile,
.result,
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

.storage-card {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 12px;
  align-items: start;
  padding: 20px;
}

.shield-badge {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-size: 18px;
}

.storage-main {
  margin: 2px 0 4px;
  font-size: 18px;
  line-height: 1.25;
  font-weight: 600;
}

.storage-sub {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-secondary);
}

.action-grid {
  display: grid;
  gap: 20px;
  margin-top: 24px;
}

.action-tile {
  padding: 24px;
}

.action-tile h2 {
  margin: 0 0 6px;
  font-size: 18px;
  line-height: 1.2;
  font-weight: 600;
}

.muted {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-secondary);
}

.stack {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

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

.file-picker {
  min-height: 56px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.file-picker:hover {
  border-color: var(--accent);
}

.file-picker:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.12);
}

.file-picker-btn {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: #f2f3f5;
  color: #1d1d1d;
  border: 1px solid #e2e3e6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
}

.file-picker-name {
  color: #626262;
  font-size: 14px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.segmented-control {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
  background: #f8f8f8;
  margin: 20px 0;
}

.expiry-chips {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.chip {
  min-height: 40px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #555;
  font-size: 14px;
  font-weight: 500;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.chip.active {
  background: var(--accent);
  color: #fff;
}

input,
button {
  width: 100%;
  font-size: 15px;
}

input {
  min-height: 52px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0 14px;
  color: var(--text);
  background: #fff;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

input::placeholder {
  color: #a1a1a1;
}

input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.12);
}

button {
  min-height: 52px;
  border: 0;
  border-radius: 14px;
  background: #1a1a1a;
  color: #fff;
  font-weight: 600;
  transition: transform 0.12s ease, opacity 0.12s ease;
}

button:active {
  transform: scale(0.97);
}

button.secondary {
  min-height: 44px;
  width: auto;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: #1a1a1a;
}

.action-receive button[type='submit'] {
  background: #2a2a2a;
}

.action-send button[type='submit'],
.action-receive button[type='submit'] {
  width: 70%;
  justify-self: center;
}

.status {
  min-height: 20px;
  margin: 14px 0 0;
  font-size: 12px;
  color: #555;
}

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

.status.success {
  color: var(--success);
}

.result {
  margin-top: 20px;
  padding: 18px;
  display: grid;
  gap: 10px;
}

.section-title {
  margin: 0 0 2px;
  font-size: 18px;
  line-height: 1.2;
  font-weight: 600;
}

label {
  font-size: 13px;
  line-height: 1.2;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: #515151;
  text-transform: uppercase;
}

.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
}

.code-wrap {
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fafafa;
  display: grid;
  align-items: center;
  text-align: center;
  padding: 0 12px;
  font-size: 18px;
  letter-spacing: 0.1em;
  font-weight: 600;
}

#qr-image {
  width: 100%;
  max-width: 220px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 8px;
}

.result-actions {
  display: flex;
  justify-content: flex-start;
}

.hidden {
  display: none !important;
}

.access-page .card {
  padding: 20px;
}

.access-page h1 {
  margin: 0 0 6px;
  font-size: 28px;
  line-height: 1.1;
  font-weight: 700;
}

.trust-line {
  margin-bottom: 8px;
}

#expires-info {
  margin-top: 4px;
}

@media (max-width: 420px) {
  .result .row {
    grid-template-columns: minmax(0, 1fr) auto;
  }
}

@media (min-width: 768px) {
  .phone-frame {
    max-width: 760px;
    padding: 24px 16px 36px;
  }
}
