:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #f6f3ee;
  --surface: #ffffff;
  --surface-soft: #faf8f4;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e0d8;
  --accent: #1f2937;
  --accent-soft: #ece7de;
  --danger: #b91c1c;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: var(--bg) !important;
  color: var(--ink) !important;
  -webkit-user-select: none;
  user-select: none;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(246, 243, 238, 0.88)),
    radial-gradient(circle at 8% 0%, rgba(31, 41, 55, 0.06), transparent 34%);
}

img {
  -webkit-user-drag: none;
  pointer-events: none;
}

button,
a,
input,
textarea,
select {
  pointer-events: auto;
}

@media print {
  body * {
    display: none !important;
  }

  body::before {
    content: "この保護資料は印刷できません";
    display: block !important;
    padding: 48px;
    color: #000;
    background: #fff;
    font-size: 24px;
  }
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--line);
  background: rgba(250, 248, 244, 0.92);
  backdrop-filter: blur(18px);
}

.app-nav {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-mark,
.login-mark {
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
}

.brand-mark {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 0.9rem;
}

.nav-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
  font-size: 0.875rem;
}

.user-chip {
  display: none;
  color: var(--muted);
}

.nav-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--ink);
  padding: 0.55rem 0.85rem;
  text-decoration: none;
  font-weight: 700;
}

@media (min-width: 760px) {
  .user-chip {
    display: inline;
  }
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
}

.login-card {
  width: min(100%, 440px);
  border: 1px solid var(--line);
  border-radius: 1.5rem;
  background: rgba(255, 255, 255, 0.9);
  padding: 2rem;
  box-shadow: 0 24px 70px rgba(31, 41, 55, 0.12);
}

.login-heading {
  margin-bottom: 1.8rem;
  text-align: left;
}

.login-mark {
  width: 3rem;
  height: 3rem;
  margin-bottom: 1.1rem;
  border-radius: 1rem;
}

.login-heading h1,
.page-heading h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 900;
  letter-spacing: -0.055em;
}

.login-heading p:not(.eyebrow) {
  margin: 0.65rem 0 0;
  color: var(--muted);
  line-height: 1.8;
}

.eyebrow {
  margin: 0 0 0.4rem;
  color: #7c6f5f !important;
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.field-label {
  display: grid;
  gap: 0.45rem;
  margin-bottom: 1rem;
  color: #374151;
  font-size: 0.875rem;
  font-weight: 800;
}

.input,
.file-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  background: #fff;
  color: var(--ink);
  padding: 0.85rem 0.95rem;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.input:focus,
.file-input:focus {
  border-color: #9ca3af;
  box-shadow: 0 0 0 4px rgba(31, 41, 55, 0.07);
}

.file-input::file-selector-button {
  margin-right: 1rem;
  border: 0;
  border-radius: 0.7rem;
  background: var(--accent);
  color: #fff;
  padding: 0.55rem 0.8rem;
  font-weight: 800;
}

.primary-button,
.secondary-button,
.danger-button,
.tab-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.9rem;
  padding: 0.78rem 1rem;
  font-weight: 850;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, border-color 160ms ease;
}

.primary-button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  box-shadow: 0 16px 36px rgba(17, 24, 39, 0.16);
}

.primary-button:hover,
.secondary-button:hover,
.danger-button:hover,
.tab-button:hover,
.nav-button:hover {
  transform: translateY(-1px);
}

.secondary-button,
.tab-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.75);
  color: var(--ink);
}

.tab-button.active {
  border-color: #1f2937;
  background: #1f2937;
  color: #fff;
}

.danger-button {
  background: #fff5f5;
  color: var(--danger);
  border: 1px solid #fecaca;
  padding: 0.55rem 0.8rem;
  font-size: 0.8rem;
}

.demo-account-box,
.info-note {
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--surface-soft);
  color: var(--muted);
}

.demo-account-box {
  display: grid;
  gap: 0.2rem;
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  font-size: 0.84rem;
}

.demo-account-box strong {
  color: var(--ink);
}

.page-heading {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
}

.info-note {
  padding: 0.9rem 1rem;
  font-size: 0.875rem;
}

@media (min-width: 860px) {
  .page-heading {
    flex-direction: row;
    align-items: flex-end;
  }
}

.panel {
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  background: rgba(255, 255, 255, 0.82);
  padding: 1.35rem;
  box-shadow: 0 20px 54px rgba(31, 41, 55, 0.08);
}

.section-title {
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.badge-green,
.badge-yellow,
.badge-cyan,
.badge-slate {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.35rem 0.62rem;
  font-size: 0.74rem;
  font-weight: 850;
}

.badge-green {
  color: #166534;
  background: #dcfce7;
}

.badge-yellow {
  color: #92400e;
  background: #fef3c7;
}

.badge-cyan,
.badge-slate {
  color: #374151;
  background: #f3f4f6;
}

.document-card {
  display: block;
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  background: rgba(255, 255, 255, 0.82);
  padding: 1.35rem;
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 18px 46px rgba(31, 41, 55, 0.07);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.document-card:hover {
  transform: translateY(-3px);
  border-color: #c8c0b5;
  box-shadow: 0 26px 64px rgba(31, 41, 55, 0.12);
}

.viewer-security-bar {
  position: sticky;
  top: 73px;
  z-index: 35;
  display: flex;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
  background: rgba(250, 248, 244, 0.92);
  color: var(--ink);
  padding: 0.8rem 1rem;
  backdrop-filter: blur(14px);
}

.protected-viewer {
  display: grid;
  gap: 2rem;
  max-width: 1060px;
  margin: 0 auto;
  padding: 2rem 1rem 5rem;
}

.page-frame {
  border-radius: 1rem;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 24px 70px rgba(31, 41, 55, 0.12);
}

.page-toolbar {
  display: flex;
  justify-content: center;
  border-bottom: 1px solid var(--line);
  background: #fbfaf8;
  color: var(--muted);
  padding: 0.7rem 1rem;
  font-size: 0.8rem;
  font-weight: 800;
}

.page-image-wrap {
  position: relative;
  overflow: hidden;
  background: #fff;
}

.page-image-wrap img {
  display: block;
  width: 100%;
  height: auto;
}

.watermark-grid {
  position: absolute;
  inset: -10%;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(6, minmax(170px, 1fr));
  gap: 48px 30px;
  opacity: 0.23;
  transform: rotate(-24deg);
  pointer-events: none;
  mix-blend-mode: multiply;
}

.watermark-grid span {
  color: rgba(17, 24, 39, 0.68);
  font-size: clamp(0.78rem, 1.4vw, 1.12rem);
  font-weight: 900;
  white-space: nowrap;
  text-transform: none;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
}

#security-flash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background: rgba(17, 24, 39, 0.84);
  color: #fff;
  font-size: clamp(2rem, 6vw, 5rem);
  font-weight: 900;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
}

#security-flash.show {
  opacity: 1;
}

::-webkit-scrollbar {
  width: 12px;
}

::-webkit-scrollbar-track {
  background: #eee9e1;
}

::-webkit-scrollbar-thumb {
  border: 3px solid #eee9e1;
  border-radius: 999px;
  background: #b8afa3;
}

/* Compact radius overrides requested for a cleaner, less bubbly interface */
.rounded-xl,
.rounded-2xl,
.rounded-3xl {
  border-radius: 0.7rem !important;
}

.login-card,
.panel,
.document-card,
.page-frame,
.input,
.file-input,
.primary-button,
.secondary-button,
.danger-button,
.tab-button,
.nav-button,
.demo-account-box,
.info-note {
  border-radius: 0.7rem;
}

.share-result-box {
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  background: var(--surface-soft);
  padding: 0.9rem;
  color: var(--ink);
}

.copy-url-button {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  background: #fff;
  color: var(--muted);
  padding: 0.65rem;
  overflow-wrap: anywhere;
  text-align: left;
  font-size: 0.82rem;
}

.share-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  background: rgba(255, 255, 255, 0.72);
  padding: 1rem;
  margin-bottom: 0.8rem;
}

.share-card h3 {
  margin: 0 0 0.25rem;
  font-weight: 850;
  color: var(--ink);
}

.share-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.share-url {
  margin-top: 0.55rem !important;
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem !important;
}

.share-actions {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.84rem;
}

.data-table th {
  color: var(--muted);
  font-weight: 800;
  padding: 0 0.75rem 0.7rem 0;
}

.data-table td {
  border-top: 1px solid var(--line);
  padding: 0.8rem 0.75rem 0.8rem 0;
  vertical-align: top;
}

.data-table p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.75rem;
}

@media (max-width: 720px) {
  .app-nav {
    align-items: flex-start;
    flex-direction: column;
    padding: 0.85rem 1rem;
  }

  .nav-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .login-page {
    align-items: start;
    padding: 1rem;
  }

  .login-card {
    margin-top: 1rem;
    padding: 1.15rem;
  }

  .login-heading h1,
  .page-heading h1 {
    font-size: 2rem;
  }

  .panel {
    padding: 1rem;
  }

  .viewer-security-bar {
    top: 92px;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .share-security-bar .ml-auto,
  .viewer-security-bar .ml-auto {
    margin-left: 0 !important;
  }

  .protected-viewer {
    gap: 1rem;
    padding: 1rem 0.55rem 3rem;
  }

  .watermark-grid {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
    gap: 38px 24px;
  }

  .share-card {
    grid-template-columns: 1fr;
  }

  .share-actions {
    width: 100%;
  }

  .share-actions button {
    flex: 1;
  }
}
