/* Rakusite — Auth & Account pages (AIBOW-style) */

:root {
  --primary: #F97316;
  --primary-dark: #C2410C;
  --accent: #431407;
  --bg: #FFFBF7;
  --surface: #ffffff;
  --border: #FED7AA;
  --text: #222222;
  --muted: #777777;
  --font-sans: "Noto Sans JP", sans-serif;
  --radius: 12px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.06);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body.auth-body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  line-height: 1.7;
}

.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px 48px;
}

.auth-logo {
  display: inline-block;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.1em;
  color: var(--text);
  text-decoration: none;
  margin-bottom: 28px;
}

.auth-logo span {
  color: var(--primary);
  font-weight: 500;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px 32px 32px;
}

.auth-card h1 {
  font-size: 1.35rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 8px;
}

.auth-lead {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 28px;
}

.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.auth-tab {
  flex: 1;
  padding: 10px 12px;
  border: none;
  background: var(--bg);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.auth-tab.is-active {
  background: var(--surface);
  color: var(--primary);
  font-weight: 700;
  box-shadow: inset 0 -2px 0 var(--primary);
}

.auth-google-wrap {
  margin-bottom: 20px;
  min-height: 44px;
  display: flex;
  justify-content: center;
}

.auth-google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.auth-google-btn:hover:not(:disabled) {
  background: #fafafa;
  border-color: #ccc;
}

.auth-google-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.auth-google-btn img {
  width: 20px;
  height: 20px;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 0.8rem;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-form .form-row {
  margin-bottom: 16px;
}

.auth-form label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 6px;
}

.auth-form input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.15s;
}

.auth-form input:focus {
  outline: none;
  border-color: var(--primary);
}

.auth-submit {
  width: 100%;
  margin-top: 8px;
  padding: 13px 16px;
  border: none;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}

.auth-submit:hover:not(:disabled) {
  background: var(--primary-dark);
}

.auth-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.auth-error {
  margin-top: 16px;
  padding: 10px 14px;
  border-radius: 8px;
  background: #fef2f2;
  color: #b91c1c;
  font-size: 0.85rem;
  display: none;
}

.auth-error.is-visible {
  display: block;
}

.auth-footer {
  margin-top: 24px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}

.auth-footer a {
  color: var(--primary);
  font-weight: 500;
}

/* Account dashboard */
.account-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.account-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.account-header__nav {
  display: flex;
  align-items: center;
  gap: 16px;
}

.account-header__user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
}

.account-header__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg);
}

.account-header__avatar--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
}

.account-main {
  flex: 1;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

.account-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.account-hero h1 {
  font-size: 1.5rem;
  font-weight: 700;
}

.account-hero p {
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: 4px;
}

.account-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: none;
  transition: background 0.15s, color 0.15s;
}

.account-btn--primary {
  background: var(--primary);
  color: #fff;
}

.account-btn--primary:hover {
  background: var(--primary-dark);
}

.account-btn--ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.account-btn--ghost:hover {
  background: var(--bg);
  color: var(--text);
}

.account-btn--danger {
  background: transparent;
  color: var(--accent);
  border: 1px solid #f5d0cb;
}

.account-btn--danger:hover {
  background: #fef2f2;
}

.account-sites {
  display: grid;
  gap: 16px;
}

.account-site-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-wrap: wrap;
}

.account-site-card__title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.account-site-card__meta {
  font-size: 0.85rem;
  color: var(--muted);
}

.account-site-card__meta a {
  color: var(--primary);
  text-decoration: none;
}

.account-site-card__meta a:hover {
  text-decoration: underline;
}

.account-site-card__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.account-empty {
  text-align: center;
  padding: 48px 24px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
}

.account-empty p {
  margin-bottom: 20px;
}

.account-loading {
  text-align: center;
  padding: 48px;
  color: var(--muted);
}

@media (max-width: 600px) {
  .auth-card {
    padding: 28px 20px 24px;
  }

  .account-site-card {
    flex-direction: column;
  }
}

/* Admin dashboard */
.admin-main {
  max-width: 920px;
}

.admin-panel--hidden {
  display: none;
}

.admin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 24px;
  margin-bottom: 20px;
}

.admin-card h2 {
  font-size: 1.1rem;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-card--danger {
  border-color: #f0c4bc;
}

.admin-lead {
  color: var(--muted);
  font-size: 0.92rem;
  margin-bottom: 18px;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.admin-stat {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 14px;
  text-align: center;
}

.admin-stat--wide {
  grid-column: 1 / -1;
  text-align: left;
}

.admin-stat__value {
  display: block;
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.2;
}

.admin-stat__label {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 4px;
}

.admin-stat__meta {
  display: block;
  margin-top: 6px;
  font-size: 0.9rem;
}

.admin-stat__meta.is-ok { color: #2f7d4b; }
.admin-stat__meta.is-bad { color: var(--accent); }

.admin-alert {
  padding: 16px 18px;
  border-radius: 10px;
  font-size: 0.92rem;
}

.admin-alert--warn {
  background: #fff8e8;
  border: 1px solid #ecd9a8;
  color: #6a5520;
}

.admin-alert code {
  font-size: 0.85em;
}

.account-btn--danger {
  background: var(--accent);
  color: #fff;
  border: none;
}

.account-btn--danger:hover {
  background: #c94d3d;
}

.admin-restore-form {
  display: grid;
  gap: 14px;
  max-width: 420px;
}

.admin-file-label,
.admin-confirm-label {
  display: grid;
  gap: 8px;
  font-size: 0.9rem;
}

.admin-file-label input[type="file"],
.admin-confirm-label input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  background: #fff;
}

.admin-status {
  margin-top: 14px;
  font-size: 0.9rem;
  color: var(--muted);
  min-height: 1.4em;
}

.admin-status--ok { color: #2f7d4b; }
.admin-status--error { color: var(--accent); }

@media (max-width: 720px) {
  .admin-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
