:root {
  color-scheme: light;
  --paper: #f5f2ec;
  --paper-deep: #e9e3da;
  --ink: #1d1c19;
  --quiet: #706a62;
  --line: rgba(44, 41, 37, 0.18);
  --accent: #b44432;
  --accent-dark: #7f2d23;
  font-family:
    -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic UI",
    "Yu Gothic", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background:
    radial-gradient(circle at 15% 0, rgba(180, 68, 50, 0.08), transparent 34%),
    var(--paper);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.portal-shell {
  width: min(100% - 32px, 1040px);
  margin: 0 auto;
}

.portal-header {
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
}

.portal-brand {
  display: grid;
  gap: 2px;
  color: inherit;
  text-decoration: none;
}

.portal-brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.portal-brand-impression {
  display: block;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  object-fit: contain;
}

.portal-brand-wordmark {
  display: block;
  width: 96px;
  height: auto;
  flex: 0 0 auto;
  object-fit: contain;
}

.portal-brand-system,
.portal-user {
  color: var(--quiet);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.portal-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.portal-main {
  display: grid;
  min-height: calc(100dvh - 76px);
  place-items: center;
  padding: 40px 0 70px;
}

.login-card,
.admin-card {
  width: min(100%, 460px);
  padding: clamp(24px, 6vw, 42px);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 22px 80px rgba(49, 40, 34, 0.1);
}

.portal-kicker {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.login-card h1,
.admin-heading h1 {
  margin: 0;
  font-size: clamp(27px, 7vw, 42px);
  line-height: 1.25;
  letter-spacing: -0.04em;
}

.portal-lead {
  margin: 14px 0 0;
  color: var(--quiet);
  font-size: 13px;
  line-height: 1.8;
}

.portal-form {
  display: grid;
  gap: 14px;
  margin-top: 28px;
}

.portal-form label,
.field {
  display: grid;
  gap: 7px;
  font-size: 12px;
  font-weight: 800;
}

.field small {
  color: var(--quiet);
  font-size: 10px;
  font-weight: 500;
  line-height: 1.55;
}

.portal-form input,
.portal-form select,
.portal-form textarea,
.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 46px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
  background: white;
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
}

.portal-form textarea,
.field textarea {
  min-height: 86px;
  resize: vertical;
}

.portal-form input:focus,
.portal-form select:focus,
.portal-form textarea:focus,
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(180, 68, 50, 0.12);
}

.primary-button,
.secondary-button,
.danger-button,
.text-button {
  display: inline-grid;
  min-height: 44px;
  place-items: center;
  padding: 0 15px;
  border: 0;
  border-radius: 11px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.primary-button {
  background: var(--accent);
  color: white;
}

.secondary-button {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
}

.danger-button {
  background: #f7e5e2;
  color: #9b3528;
}

.text-button {
  min-height: 36px;
  padding: 0 8px;
  background: transparent;
  color: var(--quiet);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.portal-status {
  min-height: 20px;
  margin: 15px 0 0;
  color: var(--quiet);
  font-size: 12px;
  line-height: 1.6;
}

.portal-status.is-error {
  color: #a2392d;
}

.login-mail-note {
  margin: 10px 0 0;
  color: var(--quiet);
  font-size: 10px;
  line-height: 1.7;
}

.local-preview-panel {
  display: grid;
  gap: 10px;
  margin-top: 24px;
  padding: 16px;
  border: 1px dashed rgba(180, 68, 50, 0.36);
  border-radius: 14px;
  background: rgba(180, 68, 50, 0.05);
}

.local-preview-panel p {
  margin: 0;
  color: var(--quiet);
  font-size: 11px;
  line-height: 1.7;
}

.local-preview-actions,
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

[hidden] {
  display: none !important;
}

.admin-main {
  padding: 34px 0 80px;
}

.admin-preview-note {
  margin-top: 24px;
}

.admin-global-status {
  margin-top: 24px;
}

.admin-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

.admin-heading h1 {
  font-size: clamp(29px, 5vw, 48px);
}

.admin-heading-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.project-list {
  display: grid;
  gap: 9px;
  margin-top: 28px;
}

.project-list-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  width: 100%;
  min-height: 74px;
  align-items: center;
  gap: 14px;
  padding: 14px 17px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  box-shadow: 0 8px 30px rgba(49, 40, 34, 0.04);
}

.project-list-row:hover {
  border-color: rgba(180, 68, 50, 0.36);
  background: rgba(255, 255, 255, 0.9);
}

.project-list-row > span:first-child {
  display: grid;
  min-width: 0;
}

.project-list-row strong {
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-list-row > i {
  color: var(--quiet);
  font-family: Georgia, serif;
  font-size: 30px;
  font-style: normal;
  font-weight: 300;
  line-height: 1;
}

.project-detail-view {
  margin-top: 26px;
}

.detail-back-button {
  min-height: 42px;
  margin: 0 0 12px;
  padding: 0 6px;
  border: 0;
  background: transparent;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.admin-card {
  width: 100%;
  padding: 24px;
}

.project-card-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
}

.project-card-header h2 {
  margin: 0;
  font-size: 21px;
}

.project-card-header p {
  margin: 5px 0 0;
  color: var(--quiet);
  font-size: 11px;
}

.status-badge {
  flex: 0 0 auto;
  padding: 6px 9px;
  border-radius: 999px;
  background: #e9e6e1;
  color: #615d57;
  font-size: 10px;
  font-weight: 900;
}

.status-badge.is-active {
  background: #e1f1e4;
  color: #2e7040;
}

.status-badge.is-shooting {
  background: #f7e3df;
  color: #963828;
}

.status-badge.is-expired {
  background: #e5e4e3;
  color: #686460;
}

.project-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.project-fields .field.is-wide {
  grid-column: 1 / -1;
}

.project-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 18px;
}

.project-meta div {
  padding: 11px;
  border-radius: 10px;
  background: var(--paper);
}

.project-meta dt {
  color: var(--quiet);
  font-size: 9px;
  font-weight: 800;
}

.project-meta dd {
  margin: 5px 0 0;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.5;
}

.project-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.empty-state {
  padding: 38px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  color: var(--quiet);
  text-align: center;
}

.access-denied {
  width: min(100%, 520px);
  margin: 48px auto 0;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
  text-align: center;
}

.access-denied h2 {
  margin: 0;
  font-size: 24px;
}

.access-denied p:not(.portal-kicker) {
  margin: 12px 0 22px;
  color: var(--quiet);
  font-size: 13px;
  line-height: 1.7;
}

.dialog {
  width: min(calc(100% - 28px), 520px);
  padding: 0;
  border: 0;
  border-radius: 22px;
  background: white;
  box-shadow: 0 22px 90px rgba(0, 0, 0, 0.28);
}

.dialog::backdrop {
  background: rgba(20, 18, 17, 0.5);
  backdrop-filter: blur(4px);
}

.dialog form {
  display: grid;
  gap: 15px;
  padding: 24px;
}

.dialog h2 {
  margin: 0;
  font-size: 23px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 5px;
}

@media (max-width: 640px) {
  .portal-header,
  .admin-heading,
  .project-card-header {
    align-items: stretch;
    flex-direction: column;
  }

  .portal-header {
    justify-content: center;
  }

  .portal-user,
  .admin-heading-actions {
    justify-content: flex-start;
  }

  .admin-heading-actions > button {
    flex: 1 1 140px;
  }

  .project-list-row {
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 9px;
    padding: 13px;
  }

  .project-fields,
  .project-meta {
    grid-template-columns: 1fr;
  }

  .project-fields .field.is-wide {
    grid-column: auto;
  }
}
