:root {
  color-scheme: light;
  --bg: #fafafa;
  --surface: #ffffff;
  --ink: #18181b;
  --text: #3f3f46;
  --muted: #71717a;
  --faint: #a1a1aa;
  --line: #e4e4e7;
  --line-strong: #d4d4d8;
  --blue: #2563eb;
  --red: #dc2626;
  font-family: "Aptos", "SF Pro Text", "Segoe UI Variable", "Segoe UI", ui-sans-serif, system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

input[readonly] {
  background: #f4f4f5;
  color: var(--muted);
}

label small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
}

.code-field input {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.34em;
  text-align: center;
  font-size: 18px;
  font-weight: 700;
}

.password-control {
  position: relative;
  display: block;
}

.password-control input {
  padding-right: 62px;
}

.input-action {
  position: absolute;
  top: 50%;
  right: 10px;
  min-width: 42px;
  min-height: 30px;
  border: 0;
  border-radius: 6px;
  padding: 0 6px;
  transform: translateY(-50%);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.input-action:hover,
.input-action:focus-visible {
  background: #f4f4f5;
  color: var(--ink);
}

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-stack {
  width: 100%;
  max-width: 388px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.auth-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(24, 24, 27, 0.04);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  align-self: center;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 650;
  letter-spacing: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #18181b;
  color: #fff;
  font-size: 11px;
  font-weight: 750;
}

.card-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  text-align: center;
}

h1 {
  margin: 0;
  color: var(--ink);
  font-size: 22px;
  line-height: 1.2;
  font-weight: 700;
}

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

.mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f4f4f5;
}

.mode-tab {
  border: 0;
  border-radius: 7px;
  padding: 8px 10px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.mode-tab.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(24, 24, 27, 0.08);
}

.auth-form {
  display: grid;
  gap: 14px;
}

.google-signin {
  display: grid;
  justify-content: center;
  min-height: 40px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
}

input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 11px;
  color: var(--ink);
  background: #fff;
  outline: none;
  font-size: 14px;
}

input:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(24, 24, 27, 0.1);
}

.primary {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.primary:hover {
  background: #27272a;
}

.primary:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.secondary-actions {
  min-height: 20px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 16px;
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
}

.link-button:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.link-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.notice,
.dev-link {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #f9fafb;
  font-size: 14px;
  line-height: 1.45;
}

.notice.error {
  border-color: rgba(220, 38, 38, 0.24);
  background: #fff6f6;
  color: var(--red);
}

.dev-link a {
  display: block;
  margin-top: 6px;
  color: var(--blue);
  font-weight: 600;
}

.dev-link strong {
  display: block;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
}

.policy-note {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

.admin-shell {
  min-height: 100vh;
  padding: 22px;
}

.admin-header,
.admin-panel {
  max-width: 1040px;
  margin: 0 auto;
}

.admin-header {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-link {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.admin-link:hover {
  color: var(--ink);
}

.admin-panel {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(24, 24, 27, 0.04);
  overflow: hidden;
}

.admin-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 22px;
  border-bottom: 1px solid var(--line);
}

.tenant-control {
  width: 180px;
}

.admin-toolbar {
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
}

.secondary,
.table-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 0 12px;
}

.secondary:hover,
.table-button:hover {
  background: #f4f4f5;
}

.status-text {
  color: var(--muted);
  font-size: 13px;
}

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

.user-table-wrap {
  overflow-x: auto;
}

.user-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.user-table th,
.user-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.user-table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.user-table td strong,
.user-table td small {
  display: block;
}

.user-table td strong {
  color: var(--ink);
  font-size: 13px;
}

.user-table td small {
  margin-top: 3px;
  color: var(--faint);
  font-size: 12px;
}

.table-actions {
  display: flex;
  gap: 8px;
}

@media (max-width: 860px) {
  .auth-shell {
    align-items: flex-start;
    padding-top: 42px;
  }

  .auth-card {
    padding: 20px;
  }

  .admin-title-row {
    flex-direction: column;
  }

  .tenant-control {
    width: 100%;
  }
}
