:root {
  --bg: #f0ede6;
  --card: #ffffff;
  --ink: #111111;
  --muted: #6b6760;
  --line: #111111;
  --accent: #c8fc72;
  --danger: #e5484d;
  --warn: #ffd84d;
  --shadow: 4px 4px 0 var(--line);
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 "Space Grotesk", "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }

header {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; background: var(--bg); border-bottom: 2px solid var(--line);
}
.brand { font-weight: 700; font-size: 18px; text-decoration: none; letter-spacing: .02em; }
.brand span { background: var(--accent); border: 2px solid var(--line); border-radius: 6px; padding: 0 6px; margin-left: 6px; font-size: 13px; }
.top-right { display: flex; align-items: center; gap: 8px; min-width: 0; }
#company { font-weight: 500; white-space: nowrap; }
#company select { padding: 6px 8px; border: 2px solid var(--line); border-radius: 8px; background: var(--accent); font-weight: 700; }
.menu {
  position: absolute; right: 16px; top: 56px; background: var(--card);
  border: 2px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  display: flex; flex-direction: column; min-width: 160px; overflow: hidden;
}
.menu a, .menu button { padding: 12px 14px; text-align: left; text-decoration: none; background: none; border: 0; cursor: pointer; }
.menu a:hover, .menu button:hover { background: var(--accent); }

main { max-width: 960px; margin: 0 auto; padding: 20px 16px 60px; }
h1 { font-size: 22px; margin: 4px 0 16px; }
h2 { font-size: 17px; margin: 0 0 12px; }
.muted { color: var(--muted); }
.center { text-align: center; }

.card {
  background: var(--card); border: 2px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px;
}
.stack > * + * { margin-top: 14px; }

.btn, button.primary, button.ghost, button.danger {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 42px; padding: 8px 16px; border: 2px solid var(--line); border-radius: 8px;
  background: var(--card); cursor: pointer; font-weight: 700; text-decoration: none;
  transition: transform .06s, box-shadow .06s;
}
button.primary, .btn.primary { background: var(--accent); box-shadow: 3px 3px 0 var(--line); }
button.primary:active, .btn.primary:active { transform: translate(3px, 3px); box-shadow: none; }
button.ghost { min-height: 36px; padding: 4px 10px; font-weight: 500; }
button.danger { background: var(--danger); color: #fff; }
button:disabled { opacity: .5; cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #4c7dff; outline-offset: 2px; }

label { display: block; font-weight: 500; font-size: 13px; margin-bottom: 4px; }
input[type=text], input[type=password], select {
  width: 100%; min-height: 44px; padding: 8px 12px; background: #fff;
  border: 2px solid var(--line); border-radius: 8px;
}
.check { display: inline-flex; align-items: center; gap: 8px; margin-right: 16px; font-size: 15px; font-weight: 400; }
.check input { width: 20px; height: 20px; accent-color: #111; }
.err { color: var(--danger); font-weight: 500; min-height: 1.5em; margin: 0; }

.login-wrap { max-width: 380px; margin: 8vh auto 0; }
.login-wrap .brand { display: block; text-align: center; font-size: 26px; margin-bottom: 20px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.tile {
  display: block; text-decoration: none; background: var(--card);
  border: 2px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px;
  transition: transform .08s, box-shadow .08s;
}
.tile:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--line); }
.tile .t { font-weight: 700; font-size: 17px; }
.tile .d { color: var(--muted); font-size: 13px; margin-top: 4px; }
.tile.soon { opacity: .7; }
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border: 2px solid var(--line); border-radius: 999px; background: var(--warn); margin-left: 6px; vertical-align: 2px; }
.badge.ok { background: var(--accent); }
.badge.off { background: #ddd; }

.row-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.ulist { display: flex; flex-direction: column; gap: 10px; }
.urow {
  display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center;
  background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); padding: 12px 14px;
}
.urow.inactive { opacity: .55; }
.urow .n { font-weight: 700; }
.urow .s { font-size: 13px; color: var(--muted); }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.tag { font-size: 12px; border: 1.5px solid var(--line); border-radius: 6px; padding: 0 6px; background: #fff; }
.tag.role { background: var(--accent); }

dialog {
  border: 2px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; width: min(460px, calc(100vw - 32px)); background: var(--card);
}
dialog::backdrop { background: rgba(0,0,0,.35); }
.actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 18px; }
.actions .left { margin-right: auto; }
.pw-box { font: 700 22px/1.2 ui-monospace, Consolas, monospace; letter-spacing: .08em; text-align: center; padding: 14px; background: var(--accent); border: 2px solid var(--line); border-radius: 8px; user-select: all; }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; opacity: 0;
  transition: opacity .2s, transform .2s; pointer-events: none; max-width: calc(100vw - 32px);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 520px) {
  .urow { grid-template-columns: 1fr; }
  #userbtn { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
