:root {
  --bg: #f5f5f5;
  --surface: #ffffff;
  --text: #222222;
  --muted: #767676;
  --disabled: #9f9f9f;
  --border: #d0d0d0;
  --border-subtle: #e9e9e9;

  --accent: #8629cc;
  --accent-hover: #a528ff;
  --accent-pressed: #6800b3;
  --accent-bg: #f8f0ff;
  --accent-border: #ca80ff;

  --danger-bg: #f2dbd9;
  --danger-text: #b20f00;
  --danger-strong: #e31300;

  --warn-bg: #fdf1dc;
  --warn-text: #cc6e00;
  --warn-strong: #f2920d;

  --ok-bg: #dfece3;
  --ok-text: #0d732e;
  --ok-strong: #1ab24c;

  --info-bg: #ebf0fa;
  --info-text: #22448b;
  --info-strong: #3b6fd4;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1420;
    --surface: #241b2e;
    --text: #f2eafb;
    --muted: #b8aec4;
    --disabled: #7d7488;
    --border: #3a2f47;
    --border-subtle: #2c2436;

    --accent: #a528ff;
    --accent-hover: #b464ff;
    --accent-pressed: #8629cc;
    --accent-bg: #2a1f38;
    --accent-border: #6800b3;

    --danger-bg: #3a1c1e;
    --danger-text: #ff8f93;
    --danger-strong: #e31300;

    --warn-bg: #3a2f14;
    --warn-text: #f0c46a;
    --warn-strong: #f2920d;

    --ok-bg: #163523;
    --ok-text: #7fe0a0;
    --ok-strong: #1ab24c;

    --info-bg: #1c2a3f;
    --info-text: #9dbcf0;
    --info-strong: #3b6fd4;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

header {
  padding: 2rem 1.5rem 1rem;
  max-width: 960px;
  margin: 0 auto;
}

header h1 {
  margin: 0 0 0.4rem;
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.2;
}

header p {
  margin: 0;
  color: var(--muted);
}

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
}

#check-form {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
}

.field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--muted);
}

input[type="text"],
textarea {
  width: 100%;
  padding: 0.6rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  resize: vertical;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

input[type="text"] {
  height: 2.5rem;
}

input[type="text"]:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}

input[type="file"] {
  color: var(--text);
}

button {
  cursor: pointer;
  border: none;
  border-radius: 8px;
  height: 2.5rem;
  padding: 0 1.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1rem;
}

#submit-btn {
  background: var(--accent);
  color: white;
  align-self: flex-start;
}

#submit-btn:hover:not(:disabled) {
  background: var(--accent-hover);
}

#submit-btn:active:not(:disabled) {
  background: var(--accent-pressed);
}

#submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.status-line {
  margin-top: 1rem;
  color: var(--muted);
}

.hidden {
  display: none !important;
}

.summary {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.summary .stat {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  min-width: 120px;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.summary .stat .value {
  font-size: 1.4rem;
  font-weight: 700;
}

.summary .stat .label {
  font-size: 0.8rem;
  color: var(--muted);
}

.summary .stat.active .value { color: var(--danger-text); }
.summary .stat.inactive .value { color: var(--ok-text); }
.summary .stat.indeterminate .value { color: var(--warn-text); }

.table-toolbar {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.table-toolbar input,
.table-toolbar select {
  height: 2.5rem;
  padding: 0 1rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

#export-btn {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  margin-left: auto;
}

#export-btn:hover {
  border-color: var(--accent-border);
  color: var(--accent);
}

.table-wrapper {
  overflow-x: auto;
  margin-top: 1rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
}

th, td {
  padding: 0.5rem 1.5rem;
  text-align: left;
  font-size: 1rem;
  white-space: nowrap;
}

th {
  cursor: pointer;
  background: var(--bg);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  user-select: none;
}

td {
  border-bottom: 1px solid var(--border-subtle);
}

tbody tr:hover td {
  background: var(--bg);
}

tbody tr:last-child td {
  border-bottom: none;
}

td.detail-cell {
  white-space: normal;
  max-width: 320px;
  color: var(--muted);
}

.badge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge.active {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.badge.inactive {
  background: var(--ok-bg);
  color: var(--ok-text);
}

.badge.indeterminate {
  background: var(--warn-bg);
  color: var(--warn-text);
}

.user-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}

.logout-link {
  font-size: 0.85rem;
  color: var(--accent);
  text-decoration: none;
}

.logout-link:hover {
  text-decoration: underline;
  color: var(--accent-hover);
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: none;
  padding: 1.5rem;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 2.5rem;
  max-width: 380px;
  text-align: center;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
}

.login-card h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 0.75rem;
}

.login-card p {
  color: var(--muted);
  margin: 0 0 1.5rem;
}

.login-error {
  color: var(--danger-text) !important;
  font-size: 0.85rem;
  background: var(--danger-bg);
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  margin: -0.5rem 0 1.5rem;
}

.google-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 2.5rem;
  background: var(--accent);
  color: white;
  text-decoration: none;
  padding: 0 1.5rem;
  border-radius: 8px;
  font-weight: 600;
}

.google-btn:hover {
  background: var(--accent-hover);
}

.back-link {
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: none;
}

.back-link:hover {
  color: var(--accent);
}
