:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #667085;
  --line: #d8dee9;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --danger: #b42318;
  font-family: "Segoe UI", "Yu Gothic", "Meiryo", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

a {
  color: var(--primary-dark);
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
}

button,
.button-link {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  padding: 8px 14px;
  background: #e6eef4;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

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

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.auth-card {
  width: min(440px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.08);
}

.auth-card h1,
.panel h1,
.panel h2 {
  margin: 0 0 14px;
}

.stack {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.segmented label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
}

.segmented input {
  width: auto;
  min-height: auto;
}

.alert,
.notice {
  padding: 12px 14px;
  border-radius: 6px;
  margin: 0 0 16px;
}

.alert {
  background: #fee4e2;
  color: var(--danger);
}

.notice {
  background: #dcfce7;
  color: #166534;
}

.share-panel {
  border-color: #99f6e4;
  background: #f0fdfa;
}

.share-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.share-header h1 {
  margin-bottom: 4px;
}

.share-note {
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.6;
}

.share-result-box {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.share-field {
  border: 1px solid #b6e5dc;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  padding: 10px 12px;
}

.share-field span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.share-field strong {
  display: block;
  color: var(--text);
  font-size: 15px;
  word-break: break-all;
}

.share-field.password strong {
  color: #b45309;
  font-family: Consolas, "Segoe UI", monospace;
}

.share-copy-text {
  width: 100%;
  min-height: 150px;
  border: 1px solid #b6e5dc;
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  font-family: "Segoe UI", "Yu Gothic", "Meiryo", sans-serif;
  font-size: 13px;
  line-height: 1.55;
  padding: 10px 12px;
  resize: vertical;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 58px;
  padding: 10px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

.topbar div {
  display: flex;
  gap: 12px;
  align-items: baseline;
}

.topbar span {
  color: var(--muted);
  font-size: 14px;
}

.topbar nav {
  display: flex;
  gap: 12px;
}

.page {
  width: min(960px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.page.wide {
  width: min(1360px, 100%);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  margin-bottom: 18px;
}

.focus-panel h1 {
  font-size: clamp(30px, 8vw, 56px);
}

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

.current-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 18px;
  padding: 8px 14px;
  border-radius: 999px;
  color: #fff;
  background: var(--status-color);
  font-weight: 700;
}

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

.form-grid {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 10px;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

.status-button {
  min-height: 68px;
  background: var(--status-color);
  color: #fff;
  font-size: 20px;
  font-weight: 700;
}

.user-list {
  display: grid;
  gap: 10px;
}

.user-row {
  display: grid;
  grid-template-columns: minmax(160px, 1.2fr) 150px 130px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.user-row span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(110px, 1fr));
  gap: 8px;
  align-items: end;
}

.add-form {
  margin-bottom: 14px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 8px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.small-input {
  width: 80px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.inline-form,
.board-row {
  display: grid;
  grid-template-columns: 1fr 120px auto auto;
  gap: 8px;
  align-items: center;
  margin: 8px 0;
}

.board-row {
  grid-template-columns: minmax(140px, 1fr) 160px auto minmax(260px, 2fr) auto;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.check {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.check input {
  width: auto;
  min-height: auto;
}

.board-page {
  height: 100vh;
  overflow: hidden;
  background: #0b1220;
  color: #eef5ff;
}

.board-header {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: #101827;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.board-header h1 {
  margin: 0;
  font-size: 26px;
}

.board-header p,
.board-header time {
  margin: 0;
  color: #b8c4d6;
}

.board-grid {
  --board-cols: 6;
  --board-gap: 10px;
  --name-size: 20px;
  --status-size: 24px;
  height: calc(100vh - 76px);
  padding: var(--board-gap);
  display: grid;
  grid-template-columns: repeat(var(--board-cols), minmax(0, 1fr));
  grid-auto-rows: minmax(64px, 1fr);
  gap: var(--board-gap);
}

.presence-card {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto auto;
  gap: 4px 8px;
  padding: 9px;
  border-radius: 8px;
  background: var(--status-color);
  color: #ffffff;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16), 0 8px 18px rgba(0, 0, 0, 0.18);
}

.status-dot {
  grid-row: 1 / 4;
  width: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
}

.card-main {
  min-width: 0;
}

.card-main h2 {
  margin: 0;
  font-size: var(--name-size);
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-main p,
.card-note,
.card-until {
  margin: 2px 0 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: max(10px, calc(var(--name-size) * 0.62));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-status {
  justify-self: stretch;
  align-self: end;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.24);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24);
  padding: 7px 8px;
  font-weight: 800;
  font-size: var(--status-size);
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-note {
  grid-column: 2;
}

.card-until {
  grid-column: 2;
  display: inline-flex;
  align-items: center;
  justify-self: start;
  max-width: 100%;
  margin-top: 2px;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.18);
  color: #fff;
  font-weight: 800;
  font-size: max(11px, calc(var(--status-size) * 0.64));
}

.board-error {
  position: fixed;
  right: 16px;
  bottom: 16px;
  padding: 12px 16px;
  border-radius: 8px;
  background: #fee4e2;
  color: #7a271a;
}

@media (max-width: 900px) {
  .admin-grid,
  .user-row,
  .inline-form,
  .board-row,
  .share-header,
  .two-col {
    grid-template-columns: 1fr;
  }

  .share-header {
    display: grid;
  }

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

  .topbar {
    align-items: flex-start;
    gap: 8px;
    flex-direction: column;
  }

  .page {
    padding: 12px;
  }
}

@media (max-width: 520px) {
  .auth-card,
  .panel {
    padding: 14px;
  }

  .status-grid {
    grid-template-columns: 1fr;
  }

  .status-button {
    min-height: 58px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .topbar nav {
    width: 100%;
    justify-content: space-between;
  }
}
